summaryrefslogtreecommitdiff
path: root/java/junit-toolkit/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/junit-toolkit/src')
-rw-r--r--java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java16
-rw-r--r--java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java5
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();