use of org.eclipse.xtext.resource.generic.GenericResourceDescriptionManager in project xtext-eclipse by eclipse.
the class GenericResourceDescriptionManagerTest method testCreateDeltaAndIsAffected.
@Test
public void testCreateDeltaAndIsAffected() {
GenericResourceDescriptionManager manager = getEmfResourceDescriptionsManager();
EClass eClass = EcoreFactory.eINSTANCE.createEClass();
eClass.setName("Test");
eClass.getESuperTypes().add(EcorePackage.Literals.EPACKAGE);
Resource resource = new XMIResourceImpl(URI.createFileURI("test.ecore"));
resource.getContents().add(eClass);
EPackage copyOfEPackage = EcoreUtil.copy(EcorePackage.eINSTANCE);
Resource ecoreResource = new XMIResourceImpl(URI.createURI(copyOfEPackage.getNsURI()));
ecoreResource.getContents().add(copyOfEPackage);
IResourceDescription oldDescription = new CopiedResourceDescription(manager.getResourceDescription(ecoreResource));
oldDescription.getExportedObjects();
copyOfEPackage.setName("ecore_new");
IResourceDescription newDescription = manager.getResourceDescription(ecoreResource);
Delta delta = manager.createDelta(oldDescription, newDescription);
assertTrue(delta.haveEObjectDescriptionsChanged());
IResourceDescription referrerDescription = manager.getResourceDescription(resource);
assertTrue(manager.isAffected(delta, referrerDescription));
}
Aggregations