swamirishi commented on code in PR #8055:
URL: https://github.com/apache/ozone/pull/8055#discussion_r2074670517


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java:
##########
@@ -1585,6 +1589,99 @@ void testGetNotExistedPart() throws IOException {
     assertEquals(0, locationList.size());
   }
 
+  private <T> Table<String, T> getMockedTable(Map<String, T> map) throws 
IOException {
+    Table<String, T> table = mock(Table.class);
+    when(table.get(anyString())).thenAnswer(i -> map.get(i.getArgument(0)));
+    when(table.getIfExist(anyString())).thenAnswer(i -> 
map.get(i.getArgument(0)));
+    return table;
+  }
+
+  private OmKeyInfo getMockedOmKeyInfo(OmBucketInfo bucketInfo, long parentId, 
String key, long objectId) {
+    OmKeyInfo omKeyInfo = mock(OmKeyInfo.class);
+    if (bucketInfo.getBucketLayout().isFileSystemOptimized()) {
+      when(omKeyInfo.getFileName()).thenReturn(key);
+    } else {
+      when(omKeyInfo.getParentObjectID()).thenReturn(parentId);
+      when(omKeyInfo.getKeyName()).thenReturn(key);
+    }
+    when(omKeyInfo.getObjectID()).thenReturn(objectId);
+    return omKeyInfo;
+  }
+
+  private OmDirectoryInfo getMockedOmDirInfo(long parentId, String key, long 
objectId) {
+    OmDirectoryInfo omKeyInfo = mock(OmDirectoryInfo.class);
+    when(omKeyInfo.getName()).thenReturn(key);
+    when(omKeyInfo.getParentObjectID()).thenReturn(parentId);

Review Comment:
   yeah this was a mistake fixed it.



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java:
##########
@@ -1585,6 +1589,99 @@ void testGetNotExistedPart() throws IOException {
     assertEquals(0, locationList.size());
   }
 
+  private <T> Table<String, T> getMockedTable(Map<String, T> map) throws 
IOException {
+    Table<String, T> table = mock(Table.class);
+    when(table.get(anyString())).thenAnswer(i -> map.get(i.getArgument(0)));
+    when(table.getIfExist(anyString())).thenAnswer(i -> 
map.get(i.getArgument(0)));
+    return table;
+  }
+
+  private OmKeyInfo getMockedOmKeyInfo(OmBucketInfo bucketInfo, long parentId, 
String key, long objectId) {
+    OmKeyInfo omKeyInfo = mock(OmKeyInfo.class);
+    if (bucketInfo.getBucketLayout().isFileSystemOptimized()) {
+      when(omKeyInfo.getFileName()).thenReturn(key);
+    } else {
+      when(omKeyInfo.getParentObjectID()).thenReturn(parentId);
+      when(omKeyInfo.getKeyName()).thenReturn(key);
+    }
+    when(omKeyInfo.getObjectID()).thenReturn(objectId);
+    return omKeyInfo;
+  }
+
+  private OmDirectoryInfo getMockedOmDirInfo(long parentId, String key, long 
objectId) {
+    OmDirectoryInfo omKeyInfo = mock(OmDirectoryInfo.class);
+    when(omKeyInfo.getName()).thenReturn(key);
+    when(omKeyInfo.getParentObjectID()).thenReturn(parentId);

Review Comment:
   done



-- 
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.

To unsubscribe, e-mail: [email protected]

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