|
@@ -34,7 +34,10 @@ import org.junit.Rule;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.junit.rules.Timeout;
|
|
import org.junit.rules.Timeout;
|
|
|
|
|
|
-public class TestFileStatusWithECPolicy {
|
|
|
|
|
|
+/**
|
|
|
|
+ * This test ensures the statuses of EC files with the default policy.
|
|
|
|
+ */
|
|
|
|
+public class TestFileStatusWithDefaultECPolicy {
|
|
private MiniDFSCluster cluster;
|
|
private MiniDFSCluster cluster;
|
|
private DistributedFileSystem fs;
|
|
private DistributedFileSystem fs;
|
|
private DFSClient client;
|
|
private DFSClient client;
|
|
@@ -50,8 +53,7 @@ public class TestFileStatusWithECPolicy {
|
|
cluster.waitActive();
|
|
cluster.waitActive();
|
|
fs = cluster.getFileSystem();
|
|
fs = cluster.getFileSystem();
|
|
client = fs.getClient();
|
|
client = fs.getClient();
|
|
- fs.enableErasureCodingPolicy(
|
|
|
|
- StripedFileTestUtil.getDefaultECPolicy().getName());
|
|
|
|
|
|
+ fs.enableErasureCodingPolicy(getEcPolicy().getName());
|
|
}
|
|
}
|
|
|
|
|
|
@After
|
|
@After
|
|
@@ -62,6 +64,10 @@ public class TestFileStatusWithECPolicy {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public ErasureCodingPolicy getEcPolicy() {
|
|
|
|
+ return StripedFileTestUtil.getDefaultECPolicy();
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void testFileStatusWithECPolicy() throws Exception {
|
|
public void testFileStatusWithECPolicy() throws Exception {
|
|
// test directory doesn't have an EC policy
|
|
// test directory doesn't have an EC policy
|
|
@@ -76,8 +82,7 @@ public class TestFileStatusWithECPolicy {
|
|
ContractTestUtils.assertNotErasureCoded(fs, file);
|
|
ContractTestUtils.assertNotErasureCoded(fs, file);
|
|
fs.delete(file, true);
|
|
fs.delete(file, true);
|
|
|
|
|
|
- final ErasureCodingPolicy ecPolicy1 =
|
|
|
|
- StripedFileTestUtil.getDefaultECPolicy();
|
|
|
|
|
|
+ final ErasureCodingPolicy ecPolicy1 = getEcPolicy();
|
|
// set EC policy on dir
|
|
// set EC policy on dir
|
|
fs.setErasureCodingPolicy(dir, ecPolicy1.getName());
|
|
fs.setErasureCodingPolicy(dir, ecPolicy1.getName());
|
|
ContractTestUtils.assertErasureCoded(fs, dir);
|
|
ContractTestUtils.assertErasureCoded(fs, dir);
|