Search in sources :

Example 1 with StartElement

use of com.mvp4g.rebind.config.element.StartElement 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 2 with StartElement

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

the class Mvp4gConfigurationTest method testForwardEventRootModule.

@Test
public void testForwardEventRootModule() throws InvalidMvp4gConfigurationException {
    StartElement start = configuration.getStart();
    start.setForwardEventType("forward");
    try {
        configuration.validateEvents();
        fail();
    } catch (InvalidMvp4gConfigurationException ex) {
        assertEquals("You can't define a forward event for RootModule since no event from parent can be forwarded to it.", ex.getMessage());
    }
}
Also used : StartElement(com.mvp4g.rebind.config.element.StartElement) InvalidMvp4gConfigurationException(com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException) Test(org.junit.Test)

Example 3 with StartElement

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

the class Mvp4gConfigurationTest method testStartEventWithParameter.

@Test
public void testStartEventWithParameter() throws InvalidMvp4gConfigurationException {
    EventElement e = newEvent("start");
    e.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
    events.add(e);
    StartElement start = configuration.getStart();
    start.setPresenter("startPresenter");
    start.setEventType("start");
    try {
        configuration.validateStart();
        fail();
    } catch (InvalidMvp4gConfigurationException ex) {
        assertEquals("Start: Start event start can't have any object associated with it.", ex.getMessage());
    }
    events.clear();
    e = newEvent("start");
    events.add(e);
    configuration.validateStart();
}
Also used : StartElement(com.mvp4g.rebind.config.element.StartElement) EventElement(com.mvp4g.rebind.config.element.EventElement) InvalidMvp4gConfigurationException(com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException) OneObject(com.mvp4g.rebind.test_tools.OneObject) Test(org.junit.Test)

Example 4 with StartElement

use of com.mvp4g.rebind.config.element.StartElement 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 5 with StartElement

use of com.mvp4g.rebind.config.element.StartElement 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());
    }
}
Also used : StartElement(com.mvp4g.rebind.config.element.StartElement) JClassType(com.google.gwt.core.ext.typeinfo.JClassType) EventElement(com.mvp4g.rebind.config.element.EventElement) InvalidMvp4gConfigurationException(com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException) OneObject(com.mvp4g.rebind.test_tools.OneObject) Test(org.junit.Test)

Aggregations

StartElement (com.mvp4g.rebind.config.element.StartElement)7 Test (org.junit.Test)6 JClassType (com.google.gwt.core.ext.typeinfo.JClassType)3 EventElement (com.mvp4g.rebind.config.element.EventElement)3 HistoryElement (com.mvp4g.rebind.config.element.HistoryElement)3 InvalidMvp4gConfigurationException (com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException)3 Mvp4gModule (com.mvp4g.client.Mvp4gModule)2 EventBusElement (com.mvp4g.rebind.config.element.EventBusElement)2 OneObject (com.mvp4g.rebind.test_tools.OneObject)2 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 GeneratorContextStub (com.mvp4g.rebind.test_tools.GeneratorContextStub)1 Before (org.junit.Before)1