aryangupta1998 commented on a change in pull request #1620:
URL: https://github.com/apache/ozone/pull/1620#discussion_r530365765



##########
File path: 
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestBlockDeletingService.java
##########
@@ -114,37 +119,55 @@ public static void init() throws IOException {
     }
     scmId = UUID.randomUUID().toString();
     clusterID = UUID.randomUUID().toString();
+    conf = new OzoneConfiguration();
+    conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY, testRoot.getAbsolutePath());
+    datanodeUuid = UUID.randomUUID().toString();
+    volumeSet = new MutableVolumeSet(datanodeUuid, conf);
   }
 
   @AfterClass
   public static void cleanup() throws IOException {
     FileUtils.deleteDirectory(testRoot);
   }
 
+  private static final DispatcherContext WRITE_STAGE =
+      new DispatcherContext.Builder()
+          .setStage(DispatcherContext.WriteChunkStage.WRITE_DATA).build();
+
+  private static final DispatcherContext COMMIT_STAGE =
+      new DispatcherContext.Builder()
+          .setStage(DispatcherContext.WriteChunkStage.COMMIT_DATA).build();
+
   /**
    * A helper method to create some blocks and put them under deletion
    * state for testing. This method directly updates container.db and
    * creates some fake chunk files for testing.
    */
   private void createToDeleteBlocks(ContainerSet containerSet,
-      MutableConfigurationSource conf, int numOfContainers,
+      int numOfContainers,
       int numOfBlocksPerContainer,
       int numOfChunksPerBlock) throws IOException {
+    ChunkManager chunkManager;
+    if (layout == FILE_PER_BLOCK) {
+      chunkManager = new FilePerBlockStrategy(true);
+    } else {
+      chunkManager = new FilePerChunkStrategy(true, null);
+    }
+    byte[] arr = randomAlphanumeric(1048576).getBytes(UTF_8);
+    ChunkBuffer buffer = ChunkBuffer.wrap(ByteBuffer.wrap(arr));
     for (int x = 0; x < numOfContainers; x++) {
-      conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY, 
testRoot.getAbsolutePath());
       long containerID = ContainerTestHelper.getTestContainerID();
-      KeyValueContainerData data = new KeyValueContainerData(containerID,
-          layout,
-          ContainerTestHelper.CONTAINER_MAX_SIZE, UUID.randomUUID().toString(),
-          UUID.randomUUID().toString());
+      KeyValueContainerData data =
+          new KeyValueContainerData(containerID, layout,
+              ContainerTestHelper.CONTAINER_MAX_SIZE,
+              UUID.randomUUID().toString(), datanodeUuid);
       data.closeContainer();
       KeyValueContainer container = new KeyValueContainer(data, conf);
-      container.create(new MutableVolumeSet(scmId, clusterID, conf),
+      container.create(volumeSet,
           new RoundRobinVolumeChoosingPolicy(), scmId);
       containerSet.addContainer(container);
       data = (KeyValueContainerData) containerSet.getContainer(
           containerID).getContainerData();
-
       long blockLength = 100;

Review comment:
       Renamed to chunkLength.




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