Class ForkJoinTaskTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by JSR166TestCase
              extended by ForkJoinTaskTest
All Implemented Interfaces:
junit.framework.Test

public class ForkJoinTaskTest
extends JSR166TestCase


Nested Class Summary
static class ForkJoinTaskTest.FJException
           
 
Nested classes/interfaces inherited from class JSR166TestCase
JSR166TestCase.AdjustablePolicy, JSR166TestCase.CallableOne, JSR166TestCase.CheckedBarrier, JSR166TestCase.CheckedCallable<T>, JSR166TestCase.CheckedInterruptedCallable<T>, JSR166TestCase.CheckedInterruptedRunnable, JSR166TestCase.CheckedRecursiveAction, JSR166TestCase.CheckedRecursiveTask<T>, JSR166TestCase.CheckedRunnable, JSR166TestCase.LongPossiblyInterruptedRunnable, JSR166TestCase.MediumInterruptedRunnable, JSR166TestCase.MediumPossiblyInterruptedRunnable, JSR166TestCase.MediumRunnable, JSR166TestCase.NoOpCallable, JSR166TestCase.NoOpREHandler, JSR166TestCase.NoOpRunnable, JSR166TestCase.NPETask, JSR166TestCase.RunnableShouldThrow, JSR166TestCase.ShortInterruptedRunnable, JSR166TestCase.ShortRunnable, JSR166TestCase.SimpleThreadFactory, JSR166TestCase.SmallCallable, JSR166TestCase.SmallPossiblyInterruptedRunnable, JSR166TestCase.SmallRunnable, JSR166TestCase.StringTask, JSR166TestCase.ThreadShouldThrow, JSR166TestCase.TrackedCallable, JSR166TestCase.TrackedLongRunnable, JSR166TestCase.TrackedMediumRunnable, JSR166TestCase.TrackedNoOpRunnable, JSR166TestCase.TrackedRunnable, JSR166TestCase.TrackedShortRunnable, JSR166TestCase.TrackedSmallRunnable
 
Field Summary
 
Fields inherited from class JSR166TestCase
eight, expensiveTests, five, four, LONG_DELAY_MS, m1, m10, m2, m3, m4, m5, m6, MEDIUM_DELAY_MS, nine, one, seven, SHORT_DELAY_MS, six, SIZE, SMALL_DELAY_MS, TEST_STRING, three, two, zero
 
