Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldClearPreviousChunks()
        public virtual void ShouldClearPreviousChunks()
        {
            // GIVEN
            System.Action <long[]> consumer = mock(typeof(System.Action));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicBoolean safeThreshold = new java.util.concurrent.atomic.AtomicBoolean(false);
            AtomicBoolean        safeThreshold = new AtomicBoolean(false);
            DelayedBuffer <long> buffer        = new DelayedBuffer <long>(singleton(0L), t => safeThreshold.get(), 10, consumer);

            // three chunks
            buffer.Offer(0);
            buffer.Maintenance();
            buffer.Offer(1);
            buffer.Maintenance();
            buffer.Offer(2);
            buffer.Maintenance();

            // WHEN
            safeThreshold.set(true);
            buffer.Clear();
            buffer.Maintenance();

            // THEN
            verifyNoMoreInteractions(consumer);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldClearCurrentChunk()
        public virtual void ShouldClearCurrentChunk()
        {
            // GIVEN
            System.Action <long[]> consumer = mock(typeof(System.Action));
            DelayedBuffer <long>   buffer   = new DelayedBuffer <long>(singleton(0L), Predicates.alwaysTrue(), 10, consumer);

            buffer.Offer(0);
            buffer.Offer(1);
            buffer.Offer(2);

            // WHEN
            buffer.Clear();
            buffer.Maintenance();

            // THEN
            verifyNoMoreInteractions(consumer);
        }