use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class TestContainer_TimeStep_ExceptionTest method test.
@Test
public void test() throws Exception {
ExceptionTest testInstance = new ExceptionTest();
TestCase testCase = new TestCase("exceptionTest").setProperty("threadCount", 1).setProperty("class", testInstance.getClass());
TestContextImpl testContext = new TestContextImpl(testCase.getId(), "localhost", mock(Server.class));
final TestContainer container = new TestContainer(testContext, testInstance, testCase);
container.invoke(SETUP);
Future f = spawn(new Callable() {
@Override
public Object call() throws Exception {
container.invoke(RUN);
return null;
}
});
assertCompletesEventually(f);
assertEquals(1L, testInstance.counter.get());
assertException("IllegalStateException", 1);
}
use of com.hazelcast.simulator.common.TestCase 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.TestCase in project hazelcast-simulator by hazelcast.
the class TestContainer_TimeStep_StopTest method test.
@Test
public void test() throws Exception {
TimeStepStopTest testInstance = new TimeStepStopTest();
TestCase testCase = new TestCase("stopRun").setProperty("threadCount", 1).setProperty("class", testInstance.getClass());
TestContextImpl testContext = new TestContextImpl(testCase.getId(), "localhost", mock(Server.class));
final TestContainer container = new TestContainer(testContext, testInstance, testCase);
container.invoke(SETUP);
Future f = spawn(new Callable() {
@Override
public Object call() throws Exception {
container.invoke(RUN);
return null;
}
});
assertCompletesEventually(f);
assertNoExceptions();
}
use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class FailureOperationTest method before.
@Before
public void before() {
testCase = new TestCase(TEST_ID);
cause = new TestException("expected exception");
operation = new FailureOperation("FailureOperationTest", WORKER_EXCEPTION, workerAddress, null, cause);
fullOperation = new FailureOperation("FailureOperationTest", WORKER_EXCEPTION, workerAddress, null, "A1_W1-member", TEST_ID, null).setTestCase(testCase);
}
use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class RegistryTest method testAddTests_testIdFixing.
@Test
public void testAddTests_testIdFixing() {
TestCase test1 = new TestCase("foo");
TestCase test2 = new TestCase("foo");
TestCase test3 = new TestCase("foo");
registry.addTests(new TestSuite().addTest(test1));
registry.addTests(new TestSuite().addTest(test2));
registry.addTests(new TestSuite().addTest(test3));
assertEquals("foo", test1.getId());
assertEquals("foo__1", test2.getId());
assertEquals("foo__2", test3.getId());
}
Aggregations