Constructor Summary
ForkJoinTaskTest()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testAbnormalForkGet()
          get of a forked task throws exception when task completes abnormally
 void testAbnormalForkGetSingleton()
          get of a forked task throws exception when task completes abnormally
 void testAbnormalForkJoin()
          join of a forked task throws exception when task completes abnormally
 void testAbnormalForkJoinSingleton()
          join of a forked task throws exception when task completes abnormally
 void testAbnormalForkQuietlyJoin()
          quietlyJoin of a forked task returns when task completes abnormally
 void testAbnormalForkQuietlyJoinSingleton()
          quietlyJoin of a forked task returns when task completes abnormally
 void testAbnormalForkTimedGet()
          timed get of a forked task throws exception when task completes abnormally
 void testAbnormalForkTimedGetSingleton()
          timed get of a forked task throws exception when task completes abnormally
 void testAbnormalInvoke()
          invoke task throws exception when task completes abnormally
 void testAbnormalInvokeAll1()
          invokeAll(tasks) with 1 argument throws exception if task does
 void testAbnormalInvokeAll1Singleton()
          invokeAll(tasks) with 1 argument throws exception if task does
 void testAbnormalInvokeAll2()
          invokeAll(t1, t2) throw exception if any task does
 void testAbnormalInvokeAll2Singleton()
          invokeAll(t1, t2) throw exception if any task does
 void testAbnormalInvokeAll3()
          invokeAll(tasks) with > 2 argument throws exception if any task does
 void testAbnormalInvokeAll3Singleton()
          invokeAll(tasks) with > 2 argument throws exception if any task does
 void testAbnormalInvokeAllCollection()
          invokeAll(collection) throws exception if any task does
 void testAbnormalInvokeAllCollectionSingleton()
          invokeAll(collection) throws exception if any task does
 void testAbnormalInvokeSingleton()
          invoke task throws exception when task completes abnormally
 void testAbnormalQuietlyInvoke()
          quietlyInvoke task returns when task completes abnormally
 void testAbnormalQuietlyInvokeSingleton()
          quietlyInvoke task returns when task completes abnormally
 void testCancelledForkGet()
          get of a forked task throws exception when task cancelled
 void testCancelledForkGetSingleton()
          get of a forked task throws exception when task cancelled
 void testCancelledForkJoin()
          join of a forked task throws exception when task cancelled
 void testCancelledForkJoinSingleton()
          join of a forked task throws exception when task cancelled
 void testCancelledForkQuietlyJoin()
          quietlyJoin of a forked task returns when task cancelled
 void testCancelledForkQuietlyJoinSingleton()
          quietlyJoin of a forked task returns when task cancelled
 void testCancelledForkTimedGet()
          timed get of a forked task throws exception when task cancelled
 void testCancelledForkTimedGetSingleton()
          timed get of a forked task throws exception when task cancelled
 void testCancelledInvoke()
          invoke task throws exception when task cancelled
 void testCancelledInvokeSingleton()
          invoke task throws exception when task cancelled
 void testCompleteExceptionally()
          invoke task throws exception after invoking completeExceptionally
 void testCompleteExceptionallySingleton()
          invoke task throws exception after invoking completeExceptionally
 void testForkGet()
          get of a forked task returns when task completes
 void testForkGetSingleton()
          get of a forked task returns when task completes
 void testForkHelpQuiesce()
          helpQuiesce returns when tasks are complete.
 void testForkHelpQuiesceSingleton()
          helpQuiesce returns when tasks are complete.
 void testForkJoin()
          join of a forked task returns when task completes
 void testForkJoinSingleton()
          join of a forked task returns when task completes
 void testForkQuietlyJoin()
          quietlyJoin of a forked task returns when task completes
 void testForkQuietlyJoinSingleton()
          quietlyJoin of a forked task returns when task completes
 void testForkTimedGet()
          timed get of a forked task returns when task completes
 void testForkTimedGetNPE()
          timed get with null time unit throws NPE
 void testForkTimedGetNPESingleton()
          timed get with null time unit throws NPE
 void testForkTimedGetSingleton()
          timed get of a forked task returns when task completes
 void testGetPool()
          getPool of executing task returns its pool
 void testGetPool2()
          getPool of non-FJ task returns null
 void testGetSurplusQueuedTaskCount()
          getSurplusQueuedTaskCount returns > 0 when there are more tasks than threads
 void testInForkJoinPool()
          inForkJoinPool of executing task returns true
 void testInForkJoinPool2()
          inForkJoinPool of non-FJ task returns false
 void testInvoke()
          invoke returns when task completes normally.
 void testInvokeAll1()
          invokeAll(tasks) with 1 argument invokes task
 void testInvokeAll1Singleton()
          invokeAll(tasks) with 1 argument invokes task
 void testInvokeAll2()
          invokeAll(t1, t2) invokes all task arguments
 void testInvokeAll2Singleton()
          invokeAll(t1, t2) invokes all task arguments
 void testInvokeAll3()
          invokeAll(tasks) with > 2 argument invokes tasks
 void testInvokeAll3Singleton()
          invokeAll(tasks) with > 2 argument invokes tasks
 void testInvokeAllCollection()
          invokeAll(collection) invokes all tasks in the collection
 void testInvokeAllCollectionSingleton()
          invokeAll(collection) invokes all tasks in the collection
 void testInvokeAllNPE()
          invokeAll(tasks) with any null task throws NPE
 void testInvokeAllNPESingleton()
          invokeAll(tasks) with any null task throws NPE
 void testInvokeSingleton()
          invoke returns when task completes normally.
 void testPeekNextLocalTask()
          peekNextLocalTask returns most recent unexecuted task.
 void testPeekNextLocalTaskAsync()
          peekNextLocalTask returns least recent unexecuted task in async mode
 void testPollNextLocalTask()
          pollNextLocalTask returns most recent unexecuted task without executing it
 void testPollNextLocalTaskAsync()
          pollNextLocalTask returns least recent unexecuted task without executing it, in async mode
 void testPollTask()
          pollTask returns an unexecuted task without executing it
 void testPollTaskAsync()
          pollTask returns an unexecuted task without executing it, in async mode
 void testQuietlyInvoke()
          quietlyInvoke task returns when task completes normally.
 void testQuietlyInvokeSingleton()
          quietlyInvoke task returns when task completes normally.
 void testSetRawResult()
          setRawResult(null) succeeds
 void testTryUnfork()
          tryUnfork returns true for most recent unexecuted task, and suppresses execution
 
Methods inherited from class JSR166TestCase
assertThreadJoinTimesOut, awaiter, checkEmpty, delay, getShortDelay, joinPool, latchAwaitingStringTask, newTestSuite, permissivePolicy, possiblyInterruptedRunnable, runTest, runTestProfiled, runWithoutPermissions, runWithPermissions, setDelays, setUp, shouldThrow, shouldThrow, tearDown, threadAssertEquals, threadAssertEquals, threadAssertFalse, threadAssertNull, threadAssertSame, threadAssertTrue, threadFail, threadRecordFailure, threadShouldThrow, threadShouldThrow, threadUnexpectedException, trackedRunnable
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ForkJoinTaskTest

