use of org.eclipse.persistence.testing.models.aggregate.Employee in project eclipselink by eclipse-ee4j.
the class UnitOfWorkTest method changeUnitOfWorkWorkingCopy.
protected void changeUnitOfWorkWorkingCopy() {
Employee employee = (Employee) this.unitOfWorkWorkingCopy;
AddressDescription addressDescription = employee.getAddressDescription();
ProjectDescription projectDescription = employee.getProjectDescription();
Responsibility responsibility = Responsibility.example6(employee);
Vector responsibilities;
Vector languages;
Language language;
// Root object changed
employee.setFirstName("ChangedFirstName");
employee.setLastName("ChangedLastName");
// First lever aggregate object changed
projectDescription.setDescription("ProjectDescription's Description changed");
// Third level aggregate object changed
addressDescription.getPeriodDescription().getPeriod().setEndDate(Helper.dateFromYearMonthDate(1995, 2, 1));
// 1 to 1 mapped object changed
projectDescription.getComputer().setValue(null);
// 1 level aggregate's 1:M mapping, removing an element
responsibility.setResponsibility("Changed Reponsibility");
responsibilities = (Vector) projectDescription.getResponsibilities().getValue();
responsibilities.removeElement(responsibilities.firstElement());
// 1 level aggregate's 1:M mapping, adding a new element
responsibilities.addElement(responsibility);
// 1 level aggregate's M:M mapping, removing an element
languages = (Vector) projectDescription.getLanguages().getValue();
languages.removeElement(languages.firstElement());
// 1 level aggregate's M:M mapping, modifying an element
language = (Language) languages.firstElement();
language.setLanguage("ModifiedLanguage");
// 1 level aggregate's M:M mapping, adding a new element
languages.addElement(Language.example7());
}
use of org.eclipse.persistence.testing.models.aggregate.Employee in project eclipselink by eclipse-ee4j.
the class UnitOfWorkCommitResumeTest method changeUnitOfWorkWorkingCopy.
/**
* Change the working copy of the object. Add a suffix to the changes.
* Make sure the suffix is so long that it will be longer that the size of
* the field in the database.
*/
protected void changeUnitOfWorkWorkingCopy() {
Employee employee = (Employee) this.unitOfWorkWorkingCopy;
AddressDescription addressDescription = employee.getAddressDescription();
ProjectDescription projectDescription = employee.getProjectDescription();
Responsibility responsibility = Responsibility.example6(employee);
Vector responsibilities;
Vector languages;
Language language;
String suffix = (Integer.valueOf(changeVersion)).toString();
// Root object changed
employee.setFirstName("First " + suffix);
employee.setLastName("Last " + suffix);
// First level aggregate object changed
projectDescription.setDescription("ProjectDescription's Description changed" + suffix);
// Third level aggregate object changed
addressDescription.getPeriodDescription().getPeriod().setEndDate(Helper.dateFromYearMonthDate(1900 + ((changeVersion + 1975) % 2500), (changeVersion % 12) + 1, (changeVersion % 28) + 1));
addressDescription.getAddress().getValue().setAddress(suffix + " Any Street");
// 1 to 1 mapped object changed
projectDescription.getComputer().getValue().setDescription("Vic 20");
// 1 level aggregate's 1:M mapping, removing an element
responsibility.setResponsibility("Changed Reponsibility" + suffix);
responsibilities = (Vector) projectDescription.getResponsibilities().getValue();
responsibilities.removeElement(responsibilities.firstElement());
// 1 level aggregate's 1:M mapping, adding a new element
responsibilities.addElement(responsibility);
// 1 level aggregate's M:M mapping, removing an element
languages = (Vector) projectDescription.getLanguages().getValue();
languages.removeElement(languages.firstElement());
// 1 level aggregate's M:M mapping, modifying an element
language = (Language) languages.firstElement();
language.setLanguage("ModifiedLanguage" + suffix);
// 1 level aggregate's M:M mapping, adding a new element
languages.addElement(Language.example7());
// Update the change version.
changeVersion++;
}
use of org.eclipse.persistence.testing.models.aggregate.Employee in project eclipselink by eclipse-ee4j.
the class AggregateTestModel method getSRGCheckForNullUnitOfWorkTestSuite.
// SRG test set is maintained by QA only, do NOT add any new tests into it.
public static TestSuite getSRGCheckForNullUnitOfWorkTestSuite() {
TestSuite suite = new TestSuite();
suite.setName("AggregateCheckForNullUnitOfWorkTestSuite");
suite.setDescription("This suite tests updating objects with UOW in the aggregate model.");
Class<Employee> employeeClass = Employee.class;
Class<Client> clientClass = Client.class;
PopulationManager manager = PopulationManager.getDefaultManager();
suite.addTest(new CheckForNullUnitOfWorkTest(manager.getObject(employeeClass, "example1")));
suite.addTest(new CheckForNullUnitOfWorkTest(manager.getObject(employeeClass, "example2")));
suite.addTest(new CheckForNullUnitOfWorkTest(manager.getObject(employeeClass, "example3")));
return suite;
}
use of org.eclipse.persistence.testing.models.aggregate.Employee in project eclipselink by eclipse-ee4j.
the class AggregateTestModel method getSRGUnitOfWorkCommitResumeTestSuite.
// SRG test set is maintained by QA only, do NOT add any new tests into it.
public static TestSuite getSRGUnitOfWorkCommitResumeTestSuite() {
TestSuite suite = new TestSuite();
suite.setName("AggregateUnitOfWorkCommitResumeTestSuite");
suite.setDescription("This suite tests updating objects with UOW in the aggregate model using the commitAndResume method.");
Class<Employee> employeeClass = Employee.class;
PopulationManager manager = PopulationManager.getDefaultManager();
suite.addTest(new BatchReadingWithAggregateCollectionMapping(Agent.class));
if (useNewAggregateCollection) {
suite.addTest(new BatchReadingWithAggregateCollectionMapping(Builder.class));
}
suite.addTest(new UnitOfWorkCommitResumeTest(manager.getObject(employeeClass, "example1")));
suite.addTest(new UnitOfWorkCommitResumeTest(manager.getObject(employeeClass, "example2")));
suite.addTest(new UnitOfWorkCommitResumeTest(manager.getObject(employeeClass, "example3")));
return suite;
}
use of org.eclipse.persistence.testing.models.aggregate.Employee in project eclipselink by eclipse-ee4j.
the class AggregateTestModel method getSRGUpdateObjectTestSuite.
// SRG test set is maintained by QA only, do NOT add any new tests into it.
public static TestSuite getSRGUpdateObjectTestSuite() {
TestSuite suite = new TestSuite();
suite.setName("AggregateUpdateObjectTestSuite");
suite.setDescription("This suite tests the updating of each object in the aggregate model.");
Class<Employee1> employee1Class = Employee1.class;
Class<Employee> employeeClass = Employee.class;
Class<Client> clientClass = Client.class;
Class<EvaluationClient> evaluationClientClass = EvaluationClient.class;
PopulationManager manager = PopulationManager.getDefaultManager();
// =================================================================================
suite.addTest(new WriteObjectTest(manager.getObject(employee1Class, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employee1Class, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employee1Class, "example2")));
// =================================================================================
suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employeeClass, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employeeClass, "example2")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employeeClass, "example3")));
suite.addTest(new WriteObjectTest(manager.getObject(clientClass, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(clientClass, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(clientClass, "example2")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(clientClass, "example3")));
suite.addTest(new WriteObjectTest(manager.getObject(evaluationClientClass, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(evaluationClientClass, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(evaluationClientClass, "example2")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(evaluationClientClass, "example3")));
// update testing on aggregate collection mapping
suite.addTest(new WriteObjectTest(manager.getObject(Agent.class, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(Agent.class, "example1")));
if (useNewAggregateCollection) {
suite.addTest(new WriteObjectTest(manager.getObject(Builder.class, "example1")));
suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(Builder.class, "example1")));
}
return suite;
}
Aggregations