Search in sources :

Example 56 with Param

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

the class ActionControllerTest method testCallWithNullParam.

@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an private action method with null value for param can be called")
public void testCallWithNullParam(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, null));
        Assert.assertTrue(controller.getModel().getBooleanValue());
        Assert.assertEquals(controller.getModel().getStringValue(), null);
        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 57 with Param

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

the class ActionTestControllerTest method callPrivateMethodWithSeveralParams.

@Test
public void callPrivateMethodWithSeveralParams() {
    Assert.assertNull(controller.getModel().getBooleanValue());
    final String value1 = "Hello Dolphin Platform!";
    final String value2 = "I want to test you!";
    final int value3 = 356;
    controller.invoke(PRIVATE_WITH_SEVERAL_PARAMS_ACTION, 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);
}
Also used : Param(com.canoo.platform.remoting.client.Param) Test(org.testng.annotations.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Example 58 with Param

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

the class ActionTestControllerTest method callPrivateMethodWithSeveralBigDecimalParams.

@Test
public void callPrivateMethodWithSeveralBigDecimalParams() {
    Assert.assertNull(controller.getModel().getBigDecimalValue());
    final BigDecimal value1 = new BigDecimal(10);
    final BigDecimal value2 = new BigDecimal(20);
    controller.invoke(PRIVATE_WITH_SEVERAL_BIGDECIMAL_PARAMS_ACTION, new Param(PARAM_NAME_1, value1), new Param(PARAM_NAME_2, value2));
    Assert.assertEquals(controller.getModel().getBigDecimalValue(), value1.add(value2));
}
Also used : Param(com.canoo.platform.remoting.client.Param) BigDecimal(java.math.BigDecimal) Test(org.testng.annotations.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Example 59 with Param

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

the class ActionTestControllerTest method callPrivateMethodWithByteParam.

@Test
public void callPrivateMethodWithByteParam() {
    Assert.assertNull(controller.getModel().getByteValue());
    final Byte value = 10;
    controller.invoke(PUBLIC_WITH_BYTE_PARAM_ACTION, new Param(PARAM_NAME, value));
    Assert.assertEquals(controller.getModel().getByteValue(), value);
}
Also used : Param(com.canoo.platform.remoting.client.Param) Test(org.testng.annotations.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Example 60 with Param

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

the class ActionTestControllerTest method callPublicMethodWithSeveralDoubleParams.

@Test
public void callPublicMethodWithSeveralDoubleParams() {
    Assert.assertNull(controller.getModel().getDoubleValue());
    final double value1 = 1.0;
    final double value2 = 2.0;
    final double value3 = 3.0;
    controller.invoke(PUBLIC_WITH_SEVERAL_DOUBLE_PARAMS_ACTION, new Param(PARAM_NAME_1, value1), new Param(PARAM_NAME_2, value2), new Param(PARAM_NAME_3, value3));
    Assert.assertEquals(controller.getModel().getDoubleValue().doubleValue(), value1 + value2 + value3);
}
Also used : Param(com.canoo.platform.remoting.client.Param) Test(org.testng.annotations.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

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