public ForkJoinTaskTest()
Method Detail

main

public static void main(java.lang.String[] args)

suite

public static junit.framework.Test suite()

testInvoke

public void testInvoke()
invoke returns when task completes normally. isCompletedAbnormally and isCancelled return false for normally completed tasks; getRawResult returns null.


testQuietlyInvoke

public void testQuietlyInvoke()
quietlyInvoke task returns when task completes normally. isCompletedAbnormally and isCancelled return false for normally completed tasks


testForkJoin

public void testForkJoin()
join of a forked task returns when task completes


testForkGet

public void testForkGet()
get of a forked task returns when task completes


testForkTimedGet

public void testForkTimedGet()
timed get of a forked task returns when task completes


testForkTimedGetNPE

public void testForkTimedGetNPE()
timed get with null time unit throws NPE


testForkQuietlyJoin

public void testForkQuietlyJoin()
quietlyJoin of a forked task returns when task completes


testForkHelpQuiesce

public void testForkHelpQuiesce()
helpQuiesce returns when tasks are complete. getQueuedTaskCount returns 0 when quiescent


testAbnormalInvoke

public void testAbnormalInvoke()
invoke task throws exception when task completes abnormally


testAbnormalQuietlyInvoke

public void testAbnormalQuietlyInvoke()
quietlyInvoke task returns when task completes abnormally


testAbnormalForkJoin

public void testAbnormalForkJoin()
join of a forked task throws exception when task completes abnormally


testAbnormalForkGet

public void testAbnormalForkGet()
get of a forked task throws exception when task completes abnormally


testAbnormalForkTimedGet

public void testAbnormalForkTimedGet()
timed get of a forked task throws exception when task completes abnormally


testAbnormalForkQuietlyJoin

public void testAbnormalForkQuietlyJoin()
quietlyJoin of a forked task returns when task completes abnormally


testCancelledInvoke

public void testCancelledInvoke()
invoke task throws exception when task cancelled


testCancelledForkJoin

public void testCancelledForkJoin()
join of a forked task throws exception when task cancelled


testCancelledForkGet

public void testCancelledForkGet()
get of a forked task throws exception when task cancelled


testCancelledForkTimedGet

public void testCancelledForkTimedGet()
                               throws java.lang.Exception
timed get of a forked task throws exception when task cancelled

Throws:
java.lang.Exception

testCancelledForkQuietlyJoin

public void testCancelledForkQuietlyJoin()
quietlyJoin of a forked task returns when task cancelled


testGetPool

public void testGetPool()
getPool of executing task returns its pool


testGetPool2

public void testGetPool2()
getPool of non-FJ task returns null


testInForkJoinPool

public void testInForkJoinPool()
inForkJoinPool of executing task returns true


testInForkJoinPool2

public void testInForkJoinPool2()
inForkJoinPool of non-FJ task returns false


testSetRawResult

public void testSetRawResult()
setRawResult(null) succeeds


testCompleteExceptionally

public void testCompleteExceptionally()
invoke task throws exception after invoking completeExceptionally


testInvokeAll2

public void testInvokeAll2()
invokeAll(t1, t2) invokes all task arguments


testInvokeAll1

public void testInvokeAll1()
invokeAll(tasks) with 1 argument invokes task


testInvokeAll3

public void testInvokeAll3()
invokeAll(tasks) with > 2 argument invokes tasks


testInvokeAllCollection

public void testInvokeAllCollection()
invokeAll(collection) invokes all tasks in the collection


testInvokeAllNPE

public void testInvokeAllNPE()
invokeAll(tasks) with any null task throws NPE


testAbnormalInvokeAll2

public void testAbnormalInvokeAll2()
invokeAll(t1, t2) throw exception if any task does


testAbnormalInvokeAll1

public void testAbnormalInvokeAll1()
invokeAll(tasks) with 1 argument throws exception if task does


testAbnormalInvokeAll3

public void testAbnormalInvokeAll3()
invokeAll(tasks) with > 2 argument throws exception if any task does


testAbnormalInvokeAllCollection

public void testAbnormalInvokeAllCollection()
invokeAll(collection) throws exception if any task does


testTryUnfork

public void testTryUnfork()
tryUnfork returns true for most recent unexecuted task, and suppresses execution


testGetSurplusQueuedTaskCount

public void testGetSurplusQueuedTaskCount()
getSurplusQueuedTaskCount returns > 0 when there are more tasks than threads


testPeekNextLocalTask

public void testPeekNextLocalTask()
peekNextLocalTask returns most recent unexecuted task.


testPollNextLocalTask

