--- jsr166/src/test/tck/RecursiveActionTest.java 2009/07/31 23:02:50 1.1 +++ jsr166/src/test/tck/RecursiveActionTest.java 2009/07/31 23:37:31 1.2 @@ -11,7 +11,7 @@ import java.util.*; public class RecursiveActionTest extends JSR166TestCase { public static void main(String[] args) { - junit.textui.TestRunner.run (suite()); + junit.textui.TestRunner.run (suite()); } public static Test suite() { return new TestSuite(RecursiveActionTest.class); @@ -29,7 +29,7 @@ public class RecursiveActionTest extends } // A simple recursive action for testing - static final class FibAction extends RecursiveAction { + static final class FibAction extends RecursiveAction { final int number; int result; FibAction(int n) { number = n; } @@ -47,7 +47,7 @@ public class RecursiveActionTest extends } // A recursive action failing in base case - static final class FailingFibAction extends RecursiveAction { + static final class FailingFibAction extends RecursiveAction { final int number; int result; FailingFibAction(int n) { number = n; } @@ -64,11 +64,11 @@ public class RecursiveActionTest extends } } - /** + /** * invoke returns when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks. getRawResult of a RecursiveAction returns null; - * + * */ public void testInvoke() { RecursiveAction a = new RecursiveAction() { @@ -85,7 +85,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * quietlyInvoke task returns when task completes normally. * isCompletedAbnormally and isCancelled return false for normally * completed tasks @@ -105,7 +105,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * join of a forked task returns when task completes */ public void testForkJoin() { @@ -122,7 +122,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * get of a forked task returns when task completes */ public void testForkGet() { @@ -134,7 +134,7 @@ public class RecursiveActionTest extends f.get(); threadAssertTrue(f.result == 21); threadAssertTrue(f.isDone()); - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } } @@ -142,7 +142,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * timed get of a forked task returns when task completes */ public void testForkTimedGet() { @@ -154,7 +154,7 @@ public class RecursiveActionTest extends f.get(5L, TimeUnit.SECONDS); threadAssertTrue(f.result == 21); threadAssertTrue(f.isDone()); - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } } @@ -162,7 +162,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * timed get with null time unit throws NPE */ public void testForkTimedGetNPE() { @@ -172,8 +172,8 @@ public class RecursiveActionTest extends FibAction f = new FibAction(8); f.fork(); f.get(5L, null); - } catch(NullPointerException success) { - } catch(Exception ex) { + } catch (NullPointerException success) { + } catch (Exception ex) { unexpectedException(); } } @@ -181,7 +181,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * helpJoin of a forked task returns when task completes */ public void testForkHelpJoin() { @@ -197,7 +197,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * quietlyJoin of a forked task returns when task completes */ public void testForkQuietlyJoin() { @@ -214,7 +214,7 @@ public class RecursiveActionTest extends } - /** + /** * quietlyHelpJoin of a forked task returns when task completes */ public void testForkQuietlyHelpJoin() { @@ -231,7 +231,7 @@ public class RecursiveActionTest extends } - /** + /** * helpQuiesce returns when tasks are complete. * getQueuedTaskCount returns 0 when quiescent */ @@ -250,7 +250,7 @@ public class RecursiveActionTest extends } - /** + /** * invoke task throws exception when task completes abnormally */ public void testAbnormalInvoke() { @@ -260,14 +260,14 @@ public class RecursiveActionTest extends FailingFibAction f = new FailingFibAction(8); f.invoke(); shouldThrow(); - } catch(FJException success) { + } catch (FJException success) { } } }; mainPool.invoke(a); } - /** + /** * quietelyInvoke task returns when task completes abnormally */ public void testAbnormalQuietlyInvoke() { @@ -281,7 +281,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * join of a forked task throws exception when task completes abnormally */ public void testAbnormalForkJoin() { @@ -292,14 +292,14 @@ public class RecursiveActionTest extends f.fork(); f.join(); shouldThrow(); - } catch(FJException success) { + } catch (FJException success) { } } }; mainPool.invoke(a); } - /** + /** * get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkGet() { @@ -310,14 +310,14 @@ public class RecursiveActionTest extends f.fork(); f.get(); shouldThrow(); - } catch(Exception success) { + } catch (Exception success) { } } }; mainPool.invoke(a); } - /** + /** * timed get of a forked task throws exception when task completes abnormally */ public void testAbnormalForkTimedGet() { @@ -328,14 +328,14 @@ public class RecursiveActionTest extends f.fork(); f.get(5L, TimeUnit.SECONDS); shouldThrow(); - } catch(Exception success) { + } catch (Exception success) { } } }; mainPool.invoke(a); } - /** + /** * join of a forked task throws exception when task completes abnormally */ public void testAbnormalForkHelpJoin() { @@ -346,14 +346,14 @@ public class RecursiveActionTest extends f.fork(); f.helpJoin(); shouldThrow(); - } catch(FJException success) { + } catch (FJException success) { } } }; mainPool.invoke(a); } - /** + /** * quietlyHelpJoin of a forked task returns when task completes abnormally. * getException of failed task returns its exception. * isCompletedAbnormally of a failed task returns true. @@ -374,7 +374,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * quietlyJoin of a forked task returns when task completes abnormally */ public void testAbnormalForkQuietlyJoin() { @@ -391,7 +391,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * invoke task throws exception when task cancelled */ public void testCancelledInvoke() { @@ -402,14 +402,14 @@ public class RecursiveActionTest extends f.cancel(true); f.invoke(); shouldThrow(); - } catch(CancellationException success) { + } catch (CancellationException success) { } } }; mainPool.invoke(a); } - /** + /** * join of a forked task throws exception when task cancelled */ public void testCancelledForkJoin() { @@ -421,14 +421,14 @@ public class RecursiveActionTest extends f.fork(); f.join(); shouldThrow(); - } catch(CancellationException success) { + } catch (CancellationException success) { } } }; mainPool.invoke(a); } - /** + /** * get of a forked task throws exception when task cancelled */ public void testCancelledForkGet() { @@ -440,14 +440,14 @@ public class RecursiveActionTest extends f.fork(); f.get(); shouldThrow(); - } catch(Exception success) { + } catch (Exception success) { } } }; mainPool.invoke(a); } - /** + /** * timed get of a forked task throws exception when task cancelled */ public void testCancelledForkTimedGet() { @@ -459,14 +459,14 @@ public class RecursiveActionTest extends f.fork(); f.get(5L, TimeUnit.SECONDS); shouldThrow(); - } catch(Exception success) { + } catch (Exception success) { } } }; mainPool.invoke(a); } - /** + /** * join of a forked task throws exception when task cancelled */ public void testCancelledForkHelpJoin() { @@ -478,14 +478,14 @@ public class RecursiveActionTest extends f.fork(); f.helpJoin(); shouldThrow(); - } catch(CancellationException success) { + } catch (CancellationException success) { } } }; mainPool.invoke(a); } - /** + /** * quietlyHelpJoin of a forked task returns when task cancelled. * getException of cancelled task returns its exception. * isCompletedAbnormally of a cancelled task returns true. @@ -507,7 +507,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * quietlyJoin of a forked task returns when task cancelled */ public void testCancelledForkQuietlyJoin() { @@ -589,7 +589,7 @@ public class RecursiveActionTest extends /** * getPoolIndex of current thread in pool returns 0 <= value < poolSize - * + * */ public void testWorkerGetPoolIndex() { RecursiveAction a = new RecursiveAction() { @@ -617,7 +617,7 @@ public class RecursiveActionTest extends a.invoke(); } - /** + /** * A reinitialized task may be re-invoked */ public void testReinitialize() { @@ -637,7 +637,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * invoke task throws exception after invoking completeExceptionally */ public void testCompleteExceptionally() { @@ -648,14 +648,14 @@ public class RecursiveActionTest extends f.completeExceptionally(new FJException()); f.invoke(); shouldThrow(); - } catch(FJException success) { + } catch (FJException success) { } } }; mainPool.invoke(a); } - /** + /** * invoke task suppresses execution invoking complete */ public void testComplete() { @@ -671,7 +671,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * invokeAll(t1, t2) invokes all task arguments */ public void testInvokeAll2() { @@ -689,7 +689,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * invokeAll(tasks) with 1 argument invokes task */ public void testInvokeAll1() { @@ -704,7 +704,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * invokeAll(tasks) with > 2 argument invokes tasks */ public void testInvokeAll3() { @@ -725,7 +725,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * invokeAll(collection) invokes all tasks in the collection */ public void testInvokeAllCollection() { @@ -751,7 +751,7 @@ public class RecursiveActionTest extends } - /** + /** * invokeAll(tasks) with any null task throws NPE */ public void testInvokeAllNPE() { @@ -770,7 +770,7 @@ public class RecursiveActionTest extends mainPool.invoke(a); } - /** + /** * invokeAll(t1, t2) throw exception if any task does */ public void testAbnormalInvokeAll2() { @@ -781,14 +781,14 @@ public class RecursiveActionTest extends FailingFibAction g = new FailingFibAction(9); invokeAll(f, g); shouldThrow(); - } catch(FJException success) { + } catch (FJException success) { } } }; mainPool.invoke(a); } - /** + /** * invokeAll(tasks) with 1 argument throws exception if task does */ public void testAbnormalInvokeAll1() { @@ -798,14 +798,14 @@ public class RecursiveActionTest extends FailingFibAction g = new FailingFibAction(9); invokeAll(g); shouldThrow(); - } catch(FJException success) { + } catch (FJException success) { } } }; mainPool.invoke(a); } - /** + /** * invokeAll(tasks) with > 2 argument throws exception if any task does */ public void testAbnormalInvokeAll3() { @@ -817,14 +817,14 @@ public class RecursiveActionTest extends FibAction h = new FibAction(7); invokeAll(f, g, h); shouldThrow(); - } catch(FJException success) { + } catch (FJException success) { } } }; mainPool.invoke(a); } - /** + /** * invokeAll(collection) throws exception if any task does */ public void testAbnormalInvokeAllCollection() { @@ -840,14 +840,14 @@ public class RecursiveActionTest extends set.add(h); invokeAll(set); shouldThrow(); - } catch(FJException success) { + } catch (FJException success) { } } }; mainPool.invoke(a); } - /** + /** * tryUnfork returns true for most recent unexecuted task, * and suppresses execution */ @@ -867,7 +867,7 @@ public class RecursiveActionTest extends singletonPool.invoke(a); } - /** + /** * getSurplusQueuedTaskCount returns > 0 when * there are more tasks than threads */ @@ -887,7 +887,7 @@ public class RecursiveActionTest extends singletonPool.invoke(a); } - /** + /** * peekNextLocalTask returns most recent unexecuted task. */ public void testPeekNextLocalTask() { @@ -906,7 +906,7 @@ public class RecursiveActionTest extends singletonPool.invoke(a); } - /** + /** * pollNextLocalTask returns most recent unexecuted task * without executing it */ @@ -925,7 +925,7 @@ public class RecursiveActionTest extends singletonPool.invoke(a); } - /** + /** * pollTask returns an unexecuted task * without executing it */ @@ -945,7 +945,7 @@ public class RecursiveActionTest extends singletonPool.invoke(a); } - /** + /** * peekNextLocalTask returns least recent unexecuted task in async mode */ public void testPeekNextLocalTaskAsync() { @@ -964,7 +964,7 @@ public class RecursiveActionTest extends asyncSingletonPool.invoke(a); } - /** + /** * pollNextLocalTask returns least recent unexecuted task * without executing it, in async mode */ @@ -984,7 +984,7 @@ public class RecursiveActionTest extends asyncSingletonPool.invoke(a); } - /** + /** * pollTask returns an unexecuted task * without executing it, in async mode */