use of org.eclipse.xtext.scoping.IScope in project dsl-devkit by dsldevkit.
the class ExportScopingTest method testEclassScope.
@Test
public void testEclassScope() throws IOException {
ExportModel model = (ExportModel) getTestSource().getModel();
IScope scope = scopeProvider.scope_EClass(model, null);
assertNotNull("Could not locate EClass.", scope.getSingleElement(QualifiedName.create("InterfaceExpression")));
assertNull("Located non-existent EClass.", scope.getSingleElement(QualifiedName.create("InterfaceExpressionX")));
}
use of org.eclipse.xtext.scoping.IScope in project dsl-devkit by dsldevkit.
the class ExportScopingTest method testImportPackageScope.
@Test
public void testImportPackageScope() throws IOException {
ExportModel model = (ExportModel) getTestSource().getModel();
IScope scope = scopeProvider.scope_Import_package(model.getImports().get(0), ExportPackage.Literals.IMPORT__PACKAGE);
assertNotNull("Could not locate Import.", scope.getSingleElement(QualifiedName.create("http://www.avaloq.com/tools/ddk/xtext/export/Export")));
assertNull("Located non-existent Import.", scope.getSingleElement(QualifiedName.create("http://www.avaloq.com/tools/ddk/xtext/export/ExportX")));
}
use of org.eclipse.xtext.scoping.IScope in project dsl-devkit by dsldevkit.
the class ExportScopingTest method testEAttributeScope.
@Test
public void testEAttributeScope() throws IOException {
ExportModel model = (ExportModel) getTestSource().getModel();
IScope scope = scopeProvider.scope_EAttribute(model.getInterfaces().get(0), null);
// CHECKSTYLE:OFF (DuplicateString)
assertNotNull("Could not locate EStructuralFeature.", scope.getSingleElement(QualifiedName.create("unordered")));
assertNull("Located non-existent EStructuralFeature.", scope.getSingleElement(QualifiedName.create("expr")));
// CHECKSTYLE:ON
}
use of org.eclipse.xtext.scoping.IScope in project dsl-devkit by dsldevkit.
the class ExportScopingTest method testInterfaceNavigationRefScope.
@Test
public void testInterfaceNavigationRefScope() throws IOException {
ExportModel model = (ExportModel) getTestSource().getModel();
IScope scope = scopeProvider.scope_InterfaceNavigation_ref(model.getInterfaces().get(0), null);
// CHECKSTYLE:OFF (DuplicateString)
assertNotNull("Could not locate InterfaceNavigationRef.", scope.getSingleElement(QualifiedName.create("expr")));
assertNull("Located non-existent InterfaceNavigationRef.", scope.getSingleElement(QualifiedName.create("unordered")));
// CHECKSTYLE:ON
}
use of org.eclipse.xtext.scoping.IScope in project dsl-devkit by dsldevkit.
the class ValidScopingTest method testEPackageScope.
/**
* Tests that EPackage instances can be imported by means of their NS URI. If an NS URI to a non-existing EPackage is provided,
* the scope provider will return <code>null</code> for such an import, i.e. will not locate it.
*/
@Test
public void testEPackageScope() throws IOException {
final ValidModel model = (ValidModel) getTestSource().getModel();
IScope scope = scopeProvider.getScope(model, ValidPackage.Literals.IMPORT__PACKAGE);
final EPackage validScopingTestPackage = model.getImports().get(0).getPackage();
assertEquals("NS URI of first import is valid", ValidscopingtestPackage.eNS_URI, validScopingTestPackage.getNsURI());
final EPackage nonExistingPackage = model.getImports().get(1).getPackage();
assertNull("Non-existing EPackage has no NS URI", nonExistingPackage.getNsURI());
assertNotNull("Import of existing EPackage is valid", scope.getSingleElement(QualifiedName.create(ValidscopingtestPackage.eNS_URI)));
assertNull("Non-existing EPackage cannot be imported", scope.getSingleElement(QualifiedName.create("http://www.avaloq.com/tools/ddk/acf/nonexistingnsuri")));
}
Aggregations