Search in sources :

Example 41 with ServerPresentationModel

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

the class TestModelCreation method testWithListReferenceModel.

@Test
public void testWithListReferenceModel() {
    final ServerModelStore serverModelStore = createServerModelStore();
    final BeanManager manager = createBeanManager(serverModelStore);
    ListReferenceModel model = manager.create(ListReferenceModel.class);
    assertThat(model, notNullValue());
    assertThat(model.getObjectList(), empty());
    assertThat(model.getPrimitiveList(), empty());
    List<ServerPresentationModel> dolphinModels = serverModelStore.findAllPresentationModelsByType(ListReferenceModel.class.getName());
    assertThat(dolphinModels, hasSize(1));
    ServerPresentationModel dolphinModel = dolphinModels.get(0);
    List<ServerAttribute> attributes = dolphinModel.getAttributes();
    assertThat(attributes, contains(allOf(hasProperty("propertyName", is(RemotingConstants.SOURCE_SYSTEM)), hasProperty("value", is(RemotingConstants.SOURCE_SYSTEM_SERVER)), hasProperty("qualifier", nullValue()))));
    List<ServerPresentationModel> classModels = serverModelStore.findAllPresentationModelsByType(PlatformRemotingConstants.DOLPHIN_BEAN);
    assertThat(classModels, contains(hasProperty("attributes", containsInAnyOrder(allOf(hasProperty("propertyName", is(PlatformRemotingConstants.JAVA_CLASS)), hasProperty("value", is(ListReferenceModel.class.getName())), hasProperty("qualifier", nullValue())), allOf(hasProperty("propertyName", is("objectList")), hasProperty("value", is(DolphinBeanConverterFactory.FIELD_TYPE_DOLPHIN_BEAN)), hasProperty("qualifier", nullValue())), allOf(hasProperty("propertyName", is("primitiveList")), hasProperty("value", is(StringConverterFactory.FIELD_TYPE_STRING)), hasProperty("qualifier", nullValue())), allOf(hasProperty("propertyName", is(RemotingConstants.SOURCE_SYSTEM)), hasProperty("value", is(RemotingConstants.SOURCE_SYSTEM_SERVER)), hasProperty("qualifier", nullValue()))))));
}
Also used : 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) ServerAttribute(com.canoo.dp.impl.server.legacy.ServerAttribute) Test(org.testng.annotations.Test) AbstractDolphinBasedTest(com.canoo.impl.server.util.AbstractDolphinBasedTest)

Example 42 with ServerPresentationModel

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

the class TestModelCreation method testWithSimpleModel.

@Test
public void testWithSimpleModel() {
    final ServerModelStore serverModelStore = createServerModelStore();
    final EventDispatcher dispatcher = createEventDispatcher(serverModelStore);
    final BeanRepository beanRepository = createBeanRepository(serverModelStore, dispatcher);
    final BeanManager manager = createBeanManager(serverModelStore, beanRepository, dispatcher);
    SimpleTestModel model = manager.create(SimpleTestModel.class);
    assertThat(model, notNullValue());
    assertThat(model.getTextProperty(), notNullValue());
    assertThat(model.getTextProperty().get(), nullValue());
    assertThat(beanRepository.isManaged(model), is(true));
    List<ServerPresentationModel> dolphinModels = serverModelStore.findAllPresentationModelsByType(SimpleTestModel.class.getName());
    assertThat(dolphinModels, hasSize(1));
    ServerPresentationModel dolphinModel = dolphinModels.get(0);
    List<ServerAttribute> attributes = dolphinModel.getAttributes();
    assertThat(attributes, containsInAnyOrder(allOf(hasProperty("propertyName", is("text")), hasProperty("value", nullValue()), hasProperty("qualifier", nullValue())), allOf(hasProperty("propertyName", is(RemotingConstants.SOURCE_SYSTEM)), hasProperty("value", is(RemotingConstants.SOURCE_SYSTEM_SERVER)), hasProperty("qualifier", nullValue()))));
    List<ServerPresentationModel> classModels = serverModelStore.findAllPresentationModelsByType(PlatformRemotingConstants.DOLPHIN_BEAN);
    assertThat(classModels, contains(hasProperty("attributes", containsInAnyOrder(allOf(hasProperty("propertyName", is(PlatformRemotingConstants.JAVA_CLASS)), hasProperty("value", is(SimpleTestModel.class.getName())), hasProperty("qualifier", nullValue())), allOf(hasProperty("propertyName", is("text")), hasProperty("value", is(StringConverterFactory.FIELD_TYPE_STRING)), hasProperty("qualifier", nullValue())), allOf(hasProperty("propertyName", is(RemotingConstants.SOURCE_SYSTEM)), hasProperty("value", is(RemotingConstants.SOURCE_SYSTEM_SERVER)), hasProperty("qualifier", nullValue()))))));
}
Also used : ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) EventDispatcher(com.canoo.dp.impl.remoting.EventDispatcher) BeanRepository(com.canoo.dp.impl.remoting.BeanRepository) ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) SimpleTestModel(com.canoo.impl.server.util.SimpleTestModel) BeanManager(com.canoo.platform.remoting.BeanManager) ServerAttribute(com.canoo.dp.impl.server.legacy.ServerAttribute) Test(org.testng.annotations.Test) AbstractDolphinBasedTest(com.canoo.impl.server.util.AbstractDolphinBasedTest)

