Search in sources :

Example 71 with TestCase

use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.

the class CoordinatorRunMonolithTest method failing.

@Test
public void failing() throws Exception {
    TestSuite suite = new TestSuite().setDurationSeconds(5).addTest(new TestCase("foo").setProperty("threadCount", 1).setProperty("class", FailingTest.class));
    DeploymentPlan deploymentPlan = new DeploymentPlan(hazelcastDriver, registry.getAgents()).addToPlan(1, "member");
    run.init(deploymentPlan);
    boolean success = run.run(suite);
    assertFalse(success);
}
Also used : TestCase(com.hazelcast.simulator.common.TestCase) FailingTest(com.hazelcast.simulator.tests.FailingTest) SuccessTest(com.hazelcast.simulator.tests.SuccessTest) Test(org.junit.Test) FailingTest(com.hazelcast.simulator.tests.FailingTest)

Example 72 with TestCase

use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.

the class CoordinatorRunMonolithTest method success.

@Test
public void success() throws Exception {
    TestSuite suite = new TestSuite().setDurationSeconds(5).addTest(new TestCase("foo").setProperty("threadCount", 1).setProperty("class", SuccessTest.class));
    DeploymentPlan deploymentPlan = new DeploymentPlan(hazelcastDriver, registry.getAgents()).addToPlan(1, "member");
    run.init(deploymentPlan);
    boolean success = run.run(suite);
    assertTrue(success);
}
Also used : TestCase(com.hazelcast.simulator.common.TestCase) SuccessTest(com.hazelcast.simulator.tests.SuccessTest) SuccessTest(com.hazelcast.simulator.tests.SuccessTest) Test(org.junit.Test) FailingTest(com.hazelcast.simulator.tests.FailingTest)

Example 73 with TestCase

use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.

the class RegistryTest method testGetTests.

// @Test
// public void testRemoveTests() {
// TestSuite testSuite1 = new TestSuite()
// .addTest(new TestCase("Test1a"))
// .addTest(new TestCase("Test1b"));
// registry.addTests(testSuite1);
// 
// TestSuite testSuite2 = new TestSuite()
// .addTest(new TestCase("Test2a"))
// .addTest(new TestCase("Test2b"));
// registry.addTests(testSuite2);
// 
// registry.removeTests(testSuite1);
// 
// assertEquals(2, registry.testCount());
// for (TestData testData : registry.getTests()) {
// assertSame(testSuite2, testData.getTestSuite());
// }
// }
@Test
public void testGetTests() {
    TestSuite testSuite = new TestSuite();
    testSuite.addTest(new TestCase("Test1"));
    testSuite.addTest(new TestCase("Test2"));
    testSuite.addTest(new TestCase("Test3"));
    registry.addTests(testSuite);
    Collection<TestData> tests = registry.getTests();
    assertEquals(3, tests.size());
    for (TestData testData : tests) {
        assertTrue(testData.getTestCase().getId().startsWith("Test"));
    }
}
Also used : TestSuite(com.hazelcast.simulator.coordinator.TestSuite) TestCase(com.hazelcast.simulator.common.TestCase) Test(org.junit.Test)

Example 74 with TestCase

use of com.hazelcast.simulator.common.TestCase in project hazelcast-simulator by hazelcast.

the class RegistryTest method testGetTest.

@Test
public void testGetTest() {
    TestSuite testSuite = new TestSuite();
    testSuite.addTest(new TestCase("Test1"));
    testSuite.addTest(new TestCase("Test2"));
    testSuite.addTest(new TestCase("Test3"));
    registry.addTests(testSuite);
    TestData testData = registry.getTest("Test2");
    assertEquals(2, testData.getTestIndex());
    assertEquals("Test2", testData.getTestCase().getId());
}
Also used : TestSuite(com.hazelcast.simulator.coordinator.TestSuite) TestCase(com.hazelcast.simulator.common.TestCase) Test(org.junit.Test)

Aggregations

TestCase (com.hazelcast.simulator.common.TestCase)74 Test (org.junit.Test)61 Server (com.hazelcast.simulator.protocol.Server)18 SuccessTest (com.hazelcast.simulator.tests.SuccessTest)13 Callable (java.util.concurrent.Callable)11 Future (java.util.concurrent.Future)11 FailingTest (com.hazelcast.simulator.tests.FailingTest)10 CreateTestOperation (com.hazelcast.simulator.worker.operations.CreateTestOperation)9 StoppingTest (com.hazelcast.simulator.tests.StoppingTest)8 TestPhase (com.hazelcast.simulator.common.TestPhase)7 StubPromise (com.hazelcast.simulator.protocol.StubPromise)6 StartPhaseOperation (com.hazelcast.simulator.worker.operations.StartPhaseOperation)6 StopException (com.hazelcast.simulator.test.StopException)5 TestSuite (com.hazelcast.simulator.coordinator.TestSuite)4 BusySpinningMetronome (com.hazelcast.simulator.worker.metronome.BusySpinningMetronome)4 EmptyMetronome (com.hazelcast.simulator.worker.metronome.EmptyMetronome)4 Metronome (com.hazelcast.simulator.worker.metronome.Metronome)4 SleepingMetronome (com.hazelcast.simulator.worker.metronome.SleepingMetronome)4 BaseThreadState (com.hazelcast.simulator.test.BaseThreadState)2 HashMap (java.util.HashMap)2