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));
}
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);
}
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);
}
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);
}
Aggregations