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

Comparing jsr166/src/test/tck/RecursiveActionTest.java (file contents):
Revision 1.20 by jsr166, Sun Nov 21 08:35:40 2010 UTC vs.
Revision 1.23 by jsr166, Mon Nov 22 07:50:50 2010 UTC

# Line 90 | Line 90 | public class RecursiveActionTest extends
90          assertNull(a.getException());
91          assertNull(a.getRawResult());
92          assertNull(a.join());
93 +        assertFalse(a.cancel(false));
94 +        assertFalse(a.cancel(true));
95          try {
96              assertNull(a.get());
97          } catch (Throwable fail) { threadUnexpectedException(fail); }
# Line 125 | Line 127 | public class RecursiveActionTest extends
127          } catch (Throwable fail) { threadUnexpectedException(fail); }
128      }
129  
130 <    void checkTaskThrew(RecursiveAction a, Throwable t) {
130 >    void checkCompletedAbnormally(RecursiveAction a, Throwable t) {
131          assertTrue(a.isDone());
132          assertFalse(a.isCancelled());
133          assertFalse(a.isCompletedNormally());
134          assertTrue(a.isCompletedAbnormally());
135          assertSame(t, a.getException());
136          assertNull(a.getRawResult());
137 +        assertFalse(a.cancel(false));
138 +        assertFalse(a.cancel(true));
139  
140          try {
141              a.join();
# Line 333 | Line 337 | public class RecursiveActionTest extends
337                      f.invoke();
338                      shouldThrow();
339                  } catch (FJException success) {
340 <                    checkTaskThrew(f, success);
340 >                    checkCompletedAbnormally(f, success);
341                  }
342              }};
343          testInvokeOnPool(mainPool(), a);
# Line 348 | Line 352 | public class RecursiveActionTest extends
352                  FailingFibAction f = new FailingFibAction(8);
353                  f.quietlyInvoke();
354                  assertTrue(f.getException() instanceof FJException);
355 <                checkTaskThrew(f, f.getException());
355 >                checkCompletedAbnormally(f, f.getException());
356              }};
357          testInvokeOnPool(mainPool(), a);
358      }
# Line 365 | Line 369 | public class RecursiveActionTest extends
369                      f.join();
370                      shouldThrow();
371                  } catch (FJException success) {
372 <                    checkTaskThrew(f, success);
372 >                    checkCompletedAbnormally(f, success);
373                  }
374              }};
375          testInvokeOnPool(mainPool(), a);
# Line 383 | Line 387 | public class RecursiveActionTest extends
387                      f.get();
388                      shouldThrow();
389                  } catch (ExecutionException success) {
390 <                    checkTaskThrew(f, success.getCause());
390 >                    Throwable cause = success.getCause();
391 >                    assertTrue(cause instanceof FJException);
392 >                    checkCompletedAbnormally(f, cause);
393                  }
394              }};
395          testInvokeOnPool(mainPool(), a);
# Line 401 | Line 407 | public class RecursiveActionTest extends
407                      f.get(5L, TimeUnit.SECONDS);
408                      shouldThrow();
409                  } catch (ExecutionException success) {
410 <                    checkTaskThrew(f, success.getCause());
410 >                    Throwable cause = success.getCause();
411 >                    assertTrue(cause instanceof FJException);
412 >                    checkCompletedAbnormally(f, cause);
413                  }
414              }};
415          testInvokeOnPool(mainPool(), a);
# Line 417 | Line 425 | public class RecursiveActionTest extends
425                  assertSame(f, f.fork());
426                  f.quietlyJoin();
427                  assertTrue(f.getException() instanceof FJException);
428 <                checkTaskThrew(f, f.getException());
428 >                checkCompletedAbnormally(f, f.getException());
429              }};
430          testInvokeOnPool(mainPool(), a);
431      }
# Line 594 | Line 602 | public class RecursiveActionTest extends
602          RecursiveAction a = new CheckedRecursiveAction() {
603              public void realCompute() {
604                  setRawResult(null);
605 +                assertNull(getRawResult());
606              }};
607          assertNull(a.invoke());
608      }
# Line 630 | Line 639 | public class RecursiveActionTest extends
639                      f.invoke();
640                      shouldThrow();
641                  } catch (FJException success) {
642 <                    checkTaskThrew(f, success);
642 >                    checkCompletedAbnormally(f, success);
643                  }
644              }};
645          testInvokeOnPool(mainPool(), a);
# Line 762 | Line 771 | public class RecursiveActionTest extends
771                      invokeAll(f, g);
772                      shouldThrow();
773                  } catch (FJException success) {
774 <                    checkTaskThrew(g, success);
774 >                    checkCompletedAbnormally(g, success);
775                  }
776              }};
777          testInvokeOnPool(mainPool(), a);
# Line 779 | Line 788 | public class RecursiveActionTest extends
788                      invokeAll(g);
789                      shouldThrow();
790                  } catch (FJException success) {
791 <                    checkTaskThrew(g, success);
791 >                    checkCompletedAbnormally(g, success);
792                  }
793              }};
794          testInvokeOnPool(mainPool(), a);
# Line 798 | Line 807 | public class RecursiveActionTest extends
807                      invokeAll(f, g, h);
808                      shouldThrow();
809                  } catch (FJException success) {
810 <                    checkTaskThrew(g, success);
810 >                    checkCompletedAbnormally(g, success);
811                  }
812              }};
813          testInvokeOnPool(mainPool(), a);
# Line 821 | Line 830 | public class RecursiveActionTest extends
830                      invokeAll(set);
831                      shouldThrow();
832                  } catch (FJException success) {
833 <                    checkTaskThrew(f, success);
833 >                    checkCompletedAbnormally(f, success);
834                  }
835              }};
836          testInvokeOnPool(mainPool(), a);
# Line 861 | Line 870 | public class RecursiveActionTest extends
870                  assertSame(f, f.fork());
871                  assertTrue(getSurplusQueuedTaskCount() > 0);
872                  helpQuiesce();
873 +                assertEquals(0, getSurplusQueuedTaskCount());
874                  checkCompletedNormally(f);
875                  checkCompletedNormally(g);
876                  checkCompletedNormally(h);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines