|
@@ -72,6 +72,7 @@ public class TestVolume {
|
|
return Arrays.asList(params);
|
|
return Arrays.asList(params);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @SuppressWarnings("visibilitymodifier")
|
|
@Parameterized.Parameter
|
|
@Parameterized.Parameter
|
|
public Class clientProtocol;
|
|
public Class clientProtocol;
|
|
|
|
|
|
@@ -120,7 +121,7 @@ public class TestVolume {
|
|
runTestCreateVolume(client);
|
|
runTestCreateVolume(client);
|
|
}
|
|
}
|
|
|
|
|
|
- static void runTestCreateVolume(ClientProtocol client)
|
|
|
|
|
|
+ static void runTestCreateVolume(ClientProtocol clientProtocol)
|
|
throws OzoneException, IOException, ParseException {
|
|
throws OzoneException, IOException, ParseException {
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
|
|
|
|
@@ -131,8 +132,8 @@ public class TestVolume {
|
|
.setQuota("100TB")
|
|
.setQuota("100TB")
|
|
.setAdmin("hdfs")
|
|
.setAdmin("hdfs")
|
|
.build();
|
|
.build();
|
|
- client.createVolume(volumeName, volumeArgs);
|
|
|
|
- OzoneVolume vol = client.getVolumeDetails(volumeName);
|
|
|
|
|
|
+ clientProtocol.createVolume(volumeName, volumeArgs);
|
|
|
|
+ OzoneVolume vol = clientProtocol.getVolumeDetails(volumeName);
|
|
|
|
|
|
assertEquals(vol.getName(), volumeName);
|
|
assertEquals(vol.getName(), volumeName);
|
|
assertEquals(vol.getAdmin(), "hdfs");
|
|
assertEquals(vol.getAdmin(), "hdfs");
|
|
@@ -147,7 +148,7 @@ public class TestVolume {
|
|
// not use Rule here because the test method is static.
|
|
// not use Rule here because the test method is static.
|
|
try {
|
|
try {
|
|
String invalidVolumeName = "#" + OzoneUtils.getRequestID().toLowerCase();
|
|
String invalidVolumeName = "#" + OzoneUtils.getRequestID().toLowerCase();
|
|
- client.createVolume(invalidVolumeName);
|
|
|
|
|
|
+ clientProtocol.createVolume(invalidVolumeName);
|
|
/*
|
|
/*
|
|
//TODO: RestClient and RpcClient should use HddsClientUtils to verify name
|
|
//TODO: RestClient and RpcClient should use HddsClientUtils to verify name
|
|
fail("Except the volume creation be failed because the"
|
|
fail("Except the volume creation be failed because the"
|
|
@@ -163,11 +164,11 @@ public class TestVolume {
|
|
runTestCreateDuplicateVolume(client);
|
|
runTestCreateDuplicateVolume(client);
|
|
}
|
|
}
|
|
|
|
|
|
- static void runTestCreateDuplicateVolume(ClientProtocol client)
|
|
|
|
|
|
+ static void runTestCreateDuplicateVolume(ClientProtocol clientProtocol)
|
|
throws OzoneException, IOException {
|
|
throws OzoneException, IOException {
|
|
try {
|
|
try {
|
|
- client.createVolume("testvol");
|
|
|
|
- client.createVolume("testvol");
|
|
|
|
|
|
+ clientProtocol.createVolume("testvol");
|
|
|
|
+ clientProtocol.createVolume("testvol");
|
|
assertFalse(true);
|
|
assertFalse(true);
|
|
} catch (IOException ioe) {
|
|
} catch (IOException ioe) {
|
|
Assert.assertTrue(ioe.getMessage()
|
|
Assert.assertTrue(ioe.getMessage()
|
|
@@ -180,11 +181,11 @@ public class TestVolume {
|
|
runTestDeleteVolume(client);
|
|
runTestDeleteVolume(client);
|
|
}
|
|
}
|
|
|
|
|
|
- static void runTestDeleteVolume(ClientProtocol client)
|
|
|
|
|
|
+ static void runTestDeleteVolume(ClientProtocol clientProtocol)
|
|
throws OzoneException, IOException {
|
|
throws OzoneException, IOException {
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
- client.createVolume(volumeName);
|
|
|
|
- client.deleteVolume(volumeName);
|
|
|
|
|
|
+ clientProtocol.createVolume(volumeName);
|
|
|
|
+ clientProtocol.deleteVolume(volumeName);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -192,13 +193,13 @@ public class TestVolume {
|
|
runTestChangeOwnerOnVolume(client);
|
|
runTestChangeOwnerOnVolume(client);
|
|
}
|
|
}
|
|
|
|
|
|
- static void runTestChangeOwnerOnVolume(ClientProtocol client)
|
|
|
|
|
|
+ static void runTestChangeOwnerOnVolume(ClientProtocol clientProtocol)
|
|
throws OzoneException, ParseException, IOException {
|
|
throws OzoneException, ParseException, IOException {
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
- client.createVolume(volumeName);
|
|
|
|
- client.getVolumeDetails(volumeName);
|
|
|
|
- client.setVolumeOwner(volumeName, "frodo");
|
|
|
|
- OzoneVolume newVol = client.getVolumeDetails(volumeName);
|
|
|
|
|
|
+ clientProtocol.createVolume(volumeName);
|
|
|
|
+ clientProtocol.getVolumeDetails(volumeName);
|
|
|
|
+ clientProtocol.setVolumeOwner(volumeName, "frodo");
|
|
|
|
+ OzoneVolume newVol = clientProtocol.getVolumeDetails(volumeName);
|
|
assertEquals(newVol.getOwner(), "frodo");
|
|
assertEquals(newVol.getOwner(), "frodo");
|
|
// verify if the creation time is missing after setting owner operation
|
|
// verify if the creation time is missing after setting owner operation
|
|
assertTrue(newVol.getCreationTime() > 0);
|
|
assertTrue(newVol.getCreationTime() > 0);
|
|
@@ -209,12 +210,12 @@ public class TestVolume {
|
|
runTestChangeQuotaOnVolume(client);
|
|
runTestChangeQuotaOnVolume(client);
|
|
}
|
|
}
|
|
|
|
|
|
- static void runTestChangeQuotaOnVolume(ClientProtocol client)
|
|
|
|
|
|
+ static void runTestChangeQuotaOnVolume(ClientProtocol clientProtocol)
|
|
throws OzoneException, IOException, ParseException {
|
|
throws OzoneException, IOException, ParseException {
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
- client.createVolume(volumeName);
|
|
|
|
- client.setVolumeQuota(volumeName, OzoneQuota.parseQuota("1000MB"));
|
|
|
|
- OzoneVolume newVol = client.getVolumeDetails(volumeName);
|
|
|
|
|
|
+ clientProtocol.createVolume(volumeName);
|
|
|
|
+ clientProtocol.setVolumeQuota(volumeName, OzoneQuota.parseQuota("1000MB"));
|
|
|
|
+ OzoneVolume newVol = clientProtocol.getVolumeDetails(volumeName);
|
|
assertEquals(newVol.getQuota(),
|
|
assertEquals(newVol.getQuota(),
|
|
OzoneQuota.parseQuota("1000MB").sizeInBytes());
|
|
OzoneQuota.parseQuota("1000MB").sizeInBytes());
|
|
// verify if the creation time is missing after setting quota operation
|
|
// verify if the creation time is missing after setting quota operation
|
|
@@ -229,14 +230,14 @@ public class TestVolume {
|
|
runTestListVolume(client);
|
|
runTestListVolume(client);
|
|
}
|
|
}
|
|
|
|
|
|
- static void runTestListVolume(ClientProtocol client)
|
|
|
|
|
|
+ static void runTestListVolume(ClientProtocol clientProtocol)
|
|
throws OzoneException, IOException {
|
|
throws OzoneException, IOException {
|
|
for (int x = 0; x < 10; x++) {
|
|
for (int x = 0; x < 10; x++) {
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
- client.createVolume(volumeName);
|
|
|
|
|
|
+ clientProtocol.createVolume(volumeName);
|
|
}
|
|
}
|
|
|
|
|
|
- List<OzoneVolume> ovols = client.listVolumes(null, null, 100);
|
|
|
|
|
|
+ List<OzoneVolume> ovols = clientProtocol.listVolumes(null, null, 100);
|
|
assertTrue(ovols.size() >= 10);
|
|
assertTrue(ovols.size() >= 10);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -247,19 +248,19 @@ public class TestVolume {
|
|
runTestListVolumePagination(client);
|
|
runTestListVolumePagination(client);
|
|
}
|
|
}
|
|
|
|
|
|
- static void runTestListVolumePagination(ClientProtocol client)
|
|
|
|
|
|
+ static void runTestListVolumePagination(ClientProtocol clientProtocol)
|
|
throws OzoneException, IOException {
|
|
throws OzoneException, IOException {
|
|
final int volCount = 2000;
|
|
final int volCount = 2000;
|
|
final int step = 100;
|
|
final int step = 100;
|
|
for (int x = 0; x < volCount; x++) {
|
|
for (int x = 0; x < volCount; x++) {
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
String volumeName = OzoneUtils.getRequestID().toLowerCase();
|
|
- client.createVolume(volumeName);
|
|
|
|
|
|
+ clientProtocol.createVolume(volumeName);
|
|
}
|
|
}
|
|
String prevKey = null;
|
|
String prevKey = null;
|
|
int count = 0;
|
|
int count = 0;
|
|
int pagecount = 0;
|
|
int pagecount = 0;
|
|
while (count < volCount) {
|
|
while (count < volCount) {
|
|
- List<OzoneVolume> ovols = client.listVolumes(null, prevKey, step);
|
|
|
|
|
|
+ List<OzoneVolume> ovols = clientProtocol.listVolumes(null, prevKey, step);
|
|
count += ovols.size();
|
|
count += ovols.size();
|
|
prevKey = ovols.get(ovols.size() - 1).getName();
|
|
prevKey = ovols.get(ovols.size() - 1).getName();
|
|
pagecount++;
|
|
pagecount++;
|
|
@@ -274,7 +275,7 @@ public class TestVolume {
|
|
runTestListAllVolumes(client);
|
|
runTestListAllVolumes(client);
|
|
}
|
|
}
|
|
|
|
|
|
- static void runTestListAllVolumes(ClientProtocol client)
|
|
|
|
|
|
+ static void runTestListAllVolumes(ClientProtocol clientProtocol)
|
|
throws OzoneException, IOException {
|
|
throws OzoneException, IOException {
|
|
final int volCount = 200;
|
|
final int volCount = 200;
|
|
final int step = 10;
|
|
final int step = 10;
|
|
@@ -288,15 +289,15 @@ public class TestVolume {
|
|
.setQuota("100TB")
|
|
.setQuota("100TB")
|
|
.setAdmin("hdfs")
|
|
.setAdmin("hdfs")
|
|
.build();
|
|
.build();
|
|
- client.createVolume(volumeName, volumeArgs);
|
|
|
|
- OzoneVolume vol = client.getVolumeDetails(volumeName);
|
|
|
|
|
|
+ clientProtocol.createVolume(volumeName, volumeArgs);
|
|
|
|
+ OzoneVolume vol = clientProtocol.getVolumeDetails(volumeName);
|
|
assertNotNull(vol);
|
|
assertNotNull(vol);
|
|
}
|
|
}
|
|
String prevKey = null;
|
|
String prevKey = null;
|
|
int count = 0;
|
|
int count = 0;
|
|
int pagecount = 0;
|
|
int pagecount = 0;
|
|
while (count < volCount) {
|
|
while (count < volCount) {
|
|
- List<OzoneVolume> ovols = client.listVolumes(null, prevKey, step);
|
|
|
|
|
|
+ List<OzoneVolume> ovols = clientProtocol.listVolumes(null, prevKey, step);
|
|
count += ovols.size();
|
|
count += ovols.size();
|
|
if (ovols.size() > 0) {
|
|
if (ovols.size() > 0) {
|
|
prevKey = ovols.get(ovols.size() - 1).getName();
|
|
prevKey = ovols.get(ovols.size() - 1).getName();
|
|
@@ -316,7 +317,7 @@ public class TestVolume {
|
|
runTestListVolumes(client);
|
|
runTestListVolumes(client);
|
|
}
|
|
}
|
|
|
|
|
|
- static void runTestListVolumes(ClientProtocol client)
|
|
|
|
|
|
+ static void runTestListVolumes(ClientProtocol clientProtocol)
|
|
throws OzoneException, IOException, ParseException {
|
|
throws OzoneException, IOException, ParseException {
|
|
final int volCount = 20;
|
|
final int volCount = 20;
|
|
final String user1 = "test-user-a";
|
|
final String user1 = "test-user-a";
|
|
@@ -342,13 +343,14 @@ public class TestVolume {
|
|
.setQuota("100TB")
|
|
.setQuota("100TB")
|
|
.setAdmin("hdfs")
|
|
.setAdmin("hdfs")
|
|
.build();
|
|
.build();
|
|
- client.createVolume(volumeName, volumeArgs);
|
|
|
|
- OzoneVolume vol = client.getVolumeDetails(volumeName);
|
|
|
|
|
|
+ clientProtocol.createVolume(volumeName, volumeArgs);
|
|
|
|
+ OzoneVolume vol = clientProtocol.getVolumeDetails(volumeName);
|
|
assertNotNull(vol);
|
|
assertNotNull(vol);
|
|
}
|
|
}
|
|
|
|
|
|
// list all the volumes belong to user1
|
|
// list all the volumes belong to user1
|
|
- List<OzoneVolume> volumeList = client.listVolumes(user1, null, null, 100);
|
|
|
|
|
|
+ List<OzoneVolume> volumeList =
|
|
|
|
+ clientProtocol.listVolumes(user1, null, null, 100);
|
|
assertEquals(10, volumeList.size());
|
|
assertEquals(10, volumeList.size());
|
|
// verify the owner name and creation time of volume
|
|
// verify the owner name and creation time of volume
|
|
for (OzoneVolume vol : volumeList) {
|
|
for (OzoneVolume vol : volumeList) {
|
|
@@ -358,25 +360,25 @@ public class TestVolume {
|
|
}
|
|
}
|
|
|
|
|
|
// test max key parameter of listing volumes
|
|
// test max key parameter of listing volumes
|
|
- volumeList = client.listVolumes(user1, null, null, 2);
|
|
|
|
|
|
+ volumeList = clientProtocol.listVolumes(user1, null, null, 2);
|
|
assertEquals(2, volumeList.size());
|
|
assertEquals(2, volumeList.size());
|
|
|
|
|
|
// test prefix parameter of listing volumes
|
|
// test prefix parameter of listing volumes
|
|
- volumeList = client.listVolumes(user1, "test-vol10", null, 10);
|
|
|
|
|
|
+ volumeList = clientProtocol.listVolumes(user1, "test-vol10", null, 10);
|
|
assertTrue(volumeList.size() == 1
|
|
assertTrue(volumeList.size() == 1
|
|
&& volumeList.get(0).getName().equals("test-vol10"));
|
|
&& volumeList.get(0).getName().equals("test-vol10"));
|
|
|
|
|
|
- volumeList = client.listVolumes(user1, "test-vol1", null, 10);
|
|
|
|
|
|
+ volumeList = clientProtocol.listVolumes(user1, "test-vol1", null, 10);
|
|
assertEquals(5, volumeList.size());
|
|
assertEquals(5, volumeList.size());
|
|
|
|
|
|
// test start key parameter of listing volumes
|
|
// test start key parameter of listing volumes
|
|
- volumeList = client.listVolumes(user2, null, "test-vol15", 10);
|
|
|
|
|
|
+ volumeList = clientProtocol.listVolumes(user2, null, "test-vol15", 10);
|
|
assertEquals(2, volumeList.size());
|
|
assertEquals(2, volumeList.size());
|
|
|
|
|
|
String volumeName;
|
|
String volumeName;
|
|
for (int x = 0; x < volCount; x++) {
|
|
for (int x = 0; x < volCount; x++) {
|
|
volumeName = "test-vol" + x;
|
|
volumeName = "test-vol" + x;
|
|
- client.deleteVolume(volumeName);
|
|
|
|
|
|
+ clientProtocol.deleteVolume(volumeName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|