summaryrefslogtreecommitdiff
path: root/qpid/java
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
commitc9c9bb94e42523b29e8bd3cc7e07aee59fcb96d4 (patch)
tree32286081b5e8a3ee1e8801bd419998d8c2156bf8 /qpid/java
parentc4252b4297e277f263154a8bb896fb160cfbca7d (diff)
downloadqpid-python-c9c9bb94e42523b29e8bd3cc7e07aee59fcb96d4.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@1342861 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java
index 7a85de99ee..a201a7bacf 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java
+++ b/qpid/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();
}