use of com.hazelcast.simulator.worker.operations.StartPhaseOperation in project hazelcast-simulator by hazelcast.
the class TestCaseRunner method startRun.
/**
* Starts running the test. This call is asynchronous. It will not wait for the running to complete. It will
* return a map of futures (one for each target worker) that can be used to sync on completion.
*/
private Map<WorkerData, Future> startRun() {
log(format("Starting run on %s workers", targetType.toString(targetCount)));
log(format("Test run using workers %s", WorkerData.toAddressString(targets)));
recordTimestamp("start");
return submitToTargets(false, new StartPhaseOperation(RUN, testCase.getId()));
}
use of com.hazelcast.simulator.worker.operations.StartPhaseOperation in project hazelcast-simulator by hazelcast.
the class TestManagerTest method test_startRun.
@Test
public void test_startRun() throws Exception {
TestCase testCase = new TestCase("foo").setProperty("threadCount", 1).setProperty("class", StoppingTest.class);
manager.createTest(new CreateTestOperation(testCase));
StubPromise promise = new StubPromise();
manager.startTestPhase(new StartPhaseOperation(RUN, "foo"), promise);
promise.assertCompletesEventually();
}
use of com.hazelcast.simulator.worker.operations.StartPhaseOperation in project hazelcast-simulator by hazelcast.
the class TestManagerTest method test_whenProblemDuringPhase.
@Test
public void test_whenProblemDuringPhase() throws Exception {
TestCase testCase = new TestCase("foo").setProperty("threadCount", 1).setProperty("class", FailingTest.class);
manager.createTest(new CreateTestOperation(testCase));
StubPromise setupPromise = new StubPromise();
manager.startTestPhase(new StartPhaseOperation(SETUP, "foo"), setupPromise);
setupPromise.assertCompletesEventually();
StubPromise runPromise = new StubPromise();
manager.startTestPhase(new StartPhaseOperation(RUN, "foo"), runPromise);
runPromise.assertCompletesEventually();
System.out.println(runPromise.getAnswer());
assertTrue(runPromise.getAnswer() instanceof Exception);
}
use of com.hazelcast.simulator.worker.operations.StartPhaseOperation in project hazelcast-simulator by hazelcast.
the class TestManagerTest method test_whenLastPhaseCompletes_thenTestRemoved.
@Test
public void test_whenLastPhaseCompletes_thenTestRemoved() throws Exception {
final TestCase testCase = new TestCase("foo").setProperty("threadCount", 1).setProperty("class", TestWithSlowSetup.class);
manager.createTest(new CreateTestOperation(testCase));
// then we call start; this call will not block
StubPromise promise = new StubPromise();
manager.startTestPhase(new StartPhaseOperation(TestPhase.LOCAL_TEARDOWN, "foo"), promise);
// but eventually the promise will complete.
promise.assertCompletesEventually();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(0, manager.getContainers().size());
}
});
}
use of com.hazelcast.simulator.worker.operations.StartPhaseOperation in project hazelcast-simulator by hazelcast.
the class TestManagerTest method test_stopRun.
@Test
public void test_stopRun() throws Exception {
TestCase testCase = new TestCase("foo").setProperty("threadCount", 1).setProperty("class", SuccessTest.class);
manager.createTest(new CreateTestOperation(testCase));
final TestContainer container = manager.getContainers().iterator().next();
// we need to call setup so the test is initialized correctly
StubPromise setupPromise = new StubPromise();
manager.startTestPhase(new StartPhaseOperation(SETUP, "foo"), setupPromise);
setupPromise.assertCompletesEventually();
// then we call start; this call will not block
StubPromise runPromise = new StubPromise();
manager.startTestPhase(new StartPhaseOperation(RUN, "foo"), runPromise);
awaitRunning(container);
// then we eventually call stop
manager.stopRun(new StopRunOperation("foo"));
// and now the test should complete.
runPromise.assertCompletesEventually();
}
Aggregations