use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.
the class SDODataObjectGetPathTest method testGetPathFromAncestorDeletedFromChildToCurrentObjectLoggingOff.
public void testGetPathFromAncestorDeletedFromChildToCurrentObjectLoggingOff() {
SDODataObject anItem = (SDODataObject) aRoot5.get("items/item[2]");
// get changeSummary
SDOChangeSummary aCS = aRoot5.getChangeSummary();
assertFalse(aCS.isLogging());
// delete source object
anItem.delete();
String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(anItem, anItem, anItem.getChangeSummary());
assertNotNull(aPath);
assertEquals(SDOConstants.EMPTY_STRING, aPath);
}
use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.
the class SDODataObjectGetPathTest method testGetPathFromAncestorDeletedFromChildToAncestorListWrapperLoggingOn.
// verify that we do not get an infinite loop if we pass in the target's changeSummary
public void testGetPathFromAncestorDeletedFromChildToAncestorListWrapperLoggingOn() {
SDODataObject anItem = (SDODataObject) aRoot5.get("items/item[2]");
// start logging
SDOChangeSummary aCS = aRoot5.getChangeSummary();
aCS.beginLogging();
assertTrue(aCS.isLogging());
// delete source object
SDODataObject deletedObject = ((SDODataObject) aRoot5.get("items"));
deletedObject.delete();
String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(anItem, aRoot5, aRoot5.getChangeSummary());
assertNotNull(aPath);
// TODO: no storage of deleted indexed postition - defaults to size() = start of list for now
// see SDODataObject: index = ((SDODataObject)parent).getList(aChild).size();
assertEquals("ns0:items/ns0:item[2]", aPath);
// assertEquals(anItem, anItemFromPath);
}
use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.
the class SDODataObjectGetPathTest method testGetPathFromAncestorModifiedFromChildToRootLoggingOnWithoutPassingChangeSummary.
public void testGetPathFromAncestorModifiedFromChildToRootLoggingOnWithoutPassingChangeSummary() {
SDODataObject anItem = (SDODataObject) aRoot5.get("billTo");
// start logging
SDOChangeSummary aCS = aRoot5.getChangeSummary();
aCS.beginLogging();
assertTrue(aCS.isLogging());
// modifydelete source object
((SDODataObject) aRoot5.get("billTo")).set("name", "new name");
String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(anItem, aRoot5, anItem.getChangeSummary());
assertNotNull(aPath);
assertEquals("ns0:billTo", aPath);
}
use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.
the class SDODataObjectGetPathTest method testGetXPathFromAncestorFromContainedToParent.
public void testGetXPathFromAncestorFromContainedToParent() {
SDODataObject target = (SDODataObject) aRoot5.get("items");
SDODataObject aSibling = (SDODataObject) aRoot5.get("items/item[2]");
String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(aSibling, target, aSibling.getChangeSummary());
assertNotNull(aPath);
assertEquals("ns0:item[2]", aPath);
}
use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.
the class SDOXMLHelperDelegate method getXmlMarshaller.
@Override
public XMLMarshaller getXmlMarshaller() {
XMLMarshaller marshaller = xmlMarshallerMap.get(Thread.currentThread());
if (marshaller == null) {
marshaller = getXmlContext().createMarshaller();
marshaller.setMarshalListener(new SDOMarshalListener(marshaller, (SDOTypeHelper) aHelperContext.getTypeHelper()));
xmlMarshallerMap.put(Thread.currentThread(), marshaller);
}
XMLContext context = getXmlContext();
if (marshaller.getXMLContext() != context) {
marshaller.setXMLContext(context);
}
return marshaller;
}
Aggregations