Search in sources :

Example 6 with CreateTestOperation

use of com.hazelcast.simulator.worker.operations.CreateTestOperation in project hazelcast-simulator by hazelcast.

the class TestManagerTest method test_createTest.

@Test
public void test_createTest() {
    TestCase testCase = new TestCase("foo").setProperty("class", SuccessTest.class);
    CreateTestOperation op = new CreateTestOperation(testCase);
    manager.createTest(op);
    Collection<TestContainer> containers = manager.getContainers();
    assertEquals(1, containers.size());
}
Also used : CreateTestOperation(com.hazelcast.simulator.worker.operations.CreateTestOperation) TestCase(com.hazelcast.simulator.common.TestCase) SuccessTest(com.hazelcast.simulator.tests.SuccessTest) FailingTest(com.hazelcast.simulator.tests.FailingTest) Test(org.junit.Test) StoppingTest(com.hazelcast.simulator.tests.StoppingTest)

Example 7 with CreateTestOperation

use of com.hazelcast.simulator.worker.operations.CreateTestOperation in project hazelcast-simulator by hazelcast.

the class WorkerOperationProcessorTest method test_CreateTestOperation.

@Test
public void test_CreateTestOperation() throws Exception {
    CreateTestOperation op = new CreateTestOperation(new TestCase("foo"));
    processor.process(op, sourceAddress, promise);
    verify(testManager).createTest(op);
    assertTrue(promise.hasAnswer());
}
Also used : CreateTestOperation(com.hazelcast.simulator.worker.operations.CreateTestOperation) TestCase(com.hazelcast.simulator.common.TestCase) Test(org.junit.Test)

Example 8 with CreateTestOperation

use of com.hazelcast.simulator.worker.operations.CreateTestOperation in project hazelcast-simulator by hazelcast.

the class TestManagerTest method test_startPhase_whenPreviousPhaseStillRunning.

@Test
public void test_startPhase_whenPreviousPhaseStillRunning() 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();
    // do the setup first (needed)
    StubPromise setupPromise = new StubPromise();
    manager.startTestPhase(new StartPhaseOperation(SETUP, "foo"), setupPromise);
    setupPromise.assertCompletesEventually();
    // then start with the run phase
    manager.startTestPhase(new StartPhaseOperation(RUN, "foo"), mock(Promise.class));
    awaitRunning(container);
    // and while the run phase is running, we'll try to do a tear down
    StubPromise promise = new StubPromise();
    manager.startTestPhase(new StartPhaseOperation(LOCAL_TEARDOWN, "foo"), promise);
    promise.assertCompletesEventually();
    assertTrue(promise.getAnswer() instanceof IllegalStateException);
}
Also used : CreateTestOperation(com.hazelcast.simulator.worker.operations.CreateTestOperation) StubPromise(com.hazelcast.simulator.protocol.StubPromise) Promise(com.hazelcast.simulator.protocol.Promise) TestCase(com.hazelcast.simulator.common.TestCase) StubPromise(com.hazelcast.simulator.protocol.StubPromise) StartPhaseOperation(com.hazelcast.simulator.worker.operations.StartPhaseOperation) SuccessTest(com.hazelcast.simulator.tests.SuccessTest) FailingTest(com.hazelcast.simulator.tests.FailingTest) Test(org.junit.Test) StoppingTest(com.hazelcast.simulator.tests.StoppingTest)

Example 9 with CreateTestOperation

use of com.hazelcast.simulator.worker.operations.CreateTestOperation in project hazelcast-simulator by hazelcast.

the class TestManagerTest method test_createTest_whenTestExist.

@Test(expected = IllegalStateException.class)
public void test_createTest_whenTestExist() {
    TestCase testCase = new TestCase("foo").setProperty("class", SuccessTest.class);
    CreateTestOperation op = new CreateTestOperation(testCase);
    manager.createTest(op);
    // duplicate.
    manager.createTest(op);
}
Also used : CreateTestOperation(com.hazelcast.simulator.worker.operations.CreateTestOperation) TestCase(com.hazelcast.simulator.common.TestCase) SuccessTest(com.hazelcast.simulator.tests.SuccessTest) FailingTest(com.hazelcast.simulator.tests.FailingTest) Test(org.junit.Test) StoppingTest(com.hazelcast.simulator.tests.StoppingTest)

Example 10 with CreateTestOperation

use of com.hazelcast.simulator.worker.operations.CreateTestOperation in project hazelcast-simulator by hazelcast.

the class TestCaseRunner method createTest.

private void createTest() {
    log("Starting Test initialization");
    invokeOnTargets(new CreateTestOperation(testCase));
    log("Completed Test initialization");
}
Also used : CreateTestOperation(com.hazelcast.simulator.worker.operations.CreateTestOperation)

Aggregations

CreateTestOperation (com.hazelcast.simulator.worker.operations.CreateTestOperation)11 Test (org.junit.Test)10 TestCase (com.hazelcast.simulator.common.TestCase)9 FailingTest (com.hazelcast.simulator.tests.FailingTest)8 StoppingTest (com.hazelcast.simulator.tests.StoppingTest)8 SuccessTest (com.hazelcast.simulator.tests.SuccessTest)8 StubPromise (com.hazelcast.simulator.protocol.StubPromise)6 StartPhaseOperation (com.hazelcast.simulator.worker.operations.StartPhaseOperation)6 Promise (com.hazelcast.simulator.protocol.Promise)1 AssertTask (com.hazelcast.simulator.utils.AssertTask)1 StopRunOperation (com.hazelcast.simulator.worker.operations.StopRunOperation)1