use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testForwardEventWithParameter.
@Test
public void testForwardEventWithParameter() throws InvalidMvp4gConfigurationException {
configuration.setModule(oracle.addClass(Modules.Module01.class));
EventElement e = newEvent("forward");
e.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
events.add(e);
StartElement start = configuration.getStart();
start.setForwardEventType("forward");
try {
setEventBus();
JClassType parentEventBus = oracle.addClass(EventBus.class);
configuration.setParentEventBus(parentEventBus);
configuration.validateEvents();
fail();
} catch (InvalidMvp4gConfigurationException ex) {
assertEquals("Forward: Forward event forward can't have any object associated with it.", ex.getMessage());
}
}
use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testEventHistoryConverterSucceeds.
@Test
public void testEventHistoryConverterSucceeds() throws InvalidMvp4gConfigurationException {
historyConverters.add(newHistoryConverter(SimpleHistoryConverter01.class, "testHistoryConverter"));
EventElement event = newEvent("testEvent");
event.setHistory("testHistoryConverter");
events.add(event);
setEventBus();
configuration.validateHistoryConverters();
}
use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testWrongEventHandlerClass.
@Test
public void testWrongEventHandlerClass() throws InvalidMvp4gConfigurationException {
EventBusElement eventBus = new EventBusElement(EventBusWithLookup.class.getName(), BaseEventBus.class.getName(), false);
configuration.setEventBus(eventBus);
EventElement event = newEvent("event");
event.setHandlers(new String[] { "test" });
events.add(event);
EventHandlerElement handler = new EventHandlerElement();
handler.setClassName(Object.class.getCanonicalName());
handler.setName("test");
eventHandlers.add(handler);
try {
configuration.validateEventHandlers();
fail();
} catch (InvalidClassException e) {
}
handler.setMultiple(Boolean.TRUE.toString());
try {
configuration.validateEventHandlers();
fail();
} catch (InvalidClassException e) {
}
PresenterElement presenter = new PresenterElement();
Class<?> c = SimpleEventHandler01.class;
oracle.addClass(c);
presenter.setClassName(c.getCanonicalName());
presenter.setName("test");
presenters.add(presenter);
try {
configuration.validateEventHandlers();
fail();
} catch (InvalidClassException e) {
}
presenter.setMultiple(Boolean.TRUE.toString());
try {
configuration.validateEventHandlers();
fail();
} catch (InvalidClassException e) {
}
}
use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testSplitterLoadersIncompatibleType.
@Test
public void testSplitterLoadersIncompatibleType() throws InvalidMvp4gConfigurationException {
EventBusElement eventBus = new EventBusElement(EventBus.class.getName(), BaseEventBus.class.getName(), false);
configuration.setEventBus(eventBus);
oracle.addClass(Loaders.Loader1.class);
oracle.addClass(Splitters.SplitterWithLoader.class);
PresenterElement presenter1 = newPresenter(SimplePresenter01.class, "presenter1");
presenter1.setAsync(Splitters.SplitterWithLoader.class.getCanonicalName());
presenters.add(presenter1);
EventElement event = new EventElement();
event.setHandlers(new String[] { "presenter1" });
configuration.getEvents().add(event);
try {
configuration.validateSplitters();
fail();
} catch (InvalidTypeException e) {
assertTrue(e.getMessage().contains("Can not convert " + EventBus.class.getCanonicalName()));
}
}
use of com.mvp4g.rebind.config.element.EventElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testForwardOk.
@Test
public void testForwardOk() throws InvalidMvp4gConfigurationException {
configuration.setModule(oracle.addClass(Modules.Module01.class));
EventElement e = newEvent("forward");
events.add(e);
StartElement start = configuration.getStart();
start.setForwardEventType("forward");
setEventBus();
JClassType parentEventBus = oracle.addClass(EventBus.class);
configuration.setParentEventBus(parentEventBus);
configuration.validateEvents();
}
Aggregations