//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTrackOffsetAfterRewind() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTrackOffsetAfterRewind() { // given Stream actual = mock(typeof(Stream)); ProgressListener progressListener = mock(typeof(ProgressListener)); ProgressTrackingOutputStream.Progress progress = new ProgressTrackingOutputStream.Progress(progressListener, 0); using (ProgressTrackingOutputStream @out = new ProgressTrackingOutputStream(actual, progress)) { @out.WriteByte(new sbyte[20]); // when progress.RewindTo(15); // i.e. the next 5 bytes we don't track @out.WriteByte(new sbyte[3]); // now there should be 2 untracked bytes left @out.WriteByte(new sbyte[9]); // this one should report 7 } progress.Done(); // then InOrder inOrder = inOrder(progressListener); inOrder.verify(progressListener).add(20); inOrder.verify(progressListener).add(7); inOrder.verify(progressListener).done(); verifyNoMoreInteractions(progressListener); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldProcessRecordsParallelAndUpdateProgress() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldProcessRecordsParallelAndUpdateProgress() { // given ProgressMonitorFactory.MultiPartBuilder progressBuilder = mock(typeof(ProgressMonitorFactory.MultiPartBuilder)); ProgressListener progressListener = mock(typeof(ProgressListener)); when(progressBuilder.ProgressForPart(anyString(), anyLong())).thenReturn(progressListener); //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") org.neo4j.helpers.collection.BoundedIterable<int> store = mock(org.neo4j.helpers.collection.BoundedIterable.class); BoundedIterable <int> store = mock(typeof(BoundedIterable)); when(store.GetEnumerator()).thenReturn(asList(42, 75, 192).GetEnumerator()); //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") RecordProcessor<int> recordProcessor = mock(RecordProcessor.class); RecordProcessor <int> recordProcessor = mock(typeof(RecordProcessor)); RecordScanner <int> scanner = new ParallelRecordScanner <int>("our test task", Statistics.NONE, 1, store, progressBuilder, recordProcessor, CacheAccess.EMPTY, QueueDistribution.ROUND_ROBIN); // when scanner.Run(); // then VerifyProcessCloseAndDone(recordProcessor, store, progressListener); }
/// <param name="progressListener"> <seealso cref="ProgressListener"/> to report upload progress to. </param> /// <param name="position"> initial position to start the upload from. This is only useful if the upload was started and made it part-way /// there before the command failed and the command has to be reissued at which point it can be resumed. This position is the position /// where the upload will continue from. This is separate from temporary failure where the upload will be retried after some back-off. /// That logic will instead make use of <seealso cref="rewindTo(long)"/>. </param> internal Progress(ProgressListener progressListener, long position) { UploadProgress = progressListener; if (position > 0) { UploadProgress.add(position); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNoteInitialPosition() public virtual void ShouldNoteInitialPosition() { // given ProgressListener progressListener = mock(typeof(ProgressListener)); // when new ProgressTrackingOutputStream.Progress(progressListener, 10); // then verify(progressListener).add(10); verifyNoMoreInteractions(progressListener); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTrackSingleByteWrites() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTrackSingleByteWrites() { // given Stream actual = mock(typeof(Stream)); ProgressListener progressListener = mock(typeof(ProgressListener)); ProgressTrackingOutputStream.Progress progress = new ProgressTrackingOutputStream.Progress(progressListener, 0); using (ProgressTrackingOutputStream @out = new ProgressTrackingOutputStream(actual, progress)) { // when @out.WriteByte(10); } progress.Done(); // then verify(progressListener).add(1); verify(progressListener).done(); verifyNoMoreInteractions(progressListener); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldUseProgressListener() internal virtual void ShouldUseProgressListener() { // GIVEN Transaction transaction = mock(typeof(Transaction)); GraphDatabaseService db = mock(typeof(GraphDatabaseService)); when(Db.beginTx()).thenReturn(transaction); ProgressListener progress = mock(typeof(ProgressListener)); BatchTransaction tx = beginBatchTx(db).withIntermediarySize(10).withProgress(progress); // WHEN tx.Increment(); tx.Increment(9); // THEN verify(db, times(2)).beginTx(); verify(transaction, times(1)).close(); verify(progress, times(1)).add(1); verify(progress, times(1)).add(9); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTrackOffsetByteArrayWrites() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTrackOffsetByteArrayWrites() { // given Stream actual = mock(typeof(Stream)); ProgressListener progressListener = mock(typeof(ProgressListener)); ProgressTrackingOutputStream.Progress progress = new ProgressTrackingOutputStream.Progress(progressListener, 0); int length = 5; using (ProgressTrackingOutputStream @out = new ProgressTrackingOutputStream(actual, progress)) { // when @out.Write(new sbyte[length * 2], 2, length); } progress.Done(); // then verify(progressListener).add(length); verify(progressListener).done(); verifyNoMoreInteractions(progressListener); }
public virtual BatchTransaction WithProgress(ProgressListener progressListener) { this._progressListener = progressListener; this._progressListener.started(); return(this); }
public override void Prepare(System.Func <long, object> inputIdLookup, Collector collector, ProgressListener progress) { // No need to prepare anything }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void verifyProcessCloseAndDone(RecordProcessor<int> recordProcessor, org.neo4j.helpers.collection.BoundedIterable<int> store, org.neo4j.helpers.progress.ProgressListener progressListener) throws Exception private static void VerifyProcessCloseAndDone(RecordProcessor <int> recordProcessor, BoundedIterable <int> store, ProgressListener progressListener) { verify(recordProcessor).process(42); verify(recordProcessor).process(75); verify(recordProcessor).process(192); verify(recordProcessor).close(); verify(store).close(); verify(progressListener, times(3)).add(1); verify(progressListener).done(); }