use of com.mvp4g.rebind.config.element.ChildModuleElement 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.ChildModuleElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testFindChildModuleSameHistory.
@Test(expected = InvalidMvp4gConfigurationException.class)
public void testFindChildModuleSameHistory() throws InvalidMvp4gConfigurationException {
setEventBus();
ChildModuleElement childModule1 = newChildModule(Modules.ModuleWithParent01.class, "child1");
childModules.add(childModule1);
ChildModuleElement childModule2 = new ChildModuleElement();
childModule2.setName("child2");
childModule2.setClassName(Modules.ModuleWithParent01.class.getCanonicalName());
childModules.add(childModule2);
JClassType module = oracle.findType(Mvp4gModule.class.getCanonicalName());
configuration.setModule(module);
try {
configuration.findChildModuleHistoryNameAndLoader();
fail();
} catch (InvalidMvp4gConfigurationException e) {
String.format("Module %s: You can't have two child modules with the same history name \"%s\".", module.getQualifiedSourceName(), "moduleWithParent");
throw e;
}
}
use of com.mvp4g.rebind.config.element.ChildModuleElement 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.ChildModuleElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method setParentEventBus.
private void setParentEventBus(Class<?> moduleClass, Class<?> parentEventBusClass) {
ChildModuleElement elt = new ChildModuleElement();
elt.setParentEventBus(oracle.findType(parentEventBusClass.getCanonicalName()));
configuration.getModuleParentEventBusClassMap().put(moduleClass.getCanonicalName(), elt);
}
use of com.mvp4g.rebind.config.element.ChildModuleElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testInvalidChildModule.
@Test(expected = InvalidClassException.class)
public void testInvalidChildModule() throws InvalidMvp4gConfigurationException {
ChildModuleElement childModule1 = new ChildModuleElement();
childModule1.setName("child1");
childModule1.setClassName(Object.class.getName());
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();
}
Aggregations