Search in sources :

Example 91 with Param

use of com.canoo.platform.remoting.client.Param 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 92 with Param

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

the class ActionControllerTest method callPublicMethodWithSeveralByteParams.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an public action method with several Byte param can be called")
public void callPublicMethodWithSeveralByteParams(String containerType, String endpoint) {
    final byte value1 = 1;
    final byte value2 = 2;
    final byte value3 = 3;
    final byte result = (byte) (value1 + value2 + value3);
    performActionForByte(containerType, endpoint, PUBLIC_WITH_SEVERAL_BYTE_PARAMS_ACTION, result, new Param(PARAM_NAME_1, value1), new Param(PARAM_NAME_2, value2), new Param(PARAM_NAME_3, value3));
}
Also used : Param(com.canoo.platform.remoting.client.Param) Test(org.testng.annotations.Test)

Example 93 with Param

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

Example 94 with Param

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

the class ActionControllerTest method callPublicMethodWithSeveralBigIntegerParams.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an public action method with several BigInteger param can be called")
public void callPublicMethodWithSeveralBigIntegerParams(String containerType, String endpoint) {
    final BigInteger value1 = BigInteger.TEN;
    final BigInteger value2 = BigInteger.TEN;
    final BigInteger value3 = BigInteger.TEN;
    final BigInteger result = value1.add(value2).add(value3);
    performActionForBigInteger(containerType, endpoint, PUBLIC_WITH_SEVERAL_BIGINTEGER_PARAMS_ACTION, result, new Param(PARAM_NAME_1, value1), new Param(PARAM_NAME_2, value2), new Param(PARAM_NAME_3, value3));
}
Also used : Param(com.canoo.platform.remoting.client.Param) BigInteger(java.math.BigInteger) Test(org.testng.annotations.Test)

Example 95 with Param

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

the class ActionControllerTest method testCallPublicMethodWithDoubleParams.

/**
 * End Float Type Related Integration Test
 */
/**
 * Start Double Type Related Integration Test
 */
@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an public action method with Double param can be called")
public void testCallPublicMethodWithDoubleParams(String containerType, String endpoint) {
    final double value = 10.0;
    performActionForDouble(containerType, endpoint, PUBLIC_WITH_DOUBLE_PARAM_ACTION, value, new Param(PARAM_NAME, value));
}
Also used : Param(com.canoo.platform.remoting.client.Param) Test(org.testng.annotations.Test)

Aggregations

Param (com.canoo.platform.remoting.client.Param)95 Test (org.testng.annotations.Test)94 ControllerUnderTest (com.canoo.platform.spring.test.ControllerUnderTest)49 SpringTestNGControllerTest (com.canoo.platform.spring.test.SpringTestNGControllerTest)49 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)49 BigDecimal (java.math.BigDecimal)8 BigInteger (java.math.BigInteger)8 ActionTestBean (com.canoo.dolphin.integration.action.ActionTestBean)5 ClientContext (com.canoo.platform.remoting.client.ClientContext)5 ToDoList (com.canoo.platform.samples.distribution.common.model.ToDoList)4 ElementType (java.lang.annotation.ElementType)4 Calendar (java.util.Calendar)4 Date (java.util.Date)4 UUID (java.util.UUID)4 MappingException (com.canoo.dp.impl.remoting.MappingException)1 CallActionCommand (com.canoo.dp.impl.remoting.commands.CallActionCommand)1 ControllerActionException (com.canoo.platform.remoting.client.ControllerActionException)1 ValueConverterException (com.canoo.platform.remoting.spi.converter.ValueConverterException)1 CompletableFuture (java.util.concurrent.CompletableFuture)1