rakeshadr commented on a change in pull request #1841:
URL: https://github.com/apache/ozone/pull/1841#discussion_r565511822



##########
File path: 
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/bucket/TestOMBucketCreateRequestV1.java
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.hadoop.ozone.om.request.bucket;
+
+import org.apache.hadoop.ozone.om.OMConfigKeys;
+import org.apache.hadoop.ozone.om.helpers.OmBucketInfo;
+import org.apache.hadoop.ozone.om.request.TestOMRequestUtils;
+import org.apache.hadoop.ozone.om.response.OMClientResponse;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.StorageTypeProto;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.UUID;
+
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests OMBucketCreateRequest class, which handles CreateBucket request.
+ */
+public class TestOMBucketCreateRequestV1 extends TestOMBucketCreateRequest {
+
+  @Test
+  public void testValidateAndUpdateCacheWithFSOBucket() throws Exception {
+    when(ozoneManager.getOMLayoutVersion()).thenReturn(
+            OMConfigKeys.OZONE_OM_LAYOUT_VERSION_V1);

Review comment:
       This test is basically to validate the number of items stored in the 
metadata map `bucketInfoFromProto.getStorageType() and 
dbBucketInfo.getMetadata()`. Existing test stores two values : key1 and key2. 
With HDDS-2939 feature, we are making use of bucket's metadata structure to 
store enable.fspaths and layoutversion details. 
   
   As we saw in below example, the purpose is basically to validate the number 
of key-value pairs stored in the hashmap and not specific values.
   
   ```
   result = {HashMap@4191}  size = 4
    "key1" -> "value1"
    "key2" -> "value2"
    "ozone.om.enable.filesystem.paths" -> "false"
    "ozone.om.layout.version" -> "V1"
   ```
   
   
   ```
   TestOMBucketCreateRequestV1: line number 106
   
   Assert.assertEquals(bucketInfoFromProto.getMetadata(),
           dbBucketInfo.getMetadata());
   ```
   
   
   In existing code, it adds two items. Please refer [code 
](https://github.com/apache/ozone/blob/master/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/bucket/TestOMBucketCreateRequest.java#L180).
 But in V1 test, it is adding two more elements.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to