summaryrefslogtreecommitdiff
path: root/java/perftests
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2012-05-26 07:45:56 +0000
committerKeith Wall <kwall@apache.org>2012-05-26 07:45:56 +0000
commit285e2be391eb11630cf3ba8a7843194864b5fbef (patch)
tree9c69adbffce549c5b84193c08ec71fb0dc7dd901 /java/perftests
parentdf1d8151da11d551d70e115de4fe22b7221d0f02 (diff)
downloadqpid-python-285e2be391eb11630cf3ba8a7843194864b5fbef.tar.gz
QPID-3936: Java Performance Test Framework.
Fix test highlighed by JDK1.7 build on Apache CI - test approach incompatible with the Junit lifecycle. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1342861 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/perftests')
-rw-r--r--java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java b/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java
index 7a85de99ee..a201a7bacf 100644
--- a/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java
+++ b/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java
@@ -34,15 +34,25 @@ public class ExecutorWithTimeLimitTest extends TestCase
private static final int TIMEOUT = 500;
private static final Object RESULT = new Object();
- private ExecutorWithLimits _limiter = new ExecutorWithTimeLimit(System.currentTimeMillis(), TIMEOUT);
+ private ExecutorWithLimits _limiter;
@SuppressWarnings("unchecked")
private Callable<Object> _callback = mock(Callable.class);
@Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _limiter = new ExecutorWithTimeLimit(System.currentTimeMillis(), TIMEOUT);
+ }
+
+ @Override
protected void tearDown() throws Exception
{
super.tearDown();
- _limiter.shutdown();
+ if (_limiter != null)
+ {
+ _limiter.shutdown();
+ }
}
public void testCallableCompletesNormally() throws Exception
@@ -78,17 +88,20 @@ public class ExecutorWithTimeLimitTest extends TestCase
public void testCallableNotRunDueToInsufficentTimeRemaining() throws Exception
{
long now = System.currentTimeMillis();
- _limiter = new ExecutorWithTimeLimit(now - 100, 100);
-
+ ExecutorWithLimits shortTimeLimiter = new ExecutorWithTimeLimit(now - 100, 100);
try
{
- _limiter.execute(_callback);
+ shortTimeLimiter.execute(_callback);
fail("Exception not thrown");
}
catch (CancellationException ca)
{
// PASS
}
+ finally
+ {
+ shortTimeLimiter.shutdown();
+ }
verify(_callback, never()).call();
}