use of com.hazelcast.simulator.worker.operations.StopRunOperation in project hazelcast-simulator by hazelcast.
the class TestCaseRunner method stopRun.
private void stopRun() {
log("Stopping test");
Map<WorkerData, Future> futures = submitToTargets(false, new StopRunOperation(testCase.getId()));
try {
waitForPhaseCompletion(RUN, futures);
log("Stopping test completed");
} catch (TestCaseAbortedException e) {
log(e.getMessage());
}
recordTimestamp("stop");
}
use of com.hazelcast.simulator.worker.operations.StopRunOperation 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();
}
use of com.hazelcast.simulator.worker.operations.StopRunOperation in project hazelcast-simulator by hazelcast.
the class WorkerOperationProcessorTest method test_unhandledException.
// make sure that unhandled exceptions are trapped.
@Test
public void test_unhandledException() throws Exception {
StopRunOperation op = new StopRunOperation("foo");
Exception e = new IndexOutOfBoundsException("");
doThrow(e).when(testManager).stopRun(op);
processor.process(op, sourceAddress, promise);
assertTrue(promise.getAnswer() instanceof IndexOutOfBoundsException);
File exceptionFile = new File(getUserDir(), "1.exception");
assertTrue(exceptionFile.exists());
assertFalse(new File(getUserDir(), "1.exception.tmp").exists());
assertNotNull(fileAsText(exceptionFile));
}
use of com.hazelcast.simulator.worker.operations.StopRunOperation in project hazelcast-simulator by hazelcast.
the class WorkerOperationProcessorTest method test_StopRunOperation.
@Test
public void test_StopRunOperation() throws Exception {
StopRunOperation op = new StopRunOperation("foo");
processor.process(op, sourceAddress, promise);
verify(testManager).stopRun(op);
assertTrue(promise.hasAnswer());
}
Aggregations