use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ChangeSummaryTestCases method testNonDataTypeManyPropertyWasNotSet.
public void testNonDataTypeManyPropertyWasNotSet() throws IOException {
Type rootType = jaxbHelperContext.getType(Root.class);
Property controlNonDataTypeContainmentManyProperty = rootType.getProperty(CONTROL_NONDATATYPE_CONTAINMENT_MANY_PROPERTY);
DataObject rootDO = jaxbHelperContext.getDataFactory().create(rootType);
rootDO.getChangeSummary().beginLogging();
DataObject newChild2DO = rootDO.createDataObject(controlNonDataTypeContainmentManyProperty);
newChild2DO.set("id", 2);
List testList = rootDO.getList(controlNonDataTypeContainmentManyProperty);
assertEquals(1, rootDO.getList(controlNonDataTypeContainmentManyProperty).size());
ChangeSummary.Setting setting = rootDO.getChangeSummary().getOldValue(rootDO, controlNonDataTypeContainmentManyProperty);
List testOldValue = (List) setting.getValue();
assertEquals(0, testOldValue.size());
assertEquals(false, setting.isSet());
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ChangeSummaryTestCases method testNonDataTypePropertyWasSet.
public void testNonDataTypePropertyWasSet() throws IOException {
Type rootType = jaxbHelperContext.getType(Root.class);
Property controlNonDataTypeProperty = rootType.getProperty(CONTROL_NONDATATYPE_CONTAINMENT_PROPERTY);
DataObject rootDO = jaxbHelperContext.getDataFactory().create(rootType);
DataObject oldChild1DO = rootDO.createDataObject(controlNonDataTypeProperty);
oldChild1DO.set("id", 1);
rootDO.getChangeSummary().beginLogging();
DataObject newChild1DO = rootDO.createDataObject(controlNonDataTypeProperty);
newChild1DO.set("id", 2);
assertEquals(newChild1DO, rootDO.getDataObject(controlNonDataTypeProperty));
ChangeSummary.Setting setting = rootDO.getChangeSummary().getOldValue(rootDO, controlNonDataTypeProperty);
DataObject testOldValue = (DataObject) setting.getValue();
assertEquals(1, testOldValue.get("id"));
assertEquals(true, setting.isSet());
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ChangeSummaryTestCases method testNonDataTypePropertyWasSetXML.
public void testNonDataTypePropertyWasSetXML() throws IOException {
Type rootType = jaxbHelperContext.getType(Root.class);
Property controlNonDataTypeProperty = rootType.getProperty(CONTROL_NONDATATYPE_CONTAINMENT_PROPERTY);
InputStream xml = Thread.currentThread().getContextClassLoader().getResourceAsStream(XML_NON_DATA_TYPE_PROPERTY_WAS_SET);
DataObject rootDO = jaxbHelperContext.getXMLHelper().load(xml).getRootObject();
ChangeSummary.Setting setting = rootDO.getChangeSummary().getOldValue(rootDO, controlNonDataTypeProperty);
DataObject testOldValue = (DataObject) setting.getValue();
assertEquals(1, testOldValue.get("id"));
assertEquals(true, setting.isSet());
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ChangeSummaryTestCases method testDataTypeManyPropertyWasNotSet.
public void testDataTypeManyPropertyWasNotSet() throws IOException {
Type rootType = jaxbHelperContext.getType(Root.class);
Property controlDataTypeManyProperty = rootType.getProperty(CONTROL_DATATYPE_MANY_PROPERTY);
DataObject rootDO = jaxbHelperContext.getDataFactory().create(rootType);
rootDO.getChangeSummary().beginLogging();
rootDO.getList(controlDataTypeManyProperty).add(CONTROL_DATATYPE_MANY_PROPERTY_NEW_VALUE);
assertEquals(1, rootDO.getList(controlDataTypeManyProperty).size());
assertEquals(CONTROL_DATATYPE_MANY_PROPERTY_NEW_VALUE, rootDO.getList(controlDataTypeManyProperty).get(0));
ChangeSummary.Setting setting = rootDO.getChangeSummary().getOldValue(rootDO, controlDataTypeManyProperty);
List testOldValue = (List) setting.getValue();
assertEquals(0, testOldValue.size());
assertEquals(false, setting.isSet());
}
use of commonj.sdo.Property in project eclipselink by eclipse-ee4j.
the class ChangeSummaryTestCases method testNonDataTypeManyPropertyWasSet.
public void testNonDataTypeManyPropertyWasSet() throws IOException {
Type rootType = jaxbHelperContext.getType(Root.class);
Property controlNonDataTypeContainmentManyProperty = rootType.getProperty(CONTROL_NONDATATYPE_CONTAINMENT_MANY_PROPERTY);
DataObject rootDO = jaxbHelperContext.getDataFactory().create(rootType);
DataObject oldChild2DO = rootDO.createDataObject(controlNonDataTypeContainmentManyProperty);
oldChild2DO.set("id", 1);
rootDO.getChangeSummary().beginLogging();
DataObject newChild2DO = rootDO.createDataObject(controlNonDataTypeContainmentManyProperty);
newChild2DO.set("id", 2);
assertEquals(2, rootDO.getList(controlNonDataTypeContainmentManyProperty).size());
ChangeSummary.Setting setting = rootDO.getChangeSummary().getOldValue(rootDO, controlNonDataTypeContainmentManyProperty);
List testOldValue = (List) setting.getValue();
assertEquals(1, testOldValue.size());
assertEquals(true, setting.isSet());
}
Aggregations