Search in sources :

Example 11 with Sequence

use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.

the class ChangeSummaryGetOldSequenceTestCases method testGetOldSequenceReattached.

public void testGetOldSequenceReattached() {
    cs.beginLogging();
    address1Object.detach();
    purchaseOrderObject.getList("address").add(address1Object);
    Sequence oldSeq = cs.getOldSequence(address1Object);
    assertNotNull(oldSeq);
}
Also used : Sequence(commonj.sdo.Sequence) SDOSequence(org.eclipse.persistence.sdo.SDOSequence)

Example 12 with Sequence

use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.

the class ChangeSummaryGetOldSequenceTestCases method testGetOldSequenceDeletedAddress.

public void testGetOldSequenceDeletedAddress() {
    cs.beginLogging();
    Sequence currentSeq = address1Object.getSequence();
    assertEquals(4, currentSeq.size());
    address1Object.delete();
    assertEquals(0, currentSeq.size());
    Sequence oldSeq = cs.getOldSequence(address1Object);
    assertNotNull(oldSeq);
    assertEquals(4, ((SDOSequence) oldSeq).getSettings().size());
}
Also used : Sequence(commonj.sdo.Sequence) SDOSequence(org.eclipse.persistence.sdo.SDOSequence) SDOSequence(org.eclipse.persistence.sdo.SDOSequence)

Example 13 with Sequence

use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.

the class ChangeSummaryGetOldSequenceTestCases method testGetOldSequenceAfterRemoveText.

public void testGetOldSequenceAfterRemoveText() {
    assertEquals(4, address1Object.getSequence().size());
    address1Object.getSequence().addText("abc");
    address1Object.getSequence().addText("def");
    assertEquals(6, address1Object.getSequence().size());
    cs.beginLogging();
    address1Object.getSequence().remove(4);
    assertEquals(5, address1Object.getSequence().size());
    assertEquals("def", (String) address1Object.getSequence().getValue(4));
    Sequence oldSeq = cs.getOldSequence(address1Object);
    assertNotNull(oldSeq);
    assertEquals(6, oldSeq.size());
    assertEquals("abc", (String) oldSeq.getValue(4));
    assertEquals("def", (String) oldSeq.getValue(5));
}
Also used : Sequence(commonj.sdo.Sequence) SDOSequence(org.eclipse.persistence.sdo.SDOSequence)

Example 14 with Sequence

use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.

the class ChangeSummaryGetOldSequenceTestCases method testGetOldSequenceDetachedItem.

public void testGetOldSequenceDetachedItem() {
    DataObject lineItem1 = (DataObject) itemsObject.getList("item").get(0);
    DataObject lineItem2 = (DataObject) itemsObject.getList("item").get(1);
    Sequence currentSeq = itemsObject.getSequence();
    assertEquals(2, currentSeq.size());
    cs.beginLogging();
    lineItem1.detach();
    assertEquals(1, currentSeq.size());
    Sequence oldSeq = cs.getOldSequence(itemsObject);
    assertNotNull(oldSeq);
    assertEquals(2, ((SDOSequence) oldSeq).getSettings().size());
    DataObject oldLineItem1 = (DataObject) oldSeq.getValue(0);
    assertEquals("Lawnmower", oldLineItem1.get("productName"));
    DataObject oldLineItem2 = (DataObject) oldSeq.getValue(1);
    assertEquals("Baby Monitor", oldLineItem2.get("productName"));
    // should be a deep copy not the same object
    assertNotSame(lineItem1, oldLineItem1);
    assertNotSame(lineItem2, oldLineItem2);
    assertFalse(lineItem1.equals(oldLineItem1));
    assertFalse(lineItem2.equals(oldLineItem2));
}
Also used : DataObject(commonj.sdo.DataObject) Sequence(commonj.sdo.Sequence) SDOSequence(org.eclipse.persistence.sdo.SDOSequence) SDOSequence(org.eclipse.persistence.sdo.SDOSequence)

Example 15 with Sequence

use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.

the class ChangeSummaryGetOldSequenceTestCases method testGetOldSequenceReattachedItem.

public void testGetOldSequenceReattachedItem() {
    DataObject lineItem1 = (DataObject) itemsObject.getList("item").get(0);
    cs.beginLogging();
    lineItem1.detach();
    assertEquals(1, itemsObject.getSequence().size());
    DataObject firstObject = (DataObject) itemsObject.getSequence().getValue(0);
    assertEquals("Baby Monitor", firstObject.get("productName"));
    itemsObject.getList("item").add(lineItem1);
    assertEquals(2, itemsObject.getSequence().size());
    DataObject firstObjectAgain = (DataObject) itemsObject.getSequence().getValue(0);
    assertEquals("Baby Monitor", firstObjectAgain.get("productName"));
    Sequence oldSeq = cs.getOldSequence(itemsObject);
    assertNotNull(oldSeq);
    assertEquals(2, oldSeq.size());
    DataObject firstObjectOld = (DataObject) oldSeq.getValue(0);
    assertEquals("Lawnmower", firstObjectOld.get("productName"));
}
Also used : DataObject(commonj.sdo.DataObject) Sequence(commonj.sdo.Sequence) SDOSequence(org.eclipse.persistence.sdo.SDOSequence)

Aggregations

Sequence (commonj.sdo.Sequence)32 SDOSequence (org.eclipse.persistence.sdo.SDOSequence)29 DataObject (commonj.sdo.DataObject)18 SDODataObject (org.eclipse.persistence.sdo.SDODataObject)12 List (java.util.List)10 ArrayList (java.util.ArrayList)8 ChangeSummary (commonj.sdo.ChangeSummary)7 SDOChangeSummary (org.eclipse.persistence.sdo.SDOChangeSummary)6 SDOType (org.eclipse.persistence.sdo.SDOType)4 Property (commonj.sdo.Property)3 DataHelper (commonj.sdo.helper.DataHelper)1 TypeHelper (commonj.sdo.helper.TypeHelper)1 Iterator (java.util.Iterator)1 SDOException (org.eclipse.persistence.exceptions.SDOException)1 XMLConversionManager (org.eclipse.persistence.internal.oxm.XMLConversionManager)1 XMLRoot (org.eclipse.persistence.oxm.XMLRoot)1 XMLUnmarshaller (org.eclipse.persistence.oxm.XMLUnmarshaller)1 SequencedObject (org.eclipse.persistence.oxm.sequenced.SequencedObject)1 SDOProperty (org.eclipse.persistence.sdo.SDOProperty)1 ListWrapper (org.eclipse.persistence.sdo.helper.ListWrapper)1