Skip to content

Commit 1d329f0

Browse files
authored
Merge branch 'apache:trunk' into HADOOP-19415-PART7
2 parents 076d5df + 8345235 commit 1d329f0

File tree

256 files changed

+2176
-1739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+2176
-1739
lines changed

hadoop-cloud-storage-project/hadoop-huaweicloud/src/test/java/org/apache/hadoop/fs/obs/TestOBSContractAppend.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
import org.apache.hadoop.conf.Configuration;
2222
import org.apache.hadoop.fs.contract.AbstractContractAppendTest;
2323
import org.apache.hadoop.fs.contract.AbstractFSContract;
24-
import org.junit.Assume;
24+
25+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
2526

2627
/**
2728
* Append test cases on obs file system.
@@ -35,6 +36,6 @@ protected AbstractFSContract createContract(final Configuration conf) {
3536

3637
@Override
3738
public void testRenameFileBeingAppended() {
38-
Assume.assumeTrue("unsupport.", false);
39+
assumeTrue(false, "unsupport.");
3940
}
4041
}

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSCopyFromLocal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import java.io.File;
2222

23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424

2525
import org.apache.hadoop.conf.Configuration;
2626
import org.apache.hadoop.fs.contract.AbstractContractCopyFromLocalTest;

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractAppendTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
import org.apache.hadoop.fs.FSDataOutputStream;
2323
import org.apache.hadoop.fs.Path;
2424

25-
import org.junit.Test;
25+
import org.junit.jupiter.api.BeforeEach;
26+
import org.junit.jupiter.api.Test;
2627
import org.slf4j.Logger;
2728
import org.slf4j.LoggerFactory;
2829

@@ -41,6 +42,7 @@ public abstract class AbstractContractAppendTest extends AbstractFSContractTestB
4142
private Path testPath;
4243
private Path target;
4344

45+
@BeforeEach
4446
@Override
4547
public void setup() throws Exception {
4648
super.setup();

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractBulkDeleteTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import java.util.Map;
2626

2727
import org.assertj.core.api.Assertions;
28-
import org.junit.Test;
28+
import org.junit.jupiter.api.BeforeEach;
29+
import org.junit.jupiter.api.Test;
2930
import org.slf4j.Logger;
3031
import org.slf4j.LoggerFactory;
3132

@@ -74,6 +75,7 @@ public abstract class AbstractContractBulkDeleteTest extends AbstractFSContractT
7475
*/
7576
private DynamicWrappedIO dynamicWrappedIO;
7677