public void testPollNextLocalTask()
pollNextLocalTask returns most recent unexecuted task without executing it


testPollTask

public void testPollTask()
pollTask returns an unexecuted task without executing it


testPeekNextLocalTaskAsync

public void testPeekNextLocalTaskAsync()
peekNextLocalTask returns least recent unexecuted task in async mode


testPollNextLocalTaskAsync

public void testPollNextLocalTaskAsync()
pollNextLocalTask returns least recent unexecuted task without executing it, in async mode


testPollTaskAsync

public void testPollTaskAsync()
pollTask returns an unexecuted task without executing it, in async mode


testInvokeSingleton

public void testInvokeSingleton()
invoke returns when task completes normally. isCompletedAbnormally and isCancelled return false for normally completed tasks; getRawResult returns null.


testQuietlyInvokeSingleton

public void testQuietlyInvokeSingleton()
quietlyInvoke task returns when task completes normally. isCompletedAbnormally and isCancelled return false for normally completed tasks


testForkJoinSingleton

public void testForkJoinSingleton()
join of a forked task returns when task completes


testForkGetSingleton

public void testForkGetSingleton()
get of a forked task returns when task completes


testForkTimedGetSingleton

public void testForkTimedGetSingleton()
timed get of a forked task returns when task completes


testForkTimedGetNPESingleton

public void testForkTimedGetNPESingleton()
timed get with null time unit throws NPE


testForkQuietlyJoinSingleton

public void testForkQuietlyJoinSingleton()
quietlyJoin of a forked task returns when task completes


testForkHelpQuiesceSingleton

public void testForkHelpQuiesceSingleton()
helpQuiesce returns when tasks are complete. getQueuedTaskCount returns 0 when quiescent


testAbnormalInvokeSingleton

public void testAbnormalInvokeSingleton()
invoke task throws exception when task completes abnormally


testAbnormalQuietlyInvokeSingleton

public void testAbnormalQuietlyInvokeSingleton()
quietlyInvoke task returns when task completes abnormally


testAbnormalForkJoinSingleton

public void testAbnormalForkJoinSingleton()
join of a forked task throws exception when task completes abnormally


testAbnormalForkGetSingleton

public void testAbnormalForkGetSingleton()
get of a forked task throws exception when task completes abnormally


testAbnormalForkTimedGetSingleton

public void testAbnormalForkTimedGetSingleton()
timed get of a forked task throws exception when task completes abnormally


testAbnormalForkQuietlyJoinSingleton

public void testAbnormalForkQuietlyJoinSingleton()
quietlyJoin of a forked task returns when task completes abnormally


testCancelledInvokeSingleton

public void testCancelledInvokeSingleton()
invoke task throws exception when task cancelled


testCancelledForkJoinSingleton

public void testCancelledForkJoinSingleton()
join of a forked task throws exception when task cancelled


testCancelledForkGetSingleton

public void testCancelledForkGetSingleton()
get of a forked task throws exception when task cancelled


testCancelledForkTimedGetSingleton

public void testCancelledForkTimedGetSingleton()
                                        throws java.lang.Exception
timed get of a forked task throws exception when task cancelled

Throws:
java.lang.Exception

testCancelledForkQuietlyJoinSingleton

public void testCancelledForkQuietlyJoinSingleton()
quietlyJoin of a forked task returns when task cancelled


testCompleteExceptionallySingleton

public void testCompleteExceptionallySingleton()
invoke task throws exception after invoking completeExceptionally


testInvokeAll2Singleton

public void testInvokeAll2Singleton()
invokeAll(t1, t2) invokes all task arguments


testInvokeAll1Singleton

public void testInvokeAll1Singleton()
invokeAll(tasks) with 1 argument invokes task


testInvokeAll3Singleton

public void testInvokeAll3Singleton()
invokeAll(tasks) with > 2 argument invokes tasks


testInvokeAllCollectionSingleton

public void testInvokeAllCollectionSingleton()
invokeAll(collection) invokes all tasks in the collection


testInvokeAllNPESingleton

public void testInvokeAllNPESingleton()
invokeAll(tasks) with any null task throws NPE


testAbnormalInvokeAll2Singleton

public void testAbnormalInvokeAll2Singleton()
invokeAll(t1, t2) throw exception if any task does


testAbnormalInvokeAll1Singleton

public void testAbnormalInvokeAll1Singleton()
invokeAll(tasks) with 1 argument throws exception if task does


testAbnormalInvokeAll3Singleton

public void testAbnormalInvokeAll3Singleton()
invokeAll(tasks) with > 2 argument throws exception if any task does


testAbnormalInvokeAllCollectionSingleton

public void testAbnormalInvokeAllCollectionSingleton()
invokeAll(collection) throws exception if any task does