Search in sources :

Example 16 with ClientContext

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

the class ActionControllerTest method performActionForInteger.

private void performActionForInteger(final String containerType, final String endpoint, final String action, final int result, final Param... params) {
    try {
        final ClientContext context = connect(endpoint);
        final ControllerProxy<ActionTestBean> controller = createController(context, ACTION_CONTROLLER_NAME);
        invoke(controller, action, containerType, params);
        Assert.assertEquals(controller.getModel().getIntegerValue().intValue(), result);
        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) ActionTestBean(com.canoo.dolphin.integration.action.ActionTestBean)

Example 17 with ClientContext

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

the class ParentChildControllerTest method testPreChildDestroyedNotCalledWhenNonChildControllerDestroyed.

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

Example 18 with ClientContext

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

the class ParentChildControllerTest method testPreDestroyInParentIsCalledFirstWhenParentIsDestroyed.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if @PreDestroyed in parent is called first")
public void testPreDestroyInParentIsCalledFirstWhenParentIsDestroyed(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();
        Property<Boolean> childPreDestroyCalledProperty = ((ChildTestBean) childController.getModel()).preDestroyedCalledProperty();
        Property<Boolean> parentPreDestroyCalledProperty = controller.getModel().preDestroyedCalledProperty();
        Assert.assertNull(parentPreDestroyCalledProperty.get());
        Assert.assertNull(childPreDestroyCalledProperty.get());
        destroy(controller, endpoint);
        Assert.assertTrue(parentPreDestroyCalledProperty.get());
        Assert.assertTrue(childPreDestroyCalledProperty.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) ChildTestBean(com.canoo.dolphin.integration.parentchild.ChildTestBean) Test(org.testng.annotations.Test)

Example 19 with ClientContext

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

the class PropertyControllerTest method testNoChangeForSameValue.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if all unsubscribe for changes is working")
public void testNoChangeForSameValue(String containerType, String endpoint) {
    try {
        ClientContext context = connect(endpoint);
        ControllerProxy<PropertyTestBean> controller = createController(context, PROPERTY_CONTROLLER_NAME);
        invoke(controller, SET_TO_DEFAULTS_ACTION, containerType);
        invoke(controller, ADD_CHANGE_LISTENER, containerType);
        controller.getModel().setBigDecimalValue(BIG_DECIMAL_VALUE);
        controller.getModel().setBigIntegerValue(BIG_INTEGER_VALUE);
        controller.getModel().setBooleanValue(BOOLEAN_VALUE);
        controller.getModel().setByteValue(BYTE_VALUE);
        controller.getModel().setCalendarValue(CALENDAR_VALUE);
        controller.getModel().setDateValue(DATE_VALUE);
        controller.getModel().setDoubleValue(DOUBLE_VALUE);
        controller.getModel().setEnumValue(ENUM_VALUE);
        controller.getModel().setFloatValue(FLOAT_VALUE);
        controller.getModel().setIntegerValue(INTEGER_VALUE);
        controller.getModel().setLongValue(LONG_VALUE);
        controller.getModel().setShortValue(SHORT_VALUE);
        controller.getModel().setStringValue(STRING_VALUE);
        controller.getModel().setUuidValue(UUID_VALUE);
        invoke(controller, PING, containerType);
        Assert.assertFalse(controller.getModel().getBigDecimalValueChanged());
        Assert.assertFalse(controller.getModel().getBigIntegerValueChanged());
        Assert.assertFalse(controller.getModel().getBooleanValueChanged());
        Assert.assertFalse(controller.getModel().getByteValueChanged());
        Assert.assertFalse(controller.getModel().getCalenderValueChanged());
        Assert.assertFalse(controller.getModel().getDateValueChanged());
        Assert.assertFalse(controller.getModel().getDoubleValueChanged());
        Assert.assertFalse(controller.getModel().getEnumValueChanged());
        Assert.assertFalse(controller.getModel().getFloatValueChanged());
        Assert.assertFalse(controller.getModel().getIntegerValueChanged());
        Assert.assertFalse(controller.getModel().getLongValueChanged());
        Assert.assertFalse(controller.getModel().getShortValueChanged());
        Assert.assertFalse(controller.getModel().getStringValueChanged());
        Assert.assertFalse(controller.getModel().getUuidValueChanged());
        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 20 with ClientContext

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

the class PropertyControllerTest method testPropertyNullValueCreating.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if all property have an null value by default")
public void testPropertyNullValueCreating(String containerType, String endpoint) {
    try {
        ClientContext context = connect(endpoint);
        ControllerProxy<PropertyTestBean> controller = createController(context, PROPERTY_CONTROLLER_NAME);
        Assert.assertNull(controller.getModel().getUuidValue());
        Assert.assertNull(controller.getModel().getStringValue());
        Assert.assertNull(controller.getModel().getShortValue());
        Assert.assertNull(controller.getModel().getLongValue());
        Assert.assertNull(controller.getModel().getIntegerValue());
        Assert.assertNull(controller.getModel().getBigDecimalValue());
        Assert.assertNull(controller.getModel().getBigIntegerValue());
        Assert.assertNull(controller.getModel().getBooleanValue());
        Assert.assertNull(controller.getModel().getByteValue());
        Assert.assertNull(controller.getModel().getCalendarValue());
        Assert.assertNull(controller.getModel().getDateValue());
        Assert.assertNull(controller.getModel().getDoubleValue());
        Assert.assertNull(controller.getModel().getEnumValue());
        Assert.assertNull(controller.getModel().getFloatValue());
        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