This is an automated email from the ASF dual-hosted git repository.
ritesh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 50cd193782 HDDS-10074. Migrate FS contract tests to JUnit5 (#5981)
50cd193782 is described below
commit 50cd19378253b86685c503437b1d44a8f543ac1f
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Thu Jan 18 01:20:11 2024 +0100
HDDS-10074. Migrate FS contract tests to JUnit5 (#5981)
---
.../fs/contract/AbstractContractAppendTest.java | 2 +-
.../fs/contract/AbstractContractConcatTest.java | 2 +-
.../AbstractContractContentSummaryTest.java | 2 +-
.../AbstractContractCopyFromLocalTest.java | 2 +-
.../fs/contract/AbstractContractCreateTest.java | 2 +-
.../fs/contract/AbstractContractDeleteTest.java | 2 +-
.../fs/contract/AbstractContractEtagTest.java | 2 +-
.../AbstractContractGetFileStatusTest.java | 2 +-
.../AbstractContractLeaseRecoveryTest.java | 2 +-
.../fs/contract/AbstractContractMkdirTest.java | 2 +-
.../AbstractContractMultipartUploaderTest.java | 2 +-
.../fs/contract/AbstractContractOpenTest.java | 2 +-
.../fs/contract/AbstractContractRenameTest.java | 2 +-
.../AbstractContractRootDirectoryTest.java | 2 +-
.../fs/contract/AbstractContractSafeModeTest.java | 2 +-
.../fs/contract/AbstractContractSeekTest.java | 2 +-
.../fs/contract/AbstractContractSetTimesTest.java | 2 +-
.../fs/contract/AbstractContractUnbufferTest.java | 2 +-
.../fs/contract/AbstractFSContractTestBase.java | 26 --
...actUnbuffer.java => AbstractOzoneContract.java} | 39 ++-
.../ozone/contract/AbstractOzoneContractTest.java | 315 +++++++++++++++++++++
.../ozone/contract/ITestOzoneContractCreate.java | 66 -----
.../ozone/contract/ITestOzoneContractDelete.java | 66 -----
.../ozone/contract/ITestOzoneContractDistCp.java | 59 ----
.../contract/ITestOzoneContractDistCpWithFSO.java | 65 -----
.../contract/ITestOzoneContractGetFileStatus.java | 83 ------
.../fs/ozone/contract/ITestOzoneContractMkdir.java | 66 -----
.../fs/ozone/contract/ITestOzoneContractOpen.java | 66 -----
.../ozone/contract/ITestOzoneContractRename.java | 67 -----
.../ozone/contract/ITestOzoneContractRootDir.java | 68 -----
.../hadoop/fs/ozone/contract/OzoneContract.java | 125 +-------
...eContractSeek.java => RootedOzoneContract.java} | 35 ++-
...ractUnbuffer.java => TestOzoneContractFSO.java} | 28 +-
...tUnbuffer.java => TestOzoneContractLegacy.java} | 31 +-
...ileStatus.java => TestRootedOzoneContract.java} | 42 +--
.../rooted/ITestRootedOzoneContractCreate.java | 49 ----
.../rooted/ITestRootedOzoneContractDelete.java | 49 ----
.../rooted/ITestRootedOzoneContractDistCp.java | 59 ----
.../rooted/ITestRootedOzoneContractMkdir.java | 49 ----
.../rooted/ITestRootedOzoneContractOpen.java | 48 ----
.../rooted/ITestRootedOzoneContractRename.java | 50 ----
.../rooted/ITestRootedOzoneContractRootDir.java | 83 ------
.../rooted/ITestRootedOzoneContractSeek.java | 48 ----
.../ozone/contract/rooted/RootedOzoneContract.java | 117 --------
.../tools/contract/AbstractContractDistCpTest.java | 2 +-
45 files changed, 419 insertions(+), 1418 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractAppendTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractAppendTest.java
index 2db8faaa6e..51d75c07d2 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractAppendTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractAppendTest.java
@@ -22,7 +22,7 @@ import org.apache.hadoop.fs.CommonPathCapabilities;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.Path;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractConcatTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractConcatTest.java
index b4d494f771..ff5ed3b062 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractConcatTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractConcatTest.java
@@ -20,7 +20,7 @@ package org.apache.hadoop.fs.contract;
import org.apache.hadoop.fs.Path;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractContentSummaryTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractContentSummaryTest.java
index 5e5c917395..07405dc9cd 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractContentSummaryTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractContentSummaryTest.java
@@ -23,7 +23,7 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.FileNotFoundException;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCopyFromLocalTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCopyFromLocalTest.java
index ca1a757e9d..0d6c30e52c 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCopyFromLocalTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCopyFromLocalTest.java
@@ -25,7 +25,7 @@ import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java
index b3b91ce467..c39a9be161 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java
@@ -28,7 +28,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.StreamCapabilities;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractDeleteTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractDeleteTest.java
index 7a60614485..8ea9357f23 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractDeleteTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractDeleteTest.java
@@ -21,7 +21,7 @@ package org.apache.hadoop.fs.contract;
import org.apache.hadoop.fs.Path;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractEtagTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractEtagTest.java
index 02c419b09a..2624605ed2 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractEtagTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractEtagTest.java
@@ -21,7 +21,7 @@ package org.apache.hadoop.fs.contract;
import java.nio.charset.StandardCharsets;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractGetFileStatusTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractGetFileStatusTest.java
index 314d289c2a..21290d1e88 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractGetFileStatusTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractGetFileStatusTest.java
@@ -33,7 +33,7 @@ import org.apache.hadoop.fs.LocatedFileStatus;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;
import org.apache.hadoop.fs.RemoteIterator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.hadoop.fs.contract.ContractTestUtils.createSubdirs;
import static org.apache.hadoop.fs.contract.ContractTestUtils.iteratorToList;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractLeaseRecoveryTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractLeaseRecoveryTest.java
index fbe47302ff..2bde7b757a 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractLeaseRecoveryTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractLeaseRecoveryTest.java
@@ -22,7 +22,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LeaseRecoverable;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractMkdirTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractMkdirTest.java
index a64398a54f..22f947abc6 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractMkdirTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractMkdirTest.java
@@ -23,7 +23,7 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.ParentNotDirectoryException;
import org.apache.hadoop.fs.Path;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractMultipartUploaderTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractMultipartUploaderTest.java
index 906c110d3d..86363b55cc 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractMultipartUploaderTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractMultipartUploaderTest.java
@@ -30,7 +30,7 @@ import java.util.concurrent.CompletableFuture;
import com.google.common.base.Charsets;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractOpenTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractOpenTest.java
index 2527aacfd9..166e8e301e 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractOpenTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractOpenTest.java
@@ -45,7 +45,7 @@ import static
org.apache.hadoop.util.functional.FutureIO.awaitFuture;
import static org.assertj.core.api.Assertions.fail;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test Open operations.
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractRenameTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractRenameTest.java
index 6ae118d346..96ecb01bfa 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractRenameTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractRenameTest.java
@@ -22,7 +22,7 @@ import org.apache.hadoop.fs.FileAlreadyExistsException;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.FileNotFoundException;
import java.io.IOException;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractRootDirectoryTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractRootDirectoryTest.java
index 8721951e65..3ff3f72cc6 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractRootDirectoryTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractRootDirectoryTest.java
@@ -21,7 +21,7 @@ package org.apache.hadoop.fs.contract;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocatedFileStatus;
import org.apache.hadoop.fs.Path;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.assertj.core.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSafeModeTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSafeModeTest.java
index 72d0dce9ff..88666ee8a9 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSafeModeTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSafeModeTest.java
@@ -19,7 +19,7 @@
package org.apache.hadoop.fs.contract;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.SafeMode;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSeekTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSeekTest.java
index c9c51f360f..49c693268e 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSeekTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSeekTest.java
@@ -25,7 +25,7 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSetTimesTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSetTimesTest.java
index f9267dbf51..b9a86ae366 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSetTimesTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractSetTimesTest.java
@@ -21,7 +21,7 @@ package org.apache.hadoop.fs.contract;
import java.io.FileNotFoundException;
import org.apache.hadoop.fs.Path;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractUnbufferTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractUnbufferTest.java
index 6312bd6060..07c4f26543 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractUnbufferTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractContractUnbufferTest.java
@@ -19,7 +19,7 @@
package org.apache.hadoop.fs.contract;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Arrays;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractFSContractTestBase.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractFSContractTestBase.java
index 586364eb07..b34e945a3d 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractFSContractTestBase.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/contract/AbstractFSContractTestBase.java
@@ -22,19 +22,11 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.apache.ozone.test.JUnit5AwareTimeout;
import org.assertj.core.api.Assertions;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInfo;
-import org.junit.rules.TestName;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,12 +70,8 @@ public abstract class AbstractFSContractTestBase implements
ContractOptions {
*/
private Path testPath;
- @Rule
- public TestName methodName = new TestName();
-
private String testMethodName;
- @BeforeClass
@BeforeAll
public static void nameTestThread() {
Thread.currentThread().setName("JUnit");
@@ -93,12 +81,6 @@ public abstract class AbstractFSContractTestBase implements
ContractOptions {
Thread.currentThread().setName("JUnit-" + getMethodName());
}
- @Before
- public void getTestMethodName() {
- testMethodName = methodName.getMethodName();
- nameThread();
- }
-
@BeforeEach
void getTestMethodName(TestInfo testInfo) {
testInfo.getTestMethod().ifPresent(m -> testMethodName = m.getName());
@@ -179,12 +161,6 @@ public abstract class AbstractFSContractTestBase
implements ContractOptions {
return new Configuration();
}
- /**
- * Set the timeout for every test.
- */
- @Rule
- public TestRule testTimeout = new JUnit5AwareTimeout(new
Timeout(getTestTimeoutMillis()));
-
/**
* Option for tests to override the default timeout value.
* @return the current test timeout
@@ -198,7 +174,6 @@ public abstract class AbstractFSContractTestBase implements
ContractOptions {
* Setup: create the contract then init it.
* @throws Exception on any failure
*/
- @Before
@BeforeEach
public void setup() throws Exception {
Thread.currentThread().setName("setup");
@@ -231,7 +206,6 @@ public abstract class AbstractFSContractTestBase implements
ContractOptions {
* Teardown.
* @throws Exception on any failure
*/
- @After
@AfterEach
public void teardown() throws Exception {
Thread.currentThread().setName("teardown");
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractUnbuffer.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContract.java
similarity index 52%
copy from
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractUnbuffer.java
copy to
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContract.java
index 1af6b87b8f..73c9fa7dc2 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractUnbuffer.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContract.java
@@ -17,31 +17,40 @@
*/
package org.apache.hadoop.fs.ozone.contract;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractUnbufferTest;
+import java.io.IOException;
+
+import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.contract.AbstractFSContract;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.hadoop.ozone.MiniOzoneCluster;
-import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
- * Ozone contract tests for {@link org.apache.hadoop.fs.CanUnbuffer#unbuffer}.
+ * Base class for Ozone filesystem contracts. It needs a {@link
MiniOzoneCluster},
+ * and provides the {@link FileSystem} that's subject of the test.
*/
-public class ITestOzoneContractUnbuffer extends AbstractContractUnbufferTest {
+abstract class AbstractOzoneContract extends AbstractFSContract {
+
+ private final MiniOzoneCluster cluster;
+
+ /**
+ * @return root URI for the FileSystem
+ */
+ protected abstract String getRootURI() throws IOException;
- @BeforeClass
- public static void createCluster() throws IOException {
- OzoneContract.createCluster();
+ protected MiniOzoneCluster getCluster() {
+ return cluster;
}
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
+ AbstractOzoneContract(MiniOzoneCluster cluster) {
+ super(cluster.getConf());
+ this.cluster = cluster;
}
@Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
+ public FileSystem getTestFileSystem() throws IOException {
+ assertNotNull(cluster, "cluster not created");
+ getConf().set("fs.defaultFS", getRootURI());
+ return FileSystem.get(getConf());
}
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContractTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContractTest.java
new file mode 100644
index 0000000000..ab1736c3b0
--- /dev/null
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContractTest.java
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.fs.ozone.contract;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.contract.AbstractContractCreateTest;
+import org.apache.hadoop.fs.contract.AbstractContractDeleteTest;
+import org.apache.hadoop.fs.contract.AbstractContractGetFileStatusTest;
+import org.apache.hadoop.fs.contract.AbstractContractMkdirTest;
+import org.apache.hadoop.fs.contract.AbstractContractOpenTest;
+import org.apache.hadoop.fs.contract.AbstractContractRenameTest;
+import org.apache.hadoop.fs.contract.AbstractContractRootDirectoryTest;
+import org.apache.hadoop.fs.contract.AbstractContractSeekTest;
+import org.apache.hadoop.fs.contract.AbstractContractUnbufferTest;
+import org.apache.hadoop.fs.contract.AbstractFSContract;
+import org.apache.hadoop.hdds.conf.DatanodeRatisServerConfig;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.ratis.conf.RatisClientConfig;
+import org.apache.hadoop.hdds.utils.IOUtils;
+import org.apache.hadoop.ozone.MiniOzoneCluster;
+import org.apache.hadoop.tools.contract.AbstractContractDistCpTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+
+import java.io.IOException;
+import java.time.Duration;
+
+import static org.apache.hadoop.fs.contract.ContractTestUtils.cleanup;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED;
+import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OFS_URI_SCHEME;
+import static org.assertj.core.api.Assumptions.assumeThat;
+
+/**
+ * Base class for Ozone contract tests. Manages lifecycle of {@link
MiniOzoneCluster}.
+ * <p/>
+ * All specific contract tests are implemented as {@link Nested} inner
classes. This allows
+ * running all tests in the same cluster.
+ * <p/>
+ * Subclasses only need to implement {@link
#createOzoneContract(Configuration)},
+ * but can tweak configuration by also overriding {@link #createOzoneConfig()}.
+ */
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+abstract class AbstractOzoneContractTest {
+
+ private static final String CONTRACT_XML = "contract/ozone.xml";
+
+ private MiniOzoneCluster cluster;
+
+ /**
+ * This must be implemented by all subclasses.
+ * @return the FS contract
+ */
+ abstract AbstractFSContract createOzoneContract(Configuration conf);
+
+ /**
+ * Creates the base configuration for contract tests. This can be tweaked
+ * in subclasses by overriding {@link #createOzoneConfig()}.
+ */
+ protected static OzoneConfiguration createBaseConfiguration() {
+ OzoneConfiguration conf = new OzoneConfiguration();
+ DatanodeRatisServerConfig ratisServerConfig =
+ conf.getObject(DatanodeRatisServerConfig.class);
+ ratisServerConfig.setRequestTimeOut(Duration.ofSeconds(3));
+ ratisServerConfig.setWatchTimeOut(Duration.ofSeconds(10));
+ conf.setFromObject(ratisServerConfig);
+
+ RatisClientConfig.RaftConfig raftClientConfig =
+ conf.getObject(RatisClientConfig.RaftConfig.class);
+ raftClientConfig.setRpcRequestTimeout(Duration.ofSeconds(3));
+ raftClientConfig.setRpcWatchRequestTimeout(Duration.ofSeconds(10));
+ conf.setFromObject(raftClientConfig);
+
+ conf.addResource(CONTRACT_XML);
+
+ conf.setBoolean(OZONE_FS_HSYNC_ENABLED, true);
+
+ return conf;
+ }
+
+ /**
+ * Hook method that allows tweaking the configuration.
+ */
+ OzoneConfiguration createOzoneConfig() {
+ return createBaseConfiguration();
+ }
+
+ MiniOzoneCluster getCluster() {
+ return cluster;
+ }
+
+ @BeforeAll
+ void setup() throws Exception {
+ cluster = MiniOzoneCluster.newBuilder(createOzoneConfig())
+ .setNumDatanodes(5)
+ .build();
+ cluster.waitForClusterToBeReady();
+ }
+
+ @AfterAll
+ void teardown() {
+ IOUtils.closeQuietly(cluster);
+ }
+
+ @Nested
+ class TestContractCreate extends AbstractContractCreateTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+ }
+
+ @Nested
+ class TestContractDistCp extends AbstractContractDistCpTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+
+ @Override
+ protected void deleteTestDirInTeardown() throws IOException {
+ super.deleteTestDirInTeardown();
+ cleanup("TEARDOWN", getLocalFS(), getLocalDir());
+ }
+ }
+
+ @Nested
+ class TestContractDelete extends AbstractContractDeleteTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+ }
+
+ @Nested
+ class TestContractGetFileStatus extends AbstractContractGetFileStatusTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+ }
+
+ @Nested
+ class TestContractMkdir extends AbstractContractMkdirTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+ }
+
+ @Nested
+ class TestContractOpen extends AbstractContractOpenTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+ }
+
+ @Nested
+ class TestContractRename extends AbstractContractRenameTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+ }
+
+ @Nested
+ class TestContractRootDirectory extends AbstractContractRootDirectoryTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+
+ @Override
+ @Test
+ public void testRmRootRecursive() throws Throwable {
+ // OFS doesn't support creating files directly under root
+ assumeThat(getContract().getScheme())
+ .isNotEqualTo(OZONE_OFS_URI_SCHEME);
+ super.testRmRootRecursive();
+ }
+
+ @Override
+ @Test
+ public void testRmNonEmptyRootDirNonRecursive() throws Throwable {
+ // OFS doesn't support creating files directly under root
+ assumeThat(getContract().getScheme())
+ .isNotEqualTo(OZONE_OFS_URI_SCHEME);
+ super.testRmNonEmptyRootDirNonRecursive();
+ }
+
+ @Override
+ @Test
+ public void testRmEmptyRootDirNonRecursive() throws Throwable {
+ // Internally test deletes volume recursively
+ // Which is not supported
+ assumeThat(getContract().getScheme())
+ .isNotEqualTo(OZONE_OFS_URI_SCHEME);
+ super.testRmEmptyRootDirNonRecursive();
+ }
+
+ @Override
+ @Test
+ public void testListEmptyRootDirectory() throws IOException {
+ // Internally test deletes volume recursively
+ // Which is not supported
+ assumeThat(getContract().getScheme())
+ .isNotEqualTo(OZONE_OFS_URI_SCHEME);
+ super.testListEmptyRootDirectory();
+ }
+
+ @Override
+ @Test
+ public void testSimpleRootListing() throws IOException {
+ // Recursive list is not supported
+ assumeThat(getContract().getScheme())
+ .isNotEqualTo(OZONE_OFS_URI_SCHEME);
+ super.testSimpleRootListing();
+ }
+
+ @Override
+ @Test
+ public void testMkDirDepth1() throws Throwable {
+ // Internally test deletes volume recursively
+ // Which is not supported
+ assumeThat(getContract().getScheme())
+ .isNotEqualTo(OZONE_OFS_URI_SCHEME);
+ super.testMkDirDepth1();
+ }
+ }
+
+ @Nested
+ class TestContractSeek extends AbstractContractSeekTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+ }
+
+ @Nested
+ class TestContractUnbuffer extends AbstractContractUnbufferTest {
+ @Override
+ protected Configuration createConfiguration() {
+ return createOzoneConfig();
+ }
+
+ @Override
+ protected AbstractFSContract createContract(Configuration conf) {
+ return createOzoneContract(conf);
+ }
+ }
+
+}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractCreate.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractCreate.java
deleted file mode 100644
index fd4e4d416f..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractCreate.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractCreateTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- * Ozone contract tests creating files.
- */
-@RunWith(Parameterized.class)
-public class ITestOzoneContractCreate extends AbstractContractCreateTest {
-
- public ITestOzoneContractCreate(boolean fso) {
- // Actual init done in initParam().
- }
-
- @Parameterized.BeforeParam
- public static void initParam(boolean fso) throws IOException {
- OzoneContract.createCluster(fso);
- }
-
- @Parameterized.AfterParam
- public static void teardownParam() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
- }
-
- @Parameterized.Parameters
- public static Collection<Boolean> data() {
- return OzoneContract.getFsoCombinations();
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractDelete.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractDelete.java
deleted file mode 100644
index 8ca70f0a7f..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractDelete.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractDeleteTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- * Ozone contract tests covering deletes.
- */
-@RunWith(Parameterized.class)
-public class ITestOzoneContractDelete extends AbstractContractDeleteTest {
-
- public ITestOzoneContractDelete(boolean fso) {
- // Actual init done in initParam().
- }
-
- @Parameterized.BeforeParam
- public static void initParam(boolean fso) throws IOException {
- OzoneContract.createCluster(fso);
- }
-
- @Parameterized.AfterParam
- public static void teardownParam() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
- }
-
- @Parameterized.Parameters
- public static Collection<Boolean> data() {
- return OzoneContract.getFsoCombinations();
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractDistCp.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractDistCp.java
deleted file mode 100644
index cba18fe25a..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractDistCp.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.tools.contract.AbstractContractDistCpTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-import static org.apache.hadoop.fs.contract.ContractTestUtils.cleanup;
-
-
-/**
- * Contract test suite covering S3A integration with DistCp.
- * Uses the block output stream, buffered to disk. This is the
- * recommended output mechanism for DistCP due to its scalability.
- */
-public class ITestOzoneContractDistCp extends AbstractContractDistCpTest {
-
- @BeforeClass
- public static void createCluster() throws IOException {
- OzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @Override
- protected OzoneContract createContract(Configuration conf) {
- return new OzoneContract(conf);
- }
-
- @Override
- protected void deleteTestDirInTeardown() throws IOException {
- super.deleteTestDirInTeardown();
- cleanup("TEARDOWN", getLocalFS(), getLocalDir());
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractDistCpWithFSO.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractDistCpWithFSO.java
deleted file mode 100644
index 333ef18f5f..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractDistCpWithFSO.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.tools.contract.AbstractContractDistCpTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-import static org.apache.hadoop.fs.contract.ContractTestUtils.cleanup;
-
-
-/**
- * Contract test suite covering S3A integration with DistCp.
- * Uses the block output stream, buffered to disk. This is the
- * recommended output mechanism for DistCP due to its scalability.
- * This test suite runs the server in File System Optimized mode.
- * <p>
- * Note: It isn't possible to convert this into a parameterized test due to
- * unrelated failures occurring while trying to handle directories with names
- * containing '[' and ']' characters.
- */
-public class ITestOzoneContractDistCpWithFSO
- extends AbstractContractDistCpTest {
-
- @BeforeClass
- public static void createCluster() throws IOException {
- OzoneContract.createCluster(true);
- }
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @Override
- protected OzoneContract createContract(Configuration conf) {
- return new OzoneContract(conf);
- }
-
- @Override
- protected void deleteTestDirInTeardown() throws IOException {
- super.deleteTestDirInTeardown();
- cleanup("TEARDOWN", getLocalFS(), getLocalDir());
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractGetFileStatus.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractGetFileStatus.java
deleted file mode 100644
index a8013387cd..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractGetFileStatus.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractGetFileStatusTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Ozone contract tests covering getFileStatus.
- */
-@RunWith(Parameterized.class)
-public class ITestOzoneContractGetFileStatus
- extends AbstractContractGetFileStatusTest {
-
- public ITestOzoneContractGetFileStatus(boolean fso) {
- // Actual init done in initParam().
- }
-
- @Parameterized.BeforeParam
- public static void initParam(boolean fso) throws IOException {
- OzoneContract.createCluster(fso);
- }
-
- @Parameterized.AfterParam
- public static void teardownParam() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- private static final Logger LOG =
- LoggerFactory.getLogger(ITestOzoneContractGetFileStatus.class);
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
- }
-
- @Override
- public void teardown() throws Exception {
- LOG.info("FS details {}", getFileSystem());
- super.teardown();
- }
-
- @Override
- protected Configuration createConfiguration() {
- return super.createConfiguration();
- }
-
- @Parameterized.Parameters
- public static Collection<Boolean> data() {
- return OzoneContract.getFsoCombinations();
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractMkdir.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractMkdir.java
deleted file mode 100644
index 49118a0595..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractMkdir.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractMkdirTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- * Test dir operations on Ozone.
- */
-@RunWith(Parameterized.class)
-public class ITestOzoneContractMkdir extends AbstractContractMkdirTest {
-
- public ITestOzoneContractMkdir(boolean fso) {
- // Actual init done in initParam().
- }
-
- @Parameterized.BeforeParam
- public static void initParam(boolean fso) throws IOException {
- OzoneContract.createCluster(fso);
- }
-
- @Parameterized.AfterParam
- public static void teardownParam() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
- }
-
- @Parameterized.Parameters
- public static Collection<Boolean> data() {
- return OzoneContract.getFsoCombinations();
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractOpen.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractOpen.java
deleted file mode 100644
index 05babc015a..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractOpen.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractOpenTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- * Ozone contract tests opening files.
- */
-@RunWith(Parameterized.class)
-public class ITestOzoneContractOpen extends AbstractContractOpenTest {
-
- public ITestOzoneContractOpen(boolean fso) {
- // Actual init done in initParam().
- }
-
- @Parameterized.BeforeParam
- public static void initParam(boolean fso) throws IOException {
- OzoneContract.createCluster(fso);
- }
-
- @Parameterized.AfterParam
- public static void teardownParam() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
- }
-
- @Parameterized.Parameters
- public static Collection<Boolean> data() {
- return OzoneContract.getFsoCombinations();
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractRename.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractRename.java
deleted file mode 100644
index fe5c112a10..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractRename.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractRenameTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- * Ozone contract tests covering rename.
- */
-@RunWith(Parameterized.class)
-public class ITestOzoneContractRename extends AbstractContractRenameTest {
-
- public ITestOzoneContractRename(boolean fso) {
- // Actual init done in initParam().
- }
-
- @Parameterized.BeforeParam
- public static void initParam(boolean fso) throws IOException {
- OzoneContract.createCluster(fso);
- }
-
- @Parameterized.AfterParam
- public static void teardownParam() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
- }
-
-
- @Parameterized.Parameters
- public static Collection<Boolean> data() {
- return OzoneContract.getFsoCombinations();
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractRootDir.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractRootDir.java
deleted file mode 100644
index f4ec389229..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractRootDir.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractRootDirectoryTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- * Ozone contract test for ROOT directory operations.
- */
-@RunWith(Parameterized.class)
-public class ITestOzoneContractRootDir extends
- AbstractContractRootDirectoryTest {
-
- public ITestOzoneContractRootDir(boolean fso) {
- // Actual init done in initParam().
- }
-
- @Parameterized.BeforeParam
- public static void initParam(boolean fso) throws IOException {
- OzoneContract.createCluster(fso);
- }
-
- @Parameterized.AfterParam
- public static void teardownParam() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
- }
-
- @Parameterized.Parameters
- public static Collection<Boolean> data() {
- return OzoneContract.getFsoCombinations();
- }
-
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/OzoneContract.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/OzoneContract.java
index f13ca6cda3..e889c4f216 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/OzoneContract.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/OzoneContract.java
@@ -19,68 +19,24 @@
package org.apache.hadoop.fs.ozone.contract;
import java.io.IOException;
-import java.time.Duration;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.hadoop.hdds.utils.IOUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-import org.apache.hadoop.hdds.conf.DatanodeRatisServerConfig;
-import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
-import org.apache.hadoop.hdds.ratis.conf.RatisClientConfig;
-import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.ozone.MiniOzoneCluster;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.ozone.TestDataUtil;
import org.apache.hadoop.ozone.client.OzoneBucket;
import org.apache.hadoop.ozone.client.OzoneClient;
-import org.apache.hadoop.ozone.om.OMConfigKeys;
-
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
-import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT;
/**
- * The contract of Ozone: only enabled if the test bucket is provided.
+ * Filesystem contract for O3FS.
*/
-class OzoneContract extends AbstractFSContract {
-
- private static final List<Boolean> FSO_COMBINATIONS = Arrays.asList(
- // FSO configuration is a cluster level server side configuration.
- // If the cluster is configured with SIMPLE metadata layout,
- // non-FSO bucket will created.
- // If the cluster is configured with PREFIX metadata layout,
- // FSO bucket will be created.
- // Presently, OzoneClient checks bucketMetadata then invokes FSO or
- // non-FSO specific code and it makes no sense to add client side
- // configs now. Once the specific client API to set FSO or non-FSO
- // bucket is provided the contract test can be refactored to include
- // another parameter (fsoClient) which sets/unsets the client side
- // configs.
- true, // Server is configured with new layout (PREFIX)
- // and new buckets will be operated on
- false // Server is configured with old layout (SIMPLE)
- // and old buckets will be operated on
- );
- private static MiniOzoneCluster cluster;
- private static final String CONTRACT_XML = "contract/ozone.xml";
-
- private static boolean fsOptimizedServer;
- private static OzoneClient client;
+final class OzoneContract extends AbstractOzoneContract {
- OzoneContract(Configuration conf) {
- super(conf);
- //insert the base features
- addConfResource(CONTRACT_XML);
- }
-
- static List<Boolean> getFsoCombinations() {
- return FSO_COMBINATIONS;
+ OzoneContract(MiniOzoneCluster cluster) {
+ super(cluster);
}
@Override
@@ -93,73 +49,12 @@ class OzoneContract extends AbstractFSContract {
return new Path("/test");
}
- public static void initOzoneConfiguration(boolean fsoServer) {
- fsOptimizedServer = fsoServer;
- }
-
- public static void createCluster(boolean fsoServer) throws IOException {
- // Set the flag to enable/disable FSO on server.
- initOzoneConfiguration(fsoServer);
- createCluster();
- }
-
- public static void createCluster() throws IOException {
- OzoneConfiguration conf = new OzoneConfiguration();
- DatanodeRatisServerConfig ratisServerConfig =
- conf.getObject(DatanodeRatisServerConfig.class);
- ratisServerConfig.setRequestTimeOut(Duration.ofSeconds(3));
- ratisServerConfig.setWatchTimeOut(Duration.ofSeconds(10));
- conf.setFromObject(ratisServerConfig);
-
- RatisClientConfig.RaftConfig raftClientConfig =
- conf.getObject(RatisClientConfig.RaftConfig.class);
- raftClientConfig.setRpcRequestTimeout(Duration.ofSeconds(3));
- raftClientConfig.setRpcWatchRequestTimeout(Duration.ofSeconds(10));
- conf.setFromObject(raftClientConfig);
-
- conf.addResource(CONTRACT_XML);
-
- BucketLayout bucketLayout = fsOptimizedServer
- ? BucketLayout.FILE_SYSTEM_OPTIMIZED : BucketLayout.LEGACY;
- conf.set(OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT, bucketLayout.name());
- conf.setBoolean(OZONE_FS_HSYNC_ENABLED, true);
-
- cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(5).build();
- try {
- cluster.waitForClusterToBeReady();
- cluster.waitForPipelineTobeReady(HddsProtos.ReplicationFactor.THREE,
- 180000);
- client = cluster.newClient();
- } catch (Exception e) {
- throw new IOException(e);
- }
- }
-
- private void copyClusterConfigs(String configKey) {
- getConf().set(configKey, cluster.getConf().get(configKey));
- }
-
@Override
- public FileSystem getTestFileSystem() throws IOException {
- //assumes cluster is not null
- assertNotNull(client);
-
- OzoneBucket bucket = TestDataUtil.createVolumeAndBucket(client);
-
- String uri = String.format("%s://%s.%s/",
- OzoneConsts.OZONE_URI_SCHEME, bucket.getName(),
bucket.getVolumeName());
- getConf().set("fs.defaultFS", uri);
- copyClusterConfigs(OMConfigKeys.OZONE_OM_ADDRESS_KEY);
- copyClusterConfigs(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY);
- copyClusterConfigs(OZONE_FS_HSYNC_ENABLED);
- return FileSystem.get(getConf());
- }
-
- public static void destroyCluster() throws IOException {
- IOUtils.closeQuietly(client);
- if (cluster != null) {
- cluster.shutdown();
- cluster = null;
+ protected String getRootURI() throws IOException {
+ try (OzoneClient client = getCluster().newClient()) {
+ BucketLayout layout = getConf().getEnum(OZONE_DEFAULT_BUCKET_LAYOUT,
BucketLayout.DEFAULT);
+ OzoneBucket bucket = TestDataUtil.createVolumeAndBucket(client, layout);
+ return String.format("%s://%s.%s/", getScheme(), bucket.getName(),
bucket.getVolumeName());
}
}
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractSeek.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/RootedOzoneContract.java
similarity index 56%
rename from
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractSeek.java
rename to
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/RootedOzoneContract.java
index 51a35ee7e3..d617ca9de7 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractSeek.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/RootedOzoneContract.java
@@ -18,32 +18,31 @@
package org.apache.hadoop.fs.ozone.contract;
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractSeekTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.ozone.MiniOzoneCluster;
+import org.apache.hadoop.ozone.OzoneConsts;
/**
- * Ozone contract tests covering file seek.
+ * Filesystem contract for OFS.
*/
-public class ITestOzoneContractSeek extends AbstractContractSeekTest {
+final class RootedOzoneContract extends AbstractOzoneContract {
+
+ RootedOzoneContract(MiniOzoneCluster cluster) {
+ super(cluster);
+ }
- @BeforeClass
- public static void createCluster() throws IOException {
- OzoneContract.createCluster();
+ @Override
+ public String getScheme() {
+ return OzoneConsts.OZONE_OFS_URI_SCHEME;
}
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
+ @Override
+ public Path getTestPath() {
+ return new Path("/testvol1/testbucket1/test");
}
@Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
+ protected String getRootURI() {
+ return String.format("%s://localhost", getScheme());
}
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractUnbuffer.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/TestOzoneContractFSO.java
similarity index 60%
rename from
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractUnbuffer.java
rename to
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/TestOzoneContractFSO.java
index 1af6b87b8f..b45e68d85e 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/ITestOzoneContractUnbuffer.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/TestOzoneContractFSO.java
@@ -18,30 +18,26 @@
package org.apache.hadoop.fs.ozone.contract;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractUnbufferTest;
import org.apache.hadoop.fs.contract.AbstractFSContract;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import java.io.IOException;
+import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT;
+import static
org.apache.hadoop.ozone.om.helpers.BucketLayout.FILE_SYSTEM_OPTIMIZED;
/**
- * Ozone contract tests for {@link org.apache.hadoop.fs.CanUnbuffer#unbuffer}.
+ * Tests O3FS with FSO bucket.
*/
-public class ITestOzoneContractUnbuffer extends AbstractContractUnbufferTest {
+class TestOzoneContractFSO extends AbstractOzoneContractTest {
- @BeforeClass
- public static void createCluster() throws IOException {
- OzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() throws IOException {
- OzoneContract.destroyCluster();
+ @Override
+ OzoneConfiguration createOzoneConfig() {
+ OzoneConfiguration conf = createBaseConfiguration();
+ conf.set(OZONE_DEFAULT_BUCKET_LAYOUT, FILE_SYSTEM_OPTIMIZED.name());
+ return conf;
}
@Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new OzoneContract(conf);
+ AbstractFSContract createOzoneContract(Configuration conf) {
+ return new OzoneContract(getCluster());
}
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractUnbuffer.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/TestOzoneContractLegacy.java
similarity index 57%
rename from
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractUnbuffer.java
rename to
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/TestOzoneContractLegacy.java
index e081e8d5b8..97ced88fcd 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractUnbuffer.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/TestOzoneContractLegacy.java
@@ -15,34 +15,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.hadoop.fs.ozone.contract.rooted;
+package org.apache.hadoop.fs.ozone.contract;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractUnbufferTest;
import org.apache.hadoop.fs.contract.AbstractFSContract;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import java.io.IOException;
+import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT;
+import static org.apache.hadoop.ozone.om.helpers.BucketLayout.LEGACY;
/**
- * Ozone contract tests for {@link org.apache.hadoop.fs.CanUnbuffer#unbuffer}.
+ * Tests O3FS with LEGACY bucket.
*/
-public class ITestRootedOzoneContractUnbuffer
- extends AbstractContractUnbufferTest {
+class TestOzoneContractLegacy extends AbstractOzoneContractTest {
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
+ @Override
+ OzoneConfiguration createOzoneConfig() {
+ OzoneConfiguration conf = createBaseConfiguration();
+ conf.set(OZONE_DEFAULT_BUCKET_LAYOUT, LEGACY.name());
+ return conf;
}
@Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
+ AbstractFSContract createOzoneContract(Configuration conf) {
+ return new OzoneContract(getCluster());
}
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractGetFileStatus.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/TestRootedOzoneContract.java
similarity index 50%
rename from
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractGetFileStatus.java
rename to
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/TestRootedOzoneContract.java
index c858b35ac7..ab738f2f66 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractGetFileStatus.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/TestRootedOzoneContract.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -6,50 +6,26 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
+package org.apache.hadoop.fs.ozone.contract;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractGetFileStatusTest;
import org.apache.hadoop.fs.contract.AbstractFSContract;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
/**
- * Ozone contract tests covering getFileStatus.
+ * Tests OFS.
*/
-public class ITestRootedOzoneContractGetFileStatus
- extends AbstractContractGetFileStatusTest {
-
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
- }
-
+class TestRootedOzoneContract extends AbstractOzoneContractTest {
@Override
- protected Configuration createConfiguration() {
- return super.createConfiguration();
+ AbstractFSContract createOzoneContract(Configuration conf) {
+ return new RootedOzoneContract(getCluster());
}
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractCreate.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractCreate.java
deleted file mode 100644
index dd1312f3eb..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractCreate.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractCreateTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- * Ozone contract tests creating files.
- */
-public class ITestRootedOzoneContractCreate extends AbstractContractCreateTest
{
-
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractDelete.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractDelete.java
deleted file mode 100644
index 12971a3e2d..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractDelete.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractDeleteTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- * Ozone contract tests covering deletes.
- */
-public class ITestRootedOzoneContractDelete extends AbstractContractDeleteTest
{
-
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractDistCp.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractDistCp.java
deleted file mode 100644
index 026f63c779..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractDistCp.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.tools.contract.AbstractContractDistCpTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-import static org.apache.hadoop.fs.contract.ContractTestUtils.cleanup;
-
-
-/**
- * Contract test suite covering S3A integration with DistCp.
- * Uses the block output stream, buffered to disk. This is the
- * recommended output mechanism for DistCP due to its scalability.
- */
-public class ITestRootedOzoneContractDistCp extends AbstractContractDistCpTest
{
-
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
- }
-
- @Override
- protected RootedOzoneContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
- }
-
- @Override
- protected void deleteTestDirInTeardown() throws IOException {
- super.deleteTestDirInTeardown();
- cleanup("TEARDOWN", getLocalFS(), getLocalDir());
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractMkdir.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractMkdir.java
deleted file mode 100644
index 680754f840..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractMkdir.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractMkdirTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- * Test dir operations on Ozone.
- */
-public class ITestRootedOzoneContractMkdir extends AbstractContractMkdirTest {
-
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractOpen.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractOpen.java
deleted file mode 100644
index 6c98cc5284..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractOpen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractOpenTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- * Ozone contract tests opening files.
- */
-public class ITestRootedOzoneContractOpen extends AbstractContractOpenTest {
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractRename.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractRename.java
deleted file mode 100644
index 56134053ea..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractRename.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractRenameTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- * Ozone contract tests covering rename.
- */
-public class ITestRootedOzoneContractRename extends AbstractContractRenameTest
{
-
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
- }
-
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractRootDir.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractRootDir.java
deleted file mode 100644
index f4e27df2cd..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractRootDir.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractRootDirectoryTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- * Ozone contract test for ROOT directory operations.
- */
-public class ITestRootedOzoneContractRootDir extends
- AbstractContractRootDirectoryTest {
-
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
- }
-
- @Override
- public void testRmRootRecursive() {
- // OFS doesn't support creating files directly under root
- }
-
- @Override
- public void testRmNonEmptyRootDirNonRecursive() {
- // OFS doesn't support creating files directly under root
- }
-
- @Override
- public void testRmEmptyRootDirNonRecursive() {
- // Internally test deletes volume recursively
- // Which is not supported
- }
-
- @Override
- public void testListEmptyRootDirectory() {
- // Internally test deletes volume recursively
- // Which is not supported
- }
-
- @Override
- public void testSimpleRootListing() {
- // Recursive list is not supported
- }
-
- @Override
- public void testMkDirDepth1() {
- // Internally test deletes volume recursively
- // Which is not supported
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractSeek.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractSeek.java
deleted file mode 100644
index ec456fe1a7..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/ITestRootedOzoneContractSeek.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.contract.AbstractContractSeekTest;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- * Ozone contract tests covering file seek.
- */
-public class ITestRootedOzoneContractSeek extends AbstractContractSeekTest {
- @BeforeClass
- public static void createCluster() throws IOException {
- RootedOzoneContract.createCluster();
- }
-
- @AfterClass
- public static void teardownCluster() {
- RootedOzoneContract.destroyCluster();
- }
-
- @Override
- protected AbstractFSContract createContract(Configuration conf) {
- return new RootedOzoneContract(conf);
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/RootedOzoneContract.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/RootedOzoneContract.java
deleted file mode 100644
index 09a05bfb33..0000000000
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/rooted/RootedOzoneContract.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs.ozone.contract.rooted;
-
-import java.io.IOException;
-import java.time.Duration;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.contract.AbstractFSContract;
-import org.apache.hadoop.hdds.conf.DatanodeRatisServerConfig;
-import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
-import org.apache.hadoop.hdds.ratis.conf.RatisClientConfig;
-import org.apache.hadoop.hdds.scm.ScmConfigKeys;
-import org.apache.hadoop.ozone.MiniOzoneCluster;
-import org.apache.hadoop.ozone.OzoneConsts;
-import org.apache.hadoop.ozone.om.OMConfigKeys;
-
-import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-/**
- * The contract of Rooted Ozone FileSystem (OFS).
- */
-class RootedOzoneContract extends AbstractFSContract {
-
- private static MiniOzoneCluster cluster;
- private static final String CONTRACT_XML = "contract/ozone.xml";
-
- RootedOzoneContract(Configuration conf) {
- super(conf);
- // insert the base features
- addConfResource(CONTRACT_XML);
- }
-
- @Override
- public String getScheme() {
- return OzoneConsts.OZONE_OFS_URI_SCHEME;
- }
-
- @Override
- public Path getTestPath() {
- return new Path("/testvol1/testbucket1/test");
- }
-
- public static void createCluster() throws IOException {
- OzoneConfiguration conf = new OzoneConfiguration();
- DatanodeRatisServerConfig ratisServerConfig =
- conf.getObject(DatanodeRatisServerConfig.class);
- ratisServerConfig.setRequestTimeOut(Duration.ofSeconds(3));
- ratisServerConfig.setWatchTimeOut(Duration.ofSeconds(10));
- conf.setFromObject(ratisServerConfig);
-
- RatisClientConfig.RaftConfig raftClientConfig =
- conf.getObject(RatisClientConfig.RaftConfig.class);
- raftClientConfig.setRpcRequestTimeout(Duration.ofSeconds(3));
- raftClientConfig.setRpcWatchRequestTimeout(Duration.ofSeconds(10));
- conf.setFromObject(raftClientConfig);
- conf.setBoolean(OZONE_FS_HSYNC_ENABLED, true);
-
- conf.addResource(CONTRACT_XML);
-
- cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(5).build();
- try {
- cluster.waitForClusterToBeReady();
- cluster.waitForPipelineTobeReady(HddsProtos.ReplicationFactor.THREE,
- 180000);
- } catch (Exception e) {
- throw new IOException(e);
- }
- }
-
- private void copyClusterConfigs(String configKey) {
- getConf().set(configKey, cluster.getConf().get(configKey));
- }
-
- @Override
- public FileSystem getTestFileSystem() throws IOException {
- //assumes cluster is not null
- assertNotNull(cluster);
-
- String uri = String.format("%s://localhost:%s/",
- OzoneConsts.OZONE_OFS_URI_SCHEME,
- cluster.getOzoneManager().getRpcPort());
- getConf().set("fs.defaultFS", uri);
- // fs.ofs.impl should be loaded from META-INF, no need to explicitly set it
- copyClusterConfigs(OMConfigKeys.OZONE_OM_ADDRESS_KEY);
- copyClusterConfigs(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY);
- copyClusterConfigs(OZONE_FS_HSYNC_ENABLED);
- return FileSystem.get(getConf());
- }
-
- public static void destroyCluster() {
- if (cluster != null) {
- cluster.shutdown();
- cluster = null;
- }
- }
-}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/tools/contract/AbstractContractDistCpTest.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/tools/contract/AbstractContractDistCpTest.java
index 5b6047acb3..8985af2ac5 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/tools/contract/AbstractContractDistCpTest.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/tools/contract/AbstractContractDistCpTest.java
@@ -56,7 +56,7 @@ import org.apache.hadoop.tools.util.DistCpTestUtils;
import org.apache.hadoop.util.functional.RemoteIterators;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]