Class ExecutorsTest

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

public class ExecutorsTest
extends JSR166TestCase


Nested Class Summary
 
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
ExecutorsTest()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testCallable1()
          callable(Runnable) returns null when called
 void testCallable2()
          callable(Runnable, result) returns result when called
 void testCallable3()
          callable(PrivilegedAction) returns its result when called
 void testCallable4()
          callable(PrivilegedExceptionAction) returns its result when called
 void testCallableNPE1()
          callable(null Runnable) throws NPE
 void testCallableNPE2()
          callable(null, result) throws NPE
 void testCallableNPE3()
          callable(null PrivilegedAction) throws NPE
 void testCallableNPE4()
          callable(null PrivilegedExceptionAction) throws NPE
 void testCastNewSingleThreadExecutor()
          A new SingleThreadExecutor cannot be casted to concrete implementation
 void testCreatePrivilegedCallableUsingCCLWithNoPrivs()
          Without class loader permissions, creating privilegedCallableUsingCurrentClassLoader throws ACE
 void testDefaultThreadFactory()
          ThreadPoolExecutor using defaultThreadFactory has specified group, priority, daemon status, and name
 void testNewCachedThreadPool1()
          A newCachedThreadPool can execute runnables
 void testNewCachedThreadPool2()
          A newCachedThreadPool with given ThreadFactory can execute runnables
 void testNewCachedThreadPool3()
          A newCachedThreadPool with null ThreadFactory throws NPE
 void testNewFixedThreadPool1()
          A new newFixedThreadPool can execute runnables
 void testNewFixedThreadPool2()
          A new newFixedThreadPool with given ThreadFactory can execute runnables
 void testNewFixedThreadPool3()
          A new newFixedThreadPool with null ThreadFactory throws NPE
 void testNewFixedThreadPool4()
          A new newFixedThreadPool with 0 threads throws IAE
 void testnewScheduledThreadPool()
          a newScheduledThreadPool successfully runs delayed task
 void testNewSingleThreadExecutor1()
          A new SingleThreadExecutor can execute runnables
 void testNewSingleThreadExecutor2()
          A new SingleThreadExecutor with given ThreadFactory can execute runnables
 void testNewSingleThreadExecutor3()
          A new SingleThreadExecutor with null ThreadFactory throws NPE
 void testNewSingleThreadScheduledExecutor()
          a newSingleThreadScheduledExecutor successfully runs delayed task
 void testprivilegedCallableUsingCCLWithPrivs()
          With class loader permissions, calling privilegedCallableUsingCurrentClassLoader does not throw ACE
 void testprivilegedCallableWithNoPrivs()
          Without permissions, calling privilegedCallable throws ACE
 void testprivilegedCallableWithPrivs()
          With permissions, calling privilegedCallable succeeds
 void testPrivilegedThreadFactory()
          ThreadPoolExecutor using privilegedThreadFactory has specified group, priority, daemon status, name, access control context and context class loader
 void testTimedCallable()
          Future.get on submitted tasks will time out if they compute too long.
 void testunconfigurableExecutorService()
          An unconfigurable newFixedThreadPool can execute runnables
 void testunconfigurableExecutorServiceNPE()
          unconfigurableExecutorService(null) throws NPE
 void testunconfigurableScheduledExecutorService()
          an unconfigurable newScheduledThreadPool successfully runs delayed task
 void testunconfigurableScheduledExecutorServiceNPE()
          unconfigurableScheduledExecutorService(null) throws NPE
 
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

ExecutorsTest

public ExecutorsTest()
Method Detail

main

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

suite

public static junit.framework.Test suite()

testNewCachedThreadPool1

public void testNewCachedThreadPool1()
A newCachedThreadPool can execute runnables


testNewCachedThreadPool2

public void testNewCachedThreadPool2()
A newCachedThreadPool with given ThreadFactory can execute runnables


testNewCachedThreadPool3

public void testNewCachedThreadPool3()
A newCachedThreadPool with null ThreadFactory throws NPE


testNewSingleThreadExecutor1

public void testNewSingleThreadExecutor1()
A new SingleThreadExecutor can execute runnables


testNewSingleThreadExecutor2

public void testNewSingleThreadExecutor2()
A new SingleThreadExecutor with given ThreadFactory can execute runnables


testNewSingleThreadExecutor3

public void testNewSingleThreadExecutor3()
A new SingleThreadExecutor with null ThreadFactory throws NPE


