Search in sources :

Example 96 with ServerModelStore

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());
}
Also used : PresentationModel(com.canoo.dp.impl.remoting.legacy.core.PresentationModel) ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) ListReferenceModel(com.canoo.impl.server.util.ListReferenceModel) BeanManager(com.canoo.platform.remoting.BeanManager) Test(org.testng.annotations.Test) AbstractDolphinBasedTest(com.canoo.impl.server.util.AbstractDolphinBasedTest)

Example 97 with ServerModelStore

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();
}
Also used : Command(com.canoo.dp.impl.remoting.legacy.communication.Command) ChangeAttributeMetadataCommand(com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand) ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) ActionRegistry(com.canoo.dp.impl.server.legacy.communication.ActionRegistry) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 98 with ServerModelStore

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"));
}
Also used : ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) ServerPresentationModelBuilder(com.canoo.dp.impl.server.model.ServerPresentationModelBuilder) ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) Test(org.testng.annotations.Test) AbstractDolphinBasedTest(com.canoo.impl.server.util.AbstractDolphinBasedTest)

Example 99 with ServerModelStore

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");
}
Also used : ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) ServerPresentationModelBuilder(com.canoo.dp.impl.server.model.ServerPresentationModelBuilder) ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) Test(org.testng.annotations.Test) AbstractDolphinBasedTest(com.canoo.impl.server.util.AbstractDolphinBasedTest)

Example 100 with ServerModelStore

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)));
}
Also used : ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) SimpleTestModel(com.canoo.impl.server.util.SimpleTestModel) BeanManager(com.canoo.platform.remoting.BeanManager) Test(org.testng.annotations.Test) AbstractDolphinBasedTest(com.canoo.impl.server.util.AbstractDolphinBasedTest)

Aggregations

ServerModelStore (com.canoo.dp.impl.server.legacy.ServerModelStore)103 Test (org.testng.annotations.Test)100 AbstractDolphinBasedTest (com.canoo.impl.server.util.AbstractDolphinBasedTest)97 BeanManager (com.canoo.platform.remoting.BeanManager)91 ServerPresentationModel (com.canoo.dp.impl.server.legacy.ServerPresentationModel)88 PresentationModel (com.canoo.dp.impl.remoting.legacy.core.PresentationModel)66 ListReferenceModel (com.canoo.impl.server.util.ListReferenceModel)65 SimpleTestModel (com.canoo.impl.server.util.SimpleTestModel)18 BeanRepository (com.canoo.dp.impl.remoting.BeanRepository)14 EventDispatcher (com.canoo.dp.impl.remoting.EventDispatcher)14 Attribute (com.canoo.dp.impl.remoting.legacy.core.Attribute)8 ServerAttribute (com.canoo.dp.impl.server.legacy.ServerAttribute)7 ServerPresentationModelBuilder (com.canoo.dp.impl.server.model.ServerPresentationModelBuilder)5 SimpleAnnotatedTestModel (com.canoo.impl.server.util.SimpleAnnotatedTestModel)5 Command (com.canoo.dp.impl.remoting.legacy.communication.Command)4 ChildModel (com.canoo.impl.server.util.ChildModel)4 SingleReferenceModel (com.canoo.impl.server.util.SingleReferenceModel)4 ValueChangeEvent (com.canoo.platform.remoting.ValueChangeEvent)4 ValueChangeListener (com.canoo.platform.remoting.ValueChangeListener)4 Subscription (com.canoo.platform.core.functional.Subscription)3