use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class PropertyBindingTest method loadAsDouble_existing.
@Test
public void loadAsDouble_existing() {
TestCase testCase = new TestCase("foo").setProperty("doubleValue", 50d);
PropertyBinding binding = new PropertyBinding(testCase);
assertEquals(50, binding.loadAsDouble("doubleValue", 10), 0.1);
}
use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class PropertyBindingTest method loadAsInt_existing.
@Test
public void loadAsInt_existing() {
TestCase testCase = new TestCase("foo").setProperty("intValue", 50);
PropertyBinding binding = new PropertyBinding(testCase);
assertEquals(50, binding.loadAsInt("intValue", 10));
}
use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class TestContainer_BasicTest method testConstructor_withTestcase.
@Test
public void testConstructor_withTestcase() {
TestCase testCase = new TestCase("TestContainerWithTestcaseTest").setProperty("class", SuccessTest.class.getName());
testContainer = new TestContainer(testContext, testCase, (Object) null);
assertNotNull(testContainer.getTestInstance());
assertTrue(testContainer.getTestInstance() instanceof SuccessTest);
}
use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class TestContainer_BasicTest method testConstructor_withNullTestContext_withTestCase.
@Test(expected = NullPointerException.class)
public void testConstructor_withNullTestContext_withTestCase() {
TestCase testCase = new TestCase("TestContainerNullContextTest").setProperty("class", SuccessTest.class);
new TestContainer(null, testCase, (Object) null);
}
use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class TestContainer_TimeStepTest method testWithAllPhases.
@Test
public void testWithAllPhases() throws Exception {
int threadCount = 2;
TestWithAllTimeStepPhases testInstance = new TestWithAllTimeStepPhases();
TestCase testCase = new TestCase("id").setProperty("threadCount", threadCount).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 runFuture = spawn(new Callable() {
@Override
public Object call() throws Exception {
container.invoke(RUN);
return null;
}
});
Thread.sleep(5000);
testContext.stop();
runFuture.get();
container.invoke(TestPhase.LOCAL_TEARDOWN);
assertEquals(threadCount, testInstance.beforeRunCount.get());
assertEquals(threadCount, testInstance.afterRunCount.get());
assertTrue(testInstance.timeStepCount.get() > 100);
}
Aggregations