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 Summary
Fields Modifier and Type Field Description static String
OPTION_ATTRIBUTE_CHANGES
Ifconfigure(Map)
is called with this key set to "ignore", changes in attributes will be ignored.static String
OPTION_UNORDERED_MOVES
Ifconfigure(Map)
is called with this key set to "ignore", MOVE changes in unordered references will be ignored.static String
OPTION_WHITESPACE
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 Constructor Description EMFModelComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCompare(IModel m1, IModel m2)
Checks if the comparator can compare these two models.Object
compare(IModel m1, IModel m2)
Returns an object with the differences between this model andotherModel
.void
configure(Map<String,Object> options)
Configures the model comparator with the specified options.File
saveDeltaToFile(Object delta, File basename)
Saves the provided delta (as produced byIModelComparator.compare(IModel, IModel)
to a file with the provided basename.
-
-
-
Field Detail
-
OPTION_WHITESPACE
public static final String OPTION_WHITESPACE
Ifconfigure(Map)
is called with this key set to "ignore", whitespace changes will be ignored.- See Also:
- Constant Field Values
-
OPTION_UNORDERED_MOVES
public static final String OPTION_UNORDERED_MOVES
Ifconfigure(Map)
is called with this key set to "ignore", MOVE changes in unordered references will be ignored.- See Also:
- Constant Field Values
-
OPTION_ATTRIBUTE_CHANGES
public static final String OPTION_ATTRIBUTE_CHANGES
Ifconfigure(Map)
is called with this key set to "ignore", changes in attributes will be ignored.- See Also:
- Constant Field Values
-
-
Method Detail
-
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 interfaceIModelComparator
- Returns:
true
ifIModelComparator.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 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
public File saveDeltaToFile(Object delta, File basename) throws IOException
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
public void configure(Map<String,Object> options)
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
-
-