Search in sources :

Example 6 with TypeOracleStub

use of com.google.gwt.dev.javac.typemodel.TypeOracleStub in project mvp4g by mvp4g.

the class Mvp4gConfigurationFileReaderTest method testWriteChildEvent.

@Test
public void testWriteChildEvent() {
    configuration.setLoadChildConfig(new ChildModulesElement());
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    JClassType moduleType = oracle.addClass(Modules.ModuleWithParent01.class);
    ChildModuleElement childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("child");
    childModule.setAutoDisplay("false");
    childModule.setAsync("false");
    configuration.getChildModules().add(childModule);
    EventElement event1 = new EventElement();
    event1.setType("event1");
    event1.setForwardToModules(new String[] { "child" });
    EventElement event2 = new EventElement();
    event2.setType("event2");
    event2.setEventObjectClass(new String[] { "java.lang.String" });
    event2.setForwardToModules(new String[] { "child" });
    EventElement event3 = new EventElement();
    event3.setType("event3");
    event3.setEventObjectClass(new String[] { "java.lang.String", "java.lang.Object" });
    event3.setForwardToModules(new String[] { "child" });
    configuration.getEvents().add(event1);
    configuration.getEvents().add(event2);
    configuration.getEvents().add(event3);
    configuration.getOthersEventBusClassMap().put(Modules.ModuleWithParent01.class.getCanonicalName(), oracle.addClass(EventBusOk.class));
    assertOutput(getExpectedEventChildModuleLoad(), false);
    writer.writeConf();
    assertOutput(getExpectedEventChildModuleLoad(), true);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) JClassType(com.google.gwt.core.ext.typeinfo.JClassType) EventBusOk(com.mvp4g.rebind.test_tools.annotation.events.EventBusOk) Test(org.junit.Test)

Example 7 with TypeOracleStub

use of com.google.gwt.dev.javac.typemodel.TypeOracleStub in project mvp4g by mvp4g.

the class Mvp4gConfigurationFileReaderTest method testWriteChildWithParentAsyncoAutoLoad.

@Test
public void testWriteChildWithParentAsyncoAutoLoad() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    JClassType moduleType = oracle.addClass(Modules.ModuleWithParent01.class);
    ChildModuleElement childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("childModule");
    childModule.setEventToDisplayView("changeBody");
    EventElement event = new EventElement();
    event.setType("errorOnLoad");
    event.setEventObjectClass(new String[] { Throwable.class.getCanonicalName() });
    configuration.getEvents().add(event);
    event = new EventElement();
    event.setType("changeBody");
    event.setEventObjectClass(new String[] { Widget.class.getCanonicalName() });
    configuration.getEvents().add(event);
    ChildModulesElement loadConfig = new ChildModulesElement();
    loadConfig.setAfterEvent("afterLoad");
    loadConfig.setBeforeEvent("beforeLoad");
    loadConfig.setErrorEvent("errorOnLoad");
    configuration.getChildModules().add(childModule);
    configuration.setLoadChildConfig(loadConfig);
    assertOutput(getExpectedChildModule(Modules.ModuleWithParent01.class.getCanonicalName()), false);
    assertOutput(getExpectedAsyncChildModule(), false);
    assertOutput(getExpectedAutoDisplayChildModule(), false);
    writer.writeConf();
    assertOutput(getExpectedChildModule(Modules.ModuleWithParent01.class.getCanonicalName()), true);
    assertOutput(getExpectedAsyncChildModule(), true);
    assertOutput(getExpectedAutoDisplayChildModule(), true);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) JClassType(com.google.gwt.core.ext.typeinfo.JClassType) Widget(com.google.gwt.user.client.ui.Widget) Test(org.junit.Test)

Example 8 with TypeOracleStub

use of com.google.gwt.dev.javac.typemodel.TypeOracleStub in project mvp4g by mvp4g.

the class Mvp4gConfigurationFileReaderTest method testWriteParentHistory.

@Test
public void testWriteParentHistory() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    JClassType moduleType = oracle.addClass(Modules.ModuleWithParent01.class);
    ChildModuleElement childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("child");
    childModule.setHistoryName("child");
    childModule.setAutoDisplay("false");
    childModule.setAsync("false");
    configuration.getChildModules().add(childModule);
    EventElement event = new EventElement();
    event.setType("test");
    event.setForwardToModules(new String[] { "child" });
    configuration.getEvents().add(event);
    configuration.getOthersEventBusClassMap().put(Modules.ModuleWithParent01.class.getCanonicalName(), oracle.addClass(EventBusOk.class));
    assertOutput(getExpectedHistoryParent(), false);
    writer.writeConf();
    assertOutput(getExpectedHistoryParent(), true);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) JClassType(com.google.gwt.core.ext.typeinfo.JClassType) EventBusOk(com.mvp4g.rebind.test_tools.annotation.events.EventBusOk) Test(org.junit.Test)

Example 9 with TypeOracleStub

use of com.google.gwt.dev.javac.typemodel.TypeOracleStub in project mvp4g by mvp4g.

the class Mvp4gConfigurationFileReaderTest method testWriteLoadChildModule.

@Test
public void testWriteLoadChildModule() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    Set<ChildModuleElement> children = configuration.getChildModules();
    JClassType moduleType = oracle.addClass(Modules.ModuleWithParent01.class);
    ChildModuleElement childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("childModule1");
    childModule.setAutoDisplay("false");
    children.add(childModule);
    moduleType = oracle.addClass(Modules.Module01.class);
    childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("childModule2");
    childModule.setAutoDisplay("false");
    children.add(childModule);
    assertOutput(getExpectedLoadChildModule(), false);
    writer.writeConf();
    assertOutput(getExpectedLoadChildModule(), true);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) JClassType(com.google.gwt.core.ext.typeinfo.JClassType) Test(org.junit.Test)

Example 10 with TypeOracleStub

use of com.google.gwt.dev.javac.typemodel.TypeOracleStub in project mvp4g by mvp4g.

the class Mvp4gConfigurationFileReaderTest method testWriteChildWithParentAsyncNoAutoLoad.

@Test
public void testWriteChildWithParentAsyncNoAutoLoad() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    JClassType moduleType = oracle.addClass(Modules.ModuleWithParent01.class);
    ChildModuleElement childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("childModule");
    childModule.setAutoDisplay("false");
    EventElement event = new EventElement();
    event.setType("errorOnLoad");
    event.setEventObjectClass(new String[] { Throwable.class.getCanonicalName() });
    configuration.getEvents().add(event);
    ChildModulesElement loadConfig = new ChildModulesElement();
    loadConfig.setAfterEvent("afterLoad");
    loadConfig.setBeforeEvent("beforeLoad");
    loadConfig.setErrorEvent("errorOnLoad");
    configuration.getChildModules().add(childModule);
    configuration.setLoadChildConfig(loadConfig);
    assertOutput(getExpectedChildModule(Modules.ModuleWithParent01.class.getCanonicalName()), false);
    assertOutput(getExpectedAsyncChildModule(), false);
    assertOutput(getExpectedAutoDisplayChildModule(), false);
    writer.writeConf();
    assertOutput(getExpectedChildModule(Modules.ModuleWithParent01.class.getCanonicalName()), true);
    assertOutput(getExpectedAsyncChildModule(), true);
    assertOutput(getExpectedAutoDisplayChildModule(), false);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) JClassType(com.google.gwt.core.ext.typeinfo.JClassType) Test(org.junit.Test)

Aggregations

TypeOracleStub (com.google.gwt.dev.javac.typemodel.TypeOracleStub)19 Test (org.junit.Test)16 JClassType (com.google.gwt.core.ext.typeinfo.JClassType)13 EventBusOk (com.mvp4g.rebind.test_tools.annotation.events.EventBusOk)5 EventBusWithLookup (com.mvp4g.client.event.EventBusWithLookup)3 SimplePresenter01 (com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01)2 Before (org.junit.Before)2 TreeLogger (com.google.gwt.core.ext.TreeLogger)1 UnitTestTreeLogger (com.google.gwt.dev.util.UnitTestTreeLogger)1 Widget (com.google.gwt.user.client.ui.Widget)1 DefaultMvp4gGinModule (com.mvp4g.client.DefaultMvp4gGinModule)1 Mvp4gModule (com.mvp4g.client.Mvp4gModule)1 Mvp4gConfiguration (com.mvp4g.rebind.config.Mvp4gConfiguration)1 SimpleEventHandler01 (com.mvp4g.rebind.test_tools.annotation.handlers.SimpleEventHandler01)1