Package org.apache.commons.collections

Examples of org.apache.commons.collections.Buffer.addAll()


        return SynchronizedBuffer.decorate(new UnboundedFifoBuffer());
    }
   
    public Collection makeFullCollection() {
        Buffer buffer = new UnboundedFifoBuffer();
        buffer.addAll(Arrays.asList(getFullElements()));
        return SynchronizedBuffer.decorate(buffer);
    }
   
    public Collection makeConfirmedCollection() {
        ArrayStack list = new ArrayStack();
View Full Code Here


        // give hungry read threads ample time to hang
        delay();

        // notifyAll should allow both read threads to complete
        blockingBuffer.addAll( Collections.singleton( obj ) );

        // allow notified threads to complete
        delay();

        // There should not be any threads waiting.
View Full Code Here

        thread1.start();
        thread2.start();

        // give hungry read threads ample time to hang
        delay();
        blockingBuffer.addAll( Collections.singleton( obj ) );

        // allow notified threads to complete
        delay();

        // There should be one thread waiting.
View Full Code Here

        // allow notified threads to complete
        delay();

        // There should be one thread waiting.
        assertTrue( "There is one thread waiting", thread1.isAlive() ^ thread2.isAlive() );
        blockingBuffer.addAll( Collections.singleton( obj ) );

        // allow notified thread to complete
        delay();

        // There should not be any threads waiting.
View Full Code Here

        thread1.start();
        thread2.start();

        // give hungry read threads ample time to hang
        delay();
        blockingBuffer.addAll( objs );

        // allow notified threads to complete
        delay();
        assertEquals( "Both objects were removed", 0, objs.size() );
View Full Code Here

        return UnmodifiableBuffer.decorate(new UnboundedFifoBuffer());
    }
   
    public Collection makeFullCollection() {
        Buffer buffer = new UnboundedFifoBuffer();
        buffer.addAll(Arrays.asList(getFullElements()));
        return UnmodifiableBuffer.decorate(buffer);
    }
   
    public Collection makeConfirmedCollection() {
        ArrayStack list = new ArrayStack();
View Full Code Here

    public void testAddAllToFullBufferNoTimeout() {
        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1);
        bounded.add( "Hello" );
        try {
            bounded.addAll(Collections.singleton("World"));
            fail();
        } catch (BufferOverflowException e) {
        }
    }
View Full Code Here

    }

    public void testAddAllToEmptyBufferExceedMaxSizeNoTimeout() {
        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1);
        try {
            bounded.addAll(Collections.nCopies(2, "test"));
            fail();
        } catch (BufferOverflowException e) {
        }
    }
View Full Code Here

    public void testAddAllToFullBufferRemoveViaIterator() {
        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500);
        bounded.add( "Hello" );
        bounded.add( "World" );
        new DelayedIteratorRemove( bounded, 200, 2 ).start();
        bounded.addAll( Arrays.asList( new String[] { "Foo", "Bar" } ) );
        assertEquals( 2, bounded.size() );
        assertEquals( "Foo", bounded.remove() );
        assertEquals( "Bar", bounded.remove() );
    }
View Full Code Here

        final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500);
        bounded.add( "Hello" );
        bounded.add( "World" );
        new DelayedRemove( bounded, 200, 2 ).start();

        bounded.addAll( Arrays.asList( new String[] { "Foo", "Bar" } ) );
        assertEquals( 2, bounded.size() );
        assertEquals( "Foo", bounded.get() );
        try {
            bounded.add( "!" );
            fail();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.