Skip to content

Commit 87e0664

Browse files
committed
Merge branch 'trunk' into HADOOP-19406_UDSSupport
2 parents 82ef314 + 6760271 commit 87e0664

File tree

268 files changed

+4430
-3546
lines changed

Some content is hidden

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

268 files changed

+4430
-3546
lines changed

hadoop-cloud-storage-project/hadoop-cos/src/test/java/org/apache/hadoop/fs/cosn/TestCosCredentials.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
import com.qcloud.cos.auth.COSCredentials;
2121
import com.qcloud.cos.auth.COSCredentialsProvider;
2222
import org.apache.hadoop.conf.Configuration;
23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;
2626

2727
import java.io.IOException;
2828
import java.net.URI;
2929
import java.net.URISyntaxException;
3030

31-
import static org.junit.Assert.assertNotNull;
32-
import static org.junit.Assert.fail;
31+
import static org.junit.jupiter.api.Assertions.assertNotNull;
32+
import static org.junit.jupiter.api.Assertions.fail;
3333

3434
public class TestCosCredentials {
3535
private static final Logger LOG =
@@ -76,7 +76,7 @@ private void validateCredentials(URI uri, Configuration configuration)
7676
COSCredentialsProvider credentialsProvider =
7777
CosNUtils.createCosCredentialsProviderSet(uri, configuration);
7878
COSCredentials cosCredentials = credentialsProvider.getCredentials();
79-
assertNotNull("The cos credentials obtained is null.", cosCredentials);
79+
assertNotNull(cosCredentials, "The cos credentials obtained is null.");
8080
if (configuration.get(
8181
CosNConfigKeys.COSN_CREDENTIALS_PROVIDER).compareToIgnoreCase(
8282
"org.apache.hadoop.fs.cosn.EnvironmentVariableCredentialsProvider")

hadoop-cloud-storage-project/hadoop-cos/src/test/java/org/apache/hadoop/fs/cosn/TestCosNInputStream.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
import org.apache.hadoop.fs.Path;
2424
import org.apache.hadoop.fs.contract.ContractTestUtils;
2525
import org.apache.hadoop.io.IOUtils;
26-
import org.junit.*;
26+
import org.junit.jupiter.api.AfterEach;
27+
import org.junit.jupiter.api.BeforeEach;
28+
import org.junit.jupiter.api.Disabled;
29+
import org.junit.jupiter.api.Test;
2730
import org.slf4j.Logger;
2831
import org.slf4j.LoggerFactory;
2932

30-
import static org.junit.Assert.assertTrue;
33+
import static org.junit.jupiter.api.Assertions.assertTrue;
3134

3235
import java.io.IOException;
3336
import java.util.Random;
@@ -43,15 +46,15 @@ public class TestCosNInputStream {
4346

4447
private Path testRootDir;
4548

46-
@Before
49+
@BeforeEach
4750
public void setUp() throws IOException {
4851
Configuration configuration = new Configuration();
4952
this.fs = CosNTestUtils.createTestFileSystem(configuration);
5053
this.testRootDir = CosNTestUtils.createTestPath(new Path("/test"));
5154
LOG.info("test root dir: " + this.testRootDir);
5255
}
5356

54-
@After
57+
@AfterEach
5558
public void tearDown() throws IOException {
5659
if (null != this.fs) {
5760
this.fs.delete(this.testRootDir, true);
@@ -76,9 +79,9 @@ public void testSeek() throws Exception {
7679
for (int i = 0; i != seekTimes; i++) {
7780
long pos = fileSize / (seekTimes - i) - 1;
7881
inputStream.seek(pos);
79-
assertTrue("expected position at: " +
80-
pos + ", but got: " + inputStream.getPos(),
81-
inputStream.getPos() == pos);
82+
assertTrue(inputStream.getPos() == pos,
83+
"expected position at: " +
84+
pos + ", but got: " + inputStream.getPos());
8285
LOG.info("completed seeking at pos: " + inputStream.getPos());
8386
}
8487
LOG.info("begin to random position seeking test...");
@@ -87,9 +90,9 @@ public void testSeek() throws Exception {
8790
long pos = Math.abs(random.nextLong()) % fileSize;
8891
LOG.info("seeking for pos: " + pos);
8992
inputStream.seek(pos);
90-
assertTrue("expected position at: " +
91-
pos + ", but got: " + inputStream.getPos(),
92-
inputStream.getPos() == pos);
93+
assertTrue(inputStream.getPos() == pos,
94+
"expected position at: " +
95+
pos + ", but got: " + inputStream.getPos());
9396
LOG.info("completed seeking at pos: " + inputStream.getPos());
9497
}
9598
}
@@ -110,16 +113,16 @@ public void testGetPos() throws Exception {
110113
Random random = new Random();
111114
long pos = Math.abs(random.nextLong()) % fileSize;
112115
inputStream.seek(pos);
113-
assertTrue("expected position at: " +
114-
pos + ", but got: " + inputStream.getPos(),
115-
inputStream.getPos() == pos);
116+
assertTrue(inputStream.getPos() == pos,
117+
"expected position at: " +
118+
pos + ", but got: " + inputStream.getPos());
116119
LOG.info("completed get pos tests.");
117120
}
118121

119122
/**
120123
* Method: seekToNewSource(long targetPos).
121124
*/
122-
@Ignore("Not ready yet")
125+
@Disabled("Not ready yet")
123126
public void testSeekToNewSource() throws Exception {
124127
LOG.info("Currently it is not supported to " +
125128
"seek the offset in a new source.");
@@ -154,8 +157,9 @@ public void testRead() throws Exception {
154157

155158
if (bytesRead % (1 * Unit.MB) == 0) {
156159
int available = inputStream.available();
157-
assertTrue("expected remaining: " + (fileSize - bytesRead) +
158-
" but got: " + available, (fileSize - bytesRead) == available);
160+
assertTrue((fileSize - bytesRead) == available,
161+
"expected remaining: " + (fileSize - bytesRead) +
162+
" but got: " + available);
159163
LOG.info("Bytes read: " +
160164
Math.round((double) bytesRead / Unit.MB) + "MB");
161165
}

hadoop-cloud-storage-project/hadoop-cos/src/test/java/org/apache/hadoop/fs/cosn/TestCosNOutputStream.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
import org.apache.hadoop.fs.FileSystem;
2222
import org.apache.hadoop.fs.Path;
2323
import org.apache.hadoop.fs.contract.ContractTestUtils;
24-
import org.junit.Rule;
25-
import org.junit.Test;
26-
import org.junit.Before;
27-
import org.junit.After;
28-
import org.junit.rules.Timeout;
24+
import org.junit.jupiter.api.AfterEach;
25+
import org.junit.jupiter.api.BeforeEach;
26+
import org.junit.jupiter.api.Test;
27+
import org.junit.jupiter.api.Timeout;
2928

3029
import java.io.IOException;
3130

@@ -34,14 +33,12 @@
3433
* <p>
3534
* If the test.fs.cosn.name property is not set, all test case will fail.
3635
*/
36+
@Timeout(3600)
3737
public class TestCosNOutputStream {
3838
private FileSystem fs;
3939
private Path testRootDir;
4040

41-
@Rule
42-
public Timeout timeout = new Timeout(3600 * 1000);
43-
44-
@Before
41+
@BeforeEach
4542
public void setUp() throws Exception {
4643
Configuration configuration = new Configuration();
4744
configuration.setInt(
@@ -53,7 +50,7 @@ public void setUp() throws Exception {
5350
this.testRootDir = new Path("/test");
5451
}
5552

56-
@After
53+
@AfterEach
5754
public void tearDown() throws Exception {
5855
}
5956

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818

1919
package org.apache.hadoop.fs.obs;
2020

21+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
22+
2123
import org.apache.hadoop.conf.Configuration;
2224
import org.apache.hadoop.fs.FileSystem;
2325
import org.apache.hadoop.fs.TestFSMainOperationsLocalFileSystem;
24-
import org.junit.After;
25-
import org.junit.Assume;
26-
import org.junit.Before;
26+
import org.junit.jupiter.api.AfterEach;
27+
import org.junit.jupiter.api.BeforeEach;
2728

2829
/**
2930
* <p>
@@ -46,7 +47,7 @@ public class TestOBSFSMainOperations extends
4647
TestFSMainOperationsLocalFileSystem {
4748

4849
@Override
49-
@Before
50+
@BeforeEach
5051
public void setUp() throws Exception {
5152
skipTestCheck();
5253
Configuration conf = new Configuration();
@@ -56,17 +57,17 @@ public void setUp() throws Exception {
5657

5758
@Override
5859
public void testWorkingDirectory() {
59-
Assume.assumeTrue("unspport.", false);
60+
assumeTrue(false, "unspport.");
6061
}
6162

6263
@Override
6364
public void testListStatusThrowsExceptionForUnreadableDir() {
64-
Assume.assumeTrue("unspport.", false);
65+
assumeTrue(false, "unspport.");
6566
}
6667

6768
@Override
6869
public void testRenameDirectoryToItself() {
69-
Assume.assumeTrue("unspport.", false);
70+
assumeTrue(false, "unspport.");
7071
}
7172

7273
@Override
@@ -76,18 +77,18 @@ public void testGlobStatusThrowsExceptionForUnreadableDir() {
7677

7778
@Override
7879
public void testRenameFileToItself() {
79-
Assume.assumeTrue("unspport.", false);
80+
assumeTrue(false, "unspport.");
8081
}
8182

8283
@Override
83-
@After
84+
@AfterEach
8485
public void tearDown() throws Exception {
8586
if(fSys != null) {
8687
super.tearDown();
8788
}
8889
}
8990

9091
public void skipTestCheck() {
91-
Assume.assumeTrue(OBSContract.isContractTestEnabled());
92+
assumeTrue(OBSContract.isContractTestEnabled());
9293
}
9394
}

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,30 @@
1818

1919
package org.apache.hadoop.fs.obs;
2020

21+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
22+
2123
import org.apache.hadoop.conf.Configuration;
2224
import org.apache.hadoop.fs.DelegateToFileSystem;
2325
import org.apache.hadoop.fs.FileContext;
2426
import org.apache.hadoop.fs.FileContextCreateMkdirBaseTest;
2527
import org.apache.hadoop.fs.FileContextTestHelper;
2628
import org.apache.hadoop.fs.FileSystem;
27-
import org.junit.Assume;
28-
import org.junit.BeforeClass;
29+
import org.junit.jupiter.api.BeforeAll;
2930

3031
import java.net.URI;
3132
import java.util.UUID;
3233

33-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
34+
import edu.umd.cs.findbugs.annotation.SuppressFBWarnings;
3435

3536
/**
3637
* File context create mkdir test cases on obs file system.
3738
*/
3839
public class TestOBSFileContextCreateMkdir extends
3940
FileContextCreateMkdirBaseTest {
4041

41-
@BeforeClass
42+
@BeforeAll
4243
public static void skipTestCheck() {
43-
Assume.assumeTrue(OBSContract.isContractTestEnabled());
44+
assumeTrue(OBSContract.isContractTestEnabled());
4445
}
4546

4647

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818

1919
package org.apache.hadoop.fs.obs;
2020

21+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
22+
2123
import org.apache.hadoop.conf.Configuration;
2224
import org.apache.hadoop.fs.DelegateToFileSystem;
2325
import org.apache.hadoop.fs.FileContext;
2426
import org.apache.hadoop.fs.FileContextMainOperationsBaseTest;
2527
import org.apache.hadoop.fs.FileSystem;
26-
import org.junit.Assume;
27-
import org.junit.BeforeClass;
28-
import org.junit.Test;
28+
import org.junit.jupiter.api.BeforeAll;
29+
import org.junit.jupiter.api.Test;
2930

3031
import java.net.URI;
3132

@@ -35,9 +36,9 @@
3536
public class TestOBSFileContextMainOperations extends
3637
FileContextMainOperationsBaseTest {
3738

38-
@BeforeClass
39+
@BeforeAll
3940
public static void skipTestCheck() {
40-
Assume.assumeTrue(OBSContract.isContractTestEnabled());
41+
assumeTrue(OBSContract.isContractTestEnabled());
4142
}
4243

4344
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
@@ -67,11 +68,11 @@ protected boolean listCorruptedBlocksSupported() {
6768
@Override
6869
@Test
6970
public void testSetVerifyChecksum() {
70-
Assume.assumeTrue("unsupport.", false);
71+
assumeTrue(false, "unsupport.");
7172
}
7273

7374
@Override
7475
public void testMkdirsFailsForSubdirectoryOfExistingFile() {
75-
Assume.assumeTrue("unsupport.", false);
76+
assumeTrue(false, "unsupport.");
7677
}
7778
}

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
package org.apache.hadoop.fs.obs;
2020

21+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
22+
2123
import org.apache.hadoop.conf.Configuration;
2224
import org.apache.hadoop.fs.DelegateToFileSystem;
2325
import org.apache.hadoop.fs.FileContext;
2426
import org.apache.hadoop.fs.FileContextURIBase;
2527
import org.apache.hadoop.fs.FileSystem;
26-
import org.junit.Assume;
27-
import org.junit.BeforeClass;
28+
import org.junit.jupiter.api.BeforeAll;
2829

2930
import java.net.URI;
3031

@@ -49,9 +50,9 @@
4950
*/
5051
public class TestOBSFileContextURI extends FileContextURIBase {
5152

52-
@BeforeClass
53+
@BeforeAll
5354
public static void skipTestCheck() {
54-
Assume.assumeTrue(OBSContract.isContractTestEnabled());
55+
assumeTrue(OBSContract.isContractTestEnabled());
5556
}
5657

5758
@Override
@@ -77,12 +78,12 @@ public void setUp() throws Exception {
7778

7879
@Override
7980
public void testMkdirsFailsForSubdirectoryOfExistingFile() {
80-
Assume.assumeTrue("unsupport.", false);
81+
assumeTrue(false, "unsupport.");
8182
}
8283

8384
@Override
8485
public void testFileStatus() {
85-
Assume.assumeTrue("unsupport.", false);
86+
assumeTrue(false, "unsupport.");
8687
}
8788

8889
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
package org.apache.hadoop.fs.obs;
2020

21+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
22+
2123
import org.apache.hadoop.conf.Configuration;
2224
import org.apache.hadoop.fs.DelegateToFileSystem;
2325
import org.apache.hadoop.fs.FileContext;
2426
import org.apache.hadoop.fs.FileContextUtilBase;
2527
import org.apache.hadoop.fs.FileSystem;
26-
import org.junit.Assume;
27-
import org.junit.BeforeClass;
28+
import org.junit.jupiter.api.BeforeAll;
2829

2930
import java.net.URI;
3031

@@ -44,9 +45,9 @@
4445
*/
4546
public class TestOBSFileContextUtil extends FileContextUtilBase {
4647

47-
@BeforeClass
48+
@BeforeAll
4849
public static void skipTestCheck() {
49-
Assume.assumeTrue(OBSContract.isContractTestEnabled());
50+
assumeTrue(OBSContract.isContractTestEnabled());
5051
}
5152

5253
@Override

0 commit comments

Comments
 (0)