use of com.canoo.dp.impl.server.legacy.ServerModelStore in project dolphin-platform by canoo.
the class TestObservableListSync method deletingPrimitiveNullFromDolphin_shouldDeleteElement.
@Test
public void deletingPrimitiveNullFromDolphin_shouldDeleteElement() {
// given :
final ServerModelStore serverModelStore = createServerModelStore();
final BeanManager manager = createBeanManager(serverModelStore);
final ListReferenceModel model = manager.create(ListReferenceModel.class);
final PresentationModel sourceModel = serverModelStore.findAllPresentationModelsByType(ListReferenceModel.class.getName()).get(0);
new PresentationModelBuilder(serverModelStore, PlatformRemotingConstants.LIST_SPLICE).withAttribute("source", sourceModel.getId()).withAttribute("attribute", "primitiveList").withAttribute("from", 0).withAttribute("to", 0).withAttribute("count", 1).withAttribute("0", null).create();
assertThat(model.getPrimitiveList(), hasSize(1));
// when :
new PresentationModelBuilder(serverModelStore, PlatformRemotingConstants.LIST_SPLICE).withAttribute("source", sourceModel.getId()).withAttribute("attribute", "primitiveList").withAttribute("from", 0).withAttribute("to", 1).withAttribute("count", 0).create();
// then :
assertThat(model.getPrimitiveList(), empty());
assertThat(serverModelStore.findAllPresentationModelsByType(PlatformRemotingConstants.LIST_SPLICE), empty());
}
use of com.canoo.dp.impl.server.legacy.ServerModelStore in project dolphin-platform by canoo.
the class StoreAttributeActionTests method setUp.
@BeforeMethod
public void setUp() throws Exception {
serverModelStore = new ServerModelStore();
serverModelStore.setCurrentResponse(new ArrayList<Command>());
registry = new ActionRegistry();
}
use of com.canoo.dp.impl.server.legacy.ServerModelStore in project dolphin-platform by canoo.
the class ServerPresentationModelBuilderTest method testWithAttributeCreation.
@Test
public void testWithAttributeCreation() {
ServerModelStore serverModelStore = createServerModelStore();
ServerPresentationModelBuilder builder = new ServerPresentationModelBuilder(serverModelStore);
ServerPresentationModel model = builder.withAttribute("testName").create();
assertNotNull(model);
assertEquals(model.getAttributes().size(), 2);
assertNotNull(model.getAttribute(RemotingConstants.SOURCE_SYSTEM));
assertNotNull(model.getAttribute("testName"));
}
use of com.canoo.dp.impl.server.legacy.ServerModelStore in project dolphin-platform by canoo.
the class ServerPresentationModelBuilderTest method testWithIdCreation.
@Test
public void testWithIdCreation() {
ServerModelStore serverModelStore = createServerModelStore();
ServerPresentationModelBuilder builder = new ServerPresentationModelBuilder(serverModelStore);
ServerPresentationModel model = builder.withId("testId").create();
assertNotNull(model);
assertEquals(model.getId(), "testId");
}
use of com.canoo.dp.impl.server.legacy.ServerModelStore in project dolphin-platform by canoo.
the class TestFindAll method testWithSimpleModel.
@Test
public void testWithSimpleModel() {
ServerModelStore serverModelStore = createServerModelStore();
final BeanManager manager = createBeanManager(serverModelStore);
SimpleTestModel model1 = manager.create(SimpleTestModel.class);
SimpleTestModel model2 = manager.create(SimpleTestModel.class);
SimpleTestModel model3 = manager.create(SimpleTestModel.class);
manager.create(SimpleAnnotatedTestModel.class);
List<SimpleTestModel> models = manager.findAll(SimpleTestModel.class);
assertThat(models, is(Arrays.asList(model1, model2, model3)));
}
Aggregations