78+
@BeforeEach
7779
@Override
7880
public void setup() throws Exception {
7981
super.setup();

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractConcatTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
import org.apache.hadoop.fs.Path;
2222

23-
import org.junit.Test;
23+
import org.junit.jupiter.api.BeforeEach;
24+
import org.junit.jupiter.api.Test;
2425
import org.slf4j.Logger;
2526
import org.slf4j.LoggerFactory;
2627

@@ -44,6 +45,7 @@ public abstract class AbstractContractConcatTest extends AbstractFSContractTestB
4445
private Path zeroByteFile;
4546
private Path target;
4647

48+
@BeforeEach
4749
@Override
4850
public void setup() throws Exception {
4951
super.setup();

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractContentSummaryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.apache.hadoop.fs.Path;
2424

2525
import org.assertj.core.api.Assertions;
26-
import org.junit.Test;
26+
import org.junit.jupiter.api.Test;
2727

2828
import java.io.FileNotFoundException;
2929

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCopyFromLocalTest.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import java.nio.charset.StandardCharsets;
2626
import java.nio.file.Files;
2727

28-
import org.junit.Test;
28+
import org.junit.jupiter.api.AfterEach;
29+
import org.junit.jupiter.api.Test;
2930

3031
import org.apache.commons.io.FileUtils;
3132
import org.apache.commons.io.IOUtils;
@@ -43,6 +44,7 @@ public abstract class AbstractContractCopyFromLocalTest extends
4344
private static final Charset ASCII = StandardCharsets.US_ASCII;
4445
private File file;
4546

47+
@AfterEach
4648
@Override
4749
public void teardown() throws Exception {
4850
super.teardown();
@@ -65,12 +67,12 @@ public void testCopyFile() throws Throwable {
6567
Path dest = copyFromLocal(file, true);
6668

6769
assertPathExists("uploaded file not found", dest);
68-
assertTrue("source file deleted", Files.exists(file.toPath()));
70+
assertTrue(Files.exists(file.toPath()), "source file deleted");
6971

7072
FileSystem fs = getFileSystem();
7173
FileStatus status = fs.getFileStatus(dest);
72-
assertEquals("File length not equal " + status,
73-
message.getBytes(ASCII).length, status.getLen());
74+
assertEquals(message.getBytes(ASCII).length, status.getLen(),
75+
"File length not equal " + status);
7476
assertFileTextEquals(dest, message);
7577
}
7678

@@ -109,7 +111,7 @@ public void testSourceIsFileAndDelSrcTrue() throws Throwable {
109111
file = createTempFile("test");
110112
copyFromLocal(file, false, true);
111113

112-
assertFalse("Source file not deleted", Files.exists(file.toPath()));
114+
assertFalse(Files.exists(file.toPath()), "Source file not deleted");
113115
}
114116

115117
@Test
@@ -215,7 +217,7 @@ public void testSrcIsDirWithDelSrcOptions() throws Throwable {
215217
copyFromLocal(source, false, true);
216218
Path dest = fileToPath(child, source.getParentFile());
217219

218-
assertFalse("Directory not deleted", Files.exists(source.toPath()));
220+
assertFalse(Files.exists(source.toPath()), "Directory not deleted");
219221
assertFileTextEquals(dest, contents);
220222
}
221223

@@ -258,8 +260,8 @@ public void testCopyDirectoryWithDelete() throws Throwable {
258260
Path dst = path(srcDir.getFileName().toString());
259261
getFileSystem().copyFromLocalFile(true, true, src, dst);
260262

261-
assertFalse("Source directory was not deleted",
262-
Files.exists(srcDir));
263+
assertFalse(Files.exists(srcDir),
264+
"Source directory was not deleted");
263265
}
264266

265267
@Test
@@ -330,7 +332,7 @@ protected File createTempDirectory(File parent, String name)
330332

331333
private void assertFileTextEquals(Path path, String expected)
332334
throws IOException {
333-
assertEquals("Wrong data in " + path,
334-
expected, IOUtils.toString(getFileSystem().open(path), ASCII));
335+
assertEquals(expected, IOUtils.toString(getFileSystem().open(path), ASCII),
336+
"Wrong data in " + path);
335337
}
336338
}

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.apache.hadoop.fs.Path;
2828
import org.apache.hadoop.fs.StreamCapabilities;
2929

30-
import org.junit.Test;
30+
import org.junit.jupiter.api.Test;
3131
import org.junit.AssumptionViolatedException;
3232
import org.slf4j.Logger;
3333
import org.slf4j.LoggerFactory;
@@ -278,8 +278,8 @@ public void testFileStatusBlocksizeNonEmptyFile() throws Throwable {
278278
FileSystem fs = getFileSystem();
279279

280280
long rootPath = fs.getDefaultBlockSize(path("/"));
281-
assertTrue("Root block size is invalid " + rootPath,
282-
rootPath > 0);
281+
assertTrue(rootPath > 0,
282+
"Root block size is invalid " + rootPath);
283283

284284
Path path = path("testFileStatusBlocksizeNonEmptyFile");
285285
byte[] data = dataset(256, 'a', 'z');
@@ -303,13 +303,13 @@ private void validateBlockSize(FileSystem fs, Path path, int minValue)
303303
FileStatus status =
304304
getFileStatusEventually(fs, path, CREATE_TIMEOUT);
305305
String statusDetails = status.toString();
306-
assertTrue("File status block size too low: " + statusDetails
307-
+ " min value: " + minValue,
308-
status.getBlockSize() >= minValue);
306+
assertTrue(status.getBlockSize() >= minValue,
307+
"File status block size too low: " + statusDetails
308+
+ " min value: " + minValue);
309309
long defaultBlockSize = fs.getDefaultBlockSize(path);
310-
assertTrue("fs.getDefaultBlockSize(" + path + ") size " +
311-
defaultBlockSize + " is below the minimum of " + minValue,
312-
defaultBlockSize >= minValue);
310+
assertTrue(defaultBlockSize >= minValue,
311+
"fs.getDefaultBlockSize(" + path + ") size " +
312+
defaultBlockSize + " is below the minimum of " + minValue);
313313
}
314314

315315
@Test
@@ -320,14 +320,14 @@ public void testCreateMakesParentDirs() throws Throwable {
320320
Path parent = new Path(grandparent, "parent");
321321
Path child = new Path(parent, "child");
322322
touch(fs, child);
323-
assertEquals("List status of parent should include the 1 child file",
324-
1, fs.listStatus(parent).length);
325-
assertTrue("Parent directory does not appear to be a directory",
326-
fs.getFileStatus(parent).isDirectory());
327-
assertEquals("List status of grandparent should include the 1 parent dir",
328-
1, fs.listStatus(grandparent).length);
329-
assertTrue("Grandparent directory does not appear to be a directory",
330-
fs.getFileStatus(grandparent).isDirectory());
323+
assertEquals(1, fs.listStatus(parent).length,
324+
"List status of parent should include the 1 child file");
325+
assertTrue(fs.getFileStatus(parent).isDirectory(),
326+
"Parent directory does not appear to be a directory");
327+
assertEquals(1, fs.listStatus(grandparent).length,
328+
"List status of grandparent should include the 1 parent dir");
329+
assertTrue(fs.getFileStatus(grandparent).isDirectory(),
330+
"Grandparent directory does not appear to be a directory");
331331
}
332332

333333
@Test
@@ -531,8 +531,8 @@ protected void validateSyncableSemantics(final FileSystem fs,
531531
final FileStatus st = fs.getFileStatus(path);
532532
if (metadataUpdatedOnHSync) {
533533
// not all stores reliably update it, HDFS/webHDFS in particular
534-
assertEquals("Metadata not updated during write " + st,
535-
2, st.getLen());
534+
assertEquals(2, st.getLen(),
535+
"Metadata not updated during write " + st);
536536
}
537537

538538
// there's no way to verify durability, but we can

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractDeleteTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import org.apache.hadoop.fs.Path;
2222

23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424

2525
import java.io.IOException;
2626

@@ -49,19 +49,19 @@ public void testDeleteNonexistentPathRecursive() throws Throwable {
4949
Path path = path("testDeleteNonexistentPathRecursive");
5050
assertPathDoesNotExist("leftover", path);
5151
ContractTestUtils.rejectRootOperation(path);
52-
assertFalse("Returned true attempting to recursively delete"
53-
+ " a nonexistent path " + path,
54-
getFileSystem().delete(path, true));
52+
assertFalse(getFileSystem().delete(path, true),
53+
"Returned true attempting to recursively delete"
54+
+ " a nonexistent path " + path);
5555
}
5656

5757
@Test
5858
public void testDeleteNonexistentPathNonRecursive() throws Throwable {
5959
Path path = path("testDeleteNonexistentPathNonRecursive");
6060
assertPathDoesNotExist("leftover", path);
6161
ContractTestUtils.rejectRootOperation(path);
62-
assertFalse("Returned true attempting to non recursively delete"
63-
+ " a nonexistent path " + path,
64-
getFileSystem().delete(path, false));
62+
assertFalse(getFileSystem().delete(path, false),
63+
"Returned true attempting to non recursively delete"
64+
+ " a nonexistent path " + path);
6565
}
6666

6767
@Test

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractEtagTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import org.assertj.core.api.Assertions;
2424
import org.junit.Assume;
25-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
2626
import org.slf4j.Logger;
2727
import org.slf4j.LoggerFactory;
2828

0 commit comments

Comments
 (0)