/** * Adds put events to the queue. * @param end * @param expectedPutCount * @throws Exception */ public void runPutTest( int end, int expectedPutCount ) throws Exception { for ( int i = 0; i <= end; i++ ) { CacheElement<String, String> elem = new CacheElement<String, String>( "testCache1", i + ":key", i + "data" ); queue.addPutEvent( elem ); } while ( !queue.isEmpty() ) { synchronized ( this ) { System.out.println( "queue is still busy, waiting 250 millis" ); this.wait( 250 ); } } System.out.println( "queue is empty, comparing putCount" ); // this becomes less accurate with each test. It should never fail. If // it does things are very off. assertTrue( "The put count [" + listen.putCount + "] is below the expected minimum threshold [" + expectedPutCount + "]", listen.putCount >= ( expectedPutCount - 1 ) ); }
/** * Adds put events to the queue. * @param end * @param expectedPutCount * @throws Exception */ public void runPutTest( int end, int expectedPutCount ) throws Exception { for ( int i = 0; i <= end; i++ ) { CacheElement<String, String> elem = new CacheElement<String, String>( "testCache1", i + ":key", i + "data" ); queue.addPutEvent( elem ); } while ( !queue.isEmpty() ) { synchronized ( this ) { System.out.println( "queue is still busy, waiting 250 millis" ); this.wait( 250 ); } } System.out.println( "queue is empty, comparing putCount" ); // this becomes less accurate with each test. It should never fail. If // it does things are very off. assertTrue( "The put count [" + listen.putCount + "] is below the expected minimum threshold [" + expectedPutCount + "]", listen.putCount >= ( expectedPutCount - 1 ) ); }
queue.addPutEvent( elem ); queue.addPutEvent( elem2 );
queue.addPutEvent( elem ); queue.addPutEvent( elem2 );