use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.
the class ChangeSummaryGetOldSequenceTestCases method testGetOldSequenceNotLogging.
public void testGetOldSequenceNotLogging() {
cs.endLogging();
address1Object.set("city", "aaa");
List oldValues = cs.getOldValues(address1Object);
assertEquals(0, oldValues.size());
address1Object.unset(address1Object.getInstanceProperty("city"));
Sequence oldAddressSeq = cs.getOldSequence(address1Object);
assertNotNull(oldAddressSeq);
}
use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.
the class ChangeSummaryGetOldSequenceTestCases method testGetOldSequenceNull.
public void testGetOldSequenceNull() {
cs.beginLogging();
Sequence oldSeq = cs.getOldSequence(null);
assertNull(oldSeq);
}
use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.
the class ChangeSummaryGetOldSequenceTestCases method testGetOldSequenceAfterUnsetAllOnAddress.
public void testGetOldSequenceAfterUnsetAllOnAddress() {
cs.beginLogging();
address1Object.unset(3);
address1Object.unset(2);
address1Object.unset(1);
address1Object.unset(0);
assertEquals(0, ((SDOSequence) address1Object.getSequence()).getSettings().size());
boolean exception = false;
try {
address1Object.getSequence().getProperty(0);
} catch (SDOException e) {
// do nothing
assertEquals(SDOException.INVALID_INDEX, e.getErrorCode());
exception = true;
} finally {
assertTrue(exception);
exception = false;
}
try {
address1Object.getSequence().getValue(0);
} catch (SDOException e) {
// do nothing
assertEquals(SDOException.INVALID_INDEX, e.getErrorCode());
exception = true;
} finally {
assertTrue(exception);
exception = false;
}
Property cityProp = address1Object.getInstanceProperty("city");
ChangeSummary.Setting cityOldSetting = cs.getOldValue(address1Object, cityProp);
assertNotNull(cityOldSetting);
Object oldCityValue = cityOldSetting.getValue();
assertNotNull(oldCityValue);
Sequence address1OldSeq = cs.getOldSequence(address1Object);
assertNotNull(address1OldSeq);
assertEquals(4, address1OldSeq.size());
}
use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.
the class SDOSequenceTestCS method testSequencesStillNullAfterIsSequencedSetToTrueOutOfSpec.
public void testSequencesStillNullAfterIsSequencedSetToTrueOutOfSpec() {
// create a dataObject with no sequence - the root
defineAndLoadRoot(false, false);
Sequence aSequence = root.getSequence();
DataObject po = (DataObject) root.get(PO_SEQUENCE_PATH);
// copy po
DataObject rootCopy = copyHelper.copy(root);
// verify we are using the same context
// assertEquals(helperContext, ((SDOCopyHelper)copyHelper).getHelperContext())
// check sequence was copied
SDOSequence aSequenceCopy = getSequence(rootCopy, PO_SEQUENCE_PATH, PO_SEQUENCE_SIZE);
assertNotNull(aSequenceCopy);
// compareSequences(aSequence, aSequenceCopy, PO_SEQUENCE_SIZE, true);
// test equalityHelper
DataObject poCopy = (DataObject) rootCopy.get(PO_SEQUENCE_PATH);
boolean bEqual = equalityHelper.equal(po, poCopy);
assertTrue(bEqual);
// modify copy sequence state - non public method - both po and poCopy will have their state changed because they share an SDOType
assertTrue(po.getType().isSequenced());
assertTrue(poCopy.getType().isSequenced());
// WARNING: Users should not be doing this - however it is supported
((SDOType) poCopy.getType()).setSequenced(false);
assertFalse(po.getType().isSequenced());
assertFalse(poCopy.getType().isSequenced());
bEqual = equalityHelper.equal(po, poCopy);
// sequences will not be compared
assertTrue(bEqual);
// turn on isSequenced - not available via spec interface - do not use
// copy
// check equality
}
use of commonj.sdo.Sequence in project eclipselink by eclipse-ee4j.
the class SDOSequenceTestCS method testEqualDeepTrueAfterIsSequencedSetToFalseAfterDefineViaNonSpecMethod.
/*
// variant test cases that should cause equality failure
testSequenceOnCopyHasDifferentOrder
testSequenceOnCopyIsEmpty
testSequenceOnCopyIsLarger
testSequenceOnCopyIsSmaller
testSequenceOnCopyHasDifferentPropertyAtIndex
testSequenceOnCopyHasDifferentValueAtIndex
testSequenceOnOriginalHasDifferentOrder
testSequenceOnOriginalIsEmpty
testSequenceOnOriginalIsLarger
testSequenceOnOriginalIsSmaller
testSequenceOnOriginalHasDifferentPropertyAtIndex
testSequenceOnOriginalHasDifferentValueAtIndex
*/
public void testEqualDeepTrueAfterIsSequencedSetToFalseAfterDefineViaNonSpecMethod() {
defineAndLoadRoot(false, false);
Sequence aSequence = getSequence(root, PO_SEQUENCE_PATH, PO_SEQUENCE_SIZE);
DataObject po = (DataObject) root.get(PO_SEQUENCE_PATH);
// copy po
DataObject rootCopy = copyHelper.copy(root);
// check sequence was copied
Sequence aSequenceCopy = getSequence(rootCopy, PO_SEQUENCE_PATH, PO_SEQUENCE_SIZE);
assertNotNull(aSequenceCopy);
// compareSequences((SDOSequence)aSequence, (SDOSequence)aSequenceCopy, PO_SEQUENCE_SIZE, true);
// test equalityHelper
DataObject poCopy = (DataObject) rootCopy.get(PO_SEQUENCE_PATH);
boolean bEqual = equalityHelper.equal(po, poCopy);
assertTrue(bEqual);
// modify copy sequence state - non public method - both po and poCopy will have their state changed because they share an SDOType
assertTrue(po.getType().isSequenced());
assertTrue(poCopy.getType().isSequenced());
// WARNING: Users should not be doing this - however it is supported
((SDOType) poCopy.getType()).setSequenced(false);
assertFalse(po.getType().isSequenced());
assertFalse(poCopy.getType().isSequenced());
bEqual = equalityHelper.equal(po, poCopy);
// sequences will not be compared
assertTrue(bEqual);
}
Aggregations