|
Re: using EMF Compare to compare Comparison objects [message #1745755 is a reply to message #1745550] |
Mon, 17 October 2016 08:27 |
|
Hi,
These two models indeed look the same, though if compared without identifiers I'm sure EMF Compare will indeed see them as different because of the very few attributes present to differentiate them. You say that you've implemented an ID function. Have you tried debugging in it to ensure that it does indeed matches properly the submatches? Could you save that comparison result as well to show us how it looks like?
And if it is indeed an ordering change that's detected even if you specified that ordering shouldn't be taken into account, it sounds like a bug. In such a case could you raise a bug against EMF Compare with samples to reproduce the behavior?
Laurent Goubet
Obeo
|
|
|
Re: using EMF Compare to compare Comparison objects [message #1745771 is a reply to message #1745755] |
Mon, 17 October 2016 12:13 |
Conor O'Mahony Messages: 27 Registered: August 2016 |
Junior Member |
|
|
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 13:18] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04438 seconds