use of com.mvp4g.rebind.config.element.ChildModulesElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testEventLoadConfigEventOk.
@Test
public void testEventLoadConfigEventOk() throws InvalidMvp4gConfigurationException {
configuration.setHistory(null);
EventElement e = newEvent("event");
events.add(e);
ChildModulesElement childModules = new ChildModulesElement();
configuration.setLoadChildConfig(childModules);
childModules.setBeforeEvent("event");
childModules.setAfterEvent("event");
childModules.setErrorEvent("event");
configuration.validateEvents();
e = newEvent("event2");
e.setEventObjectClass(new String[] { Throwable.class.getCanonicalName() });
events.add(e);
childModules = new ChildModulesElement();
configuration.setLoadChildConfig(childModules);
childModules.setErrorEvent("event2");
configuration.validateEvents();
}
use of com.mvp4g.rebind.config.element.ChildModulesElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testUnknownLoadConfigEvent.
@Test
public void testUnknownLoadConfigEvent() throws InvalidMvp4gConfigurationException {
ChildModulesElement childModules = new ChildModulesElement();
configuration.setHistory(null);
configuration.setLoadChildConfig(childModules);
childModules.setBeforeEvent("unknown");
try {
configuration.validateEvents();
fail();
} catch (UnknownConfigurationElementException e) {
// nothing to test
}
childModules = new ChildModulesElement();
configuration.setLoadChildConfig(childModules);
childModules.setAfterEvent("unknown");
try {
configuration.validateEvents();
fail();
} catch (UnknownConfigurationElementException e) {
// nothing to test
}
childModules = new ChildModulesElement();
configuration.setLoadChildConfig(childModules);
childModules.setErrorEvent("unknown");
try {
configuration.validateEvents();
fail();
} catch (UnknownConfigurationElementException e) {
// nothing to test
}
}
use of com.mvp4g.rebind.config.element.ChildModulesElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testSetterGetter.
@Test
public void testSetterGetter() {
StartElement start = new StartElement();
configuration.setStart(start);
assertSame(start, configuration.getStart());
HistoryElement history = new HistoryElement();
configuration.setHistory(history);
assertSame(history, configuration.getHistory());
EventBusElement eventBus = new EventBusElement("", "", false);
configuration.setEventBus(eventBus);
assertSame(eventBus, configuration.getEventBus());
JClassType module = oracle.findType(Mvp4gModule.class.getCanonicalName());
configuration.setModule(module);
assertSame(module, configuration.getModule());
JClassType parentEventBus = oracle.addClass(EventBus.class);
configuration.setParentEventBus(parentEventBus);
assertSame(parentEventBus, configuration.getParentEventBus());
String historyName = "historyName";
configuration.setHistoryName("historyName");
assertSame(historyName, configuration.getHistoryName());
ChildModulesElement childConfig = new ChildModulesElement();
configuration.setLoadChildConfig(childConfig);
assertSame(childConfig, configuration.getLoadChildConfig());
DebugElement debug = new DebugElement();
configuration.setDebug(debug);
assertSame(debug, configuration.getDebug());
GinModuleElement gin = new GinModuleElement();
configuration.setGinModule(gin);
assertSame(gin, configuration.getGinModule());
EventFiltersElement filters = new EventFiltersElement();
configuration.setEventFilterConfiguration(filters);
assertSame(filters, configuration.getEventFilterConfiguration());
}
use of com.mvp4g.rebind.config.element.ChildModulesElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testWrongEventLoadConfigEvent.
@Test
public void testWrongEventLoadConfigEvent() throws InvalidMvp4gConfigurationException {
configuration.setHistory(null);
EventElement e = newEvent("event");
e.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
events.add(e);
ChildModulesElement childModules = new ChildModulesElement();
configuration.setLoadChildConfig(childModules);
childModules.setBeforeEvent("event");
try {
configuration.validateEvents();
fail();
} catch (InvalidMvp4gConfigurationException ex) {
assertEquals(String.format("%s: %s event %s can't have any object associated with it.", childModules.getTagName(), "Before", "event"), ex.getMessage());
}
childModules = new ChildModulesElement();
configuration.setLoadChildConfig(childModules);
childModules.setAfterEvent("event");
try {
configuration.validateEvents();
fail();
} catch (InvalidMvp4gConfigurationException ex) {
assertEquals(String.format("%s: %s event %s can't have any object associated with it.", childModules.getTagName(), "After", "event"), ex.getMessage());
}
childModules = new ChildModulesElement();
configuration.setLoadChildConfig(childModules);
childModules.setErrorEvent("event");
try {
configuration.validateEvents();
fail();
} catch (InvalidMvp4gConfigurationException ex) {
assertEquals("childModules: Error event event can only be associated with one and only one object with type java.lang.Throwable", ex.getMessage());
}
}
Aggregations