use of org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup in project xtext-core by eclipse.
the class ImportedNamespaceAwareLocalScopeProviderTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
with(new IndexTestLanguageStandaloneSetup());
globalScopeProvider = new ResourceSetGlobalScopeProvider();
nameProvider = new DefaultDeclarativeQualifiedNameProvider();
nameConverter = new IQualifiedNameConverter.DefaultImpl();
final DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy();
strategy.setQualifiedNameProvider(nameProvider);
final DefaultResourceDescriptionManager resourceDescMnr = new DefaultResourceDescriptionManager() {
@Override
public IResourceDescription getResourceDescription(Resource resource) {
DefaultResourceDescription resourceDescription = new DefaultResourceDescription(resource, strategy);
return resourceDescription;
}
};
final DefaultResourceServiceProvider provider = new DefaultResourceServiceProvider() {
@Override
public Manager getResourceDescriptionManager() {
return resourceDescMnr;
}
};
globalScopeProvider.setGlobalResourceDecriptionProvider(new GlobalResourceDescriptionProvider(new ResourceServiceProviderRegistryImpl() {
@Override
public IResourceServiceProvider getResourceServiceProvider(URI uri, String contentType) {
return provider;
}
}));
CaseInsensitivityHelper caseInsensitivityHelper = new CaseInsensitivityHelper();
globalScopeProvider.setCaseInsensitivityHelper(caseInsensitivityHelper);
scopeProvider = new ImportedNamespaceAwareLocalScopeProvider(globalScopeProvider, nameProvider, nameConverter, caseInsensitivityHelper);
}
use of org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup in project xtext-core by eclipse.
the class AbstractReaderTest method testLoadByType_FirstOnly.
@Test
public void testLoadByType_FirstOnly() throws Exception {
Reader reader = getReader();
reader.addPath(pathTo("emptyFolder"));
reader.addPath(pathTo("nonemptyFolder"));
reader.addRegister(new IndexTestLanguageStandaloneSetup());
SlotEntry entry = createSlotEntry();
entry.setType("Entity");
entry.setFirstOnly(true);
reader.addLoad(entry);
WorkflowContext ctx = ctx();
reader.invoke(ctx, monitor(), issues());
assertEquals("Person", ((Entity) ctx.get("model")).getName());
}
use of org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup in project xtext-core by eclipse.
the class AbstractReaderTest method testLoadByType_withNsURI.
@SuppressWarnings("unchecked")
@Test
public void testLoadByType_withNsURI() throws Exception {
Reader reader = getReader();
reader.addPath(pathTo("emptyFolder"));
reader.addPath(pathTo("nonemptyFolder"));
reader.addRegister(new IndexTestLanguageStandaloneSetup());
SlotEntry entry = createSlotEntry();
entry.setType("Entity");
entry.setNsURI(IndexTestLanguagePackage.eNS_URI);
reader.addLoad(entry);
WorkflowContext ctx = ctx();
reader.invoke(ctx, monitor(), issues());
List<Entity> entities = (List<Entity>) ctx.get("model");
assertEquals(2, entities.size());
}
use of org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup in project xtext-core by eclipse.
the class AbstractReaderTest method testLoadByType.
@SuppressWarnings("unchecked")
@Test
public void testLoadByType() throws Exception {
Reader reader = getReader();
reader.addPath(pathTo("emptyFolder"));
reader.addPath(pathTo("nonemptyFolder"));
reader.addRegister(new IndexTestLanguageStandaloneSetup());
SlotEntry entry = createSlotEntry();
entry.setType("Entity");
reader.addLoad(entry);
WorkflowContext ctx = ctx();
reader.invoke(ctx, monitor(), issues());
List<Entity> entities = (List<Entity>) ctx.get("model");
assertEquals(2, entities.size());
}
use of org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup in project xtext-core by eclipse.
the class AbstractReaderTest method testLoadBySuperType.
@SuppressWarnings("unchecked")
@Test
public void testLoadBySuperType() 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);
WorkflowContext ctx = ctx();
reader.invoke(ctx, monitor(), issues());
List<Entity> entities = (List<Entity>) ctx.get("model");
assertEquals(3, entities.size());
}
Aggregations