40
40
import java .nio .file .Paths ;
41
41
import java .util .ArrayList ;
42
42
import java .util .Arrays ;
43
+ import java .util .Collections ;
43
44
import java .util .List ;
44
45
import java .util .UUID ;
45
46
import java .util .concurrent .atomic .AtomicInteger ;
@@ -98,7 +99,7 @@ public void testObjectsFitBucketWithNonExistentBucket() {
98
99
maxNumObjectTransferAttempts );
99
100
100
101
final ObjectStorageSpaceVerificationResult result = ds3ClientHelpers .objectsFromBucketWillFitInDirectory (
101
- "bad bucket name" , Arrays . asList ( new String [] {} ), Paths .get ("." ));
102
+ "bad bucket name" , Collections . emptyList ( ), Paths .get ("." ));
102
103
103
104
assertEquals (ObjectStorageSpaceVerificationResult .VerificationStatus .BucketDoesNotExist , result .getVerificationStatus ());
104
105
assertEquals (0 , result .getRequiredSpace ());
@@ -119,7 +120,7 @@ public void testObjectsFitBucketWithPathNotDirectory() throws IOException {
119
120
120
121
try {
121
122
final ObjectStorageSpaceVerificationResult result = ds3ClientHelpers .objectsFromBucketWillFitInDirectory (
122
- "bad bucket name" , Arrays . asList ( new String []{} ), textFile );
123
+ "bad bucket name" , Collections . emptyList ( ), textFile );
123
124
124
125
assertEquals (ObjectStorageSpaceVerificationResult .VerificationStatus .PathIsNotADirectory , result .getVerificationStatus ());
125
126
assertEquals (0 , result .getRequiredSpace ());
@@ -143,7 +144,7 @@ public void testObjectsFitBucketPathDoesNotExist() throws IOException {
143
144
FileUtils .deleteDirectory (directory .toFile ());
144
145
145
146
final ObjectStorageSpaceVerificationResult result = ds3ClientHelpers .objectsFromBucketWillFitInDirectory (
146
- "bad bucket name" , Arrays . asList ( new String []{} ), directory );
147
+ "bad bucket name" , Collections . emptyList ( ), directory );
147
148
148
149
assertEquals (ObjectStorageSpaceVerificationResult .VerificationStatus .PathDoesNotExist , result .getVerificationStatus ());
149
150
assertEquals (0 , result .getRequiredSpace ());
@@ -165,7 +166,7 @@ public void testObjectsFitBucketPathLacksAccess() throws IOException, Interrupte
165
166
// Deny write data access to everyone, making the directory unwritable
166
167
Runtime .getRuntime ().exec ("icacls dir /deny Everyone:(WD)" ).waitFor ();
167
168
} else {
168
- Runtime .getRuntime ().exec ("chmod -w " + directory . toString () ).waitFor ();
169
+ Runtime .getRuntime ().exec ("chmod -w " + directory ).waitFor ();
169
170
final Process lsProcess = Runtime .getRuntime ().exec ("ls -l" );
170
171
lsProcess .waitFor ();
171
172
try (final BufferedReader bufferedReader = new BufferedReader (new InputStreamReader (lsProcess .getInputStream ()))) {
@@ -180,7 +181,7 @@ public void testObjectsFitBucketPathLacksAccess() throws IOException, Interrupte
180
181
181
182
try {
182
183
final ObjectStorageSpaceVerificationResult result = ds3ClientHelpers .objectsFromBucketWillFitInDirectory (
183
- "bad bucket name" , Arrays . asList ( new String []{} ), directory );
184
+ "bad bucket name" , Collections . emptyList ( ), directory );
184
185
185
186
LOG .info (result .toString ());
186
187
@@ -194,7 +195,7 @@ public void testObjectsFitBucketPathLacksAccess() throws IOException, Interrupte
194
195
// Grant write data access to everyone, making the directory writable, so we can delete it.
195
196
Runtime .getRuntime ().exec ("icacls dir /grant Everyone:(WD)" ).waitFor ();
196
197
} else {
197
- Runtime .getRuntime ().exec ("chmod +w " + directory . toString () ).waitFor ();
198
+ Runtime .getRuntime ().exec ("chmod +w " + directory ).waitFor ();
198
199
}
199
200
200
201
FileUtils .deleteDirectory (directory .toFile ());
@@ -221,8 +222,8 @@ private interface ResultVerifier {
221
222
void verifyResult (final ObjectStorageSpaceVerificationResult result , final long totalRequiredSize );
222
223
}
223
224
224
- private void putObjectThenRunVerification (final FileSystemHelper fileSystemHelper ,
225
- final ResultVerifier resultVerifier )
225
+ private static void putObjectThenRunVerification (final FileSystemHelper fileSystemHelper ,
226
+ final ResultVerifier resultVerifier )
226
227
throws IOException , URISyntaxException
227
228
{
228
229
try {
0 commit comments