use of com.canoo.platform.remoting.client.ClientContext in project dolphin-platform by canoo.
the class ParentChildControllerTest method testPreChildDestroyedCalledWhenChildControllerDestroyed.
@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if @PreChildDestroyed is called in controller")
public void testPreChildDestroyedCalledWhenChildControllerDestroyed(final String containerType, final String endpoint) {
try {
ClientContext context = connect(endpoint);
ControllerProxy<ParentTestBean> controller = createController(context, PARENT_CONTROLLER_NAME);
controller.createController(CHILD_CONTROLLER_NAME);
Property<Boolean> preChildDestroyProperty = controller.getModel().preChildDestroyedCalledProperty();
Assert.assertNull(preChildDestroyProperty.get());
destroy(controller, endpoint);
Assert.assertTrue(preChildDestroyProperty.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 testCreateController.
@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if controller and model can be created")
public void testCreateController(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();
Assert.assertNotNull(controller);
Assert.assertNotNull(controller.getModel());
Assert.assertEquals(controller.getModel().getClass(), ParentTestBean.class);
Assert.assertEquals(childController.getModel().getClass(), ChildTestBean.class);
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 testPostChildCreatedCalledWhenNonChildControllerCreated.
@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if @PostChildCreated is not called in controller")
public void testPostChildCreatedCalledWhenNonChildControllerCreated(final String containerType, final String endpoint) {
try {
ClientContext context = connect(endpoint);
ControllerProxy<ParentTestBean> controller = createController(context, PARENT_CONTROLLER_NAME);
Assert.assertTrue(controller.getModel().postCreatedCalledProperty().get());
Property<Boolean> postChildCreatedProperty = controller.getModel().postChildCreatedCalledProperty();
Assert.assertNull(postChildCreatedProperty.get());
controller.createController(DUMMY_CHILD_CONTROLLER_NAME);
Thread.sleep(1000);
Assert.assertNull(postChildCreatedProperty.get());
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 testPropertyValueSet.
@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if all property values are snychronized")
public void testPropertyValueSet(String containerType, String endpoint) {
try {
ClientContext context = connect(endpoint);
ControllerProxy<PropertyTestBean> controller = createController(context, PROPERTY_CONTROLLER_NAME);
invoke(controller, SET_TO_DEFAULTS_ACTION, containerType);
Assert.assertEquals(controller.getModel().getBigDecimalValue(), BIG_DECIMAL_VALUE);
Assert.assertEquals(controller.getModel().getBigIntegerValue(), BIG_INTEGER_VALUE);
Assert.assertEquals(controller.getModel().getBooleanValue(), BOOLEAN_VALUE);
Assert.assertEquals(controller.getModel().getByteValue(), BYTE_VALUE);
Assert.assertEquals(controller.getModel().getCalendarValue().getTimeInMillis(), CALENDAR_VALUE.getTimeInMillis());
Assert.assertEquals(controller.getModel().getDateValue(), DATE_VALUE);
Assert.assertEquals(controller.getModel().getDoubleValue(), DOUBLE_VALUE);
Assert.assertEquals(controller.getModel().getEnumValue(), ENUM_VALUE);
Assert.assertEquals(controller.getModel().getFloatValue(), FLOAT_VALUE);
Assert.assertEquals(controller.getModel().getIntegerValue(), INTEGER_VALUE);
Assert.assertEquals(controller.getModel().getLongValue(), LONG_VALUE);
Assert.assertEquals(controller.getModel().getShortValue(), SHORT_VALUE);
Assert.assertEquals(controller.getModel().getStringValue(), STRING_VALUE);
Assert.assertEquals(controller.getModel().getUuidValue(), UUID_VALUE);
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 testPropertyCreating.
@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Test if all property instances are created by default")
public void testPropertyCreating(String containerType, String endpoint) {
try {
ClientContext context = connect(endpoint);
ControllerProxy<PropertyTestBean> controller = createController(context, PROPERTY_CONTROLLER_NAME);
Assert.assertNotNull(controller.getModel().uuidValueProperty());
Assert.assertNotNull(controller.getModel().stringValueProperty());
Assert.assertNotNull(controller.getModel().shortValueProperty());
Assert.assertNotNull(controller.getModel().longValueProperty());
Assert.assertNotNull(controller.getModel().integerValueProperty());
Assert.assertNotNull(controller.getModel().bigDecimalValueProperty());
Assert.assertNotNull(controller.getModel().bigIntegerValueProperty());
Assert.assertNotNull(controller.getModel().booleanValueProperty());
Assert.assertNotNull(controller.getModel().byteValueProperty());
Assert.assertNotNull(controller.getModel().calendarValueProperty());
Assert.assertNotNull(controller.getModel().dateValueProperty());
Assert.assertNotNull(controller.getModel().doubleValueProperty());
Assert.assertNotNull(controller.getModel().enumValueProperty());
Assert.assertNotNull(controller.getModel().floatValueProperty());
destroy(controller, endpoint);
disconnect(context, endpoint);
} catch (Exception e) {
Assert.fail("Can not create controller for " + containerType, e);
}
}
Aggregations