--- jsr166/src/test/tck/JSR166TestCase.java 2005/05/12 03:20:56 1.27 +++ jsr166/src/test/tck/JSR166TestCase.java 2009/07/31 23:37:31 1.33 @@ -108,6 +108,13 @@ public class JSR166TestCase extends Test public static Test suite ( ) { TestSuite suite = new TestSuite("JSR166 Unit Tests"); + suite.addTest(new TestSuite(ForkJoinPoolTest.class)); + suite.addTest(new TestSuite(ForkJoinTaskTest.class)); + suite.addTest(new TestSuite(RecursiveActionTest.class)); + suite.addTest(new TestSuite(RecursiveTaskTest.class)); + suite.addTest(new TestSuite(LinkedTransferQueueTest.class)); + suite.addTest(new TestSuite(PhaserTest.class)); + suite.addTest(new TestSuite(ThreadLocalRandomTest.class)); suite.addTest(new TestSuite(AbstractExecutorServiceTest.class)); suite.addTest(new TestSuite(AbstractQueueTest.class)); suite.addTest(new TestSuite(AbstractQueuedSynchronizerTest.class)); @@ -137,6 +144,7 @@ public class JSR166TestCase extends Test suite.addTest(new TestSuite(CountDownLatchTest.class)); suite.addTest(new TestSuite(CyclicBarrierTest.class)); suite.addTest(new TestSuite(DelayQueueTest.class)); + suite.addTest(new TestSuite(EntryTest.class)); suite.addTest(new TestSuite(ExchangerTest.class)); suite.addTest(new TestSuite(ExecutorsTest.class)); suite.addTest(new TestSuite(ExecutorCompletionServiceTest.class)); @@ -150,11 +158,13 @@ public class JSR166TestCase extends Test suite.addTest(new TestSuite(ReentrantLockTest.class)); suite.addTest(new TestSuite(ReentrantReadWriteLockTest.class)); suite.addTest(new TestSuite(ScheduledExecutorTest.class)); + suite.addTest(new TestSuite(ScheduledExecutorSubclassTest.class)); suite.addTest(new TestSuite(SemaphoreTest.class)); suite.addTest(new TestSuite(SynchronousQueueTest.class)); suite.addTest(new TestSuite(SystemTest.class)); suite.addTest(new TestSuite(ThreadLocalTest.class)); suite.addTest(new TestSuite(ThreadPoolExecutorTest.class)); + suite.addTest(new TestSuite(ThreadPoolExecutorSubclassTest.class)); suite.addTest(new TestSuite(ThreadTest.class)); suite.addTest(new TestSuite(TimeUnitTest.class)); suite.addTest(new TestSuite(TreeMapTest.class)); @@ -278,8 +288,13 @@ public class JSR166TestCase extends Test * threadFail with message "should throw exception" */ public void threadShouldThrow() { - threadFailed = true; - fail("should throw exception"); + try { + threadFailed = true; + fail("should throw exception"); + } catch (AssertionFailedError e) { + e.printStackTrace(); + throw e; + } } /** @@ -290,6 +305,14 @@ public class JSR166TestCase extends Test fail("Unexpected exception"); } + /** + * threadFail with message "Unexpected exception", with argument + */ + public void threadUnexpectedException(Throwable ex) { + threadFailed = true; + ex.printStackTrace(); + fail("Unexpected exception: " + ex); + } /** * Wait out termination of a thread pool or fail doing so @@ -298,9 +321,9 @@ public class JSR166TestCase extends Test try { exec.shutdown(); assertTrue(exec.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS)); - } catch(SecurityException ok) { + } catch (SecurityException ok) { // Allowed in case test doesn't have privs - } catch(InterruptedException ie) { + } catch (InterruptedException ie) { fail("Unexpected exception"); } } @@ -343,6 +366,7 @@ public class JSR166TestCase extends Test static final Integer m3 = new Integer(-3); static final Integer m4 = new Integer(-4); static final Integer m5 = new Integer(-5); + static final Integer m6 = new Integer(-6); static final Integer m10 = new Integer(-10); @@ -397,8 +421,8 @@ public class JSR166TestCase extends Test try { Thread.sleep(SHORT_DELAY_MS); } - catch(Exception e) { - threadUnexpectedException(); + catch (Exception e) { + threadUnexpectedException(e); } } } @@ -409,7 +433,7 @@ public class JSR166TestCase extends Test Thread.sleep(SHORT_DELAY_MS); threadShouldThrow(); } - catch(InterruptedException success) { + catch (InterruptedException success) { } } } @@ -419,8 +443,8 @@ public class JSR166TestCase extends Test try { Thread.sleep(SMALL_DELAY_MS); } - catch(Exception e) { - threadUnexpectedException(); + catch (Exception e) { + threadUnexpectedException(e); } } } @@ -430,7 +454,7 @@ public class JSR166TestCase extends Test try { Thread.sleep(SMALL_DELAY_MS); } - catch(Exception e) { + catch (Exception e) { } } } @@ -440,8 +464,8 @@ public class JSR166TestCase extends Test try { Thread.sleep(SMALL_DELAY_MS); } - catch(Exception e) { - threadUnexpectedException(); + catch (Exception e) { + threadUnexpectedException(e); } return Boolean.TRUE; } @@ -453,7 +477,7 @@ public class JSR166TestCase extends Test Thread.sleep(SMALL_DELAY_MS); threadShouldThrow(); } - catch(InterruptedException success) { + catch (InterruptedException success) { } } } @@ -464,8 +488,8 @@ public class JSR166TestCase extends Test try { Thread.sleep(MEDIUM_DELAY_MS); } - catch(Exception e) { - threadUnexpectedException(); + catch (Exception e) { + threadUnexpectedException(e); } } } @@ -476,7 +500,7 @@ public class JSR166TestCase extends Test Thread.sleep(MEDIUM_DELAY_MS); threadShouldThrow(); } - catch(InterruptedException success) { + catch (InterruptedException success) { } } } @@ -486,7 +510,7 @@ public class JSR166TestCase extends Test try { Thread.sleep(MEDIUM_DELAY_MS); } - catch(InterruptedException success) { + catch (InterruptedException success) { } } } @@ -496,7 +520,7 @@ public class JSR166TestCase extends Test try { Thread.sleep(LONG_DELAY_MS); } - catch(InterruptedException success) { + catch (InterruptedException success) { } } } @@ -504,8 +528,8 @@ public class JSR166TestCase extends Test /** * For use as ThreadFactory in constructors */ - static class SimpleThreadFactory implements ThreadFactory{ - public Thread newThread(Runnable r){ + static class SimpleThreadFactory implements ThreadFactory { + public Thread newThread(Runnable r) { return new Thread(r); } } @@ -516,7 +540,7 @@ public class JSR166TestCase extends Test try { Thread.sleep(SMALL_DELAY_MS); done = true; - } catch(Exception e){ + } catch (Exception e) { } } } @@ -527,7 +551,7 @@ public class JSR166TestCase extends Test try { Thread.sleep(MEDIUM_DELAY_MS); done = true; - } catch(Exception e){ + } catch (Exception e) { } } } @@ -538,7 +562,7 @@ public class JSR166TestCase extends Test try { Thread.sleep(LONG_DELAY_MS); done = true; - } catch(Exception e){ + } catch (Exception e) { } } } @@ -556,7 +580,7 @@ public class JSR166TestCase extends Test try { Thread.sleep(SMALL_DELAY_MS); done = true; - } catch(Exception e){ + } catch (Exception e) { } return Boolean.TRUE; } @@ -566,7 +590,7 @@ public class JSR166TestCase extends Test /** * For use as RejectedExecutionHandler in constructors */ - static class NoOpREHandler implements RejectedExecutionHandler{ + static class NoOpREHandler implements RejectedExecutionHandler { public void rejectedExecution(Runnable r, ThreadPoolExecutor executor){} }