Example 43 with ServerPresentationModel

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

the class TestModelDeletion method testWithSimpleModel.

@Test
public void testWithSimpleModel() {
    final ServerModelStore serverModelStore = createServerModelStore();
    final EventDispatcher dispatcher = createEventDispatcher(serverModelStore);
    final BeanRepository beanRepository = createBeanRepository(serverModelStore, dispatcher);
    final BeanManager manager = createBeanManager(serverModelStore, beanRepository, dispatcher);
    SimpleTestModel model = manager.create(SimpleTestModel.class);
    beanRepository.delete(model);
    List<ServerPresentationModel> dolphinModels = serverModelStore.findAllPresentationModelsByType(SimpleTestModel.class.getName());
    assertThat(dolphinModels, empty());
    Collection<ServerPresentationModel> allDolphinModels = serverModelStore.listPresentationModels();
    assertThat(allDolphinModels, hasSize(1));
    assertThat(beanRepository.isManaged(model), is(false));
}
Also used : ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) EventDispatcher(com.canoo.dp.impl.remoting.EventDispatcher) BeanRepository(com.canoo.dp.impl.remoting.BeanRepository) 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)

Example 44 with ServerPresentationModel

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

the class TestModelDeletion method testWithListReferenceModel.

@Test
public void testWithListReferenceModel() {
    final ServerModelStore serverModelStore = createServerModelStore();
    final EventDispatcher dispatcher = createEventDispatcher(serverModelStore);
    final BeanRepository beanRepository = createBeanRepository(serverModelStore, dispatcher);
    final BeanManager manager = createBeanManager(serverModelStore, beanRepository, dispatcher);
    ListReferenceModel model = manager.create(ListReferenceModel.class);
    beanRepository.delete(model);
    List<ServerPresentationModel> dolphinModels = serverModelStore.findAllPresentationModelsByType(ListReferenceModel.class.getName());
    assertThat(dolphinModels, empty());
    Collection<ServerPresentationModel> allDolphinModels = serverModelStore.listPresentationModels();
    // Dolphin Class Repository wurde bereits angelegt
    assertThat(allDolphinModels, hasSize(1));
    assertThat(beanRepository.isManaged(model), is(false));
}
Also used : ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) EventDispatcher(com.canoo.dp.impl.remoting.EventDispatcher) BeanRepository(com.canoo.dp.impl.remoting.BeanRepository) 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 45 with ServerPresentationModel

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

the class TestModelDeletion method testWithAnnotatedSimpleModel.

@Test
public void testWithAnnotatedSimpleModel() {
    final ServerModelStore serverModelStore = createServerModelStore();
    final EventDispatcher dispatcher = createEventDispatcher(serverModelStore);
    final BeanRepository beanRepository = createBeanRepository(serverModelStore, dispatcher);
    final BeanManager manager = createBeanManager(serverModelStore, beanRepository, dispatcher);
    SimpleAnnotatedTestModel model = manager.create(SimpleAnnotatedTestModel.class);
    beanRepository.delete(model);
    List<ServerPresentationModel> dolphinModels = serverModelStore.findAllPresentationModelsByType(SimpleAnnotatedTestModel.class.getName());
    assertThat(dolphinModels, empty());
    Collection<ServerPresentationModel> allDolphinModels = serverModelStore.listPresentationModels();
    assertThat(allDolphinModels, hasSize(1));
    assertThat(beanRepository.isManaged(model), is(false));
}
Also used : ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) EventDispatcher(com.canoo.dp.impl.remoting.EventDispatcher) SimpleAnnotatedTestModel(com.canoo.impl.server.util.SimpleAnnotatedTestModel) BeanRepository(com.canoo.dp.impl.remoting.BeanRepository) ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) BeanManager(com.canoo.platform.remoting.BeanManager) 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