Keel 2.1RC2

org.apache.excalibur.event.command.test
Class TPCThreadManagerTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.excalibur.event.command.test.TPCThreadManagerTestCase
All Implemented Interfaces:
junit.framework.Test

public class TPCThreadManagerTestCase
extends junit.framework.TestCase

Author:

Nested Class Summary
private static class TPCThreadManagerTestCase.Pipeline
           
 
Field Summary
private static int MINIMAL_NUMBER_INVOCATIONS
           
private static int SCHEDULING_TIMEOUT
           
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
TPCThreadManagerTestCase(java.lang.String name)
          Constructor for JUnit
 
Method Summary
private  Parameters createParameters(int threadsPerProcessor, long sleep)
           
 void testThreadContention()
          Checks TPCThreadManager ability to survive the situation when it tries to schedule more tasks than it has threads.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SCHEDULING_TIMEOUT

private static final int SCHEDULING_TIMEOUT
See Also:
Constant Field Values

MINIMAL_NUMBER_INVOCATIONS

private static final int MINIMAL_NUMBER_INVOCATIONS
See Also:
Constant Field Values
Constructor Detail

TPCThreadManagerTestCase

public TPCThreadManagerTestCase(java.lang.String name)
Constructor for JUnit

Parameters:
name - The name of the test
Method Detail

createParameters

private Parameters createParameters(int threadsPerProcessor,
                                    long sleep)

testThreadContention

public void testThreadContention()
                          throws java.lang.Exception
Checks TPCThreadManager ability to survive the situation when it tries to schedule more tasks than it has threads. Originally it was dying due to hitting Pool limit and not catching the resulting runtime exception.

The test is not foolproof, it probably depends on preemtive threads management.

Throws:
java.lang.Exception - on error

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.