use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class ImportScopeTest method testDuplicatesNotVisible_02_IgnoreCase.
@Test
public void testDuplicatesNotVisible_02_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);
Iterator<IEObjectDescription> iterator = scope.getAllElements().iterator();
assertSame(desc1, iterator.next());
assertSame(desc2, iterator.next());
assertFalse(iterator.hasNext());
}
use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class ImportScopeTest method testAllAliasedElements_02.
@Test
public void testAllAliasedElements_02() 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);
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(0, size(elements));
}
use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class ImportScopeTest method testAllAliasedElements_03.
@Test
public void testAllAliasedElements_03() 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);
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(0, size(elements));
}
use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class ImportScopeTest method testAllAliasedElements_04.
@Test
public void testAllAliasedElements_04() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com", "foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com", "bar"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc3 = new EObjectDescription(QualifiedName.create("de", "foo"), EcorePackage.Literals.EATTRIBUTE, null);
final ArrayList<IEObjectDescription> newArrayList = newArrayList(desc1, desc2, desc3);
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(1, size(elements));
assertSame(desc2, ((AliasedEObjectDescription) elements.iterator().next()).getAliasedEObjectDescription());
}
use of org.eclipse.xtext.resource.EObjectDescription in project xtext-core by eclipse.
the class DefaultResourceDescriptionDeltaTest method testHasChanges_DifferentTypes.
@Test
public void testHasChanges_DifferentTypes() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, Collections.singletonMap("foo", "bar")));
TestResDesc resourceDesc2 = new TestResDesc();
resourceDesc2.imported.add(FOO);
resourceDesc2.exported.add(new EObjectDescription(BAR, EcorePackage.Literals.EANNOTATION__CONTENTS, Collections.singletonMap("foo", "bar")) {
@Override
public URI getEObjectURI() {
return EcoreUtil.getURI(EcorePackage.Literals.EANNOTATION);
}
});
assertTrue(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
Aggregations