Search in sources :

Example 1 with HistoryElement

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

the class Mvp4gConfigurationTest method testHistoryWhenParent.

@Test
public void testHistoryWhenParent() throws InvalidMvp4gConfigurationException {
    historyConverters.add(new HistoryConverterElement());
    configuration.setModule(oracle.addClass(Modules.ModuleWithParent01.class));
    // configuration.setModule( oracle.addClass( Modules.ModuleWithParent01.class ) );
    setParentEventBus(Modules.ModuleWithParent01.class, EventBusOk.class);
    configuration.loadParentModule();
    configuration.getHistory().setInitEvent("event");
    try {
        configuration.validateHistory();
        fail();
    } catch (InvalidMvp4gConfigurationException e) {
        assertEquals("Module com.mvp4g.rebind.test_tools.Modules.ModuleWithParent01: History configuration (init, not found event and history parameter separator) should be set only for root module (only module with no parent)", e.getMessage());
    }
    HistoryElement history = new HistoryElement();
    configuration.setHistory(history);
    history.setNotFoundEvent("event");
    try {
        configuration.validateHistory();
        fail();
    } catch (InvalidMvp4gConfigurationException e) {
        assertEquals("Module com.mvp4g.rebind.test_tools.Modules.ModuleWithParent01: History configuration (init, not found event and history parameter separator) should be set only for root module (only module with no parent)", e.getMessage());
    }
    history = new HistoryElement();
    configuration.setHistory(history);
    configuration.validateHistory();
    assertNull(configuration.getHistory());
}
Also used : HistoryElement(com.mvp4g.rebind.config.element.HistoryElement) 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 2 with HistoryElement

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

the class Mvp4gConfigurationTest method testSetterAndGetter.

@Test
public void testSetterAndGetter() {
    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(null, null, false);
    configuration.setEventBus(eventBus);
    assertSame(eventBus, configuration.getEventBus());
    assertSame(oracle, configuration.getOracle());
}
Also used : StartElement(com.mvp4g.rebind.config.element.StartElement) HistoryElement(com.mvp4g.rebind.config.element.HistoryElement) EventBusElement(com.mvp4g.rebind.config.element.EventBusElement) Test(org.junit.Test)

Example 3 with HistoryElement

use of com.mvp4g.rebind.config.element.HistoryElement 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());
}
Also used : StartElement(com.mvp4g.rebind.config.element.StartElement) HistoryElement(com.mvp4g.rebind.config.element.HistoryElement) JClassType(com.google.gwt.core.ext.typeinfo.JClassType) GinModuleElement(com.mvp4g.rebind.config.element.GinModuleElement) Mvp4gModule(com.mvp4g.client.Mvp4gModule) ChildModulesElement(com.mvp4g.rebind.config.element.ChildModulesElement) EventBusElement(com.mvp4g.rebind.config.element.EventBusElement) DebugElement(com.mvp4g.rebind.config.element.DebugElement) EventFiltersElement(com.mvp4g.rebind.config.element.EventFiltersElement) Test(org.junit.Test)

Example 4 with HistoryElement

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

the class Mvp4gConfigurationTest method setUp.

@Before
public void setUp() {
    GeneratorContextStub context = new GeneratorContextStub();
    builder = new UnitTestTreeLogger.Builder();
    logger = builder.createLogger();
    oracle = context.getTypeOracleStub();
    // oracle.addClass( SimpleView01.class );
    configuration = new Mvp4gConfiguration(logger, context);
    presenters = configuration.getPresenters();
    views = configuration.getViews();
    events = configuration.getEvents();
    services = configuration.getServices();
    historyConverters = configuration.getHistoryConverters();
    childModules = configuration.getChildModules();
    eventHandlers = configuration.getEventHandlers();
    eventFilters = configuration.getEventFilters();
    configuration.setStart(new StartElement());
    configuration.setHistory(new HistoryElement());
    configuration.setModule(oracle.addClass(Mvp4gModule.class));
}
Also used : StartElement(com.mvp4g.rebind.config.element.StartElement) HistoryElement(com.mvp4g.rebind.config.element.HistoryElement) GeneratorContextStub(com.mvp4g.rebind.test_tools.GeneratorContextStub) Mvp4gModule(com.mvp4g.client.Mvp4gModule) UnitTestTreeLogger(com.google.gwt.dev.util.UnitTestTreeLogger) Before(org.junit.Before)

Aggregations

HistoryElement (com.mvp4g.rebind.config.element.HistoryElement)4 StartElement (com.mvp4g.rebind.config.element.StartElement)3 Test (org.junit.Test)3 Mvp4gModule (com.mvp4g.client.Mvp4gModule)2 EventBusElement (com.mvp4g.rebind.config.element.EventBusElement)2 JClassType (com.google.gwt.core.ext.typeinfo.JClassType)1 UnitTestTreeLogger (com.google.gwt.dev.util.UnitTestTreeLogger)1 ChildModulesElement (com.mvp4g.rebind.config.element.ChildModulesElement)1 DebugElement (com.mvp4g.rebind.config.element.DebugElement)1 EventFiltersElement (com.mvp4g.rebind.config.element.EventFiltersElement)1 GinModuleElement (com.mvp4g.rebind.config.element.GinModuleElement)1 HistoryConverterElement (com.mvp4g.rebind.config.element.HistoryConverterElement)1 InvalidMvp4gConfigurationException (com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException)1 GeneratorContextStub (com.mvp4g.rebind.test_tools.GeneratorContextStub)1 Modules (com.mvp4g.rebind.test_tools.Modules)1 Before (org.junit.Before)1