use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ChangeSummaryTestCases method testDataTypePropertyWasNotSetXML.
public void testDataTypePropertyWasNotSetXML() throws IOException {
Type rootType = jaxbHelperContext.getType(Root.class);
Property controlDataTypeProperty = rootType.getProperty(CONTROL_DATATYPE_PROPERTY);
InputStream xml = Thread.currentThread().getContextClassLoader().getResourceAsStream(XML_DATA_TYPE_PROPERTY_WAS_NOT_SET);
DataObject rootDO = jaxbHelperContext.getXMLHelper().load(xml).getRootObject();
assertEquals(CONTROL_DATATYPE_PROPERTY_NEW_VALUE, rootDO.get(controlDataTypeProperty));
ChangeSummary.Setting setting = rootDO.getChangeSummary().getOldValue(rootDO, controlDataTypeProperty);
String testOldValue = (String) setting.getValue();
assertEquals(null, testOldValue);
assertEquals(false, setting.isSet());
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ContainmentTestCases method testCollectionMove1.
public void testCollectionMove1() {
Type rootType = jaxbHelperContext.getTypeHelper().getType("urn:containment", "root");
Property childManyProperty = rootType.getProperty("child-many");
DataObject root1DO = jaxbHelperContext.getDataFactory().create(rootType);
DataObject childDO = root1DO.createDataObject(childManyProperty);
assertFalse(root1DO.getList(childManyProperty).isEmpty());
DataObject root2DO = jaxbHelperContext.getDataFactory().create(rootType);
assertTrue(root2DO.getList(childManyProperty).isEmpty());
root2DO.getList(childManyProperty).add(childDO);
assertTrue(root1DO.getList(childManyProperty).isEmpty());
assertFalse(root2DO.getList(childManyProperty).isEmpty());
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ContainmentTestCases method testCollectionMove2.
public void testCollectionMove2() {
Type rootType = jaxbHelperContext.getTypeHelper().getType("urn:containment", "root");
Property childManyProperty = rootType.getProperty("child-many");
Root root1 = new Root();
Child child = new Child();
ArrayList children = new ArrayList(1);
children.add(child);
root1.setChildCollectionProperty(children);
assertFalse(root1.getChildCollectionProperty().isEmpty());
Root root2 = new Root();
root2.setChildCollectionProperty(new ArrayList(1));
assertTrue(root2.getChildCollectionProperty().isEmpty());
DataObject root1DO = jaxbHelperContext.wrap(root1);
DataObject root2DO = jaxbHelperContext.wrap(root2);
DataObject childDO = (DataObject) root1DO.getList(childManyProperty).get(0);
root2DO.getList(childManyProperty).add(childDO);
assertTrue(root1DO.getList(childManyProperty).isEmpty());
assertFalse(root2DO.getList(childManyProperty).isEmpty());
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ContainmentTestCases method testGetContainer.
public void testGetContainer() {
Root root = new Root();
Child child = new Child();
root.setChildProperty(child);
Type rootType = jaxbHelperContext.getTypeHelper().getType("urn:containment", "root");
Property childProperty = rootType.getProperty("child");
DataObject rootDO = jaxbHelperContext.wrap(root);
DataObject childDO = rootDO.getDataObject(childProperty);
DataObject containerDO = childDO.getContainer();
assertNotNull(containerDO);
assertSame(rootDO, containerDO);
Property containmentProperty = childDO.getContainmentProperty();
assertNotNull(containmentProperty);
assertSame(childProperty, containmentProperty);
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ContainmentTestCases method testMove2.
public void testMove2() {
Type rootType = jaxbHelperContext.getTypeHelper().getType("urn:containment", "root");
Property childProperty = rootType.getProperty("child");
Root root1 = new Root();
Child child = new Child();
root1.setChildProperty(child);
assertNotNull(root1.getChildProperty());
Root root2 = new Root();
assertNull(root2.getChildProperty());
DataObject root1DO = jaxbHelperContext.wrap(root1);
DataObject root2DO = jaxbHelperContext.wrap(root2);
root2DO.set(childProperty, root1DO.get(childProperty));
assertNotNull(root2DO.get(childProperty));
assertNull(root1DO.get(childProperty));
}
Aggregations