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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations