Search in sources :

Example 11 with TypeOracleStub

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

the class TestAnnotationScanner method setUp.

@Before
public void setUp() {
    logger = new UnitTestTreeLogger.Builder().createLogger();
    oracle = new TypeOracleStub();
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) Before(org.junit.Before)

Example 12 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteChildNoAsyncNoAutoLoad.

@Test
public void testWriteChildNoAsyncNoAutoLoad() {
    TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
    JClassType moduleType = oracle.addClass(Modules.ModuleWithParent01.class);
    ChildModuleElement childModule = new ChildModuleElement();
    childModule.setClassName(moduleType.getQualifiedSourceName());
    childModule.setName("childModule");
    childModule.setAsync("false");
    childModule.setAutoDisplay("false");
    configuration.getChildModules().add(childModule);
    assertOutput(getExpectedChildModule(Modules.ModuleWithParent01.class.getCanonicalName()), false);
    assertOutput(getExpectedAsyncChildModule(), false);
    assertOutput(getExpectedAutoDisplayChildModule(), false);
    writer.writeConf();
    assertOutput(getExpectedChildModule(Modules.ModuleWithParent01.class.getCanonicalName()), true);
    assertOutput(getExpectedAsyncChildModule(), false);
    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 13 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteSplitterWithLoader.

@Test
public void testWriteSplitterWithLoader() {
    ViewElement view = new ViewElement();
    view.setName("view");
    view.setClassName(String.class.getCanonicalName());
    configuration.getViews().add(view);
    PresenterElement presenter = new PresenterElement();
    presenter.setName("presenter");
    presenter.setClassName(SimplePresenter01.class.getCanonicalName());
    presenter.setView("view");
    configuration.getPresenters().add(presenter);
    PresenterElement presenterWithView = new PresenterElement();
    presenterWithView.setName("presenterWithView");
    presenterWithView.setClassName(SimplePresenter01.class.getCanonicalName());
    presenterWithView.setView("view");
    presenterWithView.setInverseView("true");
    configuration.getPresenters().add(presenterWithView);
    EventHandlerElement eventHandler = new EventHandlerElement();
    eventHandler.setName("eventHandler");
    eventHandler.setClassName(SimpleEventHandler01.class.getCanonicalName());
    configuration.getEventHandlers().add(eventHandler);
    EventElement e1 = new EventElement();
    e1.setType("event1");
    e1.setSplitters(new String[] { "splitter" });
    e1.setEventObjectClass(new String[] { "int", "String" });
    EventElement e2 = new EventElement();
    e2.setType("event2");
    e2.setSplitters(new String[] { "splitter" });
    EventElement e3 = new EventElement();
    e3.setType("event3");
    e3.setSplitters(new String[] { "splitter" });
    SplitterElement splitter = new SplitterElement();
    splitter.getHandlers().add(presenter);
    splitter.getHandlers().add(presenterWithView);
    splitter.getHandlers().add(eventHandler);
    splitter.setName("splitter");
    splitter.setClassName("Splitter");
    EventAssociation<String> ea1 = new EventAssociation<String>();
    ea1.getActivated().add("eventHandler");
    ea1.getDeactivated().add("presenter");
    ea1.getBinds().add("presenter");
    ea1.getHandlers().add("eventHandler");
    splitter.getEvents().put(e1, ea1);
    EventAssociation<String> ea2 = new EventAssociation<String>();
    ea2.getActivated().add("eventHandler");
    ea2.getDeactivated().add("presenter");
    splitter.getEvents().put(e2, ea2);
    EventAssociation<String> ea3 = new EventAssociation<String>();
    ea3.getBinds().add("presenter");
    splitter.getEvents().put(e3, ea3);
    JClassType loaderType = ((TypeOracleStub) configuration.getOracle()).addClass(Loaders.Loader1.class);
    LoaderElement loader = new LoaderElement();
    loader.setName("loader");
    loader.setClassName(loaderType.getQualifiedSourceName());
    configuration.getLoaders().add(loader);
    splitter.setLoader("loader");
    Set<EventElement> events = configuration.getEvents();
    events.add(e1);
    events.add(e2);
    events.add(e3);
    configuration.getSplitters().add(splitter);
    assertOutput(getExpectedSplitter(false), false);
    assertOutput(getExpectedSplitterLoadingConf(), false);
    assertOutput(getExpectedSplitterPassiveGenerateMultiple(), false);
    assertOutput(getExpectedSplitterNotPassive(), false);
    assertOutput(getExpectedSplitterWithLoader(), false);
    writer.writeConf();
    assertOutput(getExpectedSplitter(false), true);
    assertOutput(getExpectedSplitterLoadingConf(), false);
    assertOutput(getExpectedSplitterPassiveGenerateMultiple(), false);
    assertOutput(getExpectedSplitterNotPassive(), true);
    assertOutput(getExpectedSplitterWithLoader(), true);
}
Also used : TypeOracleStub(com.google.gwt.dev.javac.typemodel.TypeOracleStub) JClassType(com.google.gwt.core.ext.typeinfo.JClassType) SimpleEventHandler01(com.mvp4g.rebind.test_tools.annotation.handlers.SimpleEventHandler01) SimplePresenter01(com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01) Test(org.junit.Test)

Example 14 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteChildPassiveEvent.

@Test
public void testWriteChildPassiveEvent() {
    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" });
    event1.setPassive("true");
    EventElement event2 = new EventElement();
    event2.setType("event2");
    event2.setEventObjectClass(new String[] { "java.lang.String" });
    event2.setForwardToModules(new String[] { "child" });
    event2.setPassive("true");
    EventElement event3 = new EventElement();
    event3.setType("event3");
    event3.setEventObjectClass(new String[] { "java.lang.String", "java.lang.Object" });
    event3.setForwardToModules(new String[] { "child" });
    event3.setPassive("true");
    configuration.getEvents().add(event1);
    configuration.getEvents().add(event2);
    configuration.getEvents().add(event3);
    configuration.getOthersEventBusClassMap().put(Modules.ModuleWithParent01.class.getCanonicalName(), oracle.addClass(EventBusOk.class));
    assertOutput(getExpectedPassiveEventChildModuleLoad(), false);
    writer.writeConf();
    assertOutput(getExpectedPassiveEventChildModuleLoad(), 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 15 with TypeOracleStub

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

the class Mvp4gConfigurationFileReaderTest method testWriteEventWithPrimitives.

@Test
public void testWriteEventWithPrimitives() {
    assertOutput(getExpectedPrimitives(), false);
    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 e1 = new EventElement();
    e1.setType("event1");
    e1.setForwardToModules(new String[] { "child" });
    e1.setEventObjectClass(new String[] { "boolean", "byte", "char", "double", "float", "int", "long", "short" });
    configuration.getEvents().add(e1);
    configuration.getOthersEventBusClassMap().put(moduleType.getQualifiedSourceName(), oracle.addClass(EventBusOk.class));
    writer.writeConf();
    assertOutput(getExpectedPrimitives(), 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)

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