//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogAndDumpData() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldLogAndDumpData() { // given DatabaseLayout databaseLayout = this.Directory.databaseLayout(); LabelScanWriteMonitor writeMonitor = new LabelScanWriteMonitor(Fs, databaseLayout); LabelScanValue value = new LabelScanValue(); writeMonitor.Range(3, 0); writeMonitor.PrepareAdd(123, 4); writeMonitor.PrepareAdd(123, 5); writeMonitor.MergeAdd(new LabelScanValue(), value.Set(4).set(5)); writeMonitor.FlushPendingUpdates(); writeMonitor.PrepareRemove(124, 5); writeMonitor.MergeRemove(value, (new LabelScanValue()).Set(5)); writeMonitor.WriteSessionEnded(); writeMonitor.Range(5, 1); writeMonitor.PrepareAdd(125, 10); writeMonitor.MergeAdd((new LabelScanValue()).Set(9), (new LabelScanValue()).Set(10)); writeMonitor.FlushPendingUpdates(); writeMonitor.WriteSessionEnded(); writeMonitor.Close(); // when LabelScanWriteMonitor.Dumper dumper = mock(typeof(LabelScanWriteMonitor.Dumper)); LabelScanWriteMonitor.Dump(Fs, databaseLayout, dumper, null); // then InOrder inOrder = Mockito.inOrder(dumper); inOrder.verify(dumper).prepare(true, 0, 0, 123, 64 * 3 + 4, 0); inOrder.verify(dumper).prepare(true, 0, 0, 123, 64 * 3 + 5, 0); inOrder.verify(dumper).merge(true, 0, 0, 3, 0, 0, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000000_00110000); inOrder.verify(dumper).prepare(false, 0, 1, 124, 64 * 3 + 5, 0); inOrder.verify(dumper).merge(false, 0, 1, 3, 0, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000000_00110000, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000000_00100000); inOrder.verify(dumper).prepare(true, 1, 0, 125, 64 * 5 + 10, 1); inOrder.verify(dumper).merge(true, 1, 0, 5, 1, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000010_00000000, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000100_00000000); inOrder.verifyNoMoreInteractions(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRotateAtConfiguredThreshold() public virtual void ShouldRotateAtConfiguredThreshold() { // given File storeDir = this.Directory.databaseDir(); int rotationThreshold = 1_000; LabelScanWriteMonitor writeMonitor = new LabelScanWriteMonitor(Fs, Directory.databaseLayout(), rotationThreshold, ByteUnit.Byte, 1, TimeUnit.DAYS); // when for (int i = 0; storeDir.listFiles().length < 5; i++) { writeMonitor.Range(i, 1); writeMonitor.PrepareAdd(i, 5); writeMonitor.MergeAdd(new LabelScanValue(), (new LabelScanValue()).Set(5)); writeMonitor.WriteSessionEnded(); } // then writeMonitor.Close(); foreach (File file in storeDir.listFiles((dir, name) => !name.Equals(_baseName))) { long sizeDiff = abs(rotationThreshold - Fs.getFileSize(file)); assertTrue(sizeDiff < rotationThreshold / 10D); } }