다음은 내 emf 인스턴스 문서의 두 가지 버전입니다. 당신이 볼 수 있듯이 변경된 유일한 것은 'productCode'값이 에서 KAF to 으로 변경되었습니다. 그러나 이것을 두 가지 변경으로 처리합니다. ADD 및 DELETE. 이유를 모르십니까?EMF 비교 : DifferenceKind는 CHANGE 대신 ADD 및 DELETE입니다. 왜?
버전 1
<billableSystemEvent eventType="1" description="Application Processed">
<billableProductCode productCode="KAF"/>
</billableSystemEvent>
버전 2
<billableSystemEvent eventType="1" description="Application Processed">
<billableProductCode productCode="Changed"/>
</billableSystemEvent>
public Comparison compare()
{
// Load the two input models
ResourceSet resourceSet1 = new ResourceSetImpl();
ResourceSet resourceSet2 = new ResourceSetImpl();
String xmi1 = "src/test/java/com/equifax/ic/provisioning/service/v1.xmi";
String xmi2 = "src/test/java/com/equifax/ic/provisioning/service/v2.xmi";
load(xmi1, resourceSet1);
load(xmi2, resourceSet2);
// Configure EMF Compare
EMFCompare comparator = EMFCompare.builder().build();
// Compare the two models
IComparisonScope scope = EMFCompare.createDefaultScope(resourceSet1, resourceSet2);
return comparator.compare(scope);
}
@Test
public void testCompare()
{
Comparison comparison = compare();
List<Diff> differences = comparison.getDifferences();
for(Diff d: differences)
{
System.err.println("d.getKind(): "+d.getKind());
System.err.println("d.getMatch(): " + d.getMatch());
System.err.println("State: " + d.getState());
}
assertSame(Integer.valueOf(12), Integer.valueOf(differences.size()));
}
출력
d.getKind(): ADD
d.getMatch(): MatchSpec{[email protected] Application Processed, [email protected] Application Processed, origin=<null>, #differences=2, #submatches=2}
State: UNRESOLVED
d.getKind(): DELETE
d.getMatch(): MatchSpec{[email protected] Application Processed, [email protected] Application Processed, origin=<null>, #differences=2, #submatches=2}
State: UNRESOLVED