Search in sources :

Example 6 with ParentTestBean

use of com.canoo.dolphin.integration.parentchild.ParentTestBean in project dolphin-platform by canoo.

the class ParentChildControllerTest method testPostChildCreatedCalledWhenNonChildControllerCreated.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if @PostChildCreated is not called in controller")
public void testPostChildCreatedCalledWhenNonChildControllerCreated(final String containerType, final String endpoint) {
    try {
        ClientContext context = connect(endpoint);
        ControllerProxy<ParentTestBean> controller = createController(context, PARENT_CONTROLLER_NAME);
        Assert.assertTrue(controller.getModel().postCreatedCalledProperty().get());
        Property<Boolean> postChildCreatedProperty = controller.getModel().postChildCreatedCalledProperty();
        Assert.assertNull(postChildCreatedProperty.get());
        controller.createController(DUMMY_CHILD_CONTROLLER_NAME);
        Thread.sleep(1000);
        Assert.assertNull(postChildCreatedProperty.get());
        destroy(controller, endpoint);
        disconnect(context, endpoint);
    } catch (Exception e) {
        Assert.fail("Can not create controller for " + containerType, e);
    }
}
Also used : ClientContext(com.canoo.platform.remoting.client.ClientContext) ParentTestBean(com.canoo.dolphin.integration.parentchild.ParentTestBean) Test(org.testng.annotations.Test)

Aggregations

ParentTestBean (com.canoo.dolphin.integration.parentchild.ParentTestBean)6 ClientContext (com.canoo.platform.remoting.client.ClientContext)6 Test (org.testng.annotations.Test)6 ChildTestBean (com.canoo.dolphin.integration.parentchild.ChildTestBean)1