Search in sources :

Example 16 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method setUp.

@Before
public void setUp() {
    sourceWriter = new SourceWriterTestStub();
    TreeLogger tl = new UnitTestTreeLogger.Builder().createLogger();
    configuration = new Mvp4gConfiguration(tl, new GeneratorContextStub());
    writer = new Mvp4gConfigurationFileWriter(sourceWriter, configuration);
    String eventBusInterface = EventBus.class.getName();
    String eventBusClass = BaseEventBus.class.getName();
    configuration.setEventBus(new EventBusElement(eventBusInterface, eventBusClass, false));
    ViewElement view = new ViewElement();
    view.setClassName(Object.class.getName());
    view.setName("startView");
    configuration.getViews().add(view);
    PresenterElement presenter = new PresenterElement();
    presenter.setClassName(SimplePresenter01.class.getCanonicalName());
    presenter.setName("startPresenter");
    presenter.setView("startView");
    configuration.getPresenters().add(presenter);
    StartElement start = new StartElement();
    start.setPresenter("startPresenter");
    configuration.setStart(start);
    GinModuleElement ginModule = new GinModuleElement();
    ginModule.setModules(new String[] { DefaultMvp4gGinModule.class.getCanonicalName() });
    configuration.setGinModule(ginModule);
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    configuration.setModule(oracle.addClass(Mvp4gModule.class));
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) Mvp4gConfiguration(com.mvp4g.rebind.config.Mvp4gConfiguration) Mvp4gModule(com.mvp4g.client.Mvp4gModule) UnitTestTreeLogger(com.google.gwt.dev.util.UnitTestTreeLogger) TreeLogger(com.google.gwt.core.ext.TreeLogger) UnitTestTreeLogger(com.google.gwt.dev.util.UnitTestTreeLogger) DefaultMvp4gGinModule(com.mvp4g.client.DefaultMvp4gGinModule) SimplePresenter01(com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01) Before(org.junit.Before)

Example 17 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteChildWithParentAsyncNoAutoLoadErrorEmpty.

@Test
public void testWriteChildWithParentAsyncNoAutoLoadErrorEmpty() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    JClassType moduleType = oracle.addClass(Modules.Module01.class);
    ChildModuleElement childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("childModule");
    childModule.setAutoDisplay("false");
    EventElement event = new EventElement();
    event.setType("errorOnLoad");
    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.Module01.class.getCanonicalName()), false);
    assertOutput(getExpectedAsyncChildModuleErrorEmpty(), false);
    assertOutput(getExpectedAutoDisplayChildModule(), false);
    writer.writeConf();
    assertOutput(getExpectedChildModule(Modules.Module01.class.getCanonicalName()), true);
    assertOutput(getExpectedAsyncChildModuleErrorEmpty(), 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)

Example 18 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteParent.

@Test
public void testWriteParent() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    configuration.setParentEventBus(oracle.addClass(EventBusWithLookup.class));
    configuration.setModule(oracle.addClass(Modules.Module01.class));
    assertOutput(new String[] { "private PlaceService placeService = null;" }, false);
    assertOutput(getExpectedSetParent(), false);
    writer.writeConf();
    assertOutput(getExpectedSetParent(), true);
    assertOutput(new String[] { "private PlaceService placeService = null;" }, false);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) EventBusWithLookup(com.mvp4g.client.event.EventBusWithLookup) Test(org.junit.Test)

Example 19 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteLoadChildModuleWithLoader.

@Test
public void testWriteLoadChildModuleWithLoader() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    Set<ChildModuleElement> children = configuration.getChildModules();
    JClassType loaderType = oracle.addClass(Loaders.Loader1.class);
    LoaderElement loader = new LoaderElement();
    loader.setName("loader");
    loader.setClassName(loaderType.getQualifiedSourceName());
    configuration.getLoaders().add(loader);
    JClassType moduleType = oracle.addClass(Modules.ModuleWithParent01.class);
    ChildModuleElement childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("childModule1");
    childModule.setLoader("loader");
    childModule.setAutoDisplay("false");
    children.add(childModule);
    moduleType = oracle.addClass(Modules.Module01.class);
    childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("childModule2");
    childModule.setAsync("false");
    childModule.setLoader("loader");
    childModule.setAutoDisplay("false");
    children.add(childModule);
    assertOutput(getExpectedLoadChildModuleWithLoader(), false);
    writer.writeConf();
    assertOutput(getExpectedLoadChildModuleWithLoader(), true);
}
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