Search in sources :

Example 1 with ResourceDescription2

use of com.avaloq.tools.ddk.xtext.resource.ResourceDescription2 in project dsl-devkit by dsldevkit.

the class BugAig1084 method recursiveLookUp.

/**
 * Test that recursive calls to {@link ResourceDescription2#getLookUp()} by {@link ResourceDescription2#computeExportedObjects()} do not cause
 * stack-overflow.
 */
@Test
public void recursiveLookUp() {
    Resource resource = org.mockito.Mockito.mock(Resource.class);
    BasicEList<Adapter> emptyEList = new BasicEList<Adapter>();
    org.mockito.Mockito.when(resource.eAdapters()).thenReturn(emptyEList);
    IResourceScopeCache cache = new OnChangeEvictingCache();
    new ResourceDescription2(resource, null, cache) {

        @Override
        protected List<IEObjectDescription> computeExportedObjects() {
            return Lists.newArrayList(getLookUp().getExportedObjects());
        }
    }.getExportedObjects();
}
Also used : OnChangeEvictingCache(org.eclipse.xtext.util.OnChangeEvictingCache) BasicEList(org.eclipse.emf.common.util.BasicEList) Resource(org.eclipse.emf.ecore.resource.Resource) IResourceScopeCache(org.eclipse.xtext.util.IResourceScopeCache) Adapter(org.eclipse.emf.common.notify.Adapter) List(java.util.List) BasicEList(org.eclipse.emf.common.util.BasicEList) ResourceDescription2(com.avaloq.tools.ddk.xtext.resource.ResourceDescription2) Test(org.junit.Test)

Aggregations

ResourceDescription2 (com.avaloq.tools.ddk.xtext.resource.ResourceDescription2)1 List (java.util.List)1 Adapter (org.eclipse.emf.common.notify.Adapter)1 BasicEList (org.eclipse.emf.common.util.BasicEList)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 IResourceScopeCache (org.eclipse.xtext.util.IResourceScopeCache)1 OnChangeEvictingCache (org.eclipse.xtext.util.OnChangeEvictingCache)1 Test (org.junit.Test)1