Skip to content

Commit 02c3b5e

Browse files
committed
HADOOP-19421. Fix CheckStyle.
1 parent 286a364 commit 02c3b5e

File tree

5 files changed

+41
-44
lines changed

5 files changed

+41
-44
lines changed

hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/ITAliyunOSSSignatureV4.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
import static org.apache.hadoop.fs.aliyun.oss.Constants.SIGNATURE_VERSION_KEY;
3434
import static org.apache.hadoop.fs.contract.ContractTestUtils.createFile;
3535
import static org.apache.hadoop.fs.contract.ContractTestUtils.dataset;
36-
import static org.junit.jupiter.api.Assertions.*;
37-
import static org.junit.Assume.assumeNotNull;
36+
import static org.junit.jupiter.api.Assertions.assertEquals;
37+
import static org.junit.jupiter.api.Assertions.assertNotNull;
38+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
3839

3940
/**
4041
* Tests Aliyun OSS system.
@@ -59,7 +60,7 @@ public void testV4() throws IOException {
5960
conf.set(REGION_KEY, "cn-hongkong");
6061
AliyunOSSFileSystem fs = new AliyunOSSFileSystem();
6162
fs.initialize(testURI, conf);
62-
assumeNotNull(fs);
63+
assumeTrue(fs != null);
6364

6465
createFile(fs, testFile, true, dataset(256, 0, 255));
6566
FileStatus status = fs.getFileStatus(testFile);
@@ -71,7 +72,7 @@ public void testV4() throws IOException {
7172
public void testDefaultSignatureVersion() throws IOException {
7273
AliyunOSSFileSystem fs = new AliyunOSSFileSystem();
7374
fs.initialize(testURI, conf);
74-
assumeNotNull(fs);
75+
assumeTrue(fs != null);
7576

7677
Path testFile2 = new Path("/test/atestr");
7778
createFile(fs, testFile2, true, dataset(256, 0, 255));

hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/TestAliyunOSSBlockOutputStream.java

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ private void bufferShouldReleased(boolean zeroSizeFile) throws IOException {
234234
OSSDataBlocks.ByteBufferBlockFactory
235235
blockFactory = (OSSDataBlocks.ByteBufferBlockFactory)
236236
((AliyunOSSFileSystem)fs).getBlockFactory();
237-
assertEquals(
238-
0, blockFactory.getOutstandingBufferCount(), "outstanding buffers in " + blockFactory);
237+
assertEquals(0, blockFactory.getOutstandingBufferCount(),
238+
"outstanding buffers in " + blockFactory);
239239
}
240240
}
241241
BlockOutputStreamStatistics statistics =
@@ -287,8 +287,8 @@ public void testDirectoryAllocatorRR() throws Throwable {
287287
tmp1.delete();
288288
File tmp2 = AliyunOSSUtils.createTmpFileForWrite("out-", 1024, conf);
289289
tmp2.delete();
290-
assertNotEquals(
291-
tmp1.getParent(), tmp2.getParent(), "round robin not working");
290+
assertNotEquals(tmp1.getParent(), tmp2.getParent(),
291+
"round robin not working");
292292
}
293293

294294
@Test
@@ -298,18 +298,17 @@ public void testByteBufferIO() throws IOException {
298298
int limit = 128;
299299
OSSDataBlocks.ByteBufferBlockFactory.ByteBufferBlock block
300300
= factory.create(1, limit, null);
301-
assertEquals(
302-
1, factory.getOutstandingBufferCount(), "outstanding buffers in " + factory);
301+
assertEquals(1, factory.getOutstandingBufferCount(),
302+
"outstanding buffers in " + factory);
303303

304304
byte[] buffer = ContractTestUtils.toAsciiByteArray("test data");
305305
int bufferLen = buffer.length;
306306
block.write(buffer, 0, bufferLen);
307307
assertEquals(bufferLen, block.dataSize());
308-
assertEquals(
309-
limit - bufferLen, block.remainingCapacity(), "capacity in " + block);
308+
assertEquals(limit - bufferLen, block.remainingCapacity(),
309+
"capacity in " + block);
310310
assertTrue(block.hasCapacity(64), "hasCapacity(64) in " + block);
311-
assertTrue(
312-
block.hasCapacity(limit - bufferLen), "No capacity in " + block);
311+
assertTrue(block.hasCapacity(limit - bufferLen), "No capacity in " + block);
313312

314313
// now start the write
315314
OSSDataBlocks.BlockUploadData blockUploadData = block.startUpload();
@@ -321,14 +320,14 @@ public void testByteBufferIO() throws IOException {
321320
assertTrue(stream.hasRemaining(), "!hasRemaining() in " + stream);
322321

323322
int expected = bufferLen;
324-
assertEquals(
325-
expected, stream.available(), "wrong available() in " + stream);
323+
assertEquals(expected, stream.available(),
324+
"wrong available() in " + stream);
326325

327326
assertEquals('t', stream.read());
328327
stream.mark(limit);
329328
expected--;
330-
assertEquals(
331-
expected, stream.available(), "wrong available() in " + stream);
329+
assertEquals(expected, stream.available(),
330+
"wrong available() in " + stream);
332331

333332
// read into a byte array with an offset
334333
int offset = 5;
@@ -337,8 +336,8 @@ public void testByteBufferIO() throws IOException {
337336
assertEquals('e', in[offset]);
338337
assertEquals('s', in[offset + 1]);
339338
expected -= 2;
340-
assertEquals(
341-
expected, stream.available(), "wrong available() in " + stream);
339+
assertEquals(expected, stream.available(),
340+
"wrong available() in " + stream);
342341

343342
// read to end
344343
byte[] remainder = new byte[limit];
@@ -350,8 +349,7 @@ public void testByteBufferIO() throws IOException {
350349
assertEquals(expected, index);
351350
assertEquals('a', remainder[--index]);
352351

353-
assertEquals(
354-
0, stream.available(), "wrong available() in " + stream);
352+
assertEquals(0, stream.available(), "wrong available() in " + stream);
355353
assertTrue(!stream.hasRemaining(), "hasRemaining() in " + stream);
356354

357355
// go the mark point
@@ -360,14 +358,14 @@ public void testByteBufferIO() throws IOException {
360358

361359
// when the stream is closed, the data should be returned
362360
stream.close();
363-
assertEquals(
364-
1, factory.getOutstandingBufferCount(), "outstanding buffers in " + factory);
361+
assertEquals(1, factory.getOutstandingBufferCount(),
362+
"outstanding buffers in " + factory);
365363
block.close();
366-
assertEquals(
367-
0, factory.getOutstandingBufferCount(), "outstanding buffers in " + factory);
364+
assertEquals(0, factory.getOutstandingBufferCount(),
365+
"outstanding buffers in " + factory);
368366
stream.close();
369-
assertEquals(
370-
0, factory.getOutstandingBufferCount(), "outstanding buffers in " + factory);
367+
assertEquals(0, factory.getOutstandingBufferCount(),
368+
"outstanding buffers in " + factory);
371369
}
372370
}
373371

hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/TestAliyunOSSFileSystemContract.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@
3737
import static org.junit.jupiter.api.Assertions.assertTrue;
3838
import static org.junit.jupiter.api.Assertions.fail;
3939
import static org.junit.jupiter.api.Assertions.assertEquals;
40-
import static org.junit.Assume.assumeFalse;
41-
import static org.junit.Assume.assumeNotNull;
42-
import static org.junit.Assume.assumeTrue;
40+
import static org.junit.jupiter.api.Assumptions.assumeFalse;
41+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
4342

4443
/**
4544
* Tests a live Aliyun OSS system.
@@ -56,7 +55,7 @@ public class TestAliyunOSSFileSystemContract
5655
public void setUp() throws Exception {
5756
Configuration conf = new Configuration();
5857
fs = AliyunOSSTestUtils.createTestFileSystem(conf);
59-
assumeNotNull(fs);
58+
assumeTrue(fs != null);
6059
}
6160

6261
@Override

hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/TestAliyunOSSFileSystemStore.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
4747
import static org.junit.jupiter.api.Assertions.assertEquals;
4848
import static org.junit.jupiter.api.Assertions.assertTrue;
49-
import static org.junit.Assume.assumeNotNull;
49+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
5050

5151
/**
5252
* Test the bridging logic between Hadoop's abstract filesystem and
@@ -78,9 +78,9 @@ public void tearDown() throws Exception {
7878
@BeforeAll
7979
public static void checkSettings() throws Exception {
8080
Configuration conf = new Configuration();
81-
assumeNotNull(conf.get(Constants.ACCESS_KEY_ID));
82-
assumeNotNull(conf.get(Constants.ACCESS_KEY_SECRET));
83-
assumeNotNull(conf.get("test.fs.oss.name"));
81+
assumeTrue(conf.get(Constants.ACCESS_KEY_ID) != null);
82+
assumeTrue(conf.get(Constants.ACCESS_KEY_SECRET) != null);
83+
assumeTrue(conf.get("test.fs.oss.name") != null);
8484
}
8585

8686
protected void writeRenameReadCompare(Path path, long len)

hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/TestAliyunOSSInputStream.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,12 @@ public void testSequentialAndRandomRead() throws Exception {
119119
assertTrue(fsDataInputStream.getPos() == 0, "expected position at:" + 0 + ", but got:"
120120
+ fsDataInputStream.getPos());
121121

122-
assertTrue(
123-
in.getExpectNextPos() == Constants.MULTIPART_DOWNLOAD_SIZE_DEFAULT, "expected position at:"
122+
assertTrue(in.getExpectNextPos() == Constants.MULTIPART_DOWNLOAD_SIZE_DEFAULT,
123+
"expected position at:"
124124
+ Constants.MULTIPART_DOWNLOAD_SIZE_DEFAULT + ", but got:"
125125
+ in.getExpectNextPos());
126126
fsDataInputStream.seek(4 * 1024 * 1024);
127-
assertTrue(
128-
in.getExpectNextPos() == 4 * 1024 * 1024
127+
assertTrue(in.getExpectNextPos() == 4 * 1024 * 1024
129128
+ Constants.MULTIPART_DOWNLOAD_SIZE_DEFAULT, "expected position at:" + 4 * 1024 * 1024
130129
+ Constants.MULTIPART_DOWNLOAD_SIZE_DEFAULT + ", but got:"
131130
+ in.getExpectNextPos());
@@ -180,8 +179,8 @@ public void testReadFile() throws Exception {
180179
if (bytesRead % (1024 * 1024) == 0) {
181180
int available = instream.available();
182181
int remaining = (int)(size - bytesRead);
183-
assertTrue(
184-
remaining == available, "expected remaining:" + remaining + ", but got:" + available);
182+
assertTrue(remaining == available,
183+
"expected remaining:" + remaining + ", but got:" + available);
185184
LOG.info("Bytes read: " + Math.round((double)bytesRead / (1024 * 1024))
186185
+ " MB");
187186
}
@@ -194,7 +193,7 @@ public void testDirectoryModifiedTime() throws Exception {
194193
Path emptyDirPath = setPath("/test/emptyDirectory");
195194
fs.mkdirs(emptyDirPath);
196195
FileStatus dirFileStatus = fs.getFileStatus(emptyDirPath);
197-
assertTrue(
198-
dirFileStatus.getModificationTime() > 0L, "expected the empty dir is new");
196+
assertTrue(dirFileStatus.getModificationTime() > 0L,
197+
"expected the empty dir is new");
199198
}
200199
}

0 commit comments

Comments
 (0)