Search in sources :

Example 16 with SDOXMLHelper

use of org.eclipse.persistence.sdo.helper.SDOXMLHelper 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 17 with SDOXMLHelper

use of org.eclipse.persistence.sdo.helper.SDOXMLHelper 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 18 with SDOXMLHelper

use of org.eclipse.persistence.sdo.helper.SDOXMLHelper 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 19 with SDOXMLHelper

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

the class LoadAndSavePurchaseOrderComplexTestCases method compareXML.

@Override
protected void compareXML(String controlFileName, String testString, boolean compareNodes) throws Exception {
    super.compareXML(controlFileName, testString, compareNodes);
    XMLMarshaller marshaller = ((SDOXMLHelper) xmlHelper).getXmlMarshaller();
    XMLMarshalListener listener = marshaller.getMarshalListener();
    assertNull(((SDOMarshalListener) listener).getMarshalledObject());
    assertNull(((SDOMarshalListener) listener).getMarshalledObjectRootQName());
    assertNull(((SDOMarshalListener) listener).getRootMarshalRecord());
}
Also used : XMLMarshaller(org.eclipse.persistence.oxm.XMLMarshaller) XMLMarshalListener(org.eclipse.persistence.oxm.XMLMarshalListener) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper)

Example 20 with SDOXMLHelper

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

the class LoadAndSaveMimeTypeOnPropertyTestCases method setUp.

@Override
public void setUp() {
    super.setUp();
    XMLMarshaller aMarshaller = ((SDOXMLHelper) xmlHelper).getXmlMarshaller();
    XMLUnmarshaller anUnmarshaller = ((SDOXMLHelper) xmlHelper).getXmlUnmarshaller();
    XMLAttachmentMarshaller anAttachmentMarshaller = new AttachmentMarshallerImpl("c_id0");
    XMLAttachmentUnmarshaller anAttachmentUnmarshaller = new AttachmentUnmarshallerImpl("Testing".getBytes());
    aMarshaller.setAttachmentMarshaller(anAttachmentMarshaller);
    anUnmarshaller.setAttachmentUnmarshaller(anAttachmentUnmarshaller);
}
Also used : XMLMarshaller(org.eclipse.persistence.oxm.XMLMarshaller) XMLAttachmentMarshaller(org.eclipse.persistence.oxm.attachment.XMLAttachmentMarshaller) XMLUnmarshaller(org.eclipse.persistence.oxm.XMLUnmarshaller) SDOXMLHelper(org.eclipse.persistence.sdo.helper.SDOXMLHelper) XMLAttachmentUnmarshaller(org.eclipse.persistence.oxm.attachment.XMLAttachmentUnmarshaller)

Aggregations

SDOXMLHelper (org.eclipse.persistence.sdo.helper.SDOXMLHelper)40 SDOMarshalListener (org.eclipse.persistence.sdo.helper.SDOMarshalListener)22 SDODataObject (org.eclipse.persistence.sdo.SDODataObject)21 SDOChangeSummary (org.eclipse.persistence.sdo.SDOChangeSummary)16 XMLDocument (commonj.sdo.helper.XMLDocument)6 XMLMarshaller (org.eclipse.persistence.oxm.XMLMarshaller)6 XMLUnmarshaller (org.eclipse.persistence.oxm.XMLUnmarshaller)5 XMLAttachmentMarshaller (org.eclipse.persistence.oxm.attachment.XMLAttachmentMarshaller)5 XMLAttachmentUnmarshaller (org.eclipse.persistence.oxm.attachment.XMLAttachmentUnmarshaller)5 ArrayList (java.util.ArrayList)4 List (java.util.List)3 SDOType (org.eclipse.persistence.sdo.SDOType)3 SDOClassLoader (org.eclipse.persistence.sdo.helper.SDOClassLoader)3 SDOTypeHelper (org.eclipse.persistence.sdo.helper.SDOTypeHelper)3 DataObject (commonj.sdo.DataObject)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 FileInputStream (java.io.FileInputStream)2 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)2 SDOXSDHelper (org.eclipse.persistence.sdo.helper.SDOXSDHelper)2 Type (commonj.sdo.Type)1