use of org.eclipse.emf.mwe.core.WorkflowContext in project xtext-core by eclipse.
the class AbstractReaderTest method testLoadMatchAll.
@Test
public void testLoadMatchAll() throws Exception {
Reader reader = getReader();
reader.addPath(pathTo("emptyFolder"));
reader.addPath(pathTo("nonemptyFolder"));
reader.addRegister(new IndexTestLanguageStandaloneSetup());
SlotEntry entry = createSlotEntry();
entry.setType("Type");
reader.addLoad(entry);
reader.setUriFilter(new UriFilter() {
@Override
public boolean matches(URI uri) {
return true;
}
});
WorkflowContext ctx = ctx();
reader.invoke(ctx, monitor(), issues());
Collection<?> slotContent = (Collection<?>) ctx.get("model");
assertNotNull(slotContent);
// Foo, Person, String
assertEquals(3, slotContent.size());
}
use of org.eclipse.emf.mwe.core.WorkflowContext in project xtext-core by eclipse.
the class AbstractReaderTest method testLoadMatchNone.
@Test
public void testLoadMatchNone() throws Exception {
final Reader reader = getReader();
reader.addPath(pathTo("emptyFolder"));
reader.addPath(pathTo("nonemptyFolder"));
reader.addRegister(new IndexTestLanguageStandaloneSetup());
SlotEntry entry = createSlotEntry();
entry.setType("Type");
reader.addLoad(entry);
reader.setUriFilter(new UriFilter() {
@Override
public boolean matches(URI uri) {
return false;
}
});
final WorkflowContext ctx = ctx();
LoggingTester.captureLogging(Level.WARN, SlotEntry.class, new Runnable() {
@Override
public void run() {
reader.invoke(ctx, monitor(), issues());
}
}).assertLogEntry("Could not find any exported element of type 'Type' -> Slot 'model' is empty.");
Collection<?> slotContent = (Collection<?>) ctx.get("model");
assertNotNull(slotContent);
assertTrue(slotContent.isEmpty());
}
use of org.eclipse.emf.mwe.core.WorkflowContext in project xtext-core by eclipse.
the class ResourceSetBasedSlotEntryReaderTest method testLoadAll.
@SuppressWarnings("unchecked")
@Test
public void testLoadAll() throws Exception {
Reader reader = getReader();
reader.addPath(pathTo("emptyFolder"));
reader.addPath(pathTo("nonemptyFolder"));
reader.addRegister(new IndexTestLanguageStandaloneSetup());
SlotEntry entry = createSlotEntry();
reader.addLoad(entry);
WorkflowContext ctx = ctx();
reader.invoke(ctx, monitor(), issues());
List<EObject> elements = (List<EObject>) ctx.get("model");
assertEquals(11, elements.size());
}
use of org.eclipse.emf.mwe.core.WorkflowContext in project xtext-core by eclipse.
the class UriBasedReaderTest method testTransitiveReferences.
@SuppressWarnings("unchecked")
@Test
public void testTransitiveReferences() throws Exception {
UriBasedReader reader = new UriBasedReader();
reader.addRegister(new ImportUriTestLanguageStandaloneSetup());
reader.addUri(pathTo2("importUriSubfolder/Start.importuritestlanguage"));
SlotEntry slotEntry = new SlotEntry();
slotEntry.setType("Type");
reader.addLoad(slotEntry);
WorkflowContext ctx = new WorkflowContextDefaultImpl();
IssuesImpl issues = new IssuesImpl();
reader.checkConfiguration(issues);
try {
reader.invoke(ctx, new NullProgressMonitor(), issues);
} catch (Exception e) {
System.out.println(issues);
throw e;
}
List<Type> types = (List<Type>) ctx.get(slotEntry.getSlot());
assertEquals(3, types.size());
for (Type type : types) {
if (type.getName().equals("Foo")) {
assertEquals("Bar", type.getExtends().getName());
} else if (type.getName().equals("Bar")) {
assertEquals("Baz", type.getExtends().getName());
} else {
assertNull(type.getExtends());
}
}
}
Aggregations