summaryrefslogtreecommitdiff
path: root/qpid/java/junit-toolkit/src/main
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2010-04-12 15:43:36 +0000
committerMartin Ritchie <ritchiem@apache.org>2010-04-12 15:43:36 +0000
commitd96f592d18e80cab8f73c740b6cb14d612befe36 (patch)
treefbb0dde256deac94dedc27759343cb94f9af007a /qpid/java/junit-toolkit/src/main
parentbca42ad2daf61898e6d3ec53795618c04df212c2 (diff)
downloadqpid-python-d96f592d18e80cab8f73c740b6cb14d612befe36.tar.gz
QPID-2421 : Fixed preFill when numConsumers > 1. This requried the introduction of a new phase in TestThreadAware : postThreadSetup. This ensures that all the threads have correctly setup their clients and so registered their topic subscribers. We can then preFill in the postThreadSetup and reliably receive the data from each of the client's publishers.
Added new sendOnly parameter to allow send only testing with topics where numConsumers must be set. Merged from 0.5.x-dev rev 920389 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@933286 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/junit-toolkit/src/main')
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java16
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java5
2 files changed, 21 insertions, 0 deletions
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java
index e0af22cfb7..93e2a3c855 100644
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java
+++ b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java
@@ -323,6 +323,22 @@ public class ScaledTestDecorator extends WrappedSuiteTestDecorator implements Sh
// Wait until all test threads have completed their setups.
barrier.await();
+
+ // Call setup on all underlying tests in the suite that are thread aware.
+ for (Test childTest : test.getAllUnderlyingTests())
+ {
+ // Check that the test is concurrency aware, so provides a setup method to call.
+ if (childTest instanceof TestThreadAware)
+ {
+ // Call the tests post thread setup.
+ TestThreadAware setupTest = (TestThreadAware) childTest;
+ setupTest.postThreadSetUp();
+ }
+ }
+
+ // Wait until all test threads have completed their prefill.
+ barrier.await();
+
// Start timing the test batch, only after thread setups have completed.
if (testResult instanceof TKTestResult)
{
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java
index d7de2822a2..94dcf5499b 100644
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java
+++ b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java
@@ -43,6 +43,11 @@ public interface TestThreadAware
public void threadSetUp();
/**
+ * Called after all threads have completed their setup.
+ */
+ public void postThreadSetUp();
+
+ /**
* Called when a test thread is destroyed.
*/
public void threadTearDown();