testCastNewSingleThreadExecutor

public void testCastNewSingleThreadExecutor()
A new SingleThreadExecutor cannot be casted to concrete implementation


testNewFixedThreadPool1

public void testNewFixedThreadPool1()
A new newFixedThreadPool can execute runnables


testNewFixedThreadPool2

public void testNewFixedThreadPool2()
A new newFixedThreadPool with given ThreadFactory can execute runnables


testNewFixedThreadPool3

public void testNewFixedThreadPool3()
A new newFixedThreadPool with null ThreadFactory throws NPE


testNewFixedThreadPool4

public void testNewFixedThreadPool4()
A new newFixedThreadPool with 0 threads throws IAE


testunconfigurableExecutorService

public void testunconfigurableExecutorService()
An unconfigurable newFixedThreadPool can execute runnables


testunconfigurableExecutorServiceNPE

public void testunconfigurableExecutorServiceNPE()
unconfigurableExecutorService(null) throws NPE


testunconfigurableScheduledExecutorServiceNPE

public void testunconfigurableScheduledExecutorServiceNPE()
unconfigurableScheduledExecutorService(null) throws NPE


testNewSingleThreadScheduledExecutor

public void testNewSingleThreadScheduledExecutor()
                                          throws java.lang.Exception
a newSingleThreadScheduledExecutor successfully runs delayed task

Throws:
java.lang.Exception

testnewScheduledThreadPool

public void testnewScheduledThreadPool()
                                throws java.lang.Exception
a newScheduledThreadPool successfully runs delayed task

Throws:
java.lang.Exception

testunconfigurableScheduledExecutorService

public void testunconfigurableScheduledExecutorService()
                                                throws java.lang.Exception
an unconfigurable newScheduledThreadPool successfully runs delayed task

Throws:
java.lang.Exception

testTimedCallable

public void testTimedCallable()
                       throws java.lang.Exception
Future.get on submitted tasks will time out if they compute too long.

Throws:
java.lang.Exception

testDefaultThreadFactory

public void testDefaultThreadFactory()
                              throws java.lang.Exception
ThreadPoolExecutor using defaultThreadFactory has specified group, priority, daemon status, and name

Throws:
java.lang.Exception

testPrivilegedThreadFactory

public void testPrivilegedThreadFactory()
                                 throws java.lang.Exception
ThreadPoolExecutor using privilegedThreadFactory has specified group, priority, daemon status, name, access control context and context class loader

Throws:
java.lang.Exception

testCreatePrivilegedCallableUsingCCLWithNoPrivs

public void testCreatePrivilegedCallableUsingCCLWithNoPrivs()
Without class loader permissions, creating privilegedCallableUsingCurrentClassLoader throws ACE


testprivilegedCallableUsingCCLWithPrivs

public void testprivilegedCallableUsingCCLWithPrivs()
                                             throws java.lang.Exception
With class loader permissions, calling privilegedCallableUsingCurrentClassLoader does not throw ACE

Throws:
java.lang.Exception

testprivilegedCallableWithNoPrivs

public void testprivilegedCallableWithNoPrivs()
                                       throws java.lang.Exception
Without permissions, calling privilegedCallable throws ACE

Throws:
java.lang.Exception

testprivilegedCallableWithPrivs

public void testprivilegedCallableWithPrivs()
                                     throws java.lang.Exception
With permissions, calling privilegedCallable succeeds

Throws:
java.lang.Exception

testCallable1

public void testCallable1()
                   throws java.lang.Exception
callable(Runnable) returns null when called

Throws:
java.lang.Exception

testCallable2

public void testCallable2()
                   throws java.lang.Exception
callable(Runnable, result) returns result when called

Throws:
java.lang.Exception

testCallable3

public void testCallable3()
                   throws java.lang.Exception
callable(PrivilegedAction) returns its result when called

Throws:
java.lang.Exception

testCallable4

public void testCallable4()
                   throws java.lang.Exception
callable(PrivilegedExceptionAction) returns its result when called

Throws:
java.lang.Exception

testCallableNPE1

public void testCallableNPE1()
callable(null Runnable) throws NPE


testCallableNPE2

public void testCallableNPE2()
callable(null, result) throws NPE


testCallableNPE3

public void testCallableNPE3()
callable(null PrivilegedAction) throws NPE


testCallableNPE4

public void testCallableNPE4()
callable(null PrivilegedExceptionAction) throws NPE