Class EMFModelComparator

java.lang.Object
org.eclipse.epsilon.eunit.cmp.emf.EMFModelComparator
All Implemented Interfaces:
IModelComparator

public class EMFModelComparator extends Object implements IModelComparator
Model comparator for EMF models, using EMF Compare 2.x.
  • Field Details

    • OPTION_WHITESPACE

      public static final String OPTION_WHITESPACE
      If configure(Map) is called with this key set to "ignore", whitespace changes will be ignored.
      See Also:
    • OPTION_UNORDERED_MOVES

      public static final String OPTION_UNORDERED_MOVES
      If configure(Map) is called with this key set to "ignore", MOVE changes in unordered references will be ignored.
      See Also:
    • OPTION_ATTRIBUTE_CHANGES

      public static final String OPTION_ATTRIBUTE_CHANGES
      If configure(Map) is called with this key set to "ignore", changes in attributes will be ignored.
      See Also:
  • Constructor Details

    • EMFModelComparator

      public EMFModelComparator()
  • Method Details

    • canCompare

      public boolean canCompare(IModel m1, IModel m2)
      Description copied from interface: IModelComparator
      Checks if the comparator can compare these two models.
      Specified by:
      canCompare in interface IModelComparator
      Returns:
      true if IModelComparator.compare(IModel, IModel) should finish successfully, and false otherwise.
    • compare

      public Object compare(IModel m1, IModel m2) throws Exception
      Description copied from interface: IModelComparator
      Returns an object with the differences between this model and otherModel. If there are no differences, returns null. The exact configuration of the comparison depends on the model. For instance, unique identifiers (such as XMI IDs) may be ignored if the main object of these comparisons is to test model transformations. These tend to produce different unique identifiers each time they are run.
      Specified by:
      compare in interface IModelComparator
      Throws:
      IllegalArgumentException - The models cannot be compared: for instance, they use incompatible drivers.
      Exception - There was some other kind of problem when performing the comparison.
    • saveDeltaToFile

      public File saveDeltaToFile(Object delta, File basename) throws IOException
      Description copied from interface: IModelComparator
      Saves the provided delta (as produced by IModelComparator.compare(IModel, IModel) to a file with the provided basename. The actual extension will be picked by this component.
      Specified by:
      saveDeltaToFile in interface IModelComparator
      Parameters:
      delta - Detected model difference (e.g. a Comparison when using EMF Compare).
      basename - File with the desired basename (extension to be picked by comparator).
      Returns:
      File where the delta has been saved, after adding the extension.
      Throws:
      IOException - There was a problem writing to the file.
    • configure

      public void configure(Map<String,Object> options)
      Description copied from interface: IModelComparator
      Configures the model comparator with the specified options. At least the IModelComparator.OPTION_MODEL_CLONE_DIRECTORY option should be honored, if models are being frozen into clones before performing the comparison.
      Specified by:
      configure in interface IModelComparator