Search in sources :

Example 26 with ServerPresentationModel

use of com.canoo.dp.impl.server.legacy.ServerPresentationModel in project dolphin-platform by canoo.

the class StoreAttributeActionTests method testChangeAttributeMetadata.

@Test
public void testChangeAttributeMetadata() {
    StoreAttributeAction action = new StoreAttributeAction();
    action.setServerModelStore(serverModelStore);
    action.registerIn(registry);
    ServerAttribute attribute = new ServerAttribute("newAttribute", "");
    serverModelStore.add(new ServerPresentationModel("model", Collections.singletonList(attribute), serverModelStore));
    registry.getActionsFor(ChangeAttributeMetadataCommand.class).get(0).handleCommand(new ChangeAttributeMetadataCommand(attribute.getId(), "value", "newValue"), Collections.emptyList());
    Assert.assertEquals("newValue", attribute.getValue());
}
Also used : ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) ChangeAttributeMetadataCommand(com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand) ServerAttribute(com.canoo.dp.impl.server.legacy.ServerAttribute) Test(org.testng.annotations.Test)

Example 27 with ServerPresentationModel

use of com.canoo.dp.impl.server.legacy.ServerPresentationModel in project dolphin-platform by canoo.

the class ServerPresentationModelBuilderFactoryTest method testSimpleCreation.

@Test
public void testSimpleCreation() {
    ServerModelStore serverModelStore = createServerModelStore();
    ServerPresentationModelBuilderFactory factory = new ServerPresentationModelBuilderFactory(serverModelStore);
    PresentationModelBuilder<ServerPresentationModel> builder = factory.createBuilder();
    assertNotNull(builder);
}
Also used : ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) ServerPresentationModelBuilderFactory(com.canoo.dp.impl.server.model.ServerPresentationModelBuilderFactory) ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) Test(org.testng.annotations.Test) AbstractDolphinBasedTest(com.canoo.impl.server.util.AbstractDolphinBasedTest)

Example 28 with ServerPresentationModel

use of com.canoo.dp.impl.server.legacy.ServerPresentationModel in project dolphin-platform by canoo.

the class ServerPresentationModelBuilderTest method testWithFilledAttributeCreation.

@Test
public void testWithFilledAttributeCreation() {
    ServerModelStore serverModelStore = createServerModelStore();
    ServerPresentationModelBuilder builder = new ServerPresentationModelBuilder(serverModelStore);
    ServerPresentationModel model = builder.withAttribute("testName", "testValue").create();
    assertNotNull(model);
    assertEquals(model.getAttributes().size(), 2);
    assertNotNull(model.getAttribute(RemotingConstants.SOURCE_SYSTEM));
    assertNotNull(model.getAttribute("testName"));
    assertEquals(model.getAttribute("testName").getValue(), "testValue");
}
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 29 with ServerPresentationModel

use of com.canoo.dp.impl.server.legacy.ServerPresentationModel in project dolphin-platform by canoo.

the class ServerPresentationModelBuilderTest method testSimpleCreation.

@Test
public void testSimpleCreation() {
    ServerModelStore serverModelStore = createServerModelStore();
    ServerPresentationModelBuilder builder = new ServerPresentationModelBuilder(serverModelStore);
    ServerPresentationModel model = builder.create();
    assertNotNull(model);
    assertEquals(model.getAttributes().size(), 1);
    assertEquals(model.getAttributes().get(0).getPropertyName(), RemotingConstants.SOURCE_SYSTEM);
    assertEquals(model.getAttributes().get(0).getValue(), RemotingConstants.SOURCE_SYSTEM_SERVER);
}
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 30 with ServerPresentationModel

use of com.canoo.dp.impl.server.legacy.ServerPresentationModel in project dolphin-platform by canoo.

the class ServerPresentationModelBuilderTest method testWithTypeCreation.

@Test
public void testWithTypeCreation() {
    ServerModelStore serverModelStore = createServerModelStore();
    ServerPresentationModelBuilder builder = new ServerPresentationModelBuilder(serverModelStore);
    ServerPresentationModel model = builder.withType("testType").create();
    assertNotNull(model);
    assertEquals(model.getPresentationModelType(), "testType");
}
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)

Aggregations

ServerPresentationModel (com.canoo.dp.impl.server.legacy.ServerPresentationModel)57 Test (org.testng.annotations.Test)56 ServerModelStore (com.canoo.dp.impl.server.legacy.ServerModelStore)55 AbstractDolphinBasedTest (com.canoo.impl.server.util.AbstractDolphinBasedTest)55 BeanManager (com.canoo.platform.remoting.BeanManager)49 PresentationModel (com.canoo.dp.impl.remoting.legacy.core.PresentationModel)33 ListReferenceModel (com.canoo.impl.server.util.ListReferenceModel)33 BeanRepository (com.canoo.dp.impl.remoting.BeanRepository)12 EventDispatcher (com.canoo.dp.impl.remoting.EventDispatcher)12 SimpleTestModel (com.canoo.impl.server.util.SimpleTestModel)11 ServerAttribute (com.canoo.dp.impl.server.legacy.ServerAttribute)9 Attribute (com.canoo.dp.impl.remoting.legacy.core.Attribute)7 ServerPresentationModelBuilder (com.canoo.dp.impl.server.model.ServerPresentationModelBuilder)5 SimpleAnnotatedTestModel (com.canoo.impl.server.util.SimpleAnnotatedTestModel)4 ChildModel (com.canoo.impl.server.util.ChildModel)3 SingleReferenceModel (com.canoo.impl.server.util.SingleReferenceModel)3 PrimitiveDataTypesModel (com.canoo.impl.server.util.PrimitiveDataTypesModel)2 ChangeAttributeMetadataCommand (com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand)1 ServerPresentationModelBuilderFactory (com.canoo.dp.impl.server.model.ServerPresentationModelBuilderFactory)1 ComplexDataTypesModel (com.canoo.impl.server.util.ComplexDataTypesModel)1