Search in sources :

Example 1 with RunLaterTestBean

use of com.canoo.dolphin.integration.runlater.RunLaterTestBean in project dolphin-platform by canoo.

the class RunLaterControllerTest method testRunLaterInPostConstruct.

@Test
public void testRunLaterInPostConstruct() {
    // given:
    final ControllerUnderTest<RunLaterTestBean> controller = createController(RUN_LATER_CONTROLLER_NAME);
    final RunLaterTestBean model = controller.getModel();
    // then
    Assert.assertNotNull(model.getPostConstructPreRunLaterCallIndex());
    Assert.assertNotNull(model.getPostConstructRunLaterCallIndex());
    Assert.assertNotNull(model.getPostConstructPostRunLaterCallIndex());
    Assert.assertTrue(model.getPostConstructPreRunLaterCallIndex() > 0);
    Assert.assertTrue(model.getPostConstructRunLaterCallIndex() > 0);
    Assert.assertTrue(model.getPostConstructPostRunLaterCallIndex() > 0);
    Assert.assertTrue(model.getPostConstructPreRunLaterCallIndex() < model.getPostConstructPostRunLaterCallIndex());
    Assert.assertTrue(model.getPostConstructPostRunLaterCallIndex() < model.getPostConstructRunLaterCallIndex());
}
Also used : RunLaterTestBean(com.canoo.dolphin.integration.runlater.RunLaterTestBean) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) Test(org.testng.annotations.Test) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Example 2 with RunLaterTestBean

use of com.canoo.dolphin.integration.runlater.RunLaterTestBean in project dolphin-platform by canoo.

the class RunLaterControllerTest method testRunLaterInAction.

@Test
public void testRunLaterInAction() {
    // given:
    final ControllerUnderTest<RunLaterTestBean> controller = createController(RUN_LATER_CONTROLLER_NAME);
    final RunLaterTestBean model = controller.getModel();
    // when:
    controller.invoke(RUN_LATER_ACTION_NAME);
    // then:
    Assert.assertNotNull(model.getActionPreRunLaterCallIndex());
    Assert.assertNotNull(model.getActionRunLaterCallIndex());
    Assert.assertNotNull(model.getActionPostRunLaterCallIndex());
    Assert.assertTrue(model.getActionPreRunLaterCallIndex() > 0);
    Assert.assertTrue(model.getActionRunLaterCallIndex() > 0);
    Assert.assertTrue(model.getActionPostRunLaterCallIndex() > 0);
    Assert.assertTrue(model.getActionPreRunLaterCallIndex() < model.getActionPostRunLaterCallIndex());
    Assert.assertTrue(model.getActionPostRunLaterCallIndex() < model.getActionRunLaterCallIndex());
}
Also used : RunLaterTestBean(com.canoo.dolphin.integration.runlater.RunLaterTestBean) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) Test(org.testng.annotations.Test) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Example 3 with RunLaterTestBean

use of com.canoo.dolphin.integration.runlater.RunLaterTestBean in project dolphin-platform by canoo.

the class RunLaterControllerTest method testRunLaterAsyncInAction.

@Test
public void testRunLaterAsyncInAction() throws Exception {
    // given:
    final ControllerUnderTest<RunLaterTestBean> controller = createController(RUN_LATER_CONTROLLER_NAME);
    final RunLaterTestBean model = controller.getModel();
    final CommunicationMonitor monitor = controller.createMonitor();
    model.actionRunLaterAsyncCallIndexProperty().onChanged(e -> {
        monitor.signal();
    });
    // when:
    controller.invoke(RUN_LATER_ASYNC_ACTION_NAME);
    monitor.await(10, TimeUnit.SECONDS);
    // then:
    Assert.assertNotNull(model.getActionPreRunLaterAsyncCallIndex());
    Assert.assertNotNull(model.getActionRunLaterAsyncCallIndex());
    Assert.assertNotNull(model.getActionPostRunLaterAsyncCallIndex());
    Assert.assertTrue(model.getActionPreRunLaterAsyncCallIndex() > 0);
    Assert.assertTrue(model.getActionRunLaterAsyncCallIndex() > 0);
    Assert.assertTrue(model.getActionPostRunLaterAsyncCallIndex() > 0);
    Assert.assertTrue(model.getActionPreRunLaterAsyncCallIndex() < model.getActionPostRunLaterAsyncCallIndex());
    Assert.assertTrue(model.getActionPostRunLaterAsyncCallIndex() < model.getActionRunLaterAsyncCallIndex());
}
Also used : CommunicationMonitor(com.canoo.platform.spring.test.CommunicationMonitor) RunLaterTestBean(com.canoo.dolphin.integration.runlater.RunLaterTestBean) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) Test(org.testng.annotations.Test) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Aggregations

RunLaterTestBean (com.canoo.dolphin.integration.runlater.RunLaterTestBean)3 ControllerUnderTest (com.canoo.platform.spring.test.ControllerUnderTest)3 SpringTestNGControllerTest (com.canoo.platform.spring.test.SpringTestNGControllerTest)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 Test (org.testng.annotations.Test)3 CommunicationMonitor (com.canoo.platform.spring.test.CommunicationMonitor)1