Search in sources :

Example 6 with TestPhase

use of com.hazelcast.simulator.common.TestPhase in project hazelcast-simulator by hazelcast.

the class TestContainer_TimeStep_LogFrequencyTest method test.

@Test
public void test() throws Exception {
    LogFrequencyTest testInstance = new LogFrequencyTest();
    TestCase testCase = new TestCase("test").setProperty("logFrequency", 1000).setProperty("threadCount", 1).setProperty("class", testInstance.getClass());
    TestContextImpl testContext = new TestContextImpl(testCase.getId(), "localhost", mock(Server.class));
    TestContainer container = new TestContainer(testContext, testInstance, testCase, mock(HazelcastInstance.class));
    for (TestPhase phase : TestPhase.values()) {
        container.invoke(phase);
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Server(com.hazelcast.simulator.protocol.Server) TestCase(com.hazelcast.simulator.common.TestCase) TestPhase(com.hazelcast.simulator.common.TestPhase) AbstractTest(com.hazelcast.simulator.test.AbstractTest) Test(org.junit.Test)

Example 7 with TestPhase

use of com.hazelcast.simulator.common.TestPhase in project hazelcast-simulator by hazelcast.

the class TestManager method startTestPhase.

public void startTestPhase(StartPhaseOperation op, Promise promise) throws Exception {
    TestPhase testPhase = op.getTestPhase();
    String testId = op.getTestId();
    TestContainer testContainer = tests.get(testId);
    if (testContainer == null) {
        throw new IllegalArgumentException(format("Could not start phase [%s] , test [%s] is not found.", testPhase, testId));
    }
    new TestPhaseThread(testContainer, testPhase, testId, promise).start();
}
Also used : TestPhase(com.hazelcast.simulator.common.TestPhase) TestPhase.getLastTestPhase(com.hazelcast.simulator.common.TestPhase.getLastTestPhase)

Example 8 with TestPhase

use of com.hazelcast.simulator.common.TestPhase in project hazelcast-simulator by hazelcast.

the class TestContainer_TimeStep_AsyncSupportTest method createContainerAndRunTestInstance.

private TestContainer createContainerAndRunTestInstance(Object testInstance, int totalIterationCount) throws Exception {
    TestCase testCase = new TestCase("test").setProperty("iterations", totalIterationCount).setProperty("threadCount", 1).setProperty("class", testInstance.getClass());
    TestContextImpl testContext = new TestContextImpl(testCase.getId(), "localhost", mock(Server.class));
    TestContainer container = new TestContainer(testContext, testInstance, testCase);
    for (TestPhase phase : TestPhase.values()) {
        container.invoke(phase);
    }
    return container;
}
Also used : Server(com.hazelcast.simulator.protocol.Server) TestCase(com.hazelcast.simulator.common.TestCase) TestPhase(com.hazelcast.simulator.common.TestPhase)

Example 9 with TestPhase

use of com.hazelcast.simulator.common.TestPhase 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

TestPhase (com.hazelcast.simulator.common.TestPhase)9 TestCase (com.hazelcast.simulator.common.TestCase)7 Server (com.hazelcast.simulator.protocol.Server)6 Test (org.junit.Test)5 CountDownLatch (java.util.concurrent.CountDownLatch)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 TestPhase.getLastTestPhase (com.hazelcast.simulator.common.TestPhase.getLastTestPhase)1 TestCaseRunner (com.hazelcast.simulator.coordinator.TestCaseRunner)1 TestData (com.hazelcast.simulator.coordinator.registry.TestData)1 AbstractTest (com.hazelcast.simulator.test.AbstractTest)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1