Search in sources :

Example 21 with Property

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());
}
Also used : Type(commonj.sdo.Type) DataObject(commonj.sdo.DataObject) List(java.util.List) ChangeSummary(commonj.sdo.ChangeSummary) Property(commonj.sdo.Property)

Example 22 with Property

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());
}
Also used : Type(commonj.sdo.Type) DataObject(commonj.sdo.DataObject) ChangeSummary(commonj.sdo.ChangeSummary) Property(commonj.sdo.Property)

Example 23 with Property

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());
}
Also used : Type(commonj.sdo.Type) DataObject(commonj.sdo.DataObject) InputStream(java.io.InputStream) ChangeSummary(commonj.sdo.ChangeSummary) Property(commonj.sdo.Property)

Example 24 with Property

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());
}
Also used : Type(commonj.sdo.Type) DataObject(commonj.sdo.DataObject) List(java.util.List) ChangeSummary(commonj.sdo.ChangeSummary) Property(commonj.sdo.Property)

Example 25 with Property

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());
}
Also used : Type(commonj.sdo.Type) DataObject(commonj.sdo.DataObject) List(java.util.List) ChangeSummary(commonj.sdo.ChangeSummary) Property(commonj.sdo.Property)

Aggregations

Property (commonj.sdo.Property)354 DataObject (commonj.sdo.DataObject)204 SDOProperty (org.eclipse.persistence.sdo.SDOProperty)194 SDODataObject (org.eclipse.persistence.sdo.SDODataObject)124 List (java.util.List)99 Type (commonj.sdo.Type)87 SDOSequence (org.eclipse.persistence.sdo.SDOSequence)76 ArrayList (java.util.ArrayList)73 ChangeSummary (commonj.sdo.ChangeSummary)56 SDOType (org.eclipse.persistence.sdo.SDOType)54 ListWrapper (org.eclipse.persistence.sdo.helper.ListWrapper)47 SDOChangeSummary (org.eclipse.persistence.sdo.SDOChangeSummary)37 SDOException (org.eclipse.persistence.exceptions.SDOException)35 Iterator (java.util.Iterator)24 QName (javax.xml.namespace.QName)12 InputStream (java.io.InputStream)11 SDOSetting (org.eclipse.persistence.sdo.SDOSetting)11 Map (java.util.Map)5 XMLDocument (commonj.sdo.helper.XMLDocument)4 SequencedObject (org.eclipse.persistence.oxm.sequenced.SequencedObject)4