From 80d234c7c782b2778676508762a41c84a9ebe9d3 Mon Sep 17 00:00:00 2001 From: Rupert Smith Date: Thu, 29 Nov 2007 12:07:25 +0000 Subject: Changed in vm broker creation so that it is an injected set task. This means the in vm broker is created on every test. Threaded tests can optionally do it on a per-thread basis instead using this approach. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@599400 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/test/testcases/MessageThroughputPerf.java | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'java/perftests/src') diff --git a/java/perftests/src/main/java/org/apache/qpid/test/testcases/MessageThroughputPerf.java b/java/perftests/src/main/java/org/apache/qpid/test/testcases/MessageThroughputPerf.java index 887479c032..663bc11717 100644 --- a/java/perftests/src/main/java/org/apache/qpid/test/testcases/MessageThroughputPerf.java +++ b/java/perftests/src/main/java/org/apache/qpid/test/testcases/MessageThroughputPerf.java @@ -24,6 +24,7 @@ import junit.framework.Test; import junit.framework.TestSuite; import org.apache.log4j.Logger; +import org.apache.log4j.NDC; import org.apache.qpid.test.framework.Assertion; import org.apache.qpid.test.framework.Circuit; @@ -45,7 +46,7 @@ import java.util.LinkedList; * *

*
CRC Card
Responsibilities Collaborations - *
+ *
Measure message throughput accross a test circuit. {@link Circuit} *
* * @todo Check that all of the messages were sent. Check that the receiving end got the same number of messages as @@ -116,11 +117,34 @@ public class MessageThroughputPerf extends FrameworkBaseCase implements TimingCo timingController = controller; } + /** + * Overrides the parent setUp method so that the in-vm broker creation is not done on a per test basis. + * + * @throws Exception Any exceptions allowed to fall through and fail the test. + */ + protected void setUp() throws Exception + { + NDC.push(getName()); + + testProps = TestContextProperties.getInstance(MessagingTestConfigProperties.defaults); + } + + /** + * Overrides the parent setUp method so that the in-vm broker clean-up is not done on a per test basis. + */ + protected void tearDown() + { + NDC.pop(); + } + /** * Performs test fixture creation on a per thread basis. This will only be called once for each test thread. */ public void threadSetUp() { + // Run the test setup tasks. This may create an in-vm broker, if a decorator has injected a task for this. + taskHandler.runSetupTasks(); + // Get the test parameters, any overrides on the command line will have been applied. ParsedProperties testProps = TestContextProperties.getInstance(MessagingTestConfigProperties.defaults); @@ -144,7 +168,10 @@ public class MessageThroughputPerf extends FrameworkBaseCase implements TimingCo * Called when a test thread is destroyed. */ public void threadTearDown() - { } + { + // Run the test teardown tasks. This may destroy the in-vm broker, if a decorator has injected a task for this. + taskHandler.runSetupTasks(); + } /** * Holds the per-thread test configurations. -- cgit v1.2.1