Search in sources :

Example 41 with ClientContext

use of com.canoo.platform.remoting.client.ClientContext in project dolphin-platform by canoo.

the class ParentChildControllerTest method testPreChildDestroyedCalledWhenChildControllerDestroyed.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if @PreChildDestroyed is called in controller")
public void testPreChildDestroyedCalledWhenChildControllerDestroyed(final String containerType, final String endpoint) {
    try {
        ClientContext context = connect(endpoint);
        ControllerProxy<ParentTestBean> controller = createController(context, PARENT_CONTROLLER_NAME);
        controller.createController(CHILD_CONTROLLER_NAME);
        Property<Boolean> preChildDestroyProperty = controller.getModel().preChildDestroyedCalledProperty();
        Assert.assertNull(preChildDestroyProperty.get());
        destroy(controller, endpoint);
        Assert.assertTrue(preChildDestroyProperty.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) ParentTestBean(com.canoo.dolphin.integration.parentchild.ParentTestBean) Test(org.testng.annotations.Test)

Example 42 with ClientContext

use of com.canoo.platform.remoting.client.ClientContext in project dolphin-platform by canoo.

the class ParentChildControllerTest method testCreateController.

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

Example 43 with ClientContext

use of com.canoo.platform.remoting.client.ClientContext 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)

Example 44 with ClientContext

use of com.canoo.platform.remoting.client.ClientContext in project dolphin-platform by canoo.

the class PropertyControllerTest method testPropertyValueSet.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if all property values are snychronized")
public void testPropertyValueSet(String containerType, String endpoint) {
    try {
        ClientContext context = connect(endpoint);
        ControllerProxy<PropertyTestBean> controller = createController(context, PROPERTY_CONTROLLER_NAME);
        invoke(controller, SET_TO_DEFAULTS_ACTION, containerType);
        Assert.assertEquals(controller.getModel().getBigDecimalValue(), BIG_DECIMAL_VALUE);
        Assert.assertEquals(controller.getModel().getBigIntegerValue(), BIG_INTEGER_VALUE);
        Assert.assertEquals(controller.getModel().getBooleanValue(), BOOLEAN_VALUE);
        Assert.assertEquals(controller.getModel().getByteValue(), BYTE_VALUE);
        Assert.assertEquals(controller.getModel().getCalendarValue().getTimeInMillis(), CALENDAR_VALUE.getTimeInMillis());
        Assert.assertEquals(controller.getModel().getDateValue(), DATE_VALUE);
        Assert.assertEquals(controller.getModel().getDoubleValue(), DOUBLE_VALUE);
        Assert.assertEquals(controller.getModel().getEnumValue(), ENUM_VALUE);
        Assert.assertEquals(controller.getModel().getFloatValue(), FLOAT_VALUE);
        Assert.assertEquals(controller.getModel().getIntegerValue(), INTEGER_VALUE);
        Assert.assertEquals(controller.getModel().getLongValue(), LONG_VALUE);
        Assert.assertEquals(controller.getModel().getShortValue(), SHORT_VALUE);
        Assert.assertEquals(controller.getModel().getStringValue(), STRING_VALUE);
        Assert.assertEquals(controller.getModel().getUuidValue(), UUID_VALUE);
        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) PropertyTestBean(com.canoo.dolphin.integration.property.PropertyTestBean) Test(org.testng.annotations.Test)

Example 45 with ClientContext

use of com.canoo.platform.remoting.client.ClientContext in project dolphin-platform by canoo.

the class PropertyControllerTest method testPropertyCreating.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if all property instances are created by default")
public void testPropertyCreating(String containerType, String endpoint) {
    try {
        ClientContext context = connect(endpoint);
        ControllerProxy<PropertyTestBean> controller = createController(context, PROPERTY_CONTROLLER_NAME);
        Assert.assertNotNull(controller.getModel().uuidValueProperty());
        Assert.assertNotNull(controller.getModel().stringValueProperty());
        Assert.assertNotNull(controller.getModel().shortValueProperty());
        Assert.assertNotNull(controller.getModel().longValueProperty());
        Assert.assertNotNull(controller.getModel().integerValueProperty());
        Assert.assertNotNull(controller.getModel().bigDecimalValueProperty());
        Assert.assertNotNull(controller.getModel().bigIntegerValueProperty());
        Assert.assertNotNull(controller.getModel().booleanValueProperty());
        Assert.assertNotNull(controller.getModel().byteValueProperty());
        Assert.assertNotNull(controller.getModel().calendarValueProperty());
        Assert.assertNotNull(controller.getModel().dateValueProperty());
        Assert.assertNotNull(controller.getModel().doubleValueProperty());
        Assert.assertNotNull(controller.getModel().enumValueProperty());
        Assert.assertNotNull(controller.getModel().floatValueProperty());
        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) PropertyTestBean(com.canoo.dolphin.integration.property.PropertyTestBean) Test(org.testng.annotations.Test)

Aggregations

ClientContext (com.canoo.platform.remoting.client.ClientContext)53 Test (org.testng.annotations.Test)37 ActionTestBean (com.canoo.dolphin.integration.action.ActionTestBean)22 PropertyTestBean (com.canoo.dolphin.integration.property.PropertyTestBean)8 ParentTestBean (com.canoo.dolphin.integration.parentchild.ParentTestBean)6 QualifierTestBean (com.canoo.dolphin.integration.qualifier.QualifierTestBean)6 QualifierTestSubBean (com.canoo.dolphin.integration.qualifier.QualifierTestSubBean)6 Param (com.canoo.platform.remoting.client.Param)5 ClientContextFactory (com.canoo.platform.remoting.client.ClientContextFactory)4 EnterpriseTestBean (com.canoo.dolphin.integration.enterprise.EnterpriseTestBean)3 URI (java.net.URI)3 ClientConfiguration (com.canoo.platform.client.ClientConfiguration)2 Scene (javafx.scene.Scene)2 BeanTestBean (com.canoo.dolphin.integration.bean.BeanTestBean)1 ChildTestBean (com.canoo.dolphin.integration.parentchild.ChildTestBean)1 ClientModelStore (com.canoo.dp.impl.client.legacy.ClientModelStore)1 AbstractClientConnector (com.canoo.dp.impl.client.legacy.communication.AbstractClientConnector)1 StrictClientSessionResponseHandler (com.canoo.dp.impl.platform.client.session.StrictClientSessionResponseHandler)1 Assert (com.canoo.dp.impl.platform.core.Assert)1 OptimizedJsonCodec (com.canoo.dp.impl.remoting.codec.OptimizedJsonCodec)1