Search in sources :

Example 1 with EnterpriseTestBean

use of com.canoo.dolphin.integration.enterprise.EnterpriseTestBean in project dolphin-platform by canoo.

the class EnterpriseControllerTest method testCreateController.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if controller and model can be created")
public void testCreateController(String containerType, String endpoint) {
    try {
        ClientContext context = connect(endpoint);
        ControllerProxy<EnterpriseTestBean> controller = createController(context, ENTERPRISE_CONTROLLER_NAME);
        Assert.assertNotNull(controller);
        Assert.assertNotNull(controller.getModel());
        Assert.assertEquals(controller.getModel().getClass(), EnterpriseTestBean.class);
        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) EnterpriseTestBean(com.canoo.dolphin.integration.enterprise.EnterpriseTestBean) Test(org.testng.annotations.Test)

Example 2 with EnterpriseTestBean

use of com.canoo.dolphin.integration.enterprise.EnterpriseTestBean in project dolphin-platform by canoo.

the class EnterpriseControllerTest method testPostConstruct.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if @PostConstruct is called in controller")
public void testPostConstruct(String containerType, String endpoint) {
    try {
        ClientContext context = connect(endpoint);
        ControllerProxy<EnterpriseTestBean> controller = createController(context, ENTERPRISE_CONTROLLER_NAME);
        Assert.assertTrue(controller.getModel().getPostConstructCalled());
        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) EnterpriseTestBean(com.canoo.dolphin.integration.enterprise.EnterpriseTestBean) Test(org.testng.annotations.Test)

Example 3 with EnterpriseTestBean

use of com.canoo.dolphin.integration.enterprise.EnterpriseTestBean in project dolphin-platform by canoo.

the class EnterpriseControllerTest method testPreDestroy.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if @PreDestroy is called in controller")
public void testPreDestroy(String containerType, String endpoint) {
    try {
        ClientContext context = connect(endpoint);
        ControllerProxy<EnterpriseTestBean> controller = createController(context, ENTERPRISE_CONTROLLER_NAME);
        Property<Boolean> preDestroyProperty = controller.getModel().preDestroyCalledProperty();
        Assert.assertNull(preDestroyProperty.get());
        destroy(controller, endpoint);
        Assert.assertTrue(preDestroyProperty.get());
        disconnect(context, endpoint);
    } catch (Exception e) {
        Assert.fail("Can not create controller for " + containerType, e);
    }
}
Also used : ClientContext(com.canoo.platform.remoting.client.ClientContext) EnterpriseTestBean(com.canoo.dolphin.integration.enterprise.EnterpriseTestBean) Test(org.testng.annotations.Test)

Aggregations

EnterpriseTestBean (com.canoo.dolphin.integration.enterprise.EnterpriseTestBean)3 ClientContext (com.canoo.platform.remoting.client.ClientContext)3 Test (org.testng.annotations.Test)3