|
|
Re: using EMF Compare to compare Comparison objects [message #1745771 is a reply to message #1745755] |
Mon, 17 October 2016 08:13  |
Eclipse User |
|
|
|
Hi Laurent,
Thanks for your reply.
The ID function is used in the matching engine in the application (rather than the one used in the test) and all it does for the model objects is return the name as the ID, as the names are unique.
Function<EObject, String> idFunction = new Function<EObject, String>()
{
public String apply(EObject input)
{
if (input instanceof AbstractBlock)
{
return ((AbstractBlock) input).getName();
}
// a null return here tells the match engine to fall back to the other matchers
return null;
}
};
IMatchEngine.Factory.Registry registry = EMFCompareRCPPlugin.getDefault().getMatchEngineFactoryRegistry();
/*
* configure our matching engine
*/
IEObjectMatcher fallBackMatcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.NEVER);
IEObjectMatcher customIDMatcher = new IdentifierEObjectMatcher(fallBackMatcher, idFunction);
IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
final MatchEngineFactoryImpl matchEngineFactory = new MatchEngineFactoryImpl(customIDMatcher, comparisonFactory);
matchEngineFactory.setRanking(20); // default engine ranking is 10, must be higher to override.
registry.add(matchEngineFactory);
I created 2 project models in our app, both with blocks named "Block_1", "Block_2" and "Block_3" (with some minor differences in Block_1 and Block_3), and ran the EMF compare - attached are the results of the comparison run WITH the ID function used, and the other where it does not use the ID function - the difference again appears to be just the ordering of the matches. (I can see this in the Application GUI too where we have plugged in the default EMF viewer - the differences are shown in a different order, so I believe that my ID function is working, it just has the list of matches in a different order).
In the test then, which is essentially using EMF compare to compare those 2 files, I debugged into the FeatureFilter in the test engine compare, to check the "Match" object matching, and it looks like it doesn't match the match objects correctly to begin with (and subsequently the check for ordering never gets used as the matchingContainment check fails.)
I will debug it some more, but the overall problem seems to be that the match objects in the tests aren't being matched to one another.
[Updated on: Mon, 17 October 2016 09:18] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03703 seconds