use of org.eclipse.xtext.naming.QualifiedName in project xtext-core by eclipse.
the class ResourceSetBasedResourceDescriptionsTest method testOneElement_Match.
@Test
public void testOneElement_Match() {
QualifiedName qualifiedName = QualifiedName.create("SomeName");
EClass type = EcorePackage.Literals.EPACKAGE;
Resource resource = createResource();
ENamedElement element = createNamedElement(qualifiedName, type, resource);
Iterable<IEObjectDescription> iterable = container.getExportedObjectsByType(EcorePackage.Literals.EPACKAGE);
assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
iterable = container.getExportedObjectsByType(EcorePackage.Literals.EOBJECT);
assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
iterable = container.getExportedObjects(EcorePackage.Literals.EPACKAGE, qualifiedName, false);
assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
iterable = container.getExportedObjects(EcorePackage.Literals.ENAMED_ELEMENT, qualifiedName, false);
assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
iterable = container.getExportedObjects(EcorePackage.Literals.EOBJECT, qualifiedName, false);
assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-core by eclipse.
the class ScopeTest method testContentByName_existent.
@Test
public void testContentByName_existent() throws Exception {
QualifiedName qualifiedName = QualifiedName.create(EcorePackage.eINSTANCE.getEAnnotation().getName());
assertEquals(qualifiedName, scope.getSingleElement(qualifiedName).getName());
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-core by eclipse.
the class ImportNormalizerTest method testDeresolve.
@Test
public void testDeresolve() throws Exception {
QualifiedName namespace = QualifiedName.create("org", "eclipse", "xtext");
QualifiedName xtextFQN = namespace.append("Xtext");
QualifiedName ytextFQN = namespace.skipLast(1).append("ytext");
QualifiedName xytextFQN = namespace.append("ytext");
ImportNormalizer importNormalizer = new ImportNormalizer(xtextFQN, false, false);
assertEquals(QualifiedName.create("Xtext"), importNormalizer.deresolve(xtextFQN));
assertEquals(null, importNormalizer.deresolve(ytextFQN));
assertEquals(null, importNormalizer.deresolve(xytextFQN));
importNormalizer = new ImportNormalizer(xytextFQN, false, false);
assertEquals(null, importNormalizer.deresolve(xtextFQN));
assertEquals(null, importNormalizer.deresolve(ytextFQN));
assertEquals(QualifiedName.create("ytext"), importNormalizer.deresolve(xytextFQN));
ImportNormalizer wildCardImportNormalizer = new ImportNormalizer(namespace, true, false);
assertEquals(QualifiedName.create("Xtext"), wildCardImportNormalizer.deresolve(xtextFQN));
assertEquals(null, wildCardImportNormalizer.deresolve(ytextFQN));
assertEquals(QualifiedName.create("ytext"), wildCardImportNormalizer.deresolve(xytextFQN));
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-core by eclipse.
the class ImportNormalizerTest method testResolveIgnoreCase.
@Test
public void testResolveIgnoreCase() throws Exception {
QualifiedName xtextRelativeName = QualifiedName.create("xtext");
QualifiedName ytextRelativeName = QualifiedName.create("ytext");
QualifiedName xytextRelativeName = QualifiedName.create("xtext", "ytext");
QualifiedName namespace = QualifiedName.create("ORG", "ECLIPSE", "XTEXT");
ImportNormalizer importNormalizer = new ImportNormalizer(namespace, false, true);
assertEquals("ORG.ECLIPSE.xtext", importNormalizer.resolve(xtextRelativeName).toString());
assertEquals(null, importNormalizer.resolve(ytextRelativeName));
assertEquals(null, importNormalizer.resolve(xytextRelativeName));
ImportNormalizer wildCardImportNormalizer = new ImportNormalizer(namespace, true, true);
assertEquals(namespace.append(xtextRelativeName), wildCardImportNormalizer.resolve(xtextRelativeName));
assertEquals(namespace.append(ytextRelativeName), wildCardImportNormalizer.resolve(ytextRelativeName));
assertEquals(namespace.append(xytextRelativeName), wildCardImportNormalizer.resolve(xytextRelativeName));
ImportNormalizer xtextImportNormalizer = new ImportNormalizer(QualifiedName.create("XTEXT"), false, true);
assertEquals(xtextRelativeName, xtextImportNormalizer.resolve(xtextRelativeName));
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-core by eclipse.
the class ImportNormalizerTest method testResolve.
@Test
public void testResolve() throws Exception {
QualifiedName xtextRelativeName = QualifiedName.create("xtext");
QualifiedName ytextRelativeName = QualifiedName.create("ytext");
QualifiedName xytextRelativeName = QualifiedName.create("xtext", "ytext");
QualifiedName namespace = QualifiedName.create("org", "eclipse", "xtext");
ImportNormalizer importNormalizer = new ImportNormalizer(namespace, false, false);
assertEquals(namespace, importNormalizer.resolve(xtextRelativeName));
assertEquals(null, importNormalizer.resolve(ytextRelativeName));
assertEquals(null, importNormalizer.resolve(xytextRelativeName));
ImportNormalizer wildCardImportNormalizer = new ImportNormalizer(namespace, true, false);
assertEquals(namespace.append(xtextRelativeName), wildCardImportNormalizer.resolve(xtextRelativeName));
assertEquals(namespace.append(ytextRelativeName), wildCardImportNormalizer.resolve(ytextRelativeName));
assertEquals(namespace.append(xytextRelativeName), wildCardImportNormalizer.resolve(xytextRelativeName));
ImportNormalizer xtextImportNormalizer = new ImportNormalizer(xtextRelativeName, false, false);
assertEquals(xtextRelativeName, xtextImportNormalizer.resolve(xtextRelativeName));
}
Aggregations