Search in sources :

Example 1 with DeltaConvertor.toObjectDeltaType

use of com.evolveum.midpoint.schema.DeltaConvertor.toObjectDeltaType in project midpoint by Evolveum.

the class TestDeltaConverter method roundTrip.

private void roundTrip(ObjectDelta delta) throws Exception {
    ObjectDeltaType deltaType = DeltaConvertor.toObjectDeltaType(delta);
    System.out.println("Serialized to bean");
    System.out.println(deltaType);
    String xml = getPrismContext().xmlSerializer().serializeRealValue(deltaType, new QName("aDelta"));
    System.out.println("Serialized to XML");
    System.out.println(xml);
    ObjectDeltaType deltaTypeParsed = getPrismContext().parserFor(xml).parseRealValue();
    System.out.println("Parsed from XML to bean");
    System.out.println(deltaTypeParsed);
    ObjectDelta deltaParsed = DeltaConvertor.createObjectDelta(deltaTypeParsed, getPrismContext());
    System.out.println("Parsed from XML to bean to delta");
    System.out.println(deltaParsed);
    assertTrue("Deltas (native) do not match", delta.equivalent(deltaParsed));
// note: comparing beans is problematic because e.g. item paths are not equal ({common-3}name vs {c=common-3}c:name)
}
Also used : DeltaConvertor.toObjectDeltaType(com.evolveum.midpoint.schema.DeltaConvertor.toObjectDeltaType) QName(javax.xml.namespace.QName) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta)

Aggregations

ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 DeltaConvertor.toObjectDeltaType (com.evolveum.midpoint.schema.DeltaConvertor.toObjectDeltaType)1 QName (javax.xml.namespace.QName)1