Source:
<code>public void testClusterManagerWriteStatusDelegateUse() throws StoreException, IOException, InterruptedException { StoreConfig defaultConfig = changeThreshold(65, 5, true); StoreTestUtils.MockReplicaId replicaId = getMockReplicaId(tempDirStr); WriteStatusDelegate writeStatusDelegate = mock(WriteStatusDelegate.class); when(writeStatusDelegate.unseal(any())).thenReturn(true); when(writeStatusDelegate.seal(any())).thenReturn(true); restartStore(defaultConfig, replicaId, writeStatusDelegate); verifyZeroInteractions(writeStatusDelegate); put(1, 50, Utils.Infinite_Time); verifyNoMoreInteractions(writeStatusDelegate); List<MockId> addedIds = put(4, 900, Utils.Infinite_Time); verify(writeStatusDelegate, times(1)).seal(replicaId); replicaId.setSealedState(true); restartStore(changeThreshold(99, 1, false), replicaId, writeStatusDelegate); verifyNoMoreInteractions(writeStatusDelegate); restartStore(changeThreshold(99, 1, true), replicaId, writeStatusDelegate); verify(writeStatusDelegate, times(1)).unseal(replicaId); replicaId.setSealedState(false); restartStore(defaultConfig, replicaId, writeStatusDelegate); verify(writeStatusDelegate, times(2)).seal(replicaId); replicaId.setSealedState(true); if (isLogSegmented) { for (MockId addedId : addedIds) { delete(addedId); } restartStore(defaultConfig, replicaId, writeStatusDelegate); verifyNoMoreInteractions(writeStatusDelegate); time.sleep(TimeUnit.DAYS.toMillis(8)); store.compact(store.getCompactionDetails(new CompactAllPolicy(defaultConfig, time)), <START> ByteBuffer.allocateDirect(100)); <END> verify(writeStatusDelegate, times(2)).unseal(replicaId); replicaId.setSealedState(true); restartStore(defaultConfig, replicaId, writeStatusDelegate); verify(writeStatusDelegate, times(3)).unseal(replicaId); } store.shutdown(); }</code><technical_language>do 2 * PUT_RECORD_SIZE + 1</technical_language>

Target:
public void testClusterManagerWriteStatusDelegateUse() throws StoreException, IOException, InterruptedException { StoreConfig defaultConfig = changeThreshold(65, 5, true); StoreTestUtils.MockReplicaId replicaId = getMockReplicaId(tempDirStr); WriteStatusDelegate writeStatusDelegate = mock(WriteStatusDelegate.class); when(writeStatusDelegate.unseal(any())).thenReturn(true); when(writeStatusDelegate.seal(any())).thenReturn(true); restartStore(defaultConfig, replicaId, writeStatusDelegate); verifyZeroInteractions(writeStatusDelegate); put(1, 50, Utils.Infinite_Time); verifyNoMoreInteractions(writeStatusDelegate); List<MockId> addedIds = put(4, 900, Utils.Infinite_Time); verify(writeStatusDelegate, times(1)).seal(replicaId); replicaId.setSealedState(true); restartStore(changeThreshold(99, 1, false), replicaId, writeStatusDelegate); verifyNoMoreInteractions(writeStatusDelegate); restartStore(changeThreshold(99, 1, true), replicaId, writeStatusDelegate); verify(writeStatusDelegate, times(1)).unseal(replicaId); replicaId.setSealedState(false); restartStore(defaultConfig, replicaId, writeStatusDelegate); verify(writeStatusDelegate, times(2)).seal(replicaId); replicaId.setSealedState(true); if (isLogSegmented) { for (MockId addedId : addedIds) { delete(addedId); } restartStore(defaultConfig, replicaId, writeStatusDelegate); verifyNoMoreInteractions(writeStatusDelegate); time.sleep(TimeUnit.DAYS.toMillis(8)); store.compact(store.getCompactionDetails(new CompactAllPolicy(defaultConfig, time)), ByteBuffer.allocateDirect(PUT_RECORD_SIZE * 2 + 1)); verify(writeStatusDelegate, times(2)).unseal(replicaId); replicaId.setSealedState(true); restartStore(defaultConfig, replicaId, writeStatusDelegate); verify(writeStatusDelegate, times(3)).unseal(replicaId); } store.shutdown(); }