use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class ImportScopeTest method testDuplicatesNotVisible_05_IgnoreCase.
@Test
public void testDuplicatesNotVisible_05_IgnoreCase() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com", "Foo"), EcorePackage.Literals.EANNOTATION, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1), true);
ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("COM"), true, true);
ImportNormalizer n2 = new ImportNormalizer(QualifiedName.create("com"), true, true);
TestableImportScope scope = new TestableImportScope(newArrayList(n1, n2), outer, new ScopeBasedSelectable(outer), EcorePackage.Literals.EOBJECT, true);
Iterator<IEObjectDescription> iterator = scope.getAllElements().iterator();
assertEquals(QualifiedName.create("Foo"), iterator.next().getName());
assertSame(desc1, iterator.next());
assertFalse(iterator.hasNext());
}
use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class ImportScopeTest method testGetAllLocalElements_01.
@Test
public void testGetAllLocalElements_01() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com", "foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com", "foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1, desc2), true);
ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("COM"), true, true);
ImportNormalizer n2 = new ImportNormalizer(QualifiedName.create("DE"), true, true);
TestableImportScope scope = new TestableImportScope(newArrayList(n1, n2), outer, new ScopeBasedSelectable(outer), EcorePackage.Literals.EOBJECT, true);
Iterable<IEObjectDescription> elements = scope.getAllLocalElements();
assertEquals(2, size(elements));
}
use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class ImportScopeTest method testGetAllLocalElements_00.
@Test
public void testGetAllLocalElements_00() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com", "foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com", "foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1, desc2), true);
ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("com"), true, true);
ImportNormalizer n2 = new ImportNormalizer(QualifiedName.create("de"), true, true);
TestableImportScope scope = new TestableImportScope(newArrayList(n1, n2), outer, new ScopeBasedSelectable(outer), EcorePackage.Literals.EOBJECT, true);
Iterable<IEObjectDescription> elements = scope.getAllLocalElements();
assertEquals(2, size(elements));
}
use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class ImportScopeTest method testDuplicatesNotVisible_03_IgnoreCase.
@Test
public void testDuplicatesNotVisible_03_IgnoreCase() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com", "foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("de", "foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1, desc2), true);
ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("com"), true, true);
ImportNormalizer n2 = new ImportNormalizer(QualifiedName.create("de"), true, true);
TestableImportScope scope = new TestableImportScope(newArrayList(n1, n2), outer, new ScopeBasedSelectable(outer), EcorePackage.Literals.EOBJECT, true);
assertNull(scope.getSingleElement(QualifiedName.create("Foo")));
assertNotNull(scope.getSingleElement(QualifiedName.create("com", "Foo")));
assertNotNull(scope.getSingleElement(QualifiedName.create("de", "Foo")));
}
use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class ImportScopeTest method testAllAliasedElements_01.
@Test
public void testAllAliasedElements_01() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com", "foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com", "foo"), EcorePackage.Literals.EATTRIBUTE, null);
final ArrayList<IEObjectDescription> newArrayList = newArrayList(desc1, desc2);
ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("COM"), true, true);
ImportNormalizer n2 = new ImportNormalizer(QualifiedName.create("DE"), true, true);
TestableImportScope scope = new TestableImportScope(newArrayList(n1, n2), IScope.NULLSCOPE, null, EcorePackage.Literals.EOBJECT, true);
Iterable<IEObjectDescription> elements = scope.getAliasedElements(newArrayList);
assertEquals(2, size(elements));
Iterator<IEObjectDescription> iterator = elements.iterator();
assertSame(desc1, ((AliasedEObjectDescription) iterator.next()).getAliasedEObjectDescription());
assertSame(desc2, ((AliasedEObjectDescription) iterator.next()).getAliasedEObjectDescription());
}
Aggregations