Search in sources :

Example 1 with CatalogFromExtensionPointScope

use of com.avaloq.tools.ddk.check.scoping.CatalogFromExtensionPointScope in project dsl-devkit by dsldevkit.

the class BugAig1314 method testSameScopeUseTwice.

/**
 * Tests that querying the same scope twice doesn't make the resource set grow.
 */
@Test
public void testSameScopeUseTwice() {
    XtextResourceSet rs = new XtextResourceSet();
    URL url = createURL();
    ModelLocation modelLocation = createModelLocation(url);
    CatalogFromExtensionPointScope scope = new TestScope(modelLocation, rs);
    assertResourceSetEmpty(rs);
    Iterable<IEObjectDescription> elements = scope.getAllElements();
    assertIterableNotEmpty(elements);
    int nofResourcesInMap = rs.getURIResourceMap().size();
    int nofResourcesInSet = rs.getResources().size();
    elements = scope.getAllElements();
    assertIterableNotEmpty(elements);
    assertResourceSet(rs, nofResourcesInSet, nofResourcesInMap);
}
Also used : XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) IModelLocation(com.avaloq.tools.ddk.check.runtime.configuration.IModelLocation) ModelLocation(com.avaloq.tools.ddk.check.runtime.configuration.ModelLocation) URL(java.net.URL) CatalogFromExtensionPointScope(com.avaloq.tools.ddk.check.scoping.CatalogFromExtensionPointScope) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 2 with CatalogFromExtensionPointScope

use of com.avaloq.tools.ddk.check.scoping.CatalogFromExtensionPointScope in project dsl-devkit by dsldevkit.

the class BugAig1314 method testDifferentScopeUseTwice.

/**
 * Tests that querying two different scopes doesn't make the resource set grow. That one was the real cause of bug AIG-1314.
 */
@Test
public void testDifferentScopeUseTwice() {
    XtextResourceSet rs = new XtextResourceSet();
    URL url = createURL();
    ModelLocation modelLocation = createModelLocation(url);
    CatalogFromExtensionPointScope scope = new TestScope(modelLocation, rs);
    assertResourceSetEmpty(rs);
    Iterable<IEObjectDescription> elements = scope.getAllElements();
    assertIterableNotEmpty(elements);
    int nofResourcesInMap = rs.getURIResourceMap().size();
    int nofResourcesInSet = rs.getResources().size();
    CatalogFromExtensionPointScope otherScope = new TestScope(modelLocation, rs);
    assertResourceSet(rs, nofResourcesInSet, nofResourcesInMap);
    elements = otherScope.getAllElements();
    assertIterableNotEmpty(elements);
    assertResourceSet(rs, nofResourcesInSet, nofResourcesInMap);
}
Also used : XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) IModelLocation(com.avaloq.tools.ddk.check.runtime.configuration.IModelLocation) ModelLocation(com.avaloq.tools.ddk.check.runtime.configuration.ModelLocation) URL(java.net.URL) CatalogFromExtensionPointScope(com.avaloq.tools.ddk.check.scoping.CatalogFromExtensionPointScope) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Aggregations

IModelLocation (com.avaloq.tools.ddk.check.runtime.configuration.IModelLocation)2 ModelLocation (com.avaloq.tools.ddk.check.runtime.configuration.ModelLocation)2 CatalogFromExtensionPointScope (com.avaloq.tools.ddk.check.scoping.CatalogFromExtensionPointScope)2 URL (java.net.URL)2 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)2 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)2 Test (org.junit.Test)2