HDFS-12758. Ozone: Correcting assertEquals argument order in test cases. Contributed by Bharat Viswanadham.
This commit is contained in:
parent
cec96b296f
commit
e395244e95
|
@ -109,33 +109,33 @@ public class TestOzoneAcls {
|
||||||
public void testAclValues() {
|
public void testAclValues() {
|
||||||
OzoneAcl acl = OzoneAcl.parseAcl("user:bilbo:rw");
|
OzoneAcl acl = OzoneAcl.parseAcl("user:bilbo:rw");
|
||||||
assertEquals(acl.getName(), "bilbo");
|
assertEquals(acl.getName(), "bilbo");
|
||||||
assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ_WRITE);
|
assertEquals(OzoneAcl.OzoneACLRights.READ_WRITE, acl.getRights());
|
||||||
assertEquals(acl.getType(), OzoneAcl.OzoneACLType.USER);
|
assertEquals(OzoneAcl.OzoneACLType.USER, acl.getType());
|
||||||
|
|
||||||
acl = OzoneAcl.parseAcl("user:bilbo:wr");
|
acl = OzoneAcl.parseAcl("user:bilbo:wr");
|
||||||
assertEquals(acl.getName(), "bilbo");
|
assertEquals("bilbo", acl.getName());
|
||||||
assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ_WRITE);
|
assertEquals(OzoneAcl.OzoneACLRights.READ_WRITE, acl.getRights());
|
||||||
assertEquals(acl.getType(), OzoneAcl.OzoneACLType.USER);
|
assertEquals(OzoneAcl.OzoneACLType.USER, acl.getType());
|
||||||
|
|
||||||
acl = OzoneAcl.parseAcl("user:bilbo:r");
|
acl = OzoneAcl.parseAcl("user:bilbo:r");
|
||||||
assertEquals(acl.getName(), "bilbo");
|
assertEquals("bilbo", acl.getName());
|
||||||
assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ);
|
assertEquals(OzoneAcl.OzoneACLRights.READ, acl.getRights());
|
||||||
assertEquals(acl.getType(), OzoneAcl.OzoneACLType.USER);
|
assertEquals(OzoneAcl.OzoneACLType.USER, acl.getType());
|
||||||
|
|
||||||
acl = OzoneAcl.parseAcl("user:bilbo:w");
|
acl = OzoneAcl.parseAcl("user:bilbo:w");
|
||||||
assertEquals(acl.getName(), "bilbo");
|
assertEquals("bilbo", acl.getName());
|
||||||
assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.WRITE);
|
assertEquals(OzoneAcl.OzoneACLRights.WRITE, acl.getRights());
|
||||||
assertEquals(acl.getType(), OzoneAcl.OzoneACLType.USER);
|
assertEquals(OzoneAcl.OzoneACLType.USER, acl.getType());
|
||||||
|
|
||||||
acl = OzoneAcl.parseAcl("group:hobbit:wr");
|
acl = OzoneAcl.parseAcl("group:hobbit:wr");
|
||||||
assertEquals(acl.getName(), "hobbit");
|
assertEquals(acl.getName(), "hobbit");
|
||||||
assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ_WRITE);
|
assertEquals(OzoneAcl.OzoneACLRights.READ_WRITE, acl.getRights());
|
||||||
assertEquals(acl.getType(), OzoneAcl.OzoneACLType.GROUP);
|
assertEquals(OzoneAcl.OzoneACLType.GROUP, acl.getType());
|
||||||
|
|
||||||
acl = OzoneAcl.parseAcl("world::wr");
|
acl = OzoneAcl.parseAcl("world::wr");
|
||||||
assertEquals(acl.getName(), "");
|
assertEquals(acl.getName(), "");
|
||||||
assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ_WRITE);
|
assertEquals(OzoneAcl.OzoneACLRights.READ_WRITE, acl.getRights());
|
||||||
assertEquals(acl.getType(), OzoneAcl.OzoneACLType.WORLD);
|
assertEquals(OzoneAcl.OzoneACLType.WORLD, acl.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,7 +488,7 @@ public final class ContainerTestHelper {
|
||||||
public static void verifyGetKey(ContainerCommandRequestProto request,
|
public static void verifyGetKey(ContainerCommandRequestProto request,
|
||||||
ContainerCommandResponseProto response) {
|
ContainerCommandResponseProto response) {
|
||||||
Assert.assertEquals(request.getTraceID(), response.getTraceID());
|
Assert.assertEquals(request.getTraceID(), response.getTraceID());
|
||||||
Assert.assertEquals(response.getResult(), ContainerProtos.Result.SUCCESS);
|
Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
|
||||||
ContainerProtos.PutKeyRequestProto putKey = request.getPutKey();
|
ContainerProtos.PutKeyRequestProto putKey = request.getPutKey();
|
||||||
ContainerProtos.GetKeyRequestProto getKey = request.getGetKey();
|
ContainerProtos.GetKeyRequestProto getKey = request.getGetKey();
|
||||||
Assert.assertEquals(putKey.getKeyData().getChunksCount(),
|
Assert.assertEquals(putKey.getKeyData().getChunksCount(),
|
||||||
|
|
|
@ -119,10 +119,10 @@ public class TestEndPoint {
|
||||||
SCMVersionResponseProto responseProto = rpcEndPoint.getEndPoint()
|
SCMVersionResponseProto responseProto = rpcEndPoint.getEndPoint()
|
||||||
.getVersion(null);
|
.getVersion(null);
|
||||||
Assert.assertNotNull(responseProto);
|
Assert.assertNotNull(responseProto);
|
||||||
Assert.assertEquals(responseProto.getKeys(0).getKey(),
|
Assert.assertEquals(VersionInfo.DESCRIPTION_KEY,
|
||||||
VersionInfo.DESCRIPTION_KEY);
|
responseProto.getKeys(0).getKey());
|
||||||
Assert.assertEquals(responseProto.getKeys(0).getValue(),
|
Assert.assertEquals(VersionInfo.getLatestVersion().getDescription(),
|
||||||
VersionInfo.getLatestVersion().getDescription());
|
responseProto.getKeys(0).getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,8 +212,8 @@ public class TestEndPoint {
|
||||||
SCMRegisteredCmdResponseProto responseProto = rpcEndPoint.getEndPoint()
|
SCMRegisteredCmdResponseProto responseProto = rpcEndPoint.getEndPoint()
|
||||||
.register(nodeToRegister, scmAddressArray);
|
.register(nodeToRegister, scmAddressArray);
|
||||||
Assert.assertNotNull(responseProto);
|
Assert.assertNotNull(responseProto);
|
||||||
Assert.assertEquals(responseProto.getDatanodeUUID(),
|
Assert.assertEquals(nodeToRegister.getDatanodeUuid(),
|
||||||
nodeToRegister.getDatanodeUuid());
|
responseProto.getDatanodeUUID());
|
||||||
Assert.assertNotNull(responseProto.getClusterID());
|
Assert.assertNotNull(responseProto.getClusterID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -773,10 +773,10 @@ public class TestContainerPersistence {
|
||||||
// Verify in-memory map
|
// Verify in-memory map
|
||||||
ContainerData actualNewData = containerManager.getContainerMap()
|
ContainerData actualNewData = containerManager.getContainerMap()
|
||||||
.get(containerName).getContainer();
|
.get(containerName).getContainer();
|
||||||
Assert.assertEquals(actualNewData.getAllMetadata().get("VOLUME"),
|
Assert.assertEquals("shire_new",
|
||||||
"shire_new");
|
actualNewData.getAllMetadata().get("VOLUME"));
|
||||||
Assert.assertEquals(actualNewData.getAllMetadata().get("owner"),
|
Assert.assertEquals("bilbo_new",
|
||||||
"bilbo_new");
|
actualNewData.getAllMetadata().get("owner"));
|
||||||
|
|
||||||
// Verify container data on disk
|
// Verify container data on disk
|
||||||
File newContainerFile = containerManager.getContainerFile(actualNewData);
|
File newContainerFile = containerManager.getContainerFile(actualNewData);
|
||||||
|
@ -791,10 +791,10 @@ public class TestContainerPersistence {
|
||||||
ContainerProtos.ContainerData.parseDelimitedFrom(newIn);
|
ContainerProtos.ContainerData.parseDelimitedFrom(newIn);
|
||||||
ContainerData actualContainerData = ContainerData
|
ContainerData actualContainerData = ContainerData
|
||||||
.getFromProtBuf(actualContainerDataProto, conf);
|
.getFromProtBuf(actualContainerDataProto, conf);
|
||||||
Assert.assertEquals(actualContainerData.getAllMetadata().get("VOLUME"),
|
Assert.assertEquals("shire_new",
|
||||||
"shire_new");
|
actualContainerData.getAllMetadata().get("VOLUME"));
|
||||||
Assert.assertEquals(actualContainerData.getAllMetadata().get("owner"),
|
Assert.assertEquals("bilbo_new",
|
||||||
"bilbo_new");
|
actualContainerData.getAllMetadata().get("owner"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test force update flag.
|
// Test force update flag.
|
||||||
|
@ -818,10 +818,10 @@ public class TestContainerPersistence {
|
||||||
// Verify in-memory map
|
// Verify in-memory map
|
||||||
actualNewData = containerManager.getContainerMap()
|
actualNewData = containerManager.getContainerMap()
|
||||||
.get(containerName).getContainer();
|
.get(containerName).getContainer();
|
||||||
Assert.assertEquals(actualNewData.getAllMetadata().get("VOLUME"),
|
Assert.assertEquals("shire_new_1",
|
||||||
"shire_new_1");
|
actualNewData.getAllMetadata().get("VOLUME"));
|
||||||
Assert.assertEquals(actualNewData.getAllMetadata().get("owner"),
|
Assert.assertEquals("bilbo_new_1",
|
||||||
"bilbo_new_1");
|
actualNewData.getAllMetadata().get("owner"));
|
||||||
|
|
||||||
// Update a non-existing container
|
// Update a non-existing container
|
||||||
exception.expect(StorageContainerException.class);
|
exception.expect(StorageContainerException.class);
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class TestContainerReplicationManager {
|
||||||
.getValue() == 1);
|
.getValue() == 1);
|
||||||
Assert.assertEquals(singleNodeContainer, containers.get(0).getKey());
|
Assert.assertEquals(singleNodeContainer, containers.get(0).getKey());
|
||||||
int count = containers.get(0).getValue();
|
int count = containers.get(0).getValue();
|
||||||
Assert.assertEquals(count, 1L);
|
Assert.assertEquals(1L, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -211,7 +211,7 @@ public class TestContainerServer {
|
||||||
ContainerTestHelper.getCreateContainerRequest(containerName);
|
ContainerTestHelper.getCreateContainerRequest(containerName);
|
||||||
ContainerCommandResponseProto response = client.sendCommand(request);
|
ContainerCommandResponseProto response = client.sendCommand(request);
|
||||||
Assert.assertTrue(request.getTraceID().equals(response.getTraceID()));
|
Assert.assertTrue(request.getTraceID().equals(response.getTraceID()));
|
||||||
Assert.assertEquals(response.getResult(), ContainerProtos.Result.SUCCESS);
|
Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
|
||||||
Assert.assertTrue(dispatcher.
|
Assert.assertTrue(dispatcher.
|
||||||
getContainerMetrics().
|
getContainerMetrics().
|
||||||
getContainerOpsMetrics(
|
getContainerOpsMetrics(
|
||||||
|
|
|
@ -184,8 +184,8 @@ public class TestKeySpaceManager {
|
||||||
|
|
||||||
VolumeArgs getVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
VolumeArgs getVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
||||||
VolumeInfo retVolumeInfo = storageHandler.getVolumeInfo(getVolumeArgs);
|
VolumeInfo retVolumeInfo = storageHandler.getVolumeInfo(getVolumeArgs);
|
||||||
Assert.assertEquals(retVolumeInfo.getQuota().sizeInBytes(),
|
Assert.assertEquals(createQuota.sizeInBytes(),
|
||||||
createQuota.sizeInBytes());
|
retVolumeInfo.getQuota().sizeInBytes());
|
||||||
|
|
||||||
// Set a new quota and test it
|
// Set a new quota and test it
|
||||||
OzoneQuota setQuota =
|
OzoneQuota setQuota =
|
||||||
|
@ -194,15 +194,15 @@ public class TestKeySpaceManager {
|
||||||
storageHandler.setVolumeQuota(createVolumeArgs, false);
|
storageHandler.setVolumeQuota(createVolumeArgs, false);
|
||||||
getVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
getVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
||||||
retVolumeInfo = storageHandler.getVolumeInfo(getVolumeArgs);
|
retVolumeInfo = storageHandler.getVolumeInfo(getVolumeArgs);
|
||||||
Assert.assertEquals(retVolumeInfo.getQuota().sizeInBytes(),
|
Assert.assertEquals(setQuota.sizeInBytes(),
|
||||||
setQuota.sizeInBytes());
|
retVolumeInfo.getQuota().sizeInBytes());
|
||||||
|
|
||||||
// Remove the quota and test it again
|
// Remove the quota and test it again
|
||||||
storageHandler.setVolumeQuota(createVolumeArgs, true);
|
storageHandler.setVolumeQuota(createVolumeArgs, true);
|
||||||
getVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
getVolumeArgs = new VolumeArgs(volumeName, userArgs);
|
||||||
retVolumeInfo = storageHandler.getVolumeInfo(getVolumeArgs);
|
retVolumeInfo = storageHandler.getVolumeInfo(getVolumeArgs);
|
||||||
Assert.assertEquals(retVolumeInfo.getQuota().sizeInBytes(),
|
Assert.assertEquals(OzoneConsts.MAX_QUOTA_IN_BYTES,
|
||||||
OzoneConsts.MAX_QUOTA_IN_BYTES);
|
retVolumeInfo.getQuota().sizeInBytes());
|
||||||
Assert.assertEquals(numVolumeCreateFail,
|
Assert.assertEquals(numVolumeCreateFail,
|
||||||
ksmMetrics.getNumVolumeCreateFails());
|
ksmMetrics.getNumVolumeCreateFails());
|
||||||
Assert.assertEquals(numVolumeInfoFail,
|
Assert.assertEquals(numVolumeInfoFail,
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class TestXceiverClientManager {
|
||||||
storageContainerLocationClient.allocateContainer(
|
storageContainerLocationClient.allocateContainer(
|
||||||
clientManager.getType(), clientManager.getFactor(), containerName1);
|
clientManager.getType(), clientManager.getFactor(), containerName1);
|
||||||
XceiverClientSpi client1 = clientManager.acquireClient(pipeline1);
|
XceiverClientSpi client1 = clientManager.acquireClient(pipeline1);
|
||||||
Assert.assertEquals(client1.getRefcount(), 1);
|
Assert.assertEquals(1, client1.getRefcount());
|
||||||
Assert.assertEquals(containerName1,
|
Assert.assertEquals(containerName1,
|
||||||
client1.getPipeline().getContainerName());
|
client1.getPipeline().getContainerName());
|
||||||
|
|
||||||
|
@ -88,13 +88,13 @@ public class TestXceiverClientManager {
|
||||||
storageContainerLocationClient.allocateContainer(
|
storageContainerLocationClient.allocateContainer(
|
||||||
clientManager.getType(), clientManager.getFactor(), containerName2);
|
clientManager.getType(), clientManager.getFactor(), containerName2);
|
||||||
XceiverClientSpi client2 = clientManager.acquireClient(pipeline2);
|
XceiverClientSpi client2 = clientManager.acquireClient(pipeline2);
|
||||||
Assert.assertEquals(client2.getRefcount(), 1);
|
Assert.assertEquals(1, client2.getRefcount());
|
||||||
Assert.assertEquals(containerName2,
|
Assert.assertEquals(containerName2,
|
||||||
client2.getPipeline().getContainerName());
|
client2.getPipeline().getContainerName());
|
||||||
|
|
||||||
XceiverClientSpi client3 = clientManager.acquireClient(pipeline1);
|
XceiverClientSpi client3 = clientManager.acquireClient(pipeline1);
|
||||||
Assert.assertEquals(client3.getRefcount(), 2);
|
Assert.assertEquals(2, client3.getRefcount());
|
||||||
Assert.assertEquals(client1.getRefcount(), 2);
|
Assert.assertEquals(2, client1.getRefcount());
|
||||||
Assert.assertEquals(containerName1,
|
Assert.assertEquals(containerName1,
|
||||||
client3.getPipeline().getContainerName());
|
client3.getPipeline().getContainerName());
|
||||||
Assert.assertEquals(client1, client3);
|
Assert.assertEquals(client1, client3);
|
||||||
|
@ -117,7 +117,7 @@ public class TestXceiverClientManager {
|
||||||
clientManager.getType(), OzoneProtos.ReplicationFactor.ONE,
|
clientManager.getType(), OzoneProtos.ReplicationFactor.ONE,
|
||||||
containerName1);
|
containerName1);
|
||||||
XceiverClientSpi client1 = clientManager.acquireClient(pipeline1);
|
XceiverClientSpi client1 = clientManager.acquireClient(pipeline1);
|
||||||
Assert.assertEquals(client1.getRefcount(), 1);
|
Assert.assertEquals(1, client1.getRefcount());
|
||||||
Assert.assertEquals(containerName1,
|
Assert.assertEquals(containerName1,
|
||||||
client1.getPipeline().getContainerName());
|
client1.getPipeline().getContainerName());
|
||||||
|
|
||||||
|
@ -127,14 +127,14 @@ public class TestXceiverClientManager {
|
||||||
clientManager.getType(),
|
clientManager.getType(),
|
||||||
OzoneProtos.ReplicationFactor.ONE, containerName2);
|
OzoneProtos.ReplicationFactor.ONE, containerName2);
|
||||||
XceiverClientSpi client2 = clientManager.acquireClient(pipeline2);
|
XceiverClientSpi client2 = clientManager.acquireClient(pipeline2);
|
||||||
Assert.assertEquals(client2.getRefcount(), 1);
|
Assert.assertEquals(1, client2.getRefcount());
|
||||||
Assert.assertEquals(containerName2,
|
Assert.assertEquals(containerName2,
|
||||||
client2.getPipeline().getContainerName());
|
client2.getPipeline().getContainerName());
|
||||||
Assert.assertNotEquals(client1, client2);
|
Assert.assertNotEquals(client1, client2);
|
||||||
|
|
||||||
// least recent container (i.e containerName1) is evicted
|
// least recent container (i.e containerName1) is evicted
|
||||||
XceiverClientSpi nonExistent1 = cache.getIfPresent(containerName1);
|
XceiverClientSpi nonExistent1 = cache.getIfPresent(containerName1);
|
||||||
Assert.assertEquals(nonExistent1, null);
|
Assert.assertEquals(null, nonExistent1);
|
||||||
// However container call should succeed because of refcount on the client.
|
// However container call should succeed because of refcount on the client.
|
||||||
String traceID1 = "trace" + RandomStringUtils.randomNumeric(4);
|
String traceID1 = "trace" + RandomStringUtils.randomNumeric(4);
|
||||||
ContainerProtocolCalls.createContainer(client1, traceID1);
|
ContainerProtocolCalls.createContainer(client1, traceID1);
|
||||||
|
@ -162,19 +162,19 @@ public class TestXceiverClientManager {
|
||||||
clientManager.getType(),
|
clientManager.getType(),
|
||||||
clientManager.getFactor(), containerName1);
|
clientManager.getFactor(), containerName1);
|
||||||
XceiverClientSpi client1 = clientManager.acquireClient(pipeline1);
|
XceiverClientSpi client1 = clientManager.acquireClient(pipeline1);
|
||||||
Assert.assertEquals(client1.getRefcount(), 1);
|
Assert.assertEquals(1, client1.getRefcount());
|
||||||
Assert.assertEquals(containerName1,
|
Assert.assertEquals(containerName1,
|
||||||
client1.getPipeline().getContainerName());
|
client1.getPipeline().getContainerName());
|
||||||
|
|
||||||
clientManager.releaseClient(client1);
|
clientManager.releaseClient(client1);
|
||||||
Assert.assertEquals(client1.getRefcount(), 0);
|
Assert.assertEquals(0, client1.getRefcount());
|
||||||
|
|
||||||
String containerName2 = "container" + RandomStringUtils.randomNumeric(10);
|
String containerName2 = "container" + RandomStringUtils.randomNumeric(10);
|
||||||
Pipeline pipeline2 =
|
Pipeline pipeline2 =
|
||||||
storageContainerLocationClient.allocateContainer(
|
storageContainerLocationClient.allocateContainer(
|
||||||
clientManager.getType(), clientManager.getFactor(), containerName2);
|
clientManager.getType(), clientManager.getFactor(), containerName2);
|
||||||
XceiverClientSpi client2 = clientManager.acquireClient(pipeline2);
|
XceiverClientSpi client2 = clientManager.acquireClient(pipeline2);
|
||||||
Assert.assertEquals(client2.getRefcount(), 1);
|
Assert.assertEquals(1, client2.getRefcount());
|
||||||
Assert.assertEquals(containerName2,
|
Assert.assertEquals(containerName2,
|
||||||
client2.getPipeline().getContainerName());
|
client2.getPipeline().getContainerName());
|
||||||
Assert.assertNotEquals(client1, client2);
|
Assert.assertNotEquals(client1, client2);
|
||||||
|
@ -182,7 +182,7 @@ public class TestXceiverClientManager {
|
||||||
|
|
||||||
// now client 1 should be evicted
|
// now client 1 should be evicted
|
||||||
XceiverClientSpi nonExistent = cache.getIfPresent(containerName1);
|
XceiverClientSpi nonExistent = cache.getIfPresent(containerName1);
|
||||||
Assert.assertEquals(nonExistent, null);
|
Assert.assertEquals(null, nonExistent);
|
||||||
|
|
||||||
// Any container operation should now fail
|
// Any container operation should now fail
|
||||||
String traceID2 = "trace" + RandomStringUtils.randomNumeric(4);
|
String traceID2 = "trace" + RandomStringUtils.randomNumeric(4);
|
||||||
|
|
|
@ -88,8 +88,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateVolumes() throws IOException {
|
public void testCreateVolumes() throws IOException {
|
||||||
super.testCreateVolumes(port);
|
super.testCreateVolumes(port);
|
||||||
Assert.assertEquals(cluster.getKeySpaceManager()
|
Assert.assertEquals(0, cluster.getKeySpaceManager()
|
||||||
.getMetrics().getNumVolumeCreateFails(), 0);
|
.getMetrics().getNumVolumeCreateFails());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,8 +100,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateVolumesWithQuota() throws IOException {
|
public void testCreateVolumesWithQuota() throws IOException {
|
||||||
super.testCreateVolumesWithQuota(port);
|
super.testCreateVolumesWithQuota(port);
|
||||||
Assert.assertEquals(cluster.getKeySpaceManager()
|
Assert.assertEquals(0, cluster.getKeySpaceManager()
|
||||||
.getMetrics().getNumVolumeCreateFails(), 0);
|
.getMetrics().getNumVolumeCreateFails());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,8 +112,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateVolumesWithInvalidQuota() throws IOException {
|
public void testCreateVolumesWithInvalidQuota() throws IOException {
|
||||||
super.testCreateVolumesWithInvalidQuota(port);
|
super.testCreateVolumesWithInvalidQuota(port);
|
||||||
Assert.assertEquals(cluster.getKeySpaceManager()
|
Assert.assertEquals(0, cluster.getKeySpaceManager()
|
||||||
.getMetrics().getNumVolumeCreateFails(), 0);
|
.getMetrics().getNumVolumeCreateFails());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,8 +126,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateVolumesWithInvalidUser() throws IOException {
|
public void testCreateVolumesWithInvalidUser() throws IOException {
|
||||||
super.testCreateVolumesWithInvalidUser(port);
|
super.testCreateVolumesWithInvalidUser(port);
|
||||||
Assert.assertEquals(cluster.getKeySpaceManager()
|
Assert.assertEquals(0, cluster.getKeySpaceManager()
|
||||||
.getMetrics().getNumVolumeCreateFails(), 0);
|
.getMetrics().getNumVolumeCreateFails());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,8 +141,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateVolumesWithOutAdminRights() throws IOException {
|
public void testCreateVolumesWithOutAdminRights() throws IOException {
|
||||||
super.testCreateVolumesWithOutAdminRights(port);
|
super.testCreateVolumesWithOutAdminRights(port);
|
||||||
Assert.assertEquals(cluster.getKeySpaceManager()
|
Assert.assertEquals(0, cluster.getKeySpaceManager()
|
||||||
.getMetrics().getNumVolumeCreateFails(), 0);
|
.getMetrics().getNumVolumeCreateFails());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,8 +153,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateVolumesInLoop() throws IOException {
|
public void testCreateVolumesInLoop() throws IOException {
|
||||||
super.testCreateVolumesInLoop(port);
|
super.testCreateVolumesInLoop(port);
|
||||||
Assert.assertEquals(cluster.getKeySpaceManager()
|
Assert.assertEquals(0, cluster.getKeySpaceManager()
|
||||||
.getMetrics().getNumVolumeCreateFails(), 0);
|
.getMetrics().getNumVolumeCreateFails());
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get volumes owned by the user.
|
* Get volumes owned by the user.
|
||||||
|
|
|
@ -236,14 +236,14 @@ public class TestKeys {
|
||||||
assertNotNull(helper.getBucket());
|
assertNotNull(helper.getBucket());
|
||||||
assertNotNull(helper.getFile());
|
assertNotNull(helper.getFile());
|
||||||
List<OzoneKey> keyList = helper.getBucket().listKeys("100", null, null);
|
List<OzoneKey> keyList = helper.getBucket().listKeys("100", null, null);
|
||||||
Assert.assertEquals(keyList.size(), 1);
|
Assert.assertEquals(1, keyList.size());
|
||||||
|
|
||||||
// test list key using a more efficient call
|
// test list key using a more efficient call
|
||||||
String newkeyName = OzoneUtils.getRequestID().toLowerCase();
|
String newkeyName = OzoneUtils.getRequestID().toLowerCase();
|
||||||
client.putKey(helper.getVol().getVolumeName(),
|
client.putKey(helper.getVol().getVolumeName(),
|
||||||
helper.getBucket().getBucketName(), newkeyName, helper.getFile());
|
helper.getBucket().getBucketName(), newkeyName, helper.getFile());
|
||||||
keyList = helper.getBucket().listKeys("100", null, null);
|
keyList = helper.getBucket().listKeys("100", null, null);
|
||||||
Assert.assertEquals(keyList.size(), 2);
|
Assert.assertEquals(2, keyList.size());
|
||||||
|
|
||||||
// test new put key with invalid volume/bucket name
|
// test new put key with invalid volume/bucket name
|
||||||
try{
|
try{
|
||||||
|
@ -425,8 +425,8 @@ public class TestKeys {
|
||||||
List<OzoneKey> keyList2 = client.listKeys(helper.getVol().getVolumeName(),
|
List<OzoneKey> keyList2 = client.listKeys(helper.getVol().getVolumeName(),
|
||||||
helper.getBucket().getBucketName(), "100", null, null);
|
helper.getBucket().getBucketName(), "100", null, null);
|
||||||
|
|
||||||
Assert.assertEquals(keyList1.size(), 11);
|
Assert.assertEquals(11, keyList1.size());
|
||||||
Assert.assertEquals(keyList2.size(), 11);
|
Assert.assertEquals(11, keyList2.size());
|
||||||
// Verify the key creation/modification time. Here we compare the time in
|
// Verify the key creation/modification time. Here we compare the time in
|
||||||
// second unit since the date string reparsed to millisecond will
|
// second unit since the date string reparsed to millisecond will
|
||||||
// lose precision.
|
// lose precision.
|
||||||
|
@ -448,15 +448,15 @@ public class TestKeys {
|
||||||
keyList1 = helper.getBucket().listKeys("1", null, null);
|
keyList1 = helper.getBucket().listKeys("1", null, null);
|
||||||
keyList2 = client.listKeys(helper.getVol().getVolumeName(),
|
keyList2 = client.listKeys(helper.getVol().getVolumeName(),
|
||||||
helper.getBucket().getBucketName(), "1", null, null);
|
helper.getBucket().getBucketName(), "1", null, null);
|
||||||
Assert.assertEquals(keyList1.size(), 1);
|
Assert.assertEquals(1, keyList1.size());
|
||||||
Assert.assertEquals(keyList2.size(), 1);
|
Assert.assertEquals(1, keyList2.size());
|
||||||
|
|
||||||
// test startKey parameter of list keys
|
// test startKey parameter of list keys
|
||||||
keyList1 = helper.getBucket().listKeys("100", "list-key4", "list-key");
|
keyList1 = helper.getBucket().listKeys("100", "list-key4", "list-key");
|
||||||
keyList2 = client.listKeys(helper.getVol().getVolumeName(),
|
keyList2 = client.listKeys(helper.getVol().getVolumeName(),
|
||||||
helper.getBucket().getBucketName(), "100", "list-key4", "list-key");
|
helper.getBucket().getBucketName(), "100", "list-key4", "list-key");
|
||||||
Assert.assertEquals(keyList1.size(), 5);
|
Assert.assertEquals(5, keyList1.size());
|
||||||
Assert.assertEquals(keyList2.size(), 5);
|
Assert.assertEquals(5, keyList2.size());
|
||||||
|
|
||||||
// test prefix parameter of list keys
|
// test prefix parameter of list keys
|
||||||
keyList1 = helper.getBucket().listKeys("100", null, "list-key2");
|
keyList1 = helper.getBucket().listKeys("100", null, "list-key2");
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class TestOzoneFileInterfaces {
|
||||||
@Test
|
@Test
|
||||||
public void testFileSystemInit() throws IOException {
|
public void testFileSystemInit() throws IOException {
|
||||||
Assert.assertTrue(fs instanceof OzoneFileSystem);
|
Assert.assertTrue(fs instanceof OzoneFileSystem);
|
||||||
Assert.assertEquals(fs.getUri().getScheme(), Constants.OZONE_URI_SCHEME);
|
Assert.assertEquals(Constants.OZONE_URI_SCHEME, fs.getUri().getScheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -120,7 +120,7 @@ public class TestOzoneFileInterfaces {
|
||||||
byte[] buffer = new byte[stringLen];
|
byte[] buffer = new byte[stringLen];
|
||||||
inputStream.readFully(0, buffer);
|
inputStream.readFully(0, buffer);
|
||||||
String out = new String(buffer, 0, buffer.length);
|
String out = new String(buffer, 0, buffer.length);
|
||||||
Assert.assertEquals(out, data);
|
Assert.assertEquals(data, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,10 +132,10 @@ public class TestOzoneFileInterfaces {
|
||||||
|
|
||||||
FileStatus status = fs.getFileStatus(path);
|
FileStatus status = fs.getFileStatus(path);
|
||||||
Assert.assertTrue(status.isDirectory());
|
Assert.assertTrue(status.isDirectory());
|
||||||
Assert.assertEquals(status.getLen(), 0);
|
Assert.assertEquals(0, status.getLen());
|
||||||
|
|
||||||
FileStatus[] statusList = fs.listStatus(new Path("/"));
|
FileStatus[] statusList = fs.listStatus(new Path("/"));
|
||||||
Assert.assertEquals(statusList.length, 1);
|
Assert.assertEquals(1, statusList.length);
|
||||||
Assert.assertEquals(statusList[0], status);
|
Assert.assertEquals(status, statusList[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue