Search in sources :

Example 1 with TypeOracleStub

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

the class ChildModuleElementTest method testParentEventBus.

@Test
public void testParentEventBus() {
    ChildModuleElement childModuleElement = new ChildModuleElement();
    assertNull(childModuleElement.getParentEventBus());
    JClassType parentEventBus = new TypeOracleStub().addClass(EventBusOk.class);
    childModuleElement.setParentEventBus(parentEventBus);
    assertSame(parentEventBus, childModuleElement.getParentEventBus());
}
Also used : JClassType(com.google.gwt.core.ext.typeinfo.JClassType) TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) Test(org.junit.Test)

Example 2 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteSiblingEvent.

private void testWriteSiblingEvent(boolean passive) {
    String passiveStr = Boolean.toString(passive);
    configuration.setLoadChildConfig(new ChildModulesElement());
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    String moduleType = oracle.addClass(Modules.ModuleWithParent01.class).getQualifiedSourceName();
    EventElement event1 = new EventElement();
    event1.setType("event1");
    event1.setPassive(passiveStr);
    event1.setSiblingsToLoad(new String[] { moduleType });
    EventElement event2 = new EventElement();
    event2.setType("event2");
    event2.setEventObjectClass(new String[] { "java.lang.String" });
    event2.setSiblingsToLoad(new String[] { moduleType });
    event2.setPassive(passiveStr);
    EventElement event3 = new EventElement();
    event3.setType("event3");
    event3.setEventObjectClass(new String[] { "java.lang.String", "java.lang.Object" });
    event3.setSiblingsToLoad(new String[] { moduleType });
    event3.setPassive(passiveStr);
    configuration.getEvents().add(event1);
    configuration.getEvents().add(event2);
    configuration.getEvents().add(event3);
    configuration.getOthersEventBusClassMap().put(moduleType, oracle.addClass(EventBusOk.class));
    assertOutput(getExpectedEventSiblingLoad(passive), false);
    writer.writeConf();
    assertOutput(getExpectedEventSiblingLoad(passive), true);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) EventBusOk(com.mvp4g.rebind.test_tools.annotation.events.EventBusOk)

Example 3 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteMultipleImpl.

@Test
public void testWriteMultipleImpl() {
    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");
    configuration.getChildModules().add(childModule);
    SplitterElement splitter = new SplitterElement();
    splitter.setName("splitter");
    splitter.setClassName("Splitter");
    configuration.getSplitters().add(splitter);
    configuration.setSuffix("suffix");
    assertOutput(getExpectedMultipleImpl(), false);
    writer.writeConf();
    assertOutput(getExpectedMultipleImpl(), true);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) JClassType(com.google.gwt.core.ext.typeinfo.JClassType) Test(org.junit.Test)

Example 4 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteChildModuleMethods.

@Test
public void testWriteChildModuleMethods() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    configuration.setModule(oracle.addClass(Modules.Module01.class));
    configuration.setParentEventBus(oracle.addClass(EventBusWithLookup.class));
    configuration.setHistoryName("child");
    assertOutput(getExpectedChildMethod(), false);
    writer.writeConf();
    assertOutput(getExpectedChildMethod(), true);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) EventBusWithLookup(com.mvp4g.client.event.EventBusWithLookup) Test(org.junit.Test)

Example 5 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteChildModuleMethodsNoHistory.

@Test
public void testWriteChildModuleMethodsNoHistory() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    configuration.setModule(oracle.addClass(Modules.Module01.class));
    configuration.setParentEventBus(oracle.addClass(EventBusWithLookup.class));
    assertOutput(getExpectedChildMethodNoHistory(), false);
    writer.writeConf();
    assertOutput(getExpectedChildMethodNoHistory(), true);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) EventBusWithLookup(com.mvp4g.client.event.EventBusWithLookup) 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