Search in sources :

Example 11 with EmployeePopulator

use of org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator in project eclipselink by eclipse-ee4j.

the class SessionsXMLBasicTestModel method getInsertObjectTestSuite.

public static TestSuite getInsertObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("EmployeeInsertObjectTestSuite");
    suite.setDescription("This suite tests the insertion of each object in the employee demo.");
    EmployeePopulator system = new EmployeePopulator();
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample1()));
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample2()));
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample3()));
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample4()));
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample5()));
    suite.addTest(new InsertObjectTest(system.basicSmallProjectExample1()));
    suite.addTest(new InsertObjectTest(system.basicSmallProjectExample2()));
    suite.addTest(new InsertObjectTest(system.basicSmallProjectExample3()));
    suite.addTest(new InsertObjectTest(system.basicLargeProjectExample1()));
    suite.addTest(new InsertObjectTest(system.basicLargeProjectExample2()));
    suite.addTest(new InsertObjectTest(system.basicLargeProjectExample3()));
    return suite;
}
Also used : InsertObjectTest(org.eclipse.persistence.testing.framework.InsertObjectTest) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) EmployeePopulator(org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator)

Example 12 with EmployeePopulator

use of org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator in project eclipselink by eclipse-ee4j.

the class SessionsXMLBasicTestModel method getSRGInsertObjectTestSuite.

// SRG test set is maintained by QA only, do NOT add any new tests into it.
public static TestSuite getSRGInsertObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("EmployeeInsertObjectTestSuite");
    suite.setDescription("This suite tests the insertion of each object in the employee demo.");
    EmployeePopulator system = new EmployeePopulator();
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample1()));
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample2()));
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample3()));
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample4()));
    suite.addTest(new InsertObjectTest(system.basicEmployeeExample5()));
    suite.addTest(new InsertObjectTest(system.basicSmallProjectExample1()));
    suite.addTest(new InsertObjectTest(system.basicSmallProjectExample2()));
    suite.addTest(new InsertObjectTest(system.basicSmallProjectExample3()));
    suite.addTest(new InsertObjectTest(system.basicLargeProjectExample1()));
    suite.addTest(new InsertObjectTest(system.basicLargeProjectExample2()));
    suite.addTest(new InsertObjectTest(system.basicLargeProjectExample3()));
    return suite;
}
Also used : InsertObjectTest(org.eclipse.persistence.testing.framework.InsertObjectTest) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) EmployeePopulator(org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator)

Example 13 with EmployeePopulator

use of org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator in project eclipselink by eclipse-ee4j.

the class CloseConnAfterDatabaseSessionTxnTest method test.

@Override
public void test() {
    EmployeePopulator system = new EmployeePopulator();
    Object employee = system.basicEmployeeExample1();
    session.insertObject(employee);
    session.deleteObject(employee);
}
Also used : EmployeePopulator(org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator)

Example 14 with EmployeePopulator

use of org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator in project eclipselink by eclipse-ee4j.

the class NestedUnitOfWorkTest method changeNestedUnitOfWorkWorkingCopy.

protected void changeNestedUnitOfWorkWorkingCopy() {
    Employee employee = (Employee) this.nestedUnitOfWorkWorkingCopy;
    // Transformation
    employee.setNormalHours(new java.sql.Time[3]);
    employee.setStartTime(Helper.timeFromHourMinuteSecond(2, 2, 2));
    employee.setEndTime(Helper.timeFromHourMinuteSecond(2, 2, 2));
    // Aggregate
    employee.setPeriod(new EmploymentPeriod(Helper.dateFromYearMonthDate(1903, 3, 3), Helper.dateFromYearMonthDate(1904, 4, 4)));
    // One to many private
    employee.setPhoneNumbers(new Vector());
    employee.addPhoneNumber(new PhoneNumber("cell", "514", "2263374"));
    employee.addPhoneNumber(new PhoneNumber("shop", "509", "8224599"));
    employee.addPhoneNumber(new PhoneNumber("fax", "509", "8224798"));
    // Many to many
    employee.setProjects(new Vector());
    employee.addProject((Project) this.nestedUnitOfWork.readObject(SmallProject.class));
    // Test adding new objects.
    employee.addProject(new SmallProject());
    employee.addProject(new SmallProject());
    // Direct collection
    employee.setResponsibilitiesList(new Vector());
    employee.addResponsibility("does not make cofffee");
    employee.addResponsibility("does not buy donuts");
    // One to one private/public
    employee.setAddress((new EmployeePopulator()).addressExample1());
}
Also used : EmploymentPeriod(org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod) SmallProject(org.eclipse.persistence.testing.models.employee.domain.SmallProject) Employee(org.eclipse.persistence.testing.models.employee.domain.Employee) EmployeePopulator(org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator) PhoneNumber(org.eclipse.persistence.testing.models.employee.domain.PhoneNumber) Vector(java.util.Vector)

Example 15 with EmployeePopulator

use of org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator in project eclipselink by eclipse-ee4j.

the class NestedUnitOfWorkDeleteNewObjectTest method test.

@Override
public void test() {
    UnitOfWork uow = getSession().acquireUnitOfWork();
    UnitOfWork nestedUow1 = uow.acquireUnitOfWork();
    Employee original = (Employee) new EmployeePopulator().basicEmployeeExample1();
    Employee employee = (Employee) nestedUow1.registerObject(original);
    nestedUow1.commit();
    UnitOfWork nestedUOW2 = uow.acquireUnitOfWork();
    nestedUOW2.deleteObject(nestedUOW2.registerObject(original));
    nestedUOW2.commit();
    uow.commit();
    if (((UnitOfWorkImpl) uow).getNewObjectsCloneToOriginal().containsKey(original)) {
        throw new TestErrorException("Failed to move the deleted new object into the parent UOW");
    }
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) Employee(org.eclipse.persistence.testing.models.employee.domain.Employee) EmployeePopulator(org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator) TestErrorException(org.eclipse.persistence.testing.framework.TestErrorException)

Aggregations

EmployeePopulator (org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator)15 Employee (org.eclipse.persistence.testing.models.employee.domain.Employee)11 TestErrorException (org.eclipse.persistence.testing.framework.TestErrorException)7 UnitOfWork (org.eclipse.persistence.sessions.UnitOfWork)6 UnitOfWorkImpl (org.eclipse.persistence.internal.sessions.UnitOfWorkImpl)4 BigDecimal (java.math.BigDecimal)3 Vector (java.util.Vector)3 InsertObjectTest (org.eclipse.persistence.testing.framework.InsertObjectTest)3 TestSuite (org.eclipse.persistence.testing.framework.TestSuite)3 ReadObjectQuery (org.eclipse.persistence.queries.ReadObjectQuery)2 EmploymentPeriod (org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod)2 PhoneNumber (org.eclipse.persistence.testing.models.employee.domain.PhoneNumber)2 OptimisticLockException (org.eclipse.persistence.exceptions.OptimisticLockException)1 ReadAllQuery (org.eclipse.persistence.queries.ReadAllQuery)1 TestWarningException (org.eclipse.persistence.testing.framework.TestWarningException)1 Address (org.eclipse.persistence.testing.models.employee.domain.Address)1 SmallProject (org.eclipse.persistence.testing.models.employee.domain.SmallProject)1