ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/JSR166TestCase.java
(Generate patch)

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.27 by jsr166, Thu May 12 03:20:56 2005 UTC vs.
Revision 1.33 by jsr166, Fri Jul 31 23:37:31 2009 UTC

# Line 108 | Line 108 | public class JSR166TestCase extends Test
108      public static Test suite ( ) {
109          TestSuite suite = new TestSuite("JSR166 Unit Tests");
110  
111 +        suite.addTest(new TestSuite(ForkJoinPoolTest.class));
112 +        suite.addTest(new TestSuite(ForkJoinTaskTest.class));
113 +        suite.addTest(new TestSuite(RecursiveActionTest.class));
114 +        suite.addTest(new TestSuite(RecursiveTaskTest.class));
115 +        suite.addTest(new TestSuite(LinkedTransferQueueTest.class));
116 +        suite.addTest(new TestSuite(PhaserTest.class));
117 +        suite.addTest(new TestSuite(ThreadLocalRandomTest.class));
118          suite.addTest(new TestSuite(AbstractExecutorServiceTest.class));
119          suite.addTest(new TestSuite(AbstractQueueTest.class));
120          suite.addTest(new TestSuite(AbstractQueuedSynchronizerTest.class));
# Line 137 | Line 144 | public class JSR166TestCase extends Test
144          suite.addTest(new TestSuite(CountDownLatchTest.class));
145          suite.addTest(new TestSuite(CyclicBarrierTest.class));
146          suite.addTest(new TestSuite(DelayQueueTest.class));
147 +        suite.addTest(new TestSuite(EntryTest.class));
148          suite.addTest(new TestSuite(ExchangerTest.class));
149          suite.addTest(new TestSuite(ExecutorsTest.class));
150          suite.addTest(new TestSuite(ExecutorCompletionServiceTest.class));
# Line 150 | Line 158 | public class JSR166TestCase extends Test
158          suite.addTest(new TestSuite(ReentrantLockTest.class));
159          suite.addTest(new TestSuite(ReentrantReadWriteLockTest.class));
160          suite.addTest(new TestSuite(ScheduledExecutorTest.class));
161 +        suite.addTest(new TestSuite(ScheduledExecutorSubclassTest.class));
162          suite.addTest(new TestSuite(SemaphoreTest.class));
163          suite.addTest(new TestSuite(SynchronousQueueTest.class));
164          suite.addTest(new TestSuite(SystemTest.class));
165          suite.addTest(new TestSuite(ThreadLocalTest.class));
166          suite.addTest(new TestSuite(ThreadPoolExecutorTest.class));
167 +        suite.addTest(new TestSuite(ThreadPoolExecutorSubclassTest.class));
168          suite.addTest(new TestSuite(ThreadTest.class));
169          suite.addTest(new TestSuite(TimeUnitTest.class));
170          suite.addTest(new TestSuite(TreeMapTest.class));
# Line 278 | Line 288 | public class JSR166TestCase extends Test
288       * threadFail with message "should throw exception"
289       */
290      public void threadShouldThrow() {
291 <        threadFailed = true;
292 <        fail("should throw exception");
291 >       try {
292 >           threadFailed = true;
293 >           fail("should throw exception");
294 >       } catch (AssertionFailedError e) {
295 >           e.printStackTrace();
296 >           throw e;
297 >       }
298      }
299  
300      /**
# Line 290 | Line 305 | public class JSR166TestCase extends Test
305          fail("Unexpected exception");
306      }
307  
308 +    /**
309 +     * threadFail with message "Unexpected exception", with argument
310 +     */
311 +    public void threadUnexpectedException(Throwable ex) {
312 +        threadFailed = true;
313 +        ex.printStackTrace();
314 +        fail("Unexpected exception: " + ex);
315 +    }
316  
317      /**
318       * Wait out termination of a thread pool or fail doing so
# Line 298 | Line 321 | public class JSR166TestCase extends Test
321          try {
322              exec.shutdown();
323              assertTrue(exec.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS));
324 <        } catch(SecurityException ok) {
324 >        } catch (SecurityException ok) {
325              // Allowed in case test doesn't have privs
326 <        } catch(InterruptedException ie) {
326 >        } catch (InterruptedException ie) {
327              fail("Unexpected exception");
328          }
329      }
# Line 343 | Line 366 | public class JSR166TestCase extends Test
366      static final Integer m3  = new Integer(-3);
367      static final Integer m4 = new Integer(-4);
368      static final Integer m5 = new Integer(-5);
369 +    static final Integer m6 = new Integer(-6);
370      static final Integer m10 = new Integer(-10);
371  
372  
# Line 397 | Line 421 | public class JSR166TestCase extends Test
421              try {
422                  Thread.sleep(SHORT_DELAY_MS);
423              }
424 <            catch(Exception e) {
425 <                threadUnexpectedException();
424 >            catch (Exception e) {
425 >                threadUnexpectedException(e);
426              }
427          }
428      }
# Line 409 | Line 433 | public class JSR166TestCase extends Test
433                  Thread.sleep(SHORT_DELAY_MS);
434                  threadShouldThrow();
435              }
436 <            catch(InterruptedException success) {
436 >            catch (InterruptedException success) {
437              }
438          }
439      }
# Line 419 | Line 443 | public class JSR166TestCase extends Test
443              try {
444                  Thread.sleep(SMALL_DELAY_MS);
445              }
446 <            catch(Exception e) {
447 <                threadUnexpectedException();
446 >            catch (Exception e) {
447 >                threadUnexpectedException(e);
448              }
449          }
450      }
# Line 430 | Line 454 | public class JSR166TestCase extends Test
454              try {
455                  Thread.sleep(SMALL_DELAY_MS);
456              }
457 <            catch(Exception e) {
457 >            catch (Exception e) {
458              }
459          }
460      }
# Line 440 | Line 464 | public class JSR166TestCase extends Test
464              try {
465                  Thread.sleep(SMALL_DELAY_MS);
466              }
467 <            catch(Exception e) {
468 <                threadUnexpectedException();
467 >            catch (Exception e) {
468 >                threadUnexpectedException(e);
469              }
470              return Boolean.TRUE;
471          }
# Line 453 | Line 477 | public class JSR166TestCase extends Test
477                  Thread.sleep(SMALL_DELAY_MS);
478                  threadShouldThrow();
479              }
480 <            catch(InterruptedException success) {
480 >            catch (InterruptedException success) {
481              }
482          }
483      }
# Line 464 | Line 488 | public class JSR166TestCase extends Test
488              try {
489                  Thread.sleep(MEDIUM_DELAY_MS);
490              }
491 <            catch(Exception e) {
492 <                threadUnexpectedException();
491 >            catch (Exception e) {
492 >                threadUnexpectedException(e);
493              }
494          }
495      }
# Line 476 | Line 500 | public class JSR166TestCase extends Test
500                  Thread.sleep(MEDIUM_DELAY_MS);
501                  threadShouldThrow();
502              }
503 <            catch(InterruptedException success) {
503 >            catch (InterruptedException success) {
504              }
505          }
506      }
# Line 486 | Line 510 | public class JSR166TestCase extends Test
510              try {
511                  Thread.sleep(MEDIUM_DELAY_MS);
512              }
513 <            catch(InterruptedException success) {
513 >            catch (InterruptedException success) {
514              }
515          }
516      }
# Line 496 | Line 520 | public class JSR166TestCase extends Test
520              try {
521                  Thread.sleep(LONG_DELAY_MS);
522              }
523 <            catch(InterruptedException success) {
523 >            catch (InterruptedException success) {
524              }
525          }
526      }
# Line 504 | Line 528 | public class JSR166TestCase extends Test
528      /**
529       * For use as ThreadFactory in constructors
530       */
531 <    static class SimpleThreadFactory implements ThreadFactory{
532 <        public Thread newThread(Runnable r){
531 >    static class SimpleThreadFactory implements ThreadFactory {
532 >        public Thread newThread(Runnable r) {
533              return new Thread(r);
534          }
535      }
# Line 516 | Line 540 | public class JSR166TestCase extends Test
540              try {
541                  Thread.sleep(SMALL_DELAY_MS);
542                  done = true;
543 <            } catch(Exception e){
543 >            } catch (Exception e) {
544              }
545          }
546      }
# Line 527 | Line 551 | public class JSR166TestCase extends Test
551              try {
552                  Thread.sleep(MEDIUM_DELAY_MS);
553                  done = true;
554 <            } catch(Exception e){
554 >            } catch (Exception e) {
555              }
556          }
557      }
# Line 538 | Line 562 | public class JSR166TestCase extends Test
562              try {
563                  Thread.sleep(LONG_DELAY_MS);
564                  done = true;
565 <            } catch(Exception e){
565 >            } catch (Exception e) {
566              }
567          }
568      }
# Line 556 | Line 580 | public class JSR166TestCase extends Test
580              try {
581                  Thread.sleep(SMALL_DELAY_MS);
582                  done = true;
583 <            } catch(Exception e){
583 >            } catch (Exception e) {
584              }
585              return Boolean.TRUE;
586          }
# Line 566 | Line 590 | public class JSR166TestCase extends Test
590      /**
591       * For use as RejectedExecutionHandler in constructors
592       */
593 <    static class NoOpREHandler implements RejectedExecutionHandler{
593 >    static class NoOpREHandler implements RejectedExecutionHandler {
594          public void rejectedExecution(Runnable r, ThreadPoolExecutor executor){}
595      }
596  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines