Search in sources :

Example 21 with Comparison

use of org.eclipse.emf.compare.Comparison in project InformationSystem by ObeoNetwork.

the class DatabaseTransformationTestSuite method loadAndProcessInputs.

/**
 * Loads the input models found at the given URIs. Then processes their
 * contents and places the result in a new Resource with the given desired
 * URI. That URI is the same as the URI of the expected output model, so
 * that EMF Compare has no problem matching the resources. This method
 * <i>does not</i> modify the input models.
 *
 * @param inputURI
 *            the URI of the input model.
 * @param desiredSynchronizedInputURI
 *            the desired URI for the result of the processing of the inputs
 *            of this test suite. Should be the same as that of the expected
 *            output.
 * @return the resource containing the result of processing the inputs of
 *         this test suite.
 */
public Resource loadAndProcessInputs(List<URI> inputURIs, URI desiredProcessedInputURI) {
    // Load input data for the test
    final Resource comparisonResource = DatabaseCompareAbstractTestSuite.loadResource(inputURIs.get(2));
    EcoreUtil.resolveAll(comparisonResource);
    // Transform the EMFCompare Comparison into a Dbevolution model.
    final Comparison comparison = (Comparison) comparisonResource.getContents().get(0);
    final Comparison dbevolution = transform(comparison);
    // Store the resulting Dbevolution into an EMF Resource
    final Resource dbevolutionResource = DatabaseCompareAbstractTestSuite.createResourceSet().createResource(desiredProcessedInputURI);
    dbevolutionResource.getContents().add(dbevolution);
    return dbevolutionResource;
}
Also used : Comparison(org.eclipse.emf.compare.Comparison) Resource(org.eclipse.emf.ecore.resource.Resource)

Example 22 with Comparison

use of org.eclipse.emf.compare.Comparison in project InformationSystem by ObeoNetwork.

the class EMFCompareUtils method compare.

/**
 * Compares two {@link Notifier} using the EMF Compare engine.
 *
 * @param expected
 * @param actual
 */
public static Comparison compare(Notifier expected, Notifier actual) {
    final IComparisonScope scope = new DefaultComparisonScope(expected, actual, null);
    final Comparison comparison = comparator.compare(scope);
    return comparison;
}
Also used : DefaultComparisonScope(org.eclipse.emf.compare.scope.DefaultComparisonScope) Comparison(org.eclipse.emf.compare.Comparison) IComparisonScope(org.eclipse.emf.compare.scope.IComparisonScope)

Aggregations

Comparison (org.eclipse.emf.compare.Comparison)22 Diff (org.eclipse.emf.compare.Diff)7 DefaultComparisonScope (org.eclipse.emf.compare.scope.DefaultComparisonScope)7 IComparisonScope (org.eclipse.emf.compare.scope.IComparisonScope)7 List (java.util.List)6 EList (org.eclipse.emf.common.util.EList)6 EMFCompare (org.eclipse.emf.compare.EMFCompare)6 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)6 EObject (org.eclipse.emf.ecore.EObject)5 File (java.io.File)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 Resource (org.eclipse.emf.ecore.resource.Resource)4 TableContainer (org.obeonetwork.dsl.database.TableContainer)4 ReferenceChange (org.eclipse.emf.compare.ReferenceChange)3 BasicMonitor (org.eclipse.emf.common.util.BasicMonitor)2 Match (org.eclipse.emf.compare.Match)2 Test (org.junit.Test)2 DataBase (org.obeonetwork.dsl.database.DataBase)2 URISyntaxException (java.net.URISyntaxException)1