Search in sources :

Example 31 with ClientContext

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

the class ActionControllerTest method testCallPrivateMethod.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an private action method can be called")
public void testCallPrivateMethod(String containerType, String endpoint) {
    try {
        final ClientContext context = connect(endpoint);
        final ControllerProxy<ActionTestBean> controller = createController(context, ACTION_CONTROLLER_NAME);
        invoke(controller, PRIVATE_ACTION, containerType);
        Assert.assertTrue(controller.getModel().getBooleanValue());
        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) Test(org.testng.annotations.Test)

Example 32 with ClientContext

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

the class ActionControllerTest method performActionForCalendar.

private void performActionForCalendar(final String containerType, final String endpoint, final String action, final Calendar 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().getCalendarValue().getTime(), result.getTime());
        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 33 with ClientContext

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

the class ActionControllerTest method performActionForBigDecimal.

private void performActionForBigDecimal(final String containerType, final String endpoint, final String action, final BigDecimal 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().getBigDecimalValue(), 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 34 with ClientContext

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

the class ActionControllerTest method testCallWithParams.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an private action method can be called")
public void testCallWithParams(String containerType, String endpoint) {
    try {
        final ClientContext context = connect(endpoint);
        final ControllerProxy<ActionTestBean> controller = createController(context, ACTION_CONTROLLER_NAME);
        final String value1 = "Hello Dolphin Platform!";
        final String value2 = "I want to test you!";
        final int value3 = 356;
        invoke(controller, PRIVATE_WITH_SEVERAL_PARAMS_ACTION, containerType, new Param(PARAM_NAME_1, value1), new Param(PARAM_NAME_2, value2), new Param(PARAM_NAME_3, value3));
        Assert.assertTrue(controller.getModel().getBooleanValue());
        Assert.assertEquals(controller.getModel().getStringValue(), value1 + value2 + value3);
        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) Param(com.canoo.platform.remoting.client.Param) Test(org.testng.annotations.Test)

Example 35 with ClientContext

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

the class ActionControllerTest method testCallPublicMethodWithParam.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an public action with param method can be called")
public void testCallPublicMethodWithParam(String containerType, String endpoint) {
    try {
        final ClientContext context = connect(endpoint);
        final ControllerProxy<ActionTestBean> controller = createController(context, ACTION_CONTROLLER_NAME);
        invoke(controller, PUBLIC_WITH_BOOLEAN_PARAM_ACTION, containerType, new Param(PARAM_NAME, true));
        Assert.assertTrue(controller.getModel().getBooleanValue());
        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) Param(com.canoo.platform.remoting.client.Param) 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