Class EMFModelComparator
java.lang.Object
org.eclipse.epsilon.eunit.cmp.emf.EMFModelComparator
- All Implemented Interfaces:
IModelComparator
Model comparator for EMF models, using EMF Compare 2.x.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Ifconfigure(Map)
is called with this key set to "ignore", changes in attributes will be ignored.static final String
Ifconfigure(Map)
is called with this key set to "ignore", MOVE changes in unordered references will be ignored.static final String
Ifconfigure(Map)
is called with this key set to "ignore", whitespace changes will be ignored.Fields inherited from interface org.eclipse.epsilon.eunit.extensions.IModelComparator
EXTENSION_POINT_ID, OPTION_MODEL_CLONE_DIRECTORY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canCompare
(IModel m1, IModel m2) Checks if the comparator can compare these two models.Returns an object with the differences between this model andotherModel
.void
Configures the model comparator with the specified options.saveDeltaToFile
(Object delta, File basename) Saves the provided delta (as produced byIModelComparator.compare(IModel, IModel)
to a file with the provided basename.
-
Field Details
-
OPTION_WHITESPACE
Ifconfigure(Map)
is called with this key set to "ignore", whitespace changes will be ignored.- See Also:
-
OPTION_UNORDERED_MOVES
Ifconfigure(Map)
is called with this key set to "ignore", MOVE changes in unordered references will be ignored.- See Also:
-
OPTION_ATTRIBUTE_CHANGES
Ifconfigure(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
Description copied from interface:IModelComparator
Checks if the comparator can compare these two models.- Specified by:
canCompare
in interfaceIModelComparator
- Returns:
true
ifIModelComparator.compare(IModel, IModel)
should finish successfully, and false otherwise.
-
compare
Description copied from interface:IModelComparator
Returns an object with the differences between this model andotherModel
. If there are no differences, returnsnull
. 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 interfaceIModelComparator
- 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
Description copied from interface:IModelComparator
Saves the provided delta (as produced byIModelComparator.compare(IModel, IModel)
to a file with the provided basename. The actual extension will be picked by this component.- Specified by:
saveDeltaToFile
in interfaceIModelComparator
- 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
Description copied from interface:IModelComparator
Configures the model comparator with the specified options. At least theIModelComparator.OPTION_MODEL_CLONE_DIRECTORY
option should be honored, if models are being frozen into clones before performing the comparison.- Specified by:
configure
in interfaceIModelComparator
-