use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testUnknownEventForAutoDisplay.
@Test(expected = UnknownConfigurationElementException.class)
public void testUnknownEventForAutoDisplay() throws InvalidMvp4gConfigurationException {
ChildModuleElement childModule1 = newChildModule(Modules.ChildModule01.class, "child1");
childModule1.setEventToDisplayView("unknown");
childModules.add(childModule1);
EventElement event = newEvent("testEvent");
event.setForwardToModules(new String[] { "child1" });
event.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
events.add(event);
setEventBus();
configuration.validateChildModules();
}
use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testHistoryNameNoConveter.
@Test
public void testHistoryNameNoConveter() {
EventElement e = newEvent("start");
e.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
e.setName("name");
events.add(e);
try {
configuration.validateHistoryConverters();
fail();
} catch (InvalidMvp4gConfigurationException ex) {
assertEquals("Event start: you defined an history name for this event but this event has no history converter.", ex.getMessage());
}
}
use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testChildModulesNoStart.
@Test(expected = InvalidMvp4gConfigurationException.class)
public void testChildModulesNoStart() throws InvalidMvp4gConfigurationException {
ChildModuleElement childModule1 = newChildModule(Modules.ChildModule01.class, "child1");
childModule1.setEventToDisplayView("testEvent");
childModules.add(childModule1);
configuration.getOthersEventBusClassMap().put(Modules.ChildModule01.class.getCanonicalName(), oracle.addClass(EventBusWithNoStartPresenter.class));
EventElement event = newEvent("testEvent");
event.setForwardToModules(new String[] { "child1" });
event.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
events.add(event);
try {
configuration.validateChildModules();
} catch (InvalidMvp4gConfigurationException e) {
assertEquals("Module com.mvp4g.rebind.test_tools.Modules.ChildModule01: You must define a start presenter since this module has a parent module that uses the auto-displayed feature for this module.", e.getMessage());
throw e;
}
}
use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testInstantiateViewAtStart.
@Test
public void testInstantiateViewAtStart() throws InvalidMvp4gConfigurationException {
ViewElement view1 = newView(SimpleView02.class, "view1");
view1.setClassName(SimpleView02.class.getCanonicalName());
views.add(view1);
ViewElement view2 = newView(SimpleView03.class, "view2");
view2.setClassName(SimpleView03.class.getCanonicalName());
views.add(view2);
ViewElement view3 = newView(SimpleView04.class, "view3");
view3.setClassName(SimpleView04.class.getCanonicalName());
views.add(view3);
PresenterElement presenter = new PresenterElement();
presenter.setName("presenter1");
Class<?> c = SimplePresenter01.class;
presenter.setClassName(c.getCanonicalName());
oracle.addClass(c);
presenter.setView("view1");
presenters.add(presenter);
PresenterElement presenter2 = new PresenterElement();
presenter2.setName("presenter2");
c = PresenterWithService.class;
presenter2.setClassName(c.getCanonicalName());
oracle.addClass(c);
presenter2.setView("view2");
presenter2.setMultiple("true");
presenters.add(presenter2);
PresenterElement presenter3 = new PresenterElement();
presenter3.setName("presenter3");
c = Presenters.AsyncPresenter.class;
oracle.addClass(c);
presenter3.setClassName(c.getCanonicalName());
presenter3.setView("view3");
presenter3.setAsync("true");
presenters.add(presenter3);
EventElement event = newEvent("event");
event.setHandlers(new String[] { "presenter1", "presenter2", "presenter3" });
events.add(event);
setEventBus();
configuration.validateEventHandlers();
assertTrue(view1.isInstantiateAtStart());
assertFalse(view2.isInstantiateAtStart());
assertFalse(view3.isInstantiateAtStart());
}
use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testSameHistoryName.
@Test
public void testSameHistoryName() {
EventElement e = newEvent("start");
e.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
e.setHistory("history");
e.setName("name");
events.add(e);
e = newEvent("start2");
e.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
e.setHistory("history");
e.setName("name");
events.add(e);
try {
configuration.validateHistoryConverters();
fail();
} catch (InvalidMvp4gConfigurationException ex) {
assertEquals("Event start2: history name already used for another event: name.", ex.getMessage());
}
}
Aggregations