use of org.eclipse.persistence.sdo.helper.SDOXMLHelper in project eclipselink by eclipse-ee4j.
the class SDOResolvableTest method setUp.
@Override
public void setUp() {
try {
xmlComparer = new SDOXMLComparer();
aHelperContext = SDOHelperContext.getHelperContext();
typeHelper = aHelperContext.getTypeHelper();
xmlHelper = aHelperContext.getXMLHelper();
xsdHelper = aHelperContext.getXSDHelper();
equalityHelper = aHelperContext.getEqualityHelper();
copyHelper = aHelperContext.getCopyHelper();
dataFactory = aHelperContext.getDataFactory();
// TODO: we should be using the DataHelper interface
dataHelper = (SDODataHelper) aHelperContext.getDataHelper();
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(true);
builderFactory.setIgnoringElementContentWhitespace(true);
try {
parser = builderFactory.newDocumentBuilder();
} catch (Exception e) {
fail("Could not create parser.");
e.printStackTrace();
}
((SDOTypeHelper) typeHelper).reset();
((SDOXMLHelper) xmlHelper).reset();
((SDOXSDHelper) xsdHelper).reset();
// load in the schema
String xsdString = getXSDString("org/eclipse/persistence/testing/sdo/helper/xmlhelper/PurchaseOrderDeep.xsd");
// Define Types so that processing attributes completes
List types = xsdHelper.define(xsdString);
// first we set up root data object
FileInputStream inStream = new FileInputStream("org/eclipse/persistence/testing/sdo/helper/xmlhelper/PurchaseOrderNSDeep.xml");
XMLDocument document = xmlHelper.load(inStream);
root = document.getRootObject();
inStream.close();
} catch (Exception e) {
e.printStackTrace();
fail("SDOResolvableTestCases.setup() failed to load DataObject");
}
}
use of org.eclipse.persistence.sdo.helper.SDOXMLHelper in project eclipselink by eclipse-ee4j.
the class LoadAndSaveBase64AttachmentTestCases 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);
}
use of org.eclipse.persistence.sdo.helper.SDOXMLHelper in project eclipselink by eclipse-ee4j.
the class SDODataObjectGetPathTest method testGetXPathFromAncestorDeletedFromChildToAncestorInsideListWrapperLoggingOn.
public void testGetXPathFromAncestorDeletedFromChildToAncestorInsideListWrapperLoggingOn() {
SDODataObject anItem = (SDODataObject) aRoot5.get("billTo/phone[1]");
// start logging
SDOChangeSummary aCS = aRoot5.getChangeSummary();
aCS.beginLogging();
assertTrue(aCS.isLogging());
// delete source object
SDODataObject deletedObjectParent = ((SDODataObject) aRoot5.get("billTo"));
// detach();
deletedObjectParent.delete();
String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(anItem, aRoot5, aRoot5.getChangeSummary());
// SDODataObject anItemFromPath = (SDODataObject)aRoot5.get(aPath);
// System.out.println("testGetPathFromAncestorDeletedFromChildToRootLoggingOn: " + aPath);
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:billTo/ns0:phone[1]", aPath);
}
use of org.eclipse.persistence.sdo.helper.SDOXMLHelper in project eclipselink by eclipse-ee4j.
the class SDODataObjectGetPathTest method testGetPathFromAncestorDetachedFromChildToAncestorInsideListWrapperLoggingOn.
// TODO: This case fails to find a path because the oldSettings map is not populated during detach()
public void testGetPathFromAncestorDetachedFromChildToAncestorInsideListWrapperLoggingOn() {
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"));
anItem.detach();
// String aPath = anItem.getPathFromAncestor(aCS, aRoot5, useXPathFormat);
String aPath = ((SDOMarshalListener) ((SDOXMLHelper) xmlHelper).getXmlMarshaller().getMarshalListener()).getPathFromAncestor(anItem, aRoot5, aRoot5.getChangeSummary());
// SDODataObject anItemFromPath = (SDODataObject)aRoot5.get(aPath);
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);
}
use of org.eclipse.persistence.sdo.helper.SDOXMLHelper in project eclipselink by eclipse-ee4j.
the class SDODataObjectGetPathTest method testGetXPathFromAncestorDeletedFromChildToRootInsideListWrapperLoggingOn.
public void testGetXPathFromAncestorDeletedFromChildToRootInsideListWrapperLoggingOn() {
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());
// SDODataObject anItemFromPath = (SDODataObject)aRoot5.get(aPath);
// System.out.println("testGetPathFromAncestorDeletedFromChildToRootLoggingOn: " + aPath);
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);
}
Aggregations