Search in sources :

Example 1 with ActionTestBean

use of com.canoo.dolphin.integration.action.ActionTestBean in project dolphin-platform by canoo.

the class ActionControllerTest method testCallPublicMethodWithParamAsMap.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an public action with param method can be called")
public void testCallPublicMethodWithParamAsMap(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, Collections.singletonMap(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) Test(org.testng.annotations.Test)

Example 2 with ActionTestBean

use of com.canoo.dolphin.integration.action.ActionTestBean in project dolphin-platform by canoo.

the class ActionControllerTest method performActionForElementType.

private void performActionForElementType(final String containerType, final String endpoint, final String action, final ElementType 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().getEnumValue(), 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 3 with ActionTestBean

use of com.canoo.dolphin.integration.action.ActionTestBean in project dolphin-platform by canoo.

the class ActionControllerTest method testCallWithParam.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an private action method with one param can be called")
public void testCallWithParam(String containerType, String endpoint) {
    try {
        final ClientContext context = connect(endpoint);
        final ControllerProxy<ActionTestBean> controller = createController(context, ACTION_CONTROLLER_NAME);
        invoke(controller, PRIVATE_WITH_STRING_PARAM_ACTION, containerType, new Param(PARAM_NAME, "Yeah!"));
        Assert.assertTrue(controller.getModel().getBooleanValue());
        Assert.assertEquals(controller.getModel().getStringValue(), "Yeah!");
        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 4 with ActionTestBean

use of com.canoo.dolphin.integration.action.ActionTestBean in project dolphin-platform by canoo.

the class ActionControllerTest method testCallPublicMethod.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an public action method can be called")
public void testCallPublicMethod(String containerType, String endpoint) {
    try {
        final ClientContext context = connect(endpoint);
        final ControllerProxy<ActionTestBean> controller = createController(context, ACTION_CONTROLLER_NAME);
        invoke(controller, PUBLIC_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 5 with ActionTestBean

use of com.canoo.dolphin.integration.action.ActionTestBean in project dolphin-platform by canoo.

the class ActionControllerTest method testCallPublicMethodWithNullParamAsMap.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an public action with null value for param method can be called")
public void testCallPublicMethodWithNullParamAsMap(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, Collections.singletonMap(PARAM_NAME, null));
        Assert.assertNull(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)

Aggregations

ActionTestBean (com.canoo.dolphin.integration.action.ActionTestBean)22 ClientContext (com.canoo.platform.remoting.client.ClientContext)22 Test (org.testng.annotations.Test)10 Param (com.canoo.platform.remoting.client.Param)5 HashMap (java.util.HashMap)1