protected void setup() { super.setup(); for (int i = 0; i < managedEmployeesToAdd.size(); i++) { Employee readEmployeeToAdd = (Employee) readObject(managedEmployeesToAdd.get(i)); if (readEmployeeToAdd != null) { managedEmployeesToAdd.set(i, readEmployeeToAdd); } else { // it's a new object } } for (int i = 0; i < managedEmployeesToRemove.size(); i++) { Employee readEmployeeToRemove = (Employee) readObject(managedEmployeesToRemove.get(i)); if (readEmployeeToRemove != null) { managedEmployeesToRemove.set(i, readEmployeeToRemove); } else { throw new TestWarningException( "Employee to be removed: " + managedEmployeesToRemove.get(i) + " is not in the db"); } } for (int i = 0; i < phonesToRemove.size(); i++) { PhoneNumber readPhoneToRemove = (PhoneNumber) readObject(phonesToRemove.get(i)); if (readPhoneToRemove != null) { phonesToRemove.set(i, readPhoneToRemove); } else { throw new TestWarningException( "Phone to be removed: " + phonesToRemove.get(i) + " is not in the db"); } } for (int i = 0; i < phonesToAdd.size(); i++) { PhoneNumber readPhoneToAdd = (PhoneNumber) readObject(phonesToAdd.get(i)); if (readPhoneToAdd != null) { phonesToAdd.set(i, readPhoneToAdd); } else { // it's a new object } } }
public void addSRGTests() { PopulationManager manager = PopulationManager.getDefaultManager(); Employee employee = (Employee) manager.getObject(Employee.class, "0001"); // Tests with using unit of work. ComplexUpdateTest test = new UpdateToNullTest(employee); test.usesUnitOfWork = true; addTest(test); test = new UpdateChangeValueTest(employee); test.usesUnitOfWork = true; addTest(test); test = new UpdateChangeNothingTest(employee); test.usesUnitOfWork = true; addTest(test); test = new UpdateChangeObjectTest(employee); test.usesUnitOfWork = true; addTest(test); test = new UpdateDeepOwnershipTest((ObjectA) manager.getObject(ObjectA.class, "example1")); test.usesUnitOfWork = true; addTest(test); addTest(new BidirectionalInsertTest(true)); addTest(new NestedUnitOfWorkTest(employee)); addTest(new NestedUnitOfWorkMultipleCommitTest(employee)); addTest(new DeepNestedUnitOfWorkTest(employee)); addTest(new MultipleUnitOfWorkTest(employee)); addTest(new InsertNewObjectTest()); addTest(new ComplexMultipleUnitOfWorkTest()); addTest(new FaultyUnitOfWorkTest()); addTest(new LockFailureUnitOfWorkTest()); addTest(new UnitOfWorkResumeTest(employee)); addTest(new UnitOfWorkResumeOnFailureTest(employee)); addTest(new DeletingFromParentSessionTest()); addTest(new org.eclipse.persistence.testing.tests.mapping.EqualObjectUnitOfWorkTest()); addTest(new NoIMWithValueHolderTest()); addTest(new UnitOfWorkRevertTest(employee)); addTest(new DeepMergeCloneSerializedTest()); addTest(new DeepMergeCloneIndirectionTest()); addTest(new RegisterNewObjectTest()); addTest(new NoIdentityMapUnitOfWorkTest()); addTest(new RefreshObjectNoIdentityMapUnitOfWorkTest()); addTest(new RelationshipTreeInsertTest()); addTest(new UnitOfWorkComplexRefreshTest()); addTest(new ViolateObjectSpaceTest()); // code coverage addTest(new NoValidationWithInitIdentityMaps()); addTest(new NoIdentityTest()); addTest(new NoIdentityMergeCloneTest()); addTest(new org.eclipse.persistence.testing.tests.mapping.BiDirectionInsertOrderTest()); addTest(new UnitOfWorkCommitResumeOnFailureNoFailureTest(employee)); addTest(new UnitOfWorkCommitAndResume(employee)); addTest(new NestedUnitOfWorkQuery()); addTest(new DeleteAndConform()); addTest(new NullAggregateTest()); addTest(new UOWHasOnlyDeletesTest()); // CR 2728 addTest(new RegisterNewObjectInIdentityMapNoSeqTest(IdValidation.NULL, false, false)); addTest(new RegisterNewObjectInIdentityMapNoSeqTest(IdValidation.ZERO, false, false)); addTest(new RegisterNewObjectInIdentityMapNoSeqTest(IdValidation.NEGATIVE, false, false)); addTest(new RegisterNewObjectInIdentityMapNoSeqTest(IdValidation.NULL, true, false)); addTest(new RegisterNewObjectInIdentityMapNoSeqTest(IdValidation.ZERO, true, false)); addTest(new RegisterNewObjectInIdentityMapNoSeqTest(IdValidation.NEGATIVE, true, false)); addTest(new RegisterNewObjectInIdentityMapNoSeqTest(IdValidation.NULL, true, true)); addTest(new RegisterNewObjectInIdentityMapNoSeqTest(IdValidation.ZERO, true, true)); addTest(new RegisterNewObjectInIdentityMapNoSeqTest(IdValidation.NEGATIVE, true, true)); // CR 2783 addTest(new NestedUnitOfWorkDeleteNewObjectTest()); // bug 3115160 addTest(new NestedUnitOfWorkDeleteNestedNewObjectTest()); // bug 3132979 addTest(new NestedUnitOfWorkDeleteConformedNestedNewObjectTest()); addTest(new DoubleNestedUnitOfWorkDeleteConformedNestedNewObjectTest()); // bug 3228185 addTest(new NestedUnitOfWorkNewObjectWithIndirectionTest()); // CR#3216 addTest(new UnitOfWorkDeleteNoValidationTest()); // CR 4094 addTest(new GetIdentityMapFromUOWForREADONLYClassTest()); // code coverage testing addTest(new UnitOfWorkCommitToDatabaseTest()); addTest(new UnitOfWorkInitializeAllIdentityMapsTest()); // CR#4204 addTest(new WasTransactionBegunPrematurelyRollbackTest()); // code coverage addTest(new CanChangeReadOnlySetTest()); // code coverage addTest(new GetFromNewObjectWithConformTest()); addTest(new UOWCommitAndResumeWithPreCalcChangeSet(employee)); addTest(new PerformDeletesFirstTest()); // bug 3815959 addTest(new PerformDeletesFirstIgnoreUpdateTest()); addTest(new PerformDeletesFirstIgnoreUpdateTest2()); // bug 2612331 addTest(new CreateDeleteCreateTest()); // bug 2612602 addTest(new WorkingCloneCopyPolicyTest()); addTest(new UnregisteredNewObjectOptimisticLockTest()); // bug 3510459 addTest(new DoubleNestedUnitOfWorkRegisterNewObjectTest()); // bug 3287196 addTest(new GetObjectFromIdentityMapTest()); addTest(new MergeDeadIndirectionTest()); // Add new tests here, if any. addTest(new CommitAfterExecuteModifyQueryDuringTransTest()); // bug 4364283 addTest(new AllChangeSetsTest()); // bug 5744009 addTest(new CurrentChangeSetTest()); // bug 4453001 addTest(new ErrorOnInsertTest()); addTest(new CollectionMappingMergeObjectTest()); addTest(new ExceptionsRaisedUnitOfWorkTest()); // bug 4736360 addTest(new NestedUOWWithNewObjectRegisteredTwiceTest()); }