use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class PropertyBindingTest method loadAsLong_existing_withUnderscores.
@Test
public void loadAsLong_existing_withUnderscores() {
TestCase testCase = new TestCase("foo").setProperty("longValue", "5_0");
PropertyBinding binding = new PropertyBinding(testCase);
assertEquals(50, binding.loadAsLong("longValue", 10));
}
use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class PropertyBindingTest method loadAsClass_nonExisting.
@Test
public void loadAsClass_nonExisting() {
TestCase testCase = new TestCase("foo");
PropertyBinding binding = new PropertyBinding(testCase);
assertEquals(Long.class, binding.loadAsClass("classValue", Long.class));
}
use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class TestContainer_BasicTest method testConstructor_withTestClassInstance.
@Test
public void testConstructor_withTestClassInstance() {
SuccessTest test = new SuccessTest();
testContainer = new TestContainer(testContext, test, new TestCase("foo"));
assertEquals(test, testContainer.getTestInstance());
assertTrue(testContainer.getTestInstance() instanceof SuccessTest);
}
use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.
the class TestContainer_TimeStepTest method testWithThreadState.
@Test
public void testWithThreadState() throws Exception {
int threadCount = 2;
TestWithThreadState testInstance = new TestWithThreadState();
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.map.size());
// each context should be unique
Set<BaseThreadState> threadStates = new HashSet<BaseThreadState>(testInstance.map.values());
assertEquals(threadCount, threadStates.size());
}
use of com.hazelcast.simulator.common.TestCase 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());
}
Aggregations