From e395244e95ce12cefa8c6f9a3f932918704cf4ca Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Wed, 8 Nov 2017 20:58:13 -0800 Subject: [PATCH] HDFS-12758. Ozone: Correcting assertEquals argument order in test cases. Contributed by Bharat Viswanadham. --- .../apache/hadoop/ozone/TestOzoneAcls.java | 30 +++++++++---------- .../ozone/container/ContainerTestHelper.java | 2 +- .../ozone/container/common/TestEndPoint.java | 12 ++++---- .../common/impl/TestContainerPersistence.java | 24 +++++++-------- .../TestContainerReplicationManager.java | 2 +- .../transport/server/TestContainerServer.java | 2 +- .../hadoop/ozone/ksm/TestKeySpaceManager.java | 12 ++++---- .../ozone/scm/TestXceiverClientManager.java | 22 +++++++------- .../web/TestDistributedOzoneVolumes.java | 24 +++++++-------- .../hadoop/ozone/web/client/TestKeys.java | 16 +++++----- .../fs/ozone/TestOzoneFileInterfaces.java | 10 +++---- 11 files changed, 78 insertions(+), 78 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/ozone/TestOzoneAcls.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/ozone/TestOzoneAcls.java index c70b75ec441..03c45c50198 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/ozone/TestOzoneAcls.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/ozone/TestOzoneAcls.java @@ -109,33 +109,33 @@ public class TestOzoneAcls { public void testAclValues() { OzoneAcl acl = OzoneAcl.parseAcl("user:bilbo:rw"); assertEquals(acl.getName(), "bilbo"); - assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ_WRITE); - assertEquals(acl.getType(), OzoneAcl.OzoneACLType.USER); + assertEquals(OzoneAcl.OzoneACLRights.READ_WRITE, acl.getRights()); + assertEquals(OzoneAcl.OzoneACLType.USER, acl.getType()); acl = OzoneAcl.parseAcl("user:bilbo:wr"); - assertEquals(acl.getName(), "bilbo"); - assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ_WRITE); - assertEquals(acl.getType(), OzoneAcl.OzoneACLType.USER); + assertEquals("bilbo", acl.getName()); + assertEquals(OzoneAcl.OzoneACLRights.READ_WRITE, acl.getRights()); + assertEquals(OzoneAcl.OzoneACLType.USER, acl.getType()); acl = OzoneAcl.parseAcl("user:bilbo:r"); - assertEquals(acl.getName(), "bilbo"); - assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ); - assertEquals(acl.getType(), OzoneAcl.OzoneACLType.USER); + assertEquals("bilbo", acl.getName()); + assertEquals(OzoneAcl.OzoneACLRights.READ, acl.getRights()); + assertEquals(OzoneAcl.OzoneACLType.USER, acl.getType()); acl = OzoneAcl.parseAcl("user:bilbo:w"); - assertEquals(acl.getName(), "bilbo"); - assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.WRITE); - assertEquals(acl.getType(), OzoneAcl.OzoneACLType.USER); + assertEquals("bilbo", acl.getName()); + assertEquals(OzoneAcl.OzoneACLRights.WRITE, acl.getRights()); + assertEquals(OzoneAcl.OzoneACLType.USER, acl.getType()); acl = OzoneAcl.parseAcl("group:hobbit:wr"); assertEquals(acl.getName(), "hobbit"); - assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ_WRITE); - assertEquals(acl.getType(), OzoneAcl.OzoneACLType.GROUP); + assertEquals(OzoneAcl.OzoneACLRights.READ_WRITE, acl.getRights()); + assertEquals(OzoneAcl.OzoneACLType.GROUP, acl.getType()); acl = OzoneAcl.parseAcl("world::wr"); assertEquals(acl.getName(), ""); - assertEquals(acl.getRights(), OzoneAcl.OzoneACLRights.READ_WRITE); - assertEquals(acl.getType(), OzoneAcl.OzoneACLType.WORLD); + assertEquals(OzoneAcl.OzoneACLRights.READ_WRITE, acl.getRights()); + assertEquals(OzoneAcl.OzoneACLType.WORLD, acl.getType()); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/ContainerTestHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/ContainerTestHelper.java index 8fbdb201f4f..b03021d74d5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/ContainerTestHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/ContainerTestHelper.java @@ -488,7 +488,7 @@ public final class ContainerTestHelper { public static void verifyGetKey(ContainerCommandRequestProto request, ContainerCommandResponseProto response) { 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.GetKeyRequestProto getKey = request.getGetKey(); Assert.assertEquals(putKey.getKeyData().getChunksCount(), diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/TestEndPoint.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/TestEndPoint.java index 820d2059714..fc5f25f8f45 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/TestEndPoint.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/TestEndPoint.java @@ -119,10 +119,10 @@ public class TestEndPoint { SCMVersionResponseProto responseProto = rpcEndPoint.getEndPoint() .getVersion(null); Assert.assertNotNull(responseProto); - Assert.assertEquals(responseProto.getKeys(0).getKey(), - VersionInfo.DESCRIPTION_KEY); - Assert.assertEquals(responseProto.getKeys(0).getValue(), - VersionInfo.getLatestVersion().getDescription()); + Assert.assertEquals(VersionInfo.DESCRIPTION_KEY, + responseProto.getKeys(0).getKey()); + Assert.assertEquals(VersionInfo.getLatestVersion().getDescription(), + responseProto.getKeys(0).getValue()); } } @@ -212,8 +212,8 @@ public class TestEndPoint { SCMRegisteredCmdResponseProto responseProto = rpcEndPoint.getEndPoint() .register(nodeToRegister, scmAddressArray); Assert.assertNotNull(responseProto); - Assert.assertEquals(responseProto.getDatanodeUUID(), - nodeToRegister.getDatanodeUuid()); + Assert.assertEquals(nodeToRegister.getDatanodeUuid(), + responseProto.getDatanodeUUID()); Assert.assertNotNull(responseProto.getClusterID()); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java index 5cfd3e58643..16f6e683112 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java @@ -773,10 +773,10 @@ public class TestContainerPersistence { // Verify in-memory map ContainerData actualNewData = containerManager.getContainerMap() .get(containerName).getContainer(); - Assert.assertEquals(actualNewData.getAllMetadata().get("VOLUME"), - "shire_new"); - Assert.assertEquals(actualNewData.getAllMetadata().get("owner"), - "bilbo_new"); + Assert.assertEquals("shire_new", + actualNewData.getAllMetadata().get("VOLUME")); + Assert.assertEquals("bilbo_new", + actualNewData.getAllMetadata().get("owner")); // Verify container data on disk File newContainerFile = containerManager.getContainerFile(actualNewData); @@ -791,10 +791,10 @@ public class TestContainerPersistence { ContainerProtos.ContainerData.parseDelimitedFrom(newIn); ContainerData actualContainerData = ContainerData .getFromProtBuf(actualContainerDataProto, conf); - Assert.assertEquals(actualContainerData.getAllMetadata().get("VOLUME"), - "shire_new"); - Assert.assertEquals(actualContainerData.getAllMetadata().get("owner"), - "bilbo_new"); + Assert.assertEquals("shire_new", + actualContainerData.getAllMetadata().get("VOLUME")); + Assert.assertEquals("bilbo_new", + actualContainerData.getAllMetadata().get("owner")); } // Test force update flag. @@ -818,10 +818,10 @@ public class TestContainerPersistence { // Verify in-memory map actualNewData = containerManager.getContainerMap() .get(containerName).getContainer(); - Assert.assertEquals(actualNewData.getAllMetadata().get("VOLUME"), - "shire_new_1"); - Assert.assertEquals(actualNewData.getAllMetadata().get("owner"), - "bilbo_new_1"); + Assert.assertEquals("shire_new_1", + actualNewData.getAllMetadata().get("VOLUME")); + Assert.assertEquals("bilbo_new_1", + actualNewData.getAllMetadata().get("owner")); // Update a non-existing container exception.expect(StorageContainerException.class); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/replication/TestContainerReplicationManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/replication/TestContainerReplicationManager.java index 8394a2cd97c..ab4b9b6a6b5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/replication/TestContainerReplicationManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/replication/TestContainerReplicationManager.java @@ -165,7 +165,7 @@ public class TestContainerReplicationManager { .getValue() == 1); Assert.assertEquals(singleNodeContainer, containers.get(0).getKey()); int count = containers.get(0).getValue(); - Assert.assertEquals(count, 1L); + Assert.assertEquals(1L, count); } @Test diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/transport/server/TestContainerServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/transport/server/TestContainerServer.java index 123de5f52bd..9b16c302ba0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/transport/server/TestContainerServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/transport/server/TestContainerServer.java @@ -211,7 +211,7 @@ public class TestContainerServer { ContainerTestHelper.getCreateContainerRequest(containerName); ContainerCommandResponseProto response = client.sendCommand(request); Assert.assertTrue(request.getTraceID().equals(response.getTraceID())); - Assert.assertEquals(response.getResult(), ContainerProtos.Result.SUCCESS); + Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult()); Assert.assertTrue(dispatcher. getContainerMetrics(). getContainerOpsMetrics( diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestKeySpaceManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestKeySpaceManager.java index ba77de56ca9..55986087080 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestKeySpaceManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestKeySpaceManager.java @@ -184,8 +184,8 @@ public class TestKeySpaceManager { VolumeArgs getVolumeArgs = new VolumeArgs(volumeName, userArgs); VolumeInfo retVolumeInfo = storageHandler.getVolumeInfo(getVolumeArgs); - Assert.assertEquals(retVolumeInfo.getQuota().sizeInBytes(), - createQuota.sizeInBytes()); + Assert.assertEquals(createQuota.sizeInBytes(), + retVolumeInfo.getQuota().sizeInBytes()); // Set a new quota and test it OzoneQuota setQuota = @@ -194,15 +194,15 @@ public class TestKeySpaceManager { storageHandler.setVolumeQuota(createVolumeArgs, false); getVolumeArgs = new VolumeArgs(volumeName, userArgs); retVolumeInfo = storageHandler.getVolumeInfo(getVolumeArgs); - Assert.assertEquals(retVolumeInfo.getQuota().sizeInBytes(), - setQuota.sizeInBytes()); + Assert.assertEquals(setQuota.sizeInBytes(), + retVolumeInfo.getQuota().sizeInBytes()); // Remove the quota and test it again storageHandler.setVolumeQuota(createVolumeArgs, true); getVolumeArgs = new VolumeArgs(volumeName, userArgs); retVolumeInfo = storageHandler.getVolumeInfo(getVolumeArgs); - Assert.assertEquals(retVolumeInfo.getQuota().sizeInBytes(), - OzoneConsts.MAX_QUOTA_IN_BYTES); + Assert.assertEquals(OzoneConsts.MAX_QUOTA_IN_BYTES, + retVolumeInfo.getQuota().sizeInBytes()); Assert.assertEquals(numVolumeCreateFail, ksmMetrics.getNumVolumeCreateFails()); Assert.assertEquals(numVolumeInfoFail, diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/TestXceiverClientManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/TestXceiverClientManager.java index 14c930fe095..97ff76f7357 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/TestXceiverClientManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/TestXceiverClientManager.java @@ -79,7 +79,7 @@ public class TestXceiverClientManager { storageContainerLocationClient.allocateContainer( clientManager.getType(), clientManager.getFactor(), containerName1); XceiverClientSpi client1 = clientManager.acquireClient(pipeline1); - Assert.assertEquals(client1.getRefcount(), 1); + Assert.assertEquals(1, client1.getRefcount()); Assert.assertEquals(containerName1, client1.getPipeline().getContainerName()); @@ -88,13 +88,13 @@ public class TestXceiverClientManager { storageContainerLocationClient.allocateContainer( clientManager.getType(), clientManager.getFactor(), containerName2); XceiverClientSpi client2 = clientManager.acquireClient(pipeline2); - Assert.assertEquals(client2.getRefcount(), 1); + Assert.assertEquals(1, client2.getRefcount()); Assert.assertEquals(containerName2, client2.getPipeline().getContainerName()); XceiverClientSpi client3 = clientManager.acquireClient(pipeline1); - Assert.assertEquals(client3.getRefcount(), 2); - Assert.assertEquals(client1.getRefcount(), 2); + Assert.assertEquals(2, client3.getRefcount()); + Assert.assertEquals(2, client1.getRefcount()); Assert.assertEquals(containerName1, client3.getPipeline().getContainerName()); Assert.assertEquals(client1, client3); @@ -117,7 +117,7 @@ public class TestXceiverClientManager { clientManager.getType(), OzoneProtos.ReplicationFactor.ONE, containerName1); XceiverClientSpi client1 = clientManager.acquireClient(pipeline1); - Assert.assertEquals(client1.getRefcount(), 1); + Assert.assertEquals(1, client1.getRefcount()); Assert.assertEquals(containerName1, client1.getPipeline().getContainerName()); @@ -127,14 +127,14 @@ public class TestXceiverClientManager { clientManager.getType(), OzoneProtos.ReplicationFactor.ONE, containerName2); XceiverClientSpi client2 = clientManager.acquireClient(pipeline2); - Assert.assertEquals(client2.getRefcount(), 1); + Assert.assertEquals(1, client2.getRefcount()); Assert.assertEquals(containerName2, client2.getPipeline().getContainerName()); Assert.assertNotEquals(client1, client2); // least recent container (i.e containerName1) is evicted XceiverClientSpi nonExistent1 = cache.getIfPresent(containerName1); - Assert.assertEquals(nonExistent1, null); + Assert.assertEquals(null, nonExistent1); // However container call should succeed because of refcount on the client. String traceID1 = "trace" + RandomStringUtils.randomNumeric(4); ContainerProtocolCalls.createContainer(client1, traceID1); @@ -162,19 +162,19 @@ public class TestXceiverClientManager { clientManager.getType(), clientManager.getFactor(), containerName1); XceiverClientSpi client1 = clientManager.acquireClient(pipeline1); - Assert.assertEquals(client1.getRefcount(), 1); + Assert.assertEquals(1, client1.getRefcount()); Assert.assertEquals(containerName1, client1.getPipeline().getContainerName()); clientManager.releaseClient(client1); - Assert.assertEquals(client1.getRefcount(), 0); + Assert.assertEquals(0, client1.getRefcount()); String containerName2 = "container" + RandomStringUtils.randomNumeric(10); Pipeline pipeline2 = storageContainerLocationClient.allocateContainer( clientManager.getType(), clientManager.getFactor(), containerName2); XceiverClientSpi client2 = clientManager.acquireClient(pipeline2); - Assert.assertEquals(client2.getRefcount(), 1); + Assert.assertEquals(1, client2.getRefcount()); Assert.assertEquals(containerName2, client2.getPipeline().getContainerName()); Assert.assertNotEquals(client1, client2); @@ -182,7 +182,7 @@ public class TestXceiverClientManager { // now client 1 should be evicted XceiverClientSpi nonExistent = cache.getIfPresent(containerName1); - Assert.assertEquals(nonExistent, null); + Assert.assertEquals(null, nonExistent); // Any container operation should now fail String traceID2 = "trace" + RandomStringUtils.randomNumeric(4); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestDistributedOzoneVolumes.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestDistributedOzoneVolumes.java index 72362773cc4..655c7ad1187 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestDistributedOzoneVolumes.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestDistributedOzoneVolumes.java @@ -88,8 +88,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper { @Test public void testCreateVolumes() throws IOException { super.testCreateVolumes(port); - Assert.assertEquals(cluster.getKeySpaceManager() - .getMetrics().getNumVolumeCreateFails(), 0); + Assert.assertEquals(0, cluster.getKeySpaceManager() + .getMetrics().getNumVolumeCreateFails()); } /** @@ -100,8 +100,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper { @Test public void testCreateVolumesWithQuota() throws IOException { super.testCreateVolumesWithQuota(port); - Assert.assertEquals(cluster.getKeySpaceManager() - .getMetrics().getNumVolumeCreateFails(), 0); + Assert.assertEquals(0, cluster.getKeySpaceManager() + .getMetrics().getNumVolumeCreateFails()); } /** @@ -112,8 +112,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper { @Test public void testCreateVolumesWithInvalidQuota() throws IOException { super.testCreateVolumesWithInvalidQuota(port); - Assert.assertEquals(cluster.getKeySpaceManager() - .getMetrics().getNumVolumeCreateFails(), 0); + Assert.assertEquals(0, cluster.getKeySpaceManager() + .getMetrics().getNumVolumeCreateFails()); } /** @@ -126,8 +126,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper { @Test public void testCreateVolumesWithInvalidUser() throws IOException { super.testCreateVolumesWithInvalidUser(port); - Assert.assertEquals(cluster.getKeySpaceManager() - .getMetrics().getNumVolumeCreateFails(), 0); + Assert.assertEquals(0, cluster.getKeySpaceManager() + .getMetrics().getNumVolumeCreateFails()); } /** @@ -141,8 +141,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper { @Test public void testCreateVolumesWithOutAdminRights() throws IOException { super.testCreateVolumesWithOutAdminRights(port); - Assert.assertEquals(cluster.getKeySpaceManager() - .getMetrics().getNumVolumeCreateFails(), 0); + Assert.assertEquals(0, cluster.getKeySpaceManager() + .getMetrics().getNumVolumeCreateFails()); } /** @@ -153,8 +153,8 @@ public class TestDistributedOzoneVolumes extends TestOzoneHelper { @Test public void testCreateVolumesInLoop() throws IOException { super.testCreateVolumesInLoop(port); - Assert.assertEquals(cluster.getKeySpaceManager() - .getMetrics().getNumVolumeCreateFails(), 0); + Assert.assertEquals(0, cluster.getKeySpaceManager() + .getMetrics().getNumVolumeCreateFails()); } /** * Get volumes owned by the user. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/client/TestKeys.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/client/TestKeys.java index 52b0ab5a9c4..c3b2dcc8a06 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/client/TestKeys.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/client/TestKeys.java @@ -236,14 +236,14 @@ public class TestKeys { assertNotNull(helper.getBucket()); assertNotNull(helper.getFile()); List 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 String newkeyName = OzoneUtils.getRequestID().toLowerCase(); client.putKey(helper.getVol().getVolumeName(), helper.getBucket().getBucketName(), newkeyName, helper.getFile()); 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 try{ @@ -425,8 +425,8 @@ public class TestKeys { List keyList2 = client.listKeys(helper.getVol().getVolumeName(), helper.getBucket().getBucketName(), "100", null, null); - Assert.assertEquals(keyList1.size(), 11); - Assert.assertEquals(keyList2.size(), 11); + Assert.assertEquals(11, keyList1.size()); + Assert.assertEquals(11, keyList2.size()); // Verify the key creation/modification time. Here we compare the time in // second unit since the date string reparsed to millisecond will // lose precision. @@ -448,15 +448,15 @@ public class TestKeys { keyList1 = helper.getBucket().listKeys("1", null, null); keyList2 = client.listKeys(helper.getVol().getVolumeName(), helper.getBucket().getBucketName(), "1", null, null); - Assert.assertEquals(keyList1.size(), 1); - Assert.assertEquals(keyList2.size(), 1); + Assert.assertEquals(1, keyList1.size()); + Assert.assertEquals(1, keyList2.size()); // test startKey parameter of list keys keyList1 = helper.getBucket().listKeys("100", "list-key4", "list-key"); keyList2 = client.listKeys(helper.getVol().getVolumeName(), helper.getBucket().getBucketName(), "100", "list-key4", "list-key"); - Assert.assertEquals(keyList1.size(), 5); - Assert.assertEquals(keyList2.size(), 5); + Assert.assertEquals(5, keyList1.size()); + Assert.assertEquals(5, keyList2.size()); // test prefix parameter of list keys keyList1 = helper.getBucket().listKeys("100", null, "list-key2"); diff --git a/hadoop-tools/hadoop-ozone/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileInterfaces.java b/hadoop-tools/hadoop-ozone/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileInterfaces.java index 62e2f191d9a..b1e0f106cb8 100644 --- a/hadoop-tools/hadoop-ozone/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileInterfaces.java +++ b/hadoop-tools/hadoop-ozone/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileInterfaces.java @@ -99,7 +99,7 @@ public class TestOzoneFileInterfaces { @Test public void testFileSystemInit() throws IOException { Assert.assertTrue(fs instanceof OzoneFileSystem); - Assert.assertEquals(fs.getUri().getScheme(), Constants.OZONE_URI_SCHEME); + Assert.assertEquals(Constants.OZONE_URI_SCHEME, fs.getUri().getScheme()); } @Test @@ -120,7 +120,7 @@ public class TestOzoneFileInterfaces { byte[] buffer = new byte[stringLen]; inputStream.readFully(0, buffer); 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); Assert.assertTrue(status.isDirectory()); - Assert.assertEquals(status.getLen(), 0); + Assert.assertEquals(0, status.getLen()); FileStatus[] statusList = fs.listStatus(new Path("/")); - Assert.assertEquals(statusList.length, 1); - Assert.assertEquals(statusList[0], status); + Assert.assertEquals(1, statusList.length); + Assert.assertEquals(status, statusList[0]); } }