Search in sources :

Example 6 with HistoryConverterElement

use of com.mvp4g.rebind.config.element.HistoryConverterElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testHistoryConverterWithNoHistory.

@Test(expected = InvalidMvp4gConfigurationException.class)
public void testHistoryConverterWithNoHistory() throws InvalidMvp4gConfigurationException {
    historyConverters.add(new HistoryConverterElement());
    configuration.validateHistory();
}
Also used : HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement) Test(org.junit.Test)

Example 7 with HistoryConverterElement

use of com.mvp4g.rebind.config.element.HistoryConverterElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testInjectedServiceValidationSucceeds.

@Test
public void testInjectedServiceValidationSucceeds() throws UnknownConfigurationElementException {
    services.add(newService("testService"));
    PresenterElement presenter = newPresenter(SimplePresenter01.class, "testPresenter");
    presenter.getInjectedServices().add(new InjectedElement("testService", "setTestService"));
    presenters.add(presenter);
    HistoryConverterElement historyConverter = newHistoryConverter(SimpleHistoryConverter01.class, "testHistoryConverter");
    historyConverter.getInjectedServices().add(new InjectedElement("testService", "setTestService"));
    historyConverters.add(historyConverter);
    configuration.validateServices();
}
Also used : HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement) InjectedElement(com.mvp4g.rebind.config.element.InjectedElement) PresenterElement(com.mvp4g.rebind.config.element.PresenterElement) Test(org.junit.Test)

Example 8 with HistoryConverterElement

use of com.mvp4g.rebind.config.element.HistoryConverterElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testHistoryName.

@Test
public void testHistoryName() throws InvalidMvp4gConfigurationException {
    historyConverters.add(new HistoryConverterElement());
    configuration.setModule(oracle.addClass(Modules.ModuleWithParentNoName.class));
    setParentEventBus(Modules.ModuleWithParentNoName.class, EventBusOk.class);
    configuration.loadParentModule();
    assertNull(configuration.getHistoryName());
    try {
        configuration.validateHistory();
        fail();
    } catch (InvalidMvp4gConfigurationException e) {
        assertTrue(e.getMessage().contains("Child module that defines history converter must have a"));
    }
    configuration.setModule(oracle.addClass(Modules.ModuleWithParent01.class));
    setParentEventBus(Modules.ModuleWithParent01.class, EventBusOk.class);
    configuration.loadParentModule();
    assertEquals("moduleWithParent01", configuration.getHistoryName());
    configuration.validateHistory();
}
Also used : HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement) InvalidMvp4gConfigurationException(com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException) Modules(com.mvp4g.rebind.test_tools.Modules) Test(org.junit.Test)

Example 9 with HistoryConverterElement

use of com.mvp4g.rebind.config.element.HistoryConverterElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testInjectedServiceValidationFailsForHistoryConverter.

@Test(expected = UnknownConfigurationElementException.class)
public void testInjectedServiceValidationFailsForHistoryConverter() throws UnknownConfigurationElementException, InvalidTypeException, InvalidClassException, NotFoundClassException {
    events.add(newEvent("badService"));
    views.add(newView(SimpleView02.class, "badService"));
    presenters.add(newPresenter(SimplePresenter01.class, "badService"));
    historyConverters.add(newHistoryConverter(SimpleHistoryConverter01.class, "badService"));
    HistoryConverterElement historyConverter = newHistoryConverter(SimpleHistoryConverter02.class, "testHistoryConverter");
    historyConverter.getInjectedServices().add(new InjectedElement("badService", "setBadService"));
    historyConverters.add(historyConverter);
    configuration.validateServices();
}
Also used : SimpleView02(com.mvp4g.rebind.test_tools.annotation.views.SimpleView02) HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement) InjectedElement(com.mvp4g.rebind.config.element.InjectedElement) SimpleHistoryConverter01(com.mvp4g.rebind.test_tools.annotation.history_converters.SimpleHistoryConverter01) SimplePresenter01(com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01) Test(org.junit.Test)

Example 10 with HistoryConverterElement

use of com.mvp4g.rebind.config.element.HistoryConverterElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testHistoryOk.

@Test
public void testHistoryOk() throws InvalidMvp4gConfigurationException {
    configuration.getHistory().setInitEvent("init");
    historyConverters.add(new HistoryConverterElement());
    configuration.validateHistory();
}
Also used : HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement) Test(org.junit.Test)

Aggregations

HistoryConverterElement (com.mvp4g.rebind.config.element.HistoryConverterElement)14 Test (org.junit.Test)12 EventElement (com.mvp4g.rebind.config.element.EventElement)4 InjectedElement (com.mvp4g.rebind.config.element.InjectedElement)3 BaseEventBus (com.mvp4g.client.event.BaseEventBus)2 EventBus (com.mvp4g.client.event.EventBus)2 EventBusElement (com.mvp4g.rebind.config.element.EventBusElement)2 PresenterElement (com.mvp4g.rebind.config.element.PresenterElement)2 InvalidMvp4gConfigurationException (com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException)2 Modules (com.mvp4g.rebind.test_tools.Modules)2 ClearHistory (com.mvp4g.client.history.ClearHistory)1 EventHandlerElement (com.mvp4g.rebind.config.element.EventHandlerElement)1 HistoryElement (com.mvp4g.rebind.config.element.HistoryElement)1 ServiceElement (com.mvp4g.rebind.config.element.ServiceElement)1 InvalidTypeException (com.mvp4g.rebind.exception.InvalidTypeException)1 OneObject (com.mvp4g.rebind.test_tools.OneObject)1 EventBusOk (com.mvp4g.rebind.test_tools.annotation.events.EventBusOk)1 SimpleHistoryConverter01 (com.mvp4g.rebind.test_tools.annotation.history_converters.SimpleHistoryConverter01)1 SimplePresenter01 (com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01)1 SimpleView02 (com.mvp4g.rebind.test_tools.annotation.views.SimpleView02)1