Search in sources :

Example 6 with Employee

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());
}
Also used : Employee(org.eclipse.persistence.testing.models.aggregate.Employee) Language(org.eclipse.persistence.testing.models.aggregate.Language) AddressDescription(org.eclipse.persistence.testing.models.aggregate.AddressDescription) Responsibility(org.eclipse.persistence.testing.models.aggregate.Responsibility) ProjectDescription(org.eclipse.persistence.testing.models.aggregate.ProjectDescription)

Example 7 with Employee

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++;
}
Also used : Employee(org.eclipse.persistence.testing.models.aggregate.Employee) Language(org.eclipse.persistence.testing.models.aggregate.Language) AddressDescription(org.eclipse.persistence.testing.models.aggregate.AddressDescription) Responsibility(org.eclipse.persistence.testing.models.aggregate.Responsibility) ProjectDescription(org.eclipse.persistence.testing.models.aggregate.ProjectDescription)

Example 8 with Employee

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;
}
Also used : Employee(org.eclipse.persistence.testing.models.aggregate.Employee) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) Client(org.eclipse.persistence.testing.models.aggregate.Client) EvaluationClient(org.eclipse.persistence.testing.models.aggregate.EvaluationClient)

Example 9 with Employee

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;
}
Also used : Agent(org.eclipse.persistence.testing.models.aggregate.Agent) Employee(org.eclipse.persistence.testing.models.aggregate.Employee) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) Builder(org.eclipse.persistence.testing.models.aggregate.Builder)

Example 10 with Employee

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;
}
Also used : Employee(org.eclipse.persistence.testing.models.aggregate.Employee) UnitOfWorkBasicUpdateObjectTest(org.eclipse.persistence.testing.framework.UnitOfWorkBasicUpdateObjectTest) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) WriteObjectTest(org.eclipse.persistence.testing.framework.WriteObjectTest) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) EvaluationClient(org.eclipse.persistence.testing.models.aggregate.EvaluationClient) Client(org.eclipse.persistence.testing.models.aggregate.Client) EvaluationClient(org.eclipse.persistence.testing.models.aggregate.EvaluationClient) Employee1(org.eclipse.persistence.testing.models.aggregate.Employee1)

Aggregations

Employee (org.eclipse.persistence.testing.models.aggregate.Employee)11 TestSuite (org.eclipse.persistence.testing.framework.TestSuite)6 PopulationManager (org.eclipse.persistence.tools.schemaframework.PopulationManager)6 Client (org.eclipse.persistence.testing.models.aggregate.Client)5 EvaluationClient (org.eclipse.persistence.testing.models.aggregate.EvaluationClient)5 AddressDescription (org.eclipse.persistence.testing.models.aggregate.AddressDescription)4 Language (org.eclipse.persistence.testing.models.aggregate.Language)4 ProjectDescription (org.eclipse.persistence.testing.models.aggregate.ProjectDescription)4 Agent (org.eclipse.persistence.testing.models.aggregate.Agent)3 Builder (org.eclipse.persistence.testing.models.aggregate.Builder)3 Responsibility (org.eclipse.persistence.testing.models.aggregate.Responsibility)3 Employee1 (org.eclipse.persistence.testing.models.aggregate.Employee1)2 Vector (java.util.Vector)1 DescriptorEvent (org.eclipse.persistence.descriptors.DescriptorEvent)1 DeleteObjectTest (org.eclipse.persistence.testing.framework.DeleteObjectTest)1 ReadObjectTest (org.eclipse.persistence.testing.framework.ReadObjectTest)1 UnitOfWorkBasicUpdateObjectTest (org.eclipse.persistence.testing.framework.UnitOfWorkBasicUpdateObjectTest)1 WriteObjectTest (org.eclipse.persistence.testing.framework.WriteObjectTest)1 AggregateEventListener (org.eclipse.persistence.testing.models.aggregate.AggregateEventListener)1 Computer (org.eclipse.persistence.testing.models.aggregate.Computer)1