X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Futil%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Futil%2Fconcurrent%2FThreadPoolExecutorTest.java;h=44f90f9884d927df4a20fb939a4ecb4e000334c1;hb=178b951cbabbc81d3bcf00749a7c97964ed20296;hp=c9b3dab1886c687d82f892873bbfb5fe99fd29f4;hpb=82af449e4ef07d80490e79484d0402b81009541e;p=yangtools.git diff --git a/common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/ThreadPoolExecutorTest.java b/common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/ThreadPoolExecutorTest.java index c9b3dab188..44f90f9884 100644 --- a/common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/ThreadPoolExecutorTest.java +++ b/common/util/src/test/java/org/opendaylight/yangtools/util/concurrent/ThreadPoolExecutorTest.java @@ -10,6 +10,7 @@ package org.opendaylight.yangtools.util.concurrent; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import com.google.common.base.Stopwatch; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -19,12 +20,9 @@ import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; - import org.junit.After; import org.junit.Test; -import com.google.common.base.Stopwatch; - /** * Tests various ThreadPoolExecutor implementations. * @@ -49,7 +47,7 @@ public class ThreadPoolExecutorTest { 100000, "TestPool", 0 ); } - @Test(expected=RejectedExecutionException.class) + @Test(expected = RejectedExecutionException.class) public void testFastThreadPoolRejectingTask() throws Exception { executor = SpecialExecutors.newBoundedFastThreadPool( 1, 1, "TestPool" ); @@ -77,7 +75,7 @@ public class ThreadPoolExecutorTest { 100000, "TestPool", 0 ); } - @Test(expected=RejectedExecutionException.class) + @Test(expected = RejectedExecutionException.class) public void testCachedThreadRejectingTask() throws Exception { ExecutorService executor = SpecialExecutors.newBoundedCachedThreadPool( 1, 1, "TestPool" ); @@ -101,8 +99,7 @@ public class ThreadPoolExecutorTest { this.executor = executor; - System.out.println( "\nTesting " + executor.getClass().getSimpleName() + " with " + - numTasksToRun + " tasks." ); + System.out.println("\nTesting " + executor.getClass().getSimpleName() + " with " + numTasksToRun + " tasks."); final CountDownLatch tasksRunLatch = new CountDownLatch( numTasksToRun ); final ConcurrentMap taskCountPerThread = new ConcurrentHashMap<>(); @@ -129,8 +126,7 @@ public class ThreadPoolExecutorTest { stopWatch.stop(); if (!done) { - fail( (numTasksToRun - tasksRunLatch.getCount()) + " tasks out of " + - numTasksToRun + " executed" ); + fail((numTasksToRun - tasksRunLatch.getCount()) + " tasks out of " + numTasksToRun + " executed"); } if (threadError.get() != null) { @@ -183,7 +179,8 @@ public class ThreadPoolExecutorTest { } else if (blockLatch != null) { blockLatch.await(); } - } catch( InterruptedException e ) {} + } catch (InterruptedException e) { + } if (expThreadPrefix != null) { assertEquals( "Thread name starts with " + expThreadPrefix, true, @@ -203,7 +200,7 @@ public class ThreadPoolExecutorTest { count.incrementAndGet(); } - } catch( AssertionError e ) { + } catch (AssertionError e) { if (threadError != null) { threadError.set( e ); }