Search in sources :

Example 1 with TestCaseRunner

use of com.hazelcast.simulator.coordinator.TestCaseRunner in project hazelcast-simulator by hazelcast.

the class RunTestSuiteTask method runParallel.

private boolean runParallel() {
    final AtomicBoolean success = new AtomicBoolean(true);
    ThreadSpawner spawner = new ThreadSpawner("runParallel", true);
    for (final TestCaseRunner runner : runners) {
        spawner.spawn(new Runnable() {

            @Override
            public void run() {
                try {
                    if (!runner.run()) {
                        success.set(false);
                    }
                } catch (Exception e) {
                    throw rethrow(e);
                }
            }
        });
    }
    spawner.awaitCompletion();
    return success.get();
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TestCaseRunner(com.hazelcast.simulator.coordinator.TestCaseRunner) ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner)

Example 2 with TestCaseRunner

use of com.hazelcast.simulator.coordinator.TestCaseRunner in project hazelcast-simulator by hazelcast.

the class RunTestSuiteTask method run0.

private boolean run0(List<TestData> tests, List<WorkerData> targets) {
    int testCount = testSuite.size();
    boolean parallel = testSuite.isParallel() && testCount > 1;
    Map<TestPhase, CountDownLatch> testPhaseSyncMap = getTestPhaseSyncMap(testCount, parallel, coordinatorParameters.getLastTestPhaseToSync());
    LOGGER.info("Starting TestSuite");
    echoTestSuiteDuration(parallel);
    for (TestData test : tests) {
        int testIndex = test.getTestIndex();
        TestCase testCase = test.getTestCase();
        LOGGER.info(format("Configuration for %s (T%d):%n%s", testCase.getId(), testIndex, testCase));
        TestCaseRunner runner = new TestCaseRunner(test, coordinatorParameters, targets, client, testPhaseSyncMap, failureCollector, registry, performanceStatsCollector);
        runners.add(runner);
    }
    echoTestSuiteStart(testCount, parallel);
    long started = System.nanoTime();
    boolean success = parallel ? runParallel() : runSequential();
    echoTestSuiteEnd(testCount, started);
    return success;
}
Also used : TestData(com.hazelcast.simulator.coordinator.registry.TestData) TestCase(com.hazelcast.simulator.common.TestCase) TestPhase(com.hazelcast.simulator.common.TestPhase) TestCaseRunner(com.hazelcast.simulator.coordinator.TestCaseRunner) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

TestCaseRunner (com.hazelcast.simulator.coordinator.TestCaseRunner)2 TestCase (com.hazelcast.simulator.common.TestCase)1 TestPhase (com.hazelcast.simulator.common.TestPhase)1 TestData (com.hazelcast.simulator.coordinator.registry.TestData)1 ThreadSpawner (com.hazelcast.simulator.utils.ThreadSpawner)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1