Source:
public void controlBlobStoreSuccessTest() throws InterruptedException, IOException { List<? extends PartitionId> partitionIds = clusterMap.getAllPartitionIds(); PartitionId id = partitionIds.get(0); List<? extends ReplicaId> replicaIds = id.getReplicaIds(); assertTrue("This test needs more than one replica for the first partition to work", replicaIds.size() > 1); int correlationId = TestUtils.RANDOM.nextInt(); String clientId = UtilsTest.getRandomString(10); long acceptableLagInBytes = 0; short numReplicasCaughtUpPerPartition = 3; replicationManager.reset(); replicationManager.controlReplicationReturnVal = true; generateLagOverrides(0, acceptableLagInBytes); AdminRequest adminRequest = new AdminRequest(AdminRequestOrResponseType.BlobStoreControl, id, correlationId, clientId); BlobStoreControlAdminRequest stopBlobStoreAdminRequest = new BlobStoreControlAdminRequest(numReplicasCaughtUpPerPartition, false, adminRequest); Response response = sendRequestGetResponse(stopBlobStoreAdminRequest, ServerErrorCode.No_Error); assertTrue("Response not of type AdminResponse", response instanceof AdminResponse); assertEquals("Partition disabled for compaction not as expected", id, storageManager.compactionControlledPartitionId); assertEquals("Origins list should be empty", true, replicationManager.originsVal.isEmpty()); assertEquals("Replication on given BlobStore should be disabled", false, replicationManager.enableVal); assertEquals("Partition shutdown not as expected", id, storageManager.shutdownPartitionId); adminRequest = new AdminRequest(AdminRequestOrResponseType.BlobStoreControl, id, correlationId, clientId); BlobStoreControlAdminRequest startBlobStoreAdminRequest = new BlobStoreControlAdminRequest(numReplicasCaughtUpPerPartition, true, adminRequest); response = sendRequestGetResponse(startBlobStoreAdminRequest, ServerErrorCode.No_Error); assertTrue("Response not of type AdminResponse", response instanceof AdminResponse); assertEquals("Partition started not as expected", id, storageManager.startedPartitionId); assertEquals("Replication on given BlobStore should be enabled", true, replicationManager.enableVal); assertEquals("Partition enabled for compaction not as expected", id, storageManager.compactionControlledPartitionId); }

Target:
public void controlBlobStoreSuccessTest() throws InterruptedException, IOException { List<? extends PartitionId> partitionIds = clusterMap.getAllPartitionIds(); PartitionId id = partitionIds.get(0); List<? extends ReplicaId> replicaIds = id.getReplicaIds(); assertTrue("This test needs more than one replica for the first partition to work", replicaIds.size() > 1); int correlationId = TestUtils.RANDOM.nextInt(); String clientId = UtilsTest.getRandomString(10); long acceptableLagInBytes = 0; short numReplicasCaughtUpPerPartition = 3; replicationManager.reset(); replicationManager.controlReplicationReturnVal = true; generateLagOverrides(0, acceptableLagInBytes); AdminRequest adminRequest = new AdminRequest(AdminRequestOrResponseType.BlobStoreControl, id, correlationId, clientId); BlobStoreControlAdminRequest stopBlobStoreAdminRequest = new BlobStoreControlAdminRequest(numReplicasCaughtUpPerPartition, false, adminRequest); Response response = sendRequestGetResponse(stopBlobStoreAdminRequest, ServerErrorCode.No_Error); assertTrue("Response not of type AdminResponse", response instanceof AdminResponse); assertEquals("Compaction on store should be disabled after stopping the BlobStore", false, storageManager.compactionEnableVal); assertEquals("Partition disabled for compaction not as expected", id, storageManager.compactionControlledPartitionId); assertEquals("Origins list should be empty", true, replicationManager.originsVal.isEmpty()); assertEquals("Replication on given BlobStore should be disabled", false, replicationManager.enableVal); assertEquals("Partition shutdown not as expected", id, storageManager.shutdownPartitionId); adminRequest = new AdminRequest(AdminRequestOrResponseType.BlobStoreControl, id, correlationId, clientId); BlobStoreControlAdminRequest startBlobStoreAdminRequest = new BlobStoreControlAdminRequest(numReplicasCaughtUpPerPartition, true, adminRequest); response = sendRequestGetResponse(startBlobStoreAdminRequest, ServerErrorCode.No_Error); assertTrue("Response not of type AdminResponse", response instanceof AdminResponse); assertEquals("Partition started not as expected", id, storageManager.startedPartitionId); assertEquals("Replication on given BlobStore should be enabled", true, replicationManager.enableVal); assertEquals("Partition controlled for compaction not as expected", id, storageManager.compactionControlledPartitionId); assertEquals("Compaction on store should be enabled after starting the BlobStore", true, storageManager.compactionEnableVal); }