diff options
author | Martin Ritchie <ritchiem@apache.org> | 2010-04-12 15:43:36 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2010-04-12 15:43:36 +0000 |
commit | 9460e367862b6e37a9c10eff53ccee457c20087b (patch) | |
tree | 667fa3e030e71a0ffdbf8b46e241b5740c3da529 /java/junit-toolkit/src | |
parent | 478c77e8f2e6f69d3efa8252b0adb255ab7aa331 (diff) | |
download | qpid-python-9460e367862b6e37a9c10eff53ccee457c20087b.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/qpid@933286 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/junit-toolkit/src')
-rw-r--r-- | java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java | 16 | ||||
-rw-r--r-- | java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java b/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java index e0af22cfb7..93e2a3c855 100644 --- a/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java +++ b/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/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java b/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java index d7de2822a2..94dcf5499b 100644 --- a/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java +++ b/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(); |