HDFS-7029. Archival Storage: fix TestDFSInotifyEventInputStream and TestDistributedFileSystem. Contributed by Tsz Wo Nicholas Sze.

This commit is contained in:
Jing Zhao 2014-09-08 14:57:27 -07:00
parent 74a7e227c8
commit 867f0f141c
2 changed files with 16 additions and 1 deletions

View File

@ -55,6 +55,17 @@ public class BlockStoragePolicy {
public static final int ID_MAX = (1 << ID_BIT_LENGTH) - 1; public static final int ID_MAX = (1 << ID_BIT_LENGTH) - 1;
public static final byte ID_UNSPECIFIED = 0; public static final byte ID_UNSPECIFIED = 0;
private static final Suite DEFAULT_SUITE = createDefaultSuite();
private static Suite createDefaultSuite() {
final BlockStoragePolicy[] policies = new BlockStoragePolicy[1 << ID_BIT_LENGTH];
final StorageType[] storageTypes = {StorageType.DISK};
final byte defaultPolicyId = 12;
policies[defaultPolicyId] = new BlockStoragePolicy(defaultPolicyId, "HOT",
storageTypes, StorageType.EMPTY_ARRAY, StorageType.EMPTY_ARRAY);
return new Suite(defaultPolicyId, policies);
}
/** A block storage policy suite. */ /** A block storage policy suite. */
public static class Suite { public static class Suite {
private final byte defaultPolicyID; private final byte defaultPolicyID;
@ -342,6 +353,10 @@ public class BlockStoragePolicy {
public static Suite readBlockStorageSuite(Configuration conf) { public static Suite readBlockStorageSuite(Configuration conf) {
final BlockStoragePolicy[] policies = new BlockStoragePolicy[1 << ID_BIT_LENGTH]; final BlockStoragePolicy[] policies = new BlockStoragePolicy[1 << ID_BIT_LENGTH];
final String[] values = conf.getStrings(DFS_BLOCK_STORAGE_POLICIES_KEY); final String[] values = conf.getStrings(DFS_BLOCK_STORAGE_POLICIES_KEY);
if (values == null) {
// conf property is missing, use default suite.
return DEFAULT_SUITE;
}
byte firstID = -1; byte firstID = -1;
for(String v : values) { for(String v : values) {
v = v.trim(); v = v.trim();

View File

@ -64,7 +64,7 @@ public class TestDFSInotifyEventInputStream {
*/ */
@Test @Test
public void testOpcodeCount() { public void testOpcodeCount() {
Assert.assertTrue(FSEditLogOpCodes.values().length == 46); Assert.assertTrue(FSEditLogOpCodes.values().length == 47);
} }