Search in sources :

Example 11 with SDOMarshalListener

use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method testGetPathFromAncestorDeletedFromContainedToParentLoggingOn.

// these deleted tests are not supported yet for XPath
// TODO: we must store the index (2) position when deleting inside a ListWrapper
public void testGetPathFromAncestorDeletedFromContainedToParentLoggingOn() {
    SDODataObject target = (SDODataObject) aRoot5.get("items");
    SDODataObject aSibling = (SDODataObject) aRoot5.get("items/item[2]");
    // start logging
    SDOChangeSummary aCS = aRoot5.getChangeSummary();
    aCS.beginLogging();
    // delete source object
    aSibling.delete();
    String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(aSibling, target, target.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:item[2]", aPath);
}
Also used : SDOChangeSummary(org.eclipse.persistence.sdo.SDOChangeSummary) SDOMarshalListener(org.eclipse.persistence.sdo.helper.SDOMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Example 12 with SDOMarshalListener

use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method testGetPathFromAncestorDeletedFromChildToAncestorInsideListWrapperLoggingOn.

// test index=0 from item inside deleted listWrapper
public void testGetPathFromAncestorDeletedFromChildToAncestorInsideListWrapperLoggingOn() {
    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"));
    // detach();
    anItem.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("items/item[2]", aPath);
    assertEquals("ns0:items/ns0:item[2]", aPath);
}
Also used : SDOChangeSummary(org.eclipse.persistence.sdo.SDOChangeSummary) SDOMarshalListener(org.eclipse.persistence.sdo.helper.SDOMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Example 13 with SDOMarshalListener

use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method testGetPathFromAncestorDeletedFromRootToSiblingLoggingOff.

public void testGetPathFromAncestorDeletedFromRootToSiblingLoggingOff() {
    SDODataObject anItem = (SDODataObject) aRoot5.get("items/item[2]");
    String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(aRoot5, anItem, aRoot5.getChangeSummary());
    // get changeSummary
    SDOChangeSummary aCS = aRoot5.getChangeSummary();
    assertFalse(aCS.isLogging());
    // delete source object
    aRoot5.delete();
    assertEquals(SDOConstants.SDO_XPATH_INVALID_PATH, aPath);
}
Also used : SDOChangeSummary(org.eclipse.persistence.sdo.SDOChangeSummary) SDOMarshalListener(org.eclipse.persistence.sdo.helper.SDOMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Example 14 with SDOMarshalListener

use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method testGetXPathFromAncestorDeletedFromRootToCurrentObjectLoggingOn.

public void testGetXPathFromAncestorDeletedFromRootToCurrentObjectLoggingOn() {
    String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(aRoot5, aRoot5, aRoot5.getChangeSummary());
    // start logging
    SDOChangeSummary aCS = aRoot5.getChangeSummary();
    aCS.beginLogging();
    assertTrue(aCS.isLogging());
    // delete source object
    aRoot5.delete();
    assertNotNull(aPath);
    assertEquals(SDOConstants.EMPTY_STRING, aPath);
}
Also used : SDOChangeSummary(org.eclipse.persistence.sdo.SDOChangeSummary) SDOMarshalListener(org.eclipse.persistence.sdo.helper.SDOMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper)

Example 15 with SDOMarshalListener

use of org.eclipse.persistence.sdo.helper.SDOMarshalListener in project eclipselink by eclipse-ee4j.

the class SDODataObjectGetPathTest method testGetPathFromAncestorFromChildToRoot.

public void testGetPathFromAncestorFromChildToRoot() {
    SDODataObject anItem = (SDODataObject) aRoot5.get("items/item[2]");
    String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(anItem, aRoot5, anItem.getChangeSummary());
    assertNotNull(aPath);
    assertEquals("ns0:items/ns0:item[2]", aPath);
}
Also used : SDOMarshalListener(org.eclipse.persistence.sdo.helper.SDOMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Aggregations

SDOMarshalListener (org.eclipse.persistence.sdo.helper.SDOMarshalListener)27 SDOXMLHelper (org.eclipse.persistence.sdo.helper.SDOXMLHelper)22 SDODataObject (org.eclipse.persistence.sdo.SDODataObject)20 SDOChangeSummary (org.eclipse.persistence.sdo.SDOChangeSummary)16 QName (javax.xml.namespace.QName)3 XMLMarshaller (org.eclipse.persistence.oxm.XMLMarshaller)3 XMLMarshalException (org.eclipse.persistence.exceptions.XMLMarshalException)2 FormattedWriterRecord (org.eclipse.persistence.oxm.record.FormattedWriterRecord)2 WriterRecord (org.eclipse.persistence.oxm.record.WriterRecord)2 SDOType (org.eclipse.persistence.sdo.SDOType)2 SDOTypeHelper (org.eclipse.persistence.sdo.helper.SDOTypeHelper)2 DataObject (commonj.sdo.DataObject)1 IOException (java.io.IOException)1 OutputStreamWriter (java.io.OutputStreamWriter)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 Writer (java.io.Writer)1 DOMResult (javax.xml.transform.dom.DOMResult)1 SAXResult (javax.xml.transform.sax.SAXResult)1 StreamResult (javax.xml.transform.stream.StreamResult)1