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);
}
}
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();
}
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;
}
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;
}
Aggregations