hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject hadoop git commit: HDFS-12058. Ozone: OzoneClient: OzoneClientImpl add getDetails calls. Contributed by Nandakumar.
Date Mon, 17 Jul 2017 20:00:06 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 19f665f48 -> e0687dde4


HDFS-12058. Ozone: OzoneClient: OzoneClientImpl add getDetails calls. Contributed by Nandakumar.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e0687dde
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e0687dde
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e0687dde

Branch: refs/heads/HDFS-7240
Commit: e0687dde4a3e19da2a7f73c80997950ee057c146
Parents: 19f665f
Author: Anu Engineer <aengineer@apache.org>
Authored: Mon Jul 17 12:59:47 2017 -0700
Committer: Anu Engineer <aengineer@apache.org>
Committed: Mon Jul 17 12:59:47 2017 -0700

----------------------------------------------------------------------
 .../apache/hadoop/ozone/OzoneClientImpl.java    | 18 ++++++++-
 .../hadoop/ozone/TestOzoneClientImpl.java       | 40 +++++++++++++++-----
 2 files changed, 46 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e0687dde/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientImpl.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientImpl.java
index 15998a1..11e8fff 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientImpl.java
@@ -411,7 +411,11 @@ public class OzoneClientImpl implements OzoneClient, Closeable {
   public OzoneBucket getBucketDetails(String volumeName,
                                         String bucketName)
       throws IOException {
-    throw new UnsupportedOperationException("Not yet implemented.");
+    Preconditions.checkNotNull(volumeName);
+    Preconditions.checkNotNull(bucketName);
+    KsmBucketInfo bucketInfo =
+        keySpaceManagerClient.getBucketInfo(volumeName, bucketName);
+    return new OzoneBucket(bucketInfo);
   }
 
   @Override
@@ -493,7 +497,17 @@ public class OzoneClientImpl implements OzoneClient, Closeable {
   public OzoneKey getkeyDetails(String volumeName, String bucketName,
                                   String keyName)
       throws IOException {
-    throw new UnsupportedOperationException("Not yet implemented.");
+    Preconditions.checkNotNull(volumeName);
+    Preconditions.checkNotNull(bucketName);
+    Preconditions.checkNotNull(keyName);
+    KsmKeyArgs keyArgs = new KsmKeyArgs.Builder()
+        .setVolumeName(volumeName)
+        .setBucketName(bucketName)
+        .setKeyName(keyName)
+        .build();
+    KsmKeyInfo keyInfo =
+        keySpaceManagerClient.lookupKey(keyArgs);
+    return new OzoneKey(keyInfo);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e0687dde/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientImpl.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientImpl.java
index 8caa73b..30ef144 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientImpl.java
@@ -60,9 +60,8 @@ public class TestOzoneClientImpl {
       throws IOException, OzoneException {
     String volumeName = UUID.randomUUID().toString();
     ozClient.createVolume(volumeName);
-    //Assert to be done once infoVolume is implemented in OzoneClient.
-    //For now the test will fail if there are any Exception
-    // during volume creation
+    OzoneVolume volume = ozClient.getVolumeDetails(volumeName);
+    Assert.assertEquals(volumeName, volume.getVolumeName());
   }
 
   @Test
@@ -70,7 +69,9 @@ public class TestOzoneClientImpl {
       throws IOException, OzoneException {
     String volumeName = UUID.randomUUID().toString();
     ozClient.createVolume(volumeName, "test");
-    //Assert has to be done after infoVolume implementation.
+    OzoneVolume volume = ozClient.getVolumeDetails(volumeName);
+    Assert.assertEquals(volumeName, volume.getVolumeName());
+    Assert.assertEquals("test", volume.getOwnerName());
   }
 
   @Test
@@ -79,6 +80,10 @@ public class TestOzoneClientImpl {
     String volumeName = UUID.randomUUID().toString();
     ozClient.createVolume(volumeName, "test",
         10000000000L);
+    OzoneVolume volume = ozClient.getVolumeDetails(volumeName);
+    Assert.assertEquals(volumeName, volume.getVolumeName());
+    Assert.assertEquals("test", volume.getOwnerName());
+    Assert.assertEquals(10000000000L, volume.getQuota());
   }
 
   @Test
@@ -102,7 +107,8 @@ public class TestOzoneClientImpl {
     String bucketName = UUID.randomUUID().toString();
     ozClient.createVolume(volumeName);
     ozClient.createBucket(volumeName, bucketName);
-    //Assert has to be done.
+    OzoneBucket bucket = ozClient.getBucketDetails(volumeName, bucketName);
+    Assert.assertEquals(bucketName, bucket.getBucketName());
   }
 
   @Test
@@ -113,7 +119,10 @@ public class TestOzoneClientImpl {
     ozClient.createVolume(volumeName);
     ozClient.createBucket(volumeName, bucketName,
         OzoneConsts.Versioning.ENABLED);
-    //Assert has to be done.
+    OzoneBucket bucket = ozClient.getBucketDetails(volumeName, bucketName);
+    Assert.assertEquals(bucketName, bucket.getBucketName());
+    Assert.assertEquals(OzoneConsts.Versioning.ENABLED,
+        bucket.getVersioning());
   }
 
   @Test
@@ -123,7 +132,9 @@ public class TestOzoneClientImpl {
     String bucketName = UUID.randomUUID().toString();
     ozClient.createVolume(volumeName);
     ozClient.createBucket(volumeName, bucketName, StorageType.SSD);
-    //Assert has to be done.
+    OzoneBucket bucket = ozClient.getBucketDetails(volumeName, bucketName);
+    Assert.assertEquals(bucketName, bucket.getBucketName());
+    Assert.assertEquals(StorageType.SSD, bucket.getStorageType());
   }
 
   @Test
@@ -135,7 +146,9 @@ public class TestOzoneClientImpl {
         OzoneAcl.OzoneACLRights.READ_WRITE);
     ozClient.createVolume(volumeName);
     ozClient.createBucket(volumeName, bucketName, userAcl);
-    //Assert has to be done.
+    OzoneBucket bucket = ozClient.getBucketDetails(volumeName, bucketName);
+    Assert.assertEquals(bucketName, bucket.getBucketName());
+    Assert.assertTrue(bucket.getAcls().contains(userAcl));
   }
 
   @Test
@@ -149,7 +162,12 @@ public class TestOzoneClientImpl {
     ozClient.createBucket(volumeName, bucketName,
         OzoneConsts.Versioning.ENABLED,
         StorageType.SSD, userAcl);
-    //Assert has to be done.
+    OzoneBucket bucket = ozClient.getBucketDetails(volumeName, bucketName);
+    Assert.assertEquals(bucketName, bucket.getBucketName());
+    Assert.assertEquals(OzoneConsts.Versioning.ENABLED,
+        bucket.getVersioning());
+    Assert.assertEquals(StorageType.SSD, bucket.getStorageType());
+    Assert.assertTrue(bucket.getAcls().contains(userAcl));
   }
 
   @Test
@@ -178,7 +196,9 @@ public class TestOzoneClientImpl {
     OzoneOutputStream out = ozClient.createKey(volumeName, bucketName,
         keyName, value.getBytes().length);
     out.write(value.getBytes());
-    //Assert has to be done.
+    OzoneKey key = ozClient.getkeyDetails(volumeName, bucketName, keyName);
+    Assert.assertEquals(keyName, key.getKeyName());
+    //Content validation has to be done after getKey implementation.
   }
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message