Class CyclicBarrierTest

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

public class CyclicBarrierTest
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
CyclicBarrierTest()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testAwait1_Interrupted_BrokenBarrier()
          An interruption in one party causes others waiting in await to throw BrokenBarrierException
 void testAwait2_Interrupted_BrokenBarrier()
          An interruption in one party causes others waiting in timed await to throw BrokenBarrierException
 void testAwait3_TimeOutException()
          A timeout in timed await throws TimeoutException
 void testAwait4_Timeout_BrokenBarrier()
          A timeout in one party causes others waiting in timed await to throw BrokenBarrierException
 void testAwait5_Timeout_BrokenBarrier()
          A timeout in one party causes others waiting in await to throw BrokenBarrierException
 void testBarrierAction()
          The supplied barrier action is run at barrier
 void testConstructor1()
          Creating with negative parties throws IAE
 void testConstructor2()
          Creating with negative parties and no action throws IAE
 void testGetParties()
          getParties returns the number of parties given in constructor
 void testReset_BrokenBarrier()
          A reset of an active barrier causes waiting threads to throw BrokenBarrierException
 void testReset_Leakage()
          All threads block while a barrier is broken.
 void testReset_NoBrokenBarrier()
          A reset before threads enter barrier does not throw BrokenBarrierException
 void testResetAfterCommandException()
          Reset of a barrier after a failed command reinitializes it.
 void testResetAfterInterrupt()
          Reset of a barrier after interruption reinitializes it.
 void testResetAfterTimeout()
          Reset of a barrier after timeout reinitializes it.
 void testResetWithoutBreakage()
          Reset of a non-broken barrier does not break barrier
 void testSingleParty()
          A 1-party barrier triggers after single await
 void testTwoParties()
          A 2-party/thread barrier triggers after both threads invoke await
 
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

CyclicBarrierTest

public CyclicBarrierTest()
Method Detail

main

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

suite

public static junit.framework.Test suite()

testConstructor1

public void testConstructor1()
Creating with negative parties throws IAE


testConstructor2

public void testConstructor2()
Creating with negative parties and no action throws IAE


testGetParties

public void testGetParties()
getParties returns the number of parties given in constructor


testSingleParty

public void testSingleParty()
                     throws java.lang.Exception
A 1-party barrier triggers after single await

Throws:
java.lang.Exception

testBarrierAction

public void testBarrierAction()
                       throws java.lang.Exception
The supplied barrier action is run at barrier

Throws:
java.lang.Exception

testTwoParties

public void testTwoParties()
                    throws java.lang.Exception
A 2-party/thread barrier triggers after both threads invoke await

Throws:
java.lang.Exception

testAwait1_Interrupted_BrokenBarrier

public void testAwait1_Interrupted_BrokenBarrier()
                                          throws java.lang.Exception
An interruption in one party causes others waiting in await to throw BrokenBarrierException

Throws:
java.lang.Exception

testAwait2_Interrupted_BrokenBarrier

public void testAwait2_Interrupted_BrokenBarrier()
                                          throws java.lang.Exception
An interruption in one party causes others waiting in timed await to throw BrokenBarrierException

Throws:
java.lang.Exception

testAwait3_TimeOutException

public void testAwait3_TimeOutException()
                                 throws java.lang.InterruptedException
A timeout in timed await throws TimeoutException

Throws:
java.lang.InterruptedException

testAwait4_Timeout_BrokenBarrier

public void testAwait4_Timeout_BrokenBarrier()
                                      throws java.lang.InterruptedException
A timeout in one party causes others waiting in timed await to throw BrokenBarrierException

Throws:
java.lang.InterruptedException

testAwait5_Timeout_BrokenBarrier

public void testAwait5_Timeout_BrokenBarrier()
                                      throws java.lang.InterruptedException
A timeout in one party causes others waiting in await to throw BrokenBarrierException

Throws:
java.lang.InterruptedException

testReset_BrokenBarrier

public void testReset_BrokenBarrier()
                             throws java.lang.InterruptedException
A reset of an active barrier causes waiting threads to throw BrokenBarrierException

Throws:
java.lang.InterruptedException

testReset_NoBrokenBarrier

public void testReset_NoBrokenBarrier()
                               throws java.lang.Exception
A reset before threads enter barrier does not throw BrokenBarrierException

Throws:
java.lang.Exception

testReset_Leakage

public void testReset_Leakage()
                       throws java.lang.InterruptedException
All threads block while a barrier is broken.

Throws:
java.lang.InterruptedException

testResetWithoutBreakage

public void testResetWithoutBreakage()
                              throws java.lang.Exception
Reset of a non-broken barrier does not break barrier

Throws:
java.lang.Exception

testResetAfterInterrupt

public void testResetAfterInterrupt()
                             throws java.lang.Exception
Reset of a barrier after interruption reinitializes it.

Throws:
java.lang.Exception

testResetAfterTimeout

public void testResetAfterTimeout()
                           throws java.lang.Exception
Reset of a barrier after timeout reinitializes it.

Throws:
java.lang.Exception

testResetAfterCommandException

public void testResetAfterCommandException()
                                    throws java.lang.Exception
Reset of a barrier after a failed command reinitializes it.

Throws:
java.lang.Exception