Search in sources :

Example 1 with PopulationManager

use of org.eclipse.persistence.tools.schemaframework.PopulationManager in project eclipselink by eclipse-ee4j.

the class CacheHitAndInMemoryTestSuite method addCacheTests.

public void addCacheTests() {
    /**
     * Cache hit tests
     */
    PopulationManager manager = PopulationManager.getDefaultManager();
    addTest(new CacheMissTest());
    addTest(new OneToOneCacheHitTest());
    addTest(new CacheHitTest(manager.getObject(org.eclipse.persistence.testing.models.employee.domain.Employee.class, "0001")));
    addTest(new CacheHitTest(manager.getObject(Shipment.class, "example1")));
    Order order = (Order) ((Shipment) org.eclipse.persistence.testing.models.legacy.Employee.example1().shipments.elementAt(0)).orders.elementAt(0);
    order.shipment.shipmentNumber = order.shipment.shipmentNumber.intValue();
    addTest(new CacheHitTest(order));
    org.eclipse.persistence.testing.models.legacy.Employee employee = (org.eclipse.persistence.testing.models.legacy.Employee) manager.getObject(org.eclipse.persistence.testing.models.legacy.Employee.class, "example1");
    addTest(new CacheHitTest(employee));
    Computer computer = employee.computer;
    addTest(new CacheHitTest(computer));
    addTest(new CacheHitWithInheritance());
    addTest(new CacheHitWithNonPKCriteriaTest());
    addTest(new CacheHitOnPKWithInheritanceTest());
    addTest(new QueryCacheHitDisabledAndDescriptorDisabledTest());
    addTest(new QueryCacheHitDisabledAndDescriptorEnabledTest());
    addTest(new QueryCacheHitEnabledAndDescriptorDisabledTest());
    addTest(new QueryCacheHitEnabledAndDescriptorEnabledTest());
    addTest(new QueryCacheHitUndefinedAndDescriptorDisabledTest());
    addTest(new QueryCacheHitUndefinedAndDescriptorEnabledTest());
}
Also used : Computer(org.eclipse.persistence.testing.models.legacy.Computer) Order(org.eclipse.persistence.testing.models.legacy.Order) Shipment(org.eclipse.persistence.testing.models.legacy.Shipment) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) org.eclipse.persistence.testing.models.employee.domain(org.eclipse.persistence.testing.models.employee.domain)

Example 2 with PopulationManager

use of org.eclipse.persistence.tools.schemaframework.PopulationManager in project eclipselink by eclipse-ee4j.

the class CacheHitAndInMemoryTestSuite method addInMemoryMissTests.

public void addInMemoryMissTests() {
    PopulationManager manager = PopulationManager.getDefaultManager();
    Employee example = (Employee) manager.getObject(org.eclipse.persistence.testing.models.employee.domain.Employee.class, "0001");
    ExpressionBuilder builder = new ExpressionBuilder();
    ReadObjectQuery query = new ReadObjectQuery(org.eclipse.persistence.testing.models.employee.domain.Employee.class, builder.get("id").equal(example.getId()).and(builder.get("firstName").equal(example.getFirstName())));
    query.checkCacheByExactPrimaryKey();
    InMemoryCacheMissTest test = new InMemoryCacheMissTest(query);
    test.setName("InMemoryCacheMissTest - by key exact");
    addTest(test);
    builder = new ExpressionBuilder();
    query = new ReadObjectQuery(Employee.class, builder.get("id").equal(example.getId()).and(builder.get("firstName").notEqual(example.getFirstName())));
    test = new InMemoryCacheMissTest(query);
    query.checkCacheByPrimaryKey();
    test.setName("InMemoryCacheMissTest - by non exact");
    addTest(test);
    builder = new ExpressionBuilder();
    query = new ReadObjectQuery(Employee.class, builder.get("id").equal(example.getId()).and(builder.get("firstName").like(example.getLastName())));
    test = new InMemoryCacheMissTest(query);
    query.checkCacheByPrimaryKey();
    test.setName("InMemoryCacheMissTest - by non exact - exception");
    addTest(test);
    builder = new ExpressionBuilder();
    query = new ReadObjectQuery(Employee.class, builder.get("id").equal(example.getId()).and(builder.get("firstName").like(example.getLastName())));
    test = new InMemoryCacheMissTest(query);
    query.checkCacheThenDatabase();
    test.setName("InMemoryCacheMissTest - by non exact - exception");
    addTest(test);
    builder = new ExpressionBuilder();
    query = new ReadObjectQuery(Employee.class, builder.get("firstName").equal(example.getLastName()).and(builder.get("lastName").equal(example.getFirstName())));
    test = new InMemoryCacheMissTest(query);
    test.setName("InMemoryCacheMissTest - name index");
    addTest(test);
    builder = new ExpressionBuilder();
    query = new ReadObjectQuery(Employee.class, builder.get("firstName").equal(example.getFirstName()).and(builder.get("lastName").equal(example.getLastName())).and(builder.get("salary").notEqual(example.getSalary())));
    test = new InMemoryCacheMissTest(query);
    test.setName("InMemoryCacheMissTest - name index");
    addTest(test);
}
Also used : PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) org.eclipse.persistence.testing.models.employee.domain(org.eclipse.persistence.testing.models.employee.domain)

Example 3 with PopulationManager

use of org.eclipse.persistence.tools.schemaframework.PopulationManager in project eclipselink by eclipse-ee4j.

the class EmployeeBasicTestModel method getSRGReadObjectTestSuite.

// SRG test set is maintained by QA only, do NOT add any new tests into it.
public static TestSuite getSRGReadObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("EmployeeReadObjectTestSuite");
    suite.setDescription("This suite test the reading of each object in the employee demo.");
    Class<Employee> employeeClass = org.eclipse.persistence.testing.models.employee.domain.Employee.class;
    Class<LargeProject> largeProjectClass = org.eclipse.persistence.testing.models.employee.domain.LargeProject.class;
    Class<SmallProject> smallProjectClass = org.eclipse.persistence.testing.models.employee.domain.SmallProject.class;
    PopulationManager manager = PopulationManager.getDefaultManager();
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0001")));
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0002")));
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0003")));
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0004")));
    suite.addTest(new ReadObjectTest(manager.getObject(employeeClass, "0005")));
    Employee employee = (Employee) manager.getObject(employeeClass, "0001");
    suite.addTest(new ReadObjectCallTest(employeeClass, new SQLCall("SELECT t0.VERSION, t1.EMP_ID, t0.L_NAME, t0.F_NAME, t1.SALARY, t0.EMP_ID, t0.GENDER, t0.END_DATE, t0.START_DATE, t0.MANAGER_ID, t0.END_TIME, t0.START_TIME, t0.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE t1.EMP_ID = t0.EMP_ID AND t0.F_NAME = '" + employee.getFirstName() + "' AND t0.L_NAME = '" + employee.getLastName() + "'")));
    employee = (Employee) manager.getObject(employeeClass, "0002");
    suite.addTest(new ReadObjectCallTest(employeeClass, new SQLCall("SELECT  t0.VERSION, t1.EMP_ID, t0.L_NAME, t0.F_NAME, t1.SALARY, t0.EMP_ID, t0.GENDER, t0.END_DATE, t0.START_DATE, t0.MANAGER_ID, t0.END_TIME, t0.START_TIME, t0.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE t1.EMP_ID = t0.EMP_ID AND t0.F_NAME = '" + employee.getFirstName() + "' AND t0.L_NAME = '" + employee.getLastName() + "'")));
    employee = (Employee) manager.getObject(employeeClass, "0003");
    suite.addTest(new ReadObjectCallTest(employeeClass, new SQLCall("SELECT  t0.VERSION, t1.EMP_ID, t0.L_NAME, t0.F_NAME, t1.SALARY, t0.EMP_ID, t0.GENDER, t0.END_DATE, t0.START_DATE, t0.MANAGER_ID, t0.END_TIME, t0.START_TIME, t0.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE t1.EMP_ID = t0.EMP_ID AND t0.F_NAME = '" + employee.getFirstName() + "' AND t0.L_NAME = '" + employee.getLastName() + "'")));
    org.eclipse.persistence.testing.models.employee.domain.Project project = (org.eclipse.persistence.testing.models.employee.domain.Project) manager.getObject(largeProjectClass, "0001");
    ReadObjectTest test = new ReadObjectTest(project);
    test.setQuery(new org.eclipse.persistence.queries.ReadObjectQuery(org.eclipse.persistence.testing.models.employee.domain.Project.class, new org.eclipse.persistence.expressions.ExpressionBuilder().get("id").equal(project.getId())));
    suite.addTest(test);
    suite.addTest(new ReadObjectTest(manager.getObject(smallProjectClass, "0001")));
    suite.addTest(new ReadObjectTest(manager.getObject(smallProjectClass, "0002")));
    suite.addTest(new ReadObjectTest(manager.getObject(smallProjectClass, "0003")));
    suite.addTest(new ReadObjectTest(manager.getObject(largeProjectClass, "0001")));
    suite.addTest(new ReadObjectTest(manager.getObject(largeProjectClass, "0002")));
    suite.addTest(new ReadObjectTest(manager.getObject(largeProjectClass, "0003")));
    return suite;
}
Also used : SQLCall(org.eclipse.persistence.queries.SQLCall) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) org.eclipse.persistence.testing.models.employee.domain(org.eclipse.persistence.testing.models.employee.domain)

Example 4 with PopulationManager

use of org.eclipse.persistence.tools.schemaframework.PopulationManager in project eclipselink by eclipse-ee4j.

the class MappingTestModel method getDeleteObjectTestSuite.

public static TestSuite getDeleteObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("MappingDeleteObjectTestSuite");
    suite.setDescription("This suite tests the deletion of each object in the mapping model.");
    PopulationManager manager = PopulationManager.getDefaultManager();
    suite.addTest(new DeleteObjectTest(manager.getObject(Employee.class, "example1")));
    suite.addTest(new DeleteObjectTest(manager.getObject(Employee.class, "example2")));
    suite.addTest(new DeleteObjectTest(manager.getObject(Employee.class, "example3")));
    suite.addTest(new DeleteObjectTest(manager.getObject(Computer.class, "example2")));
    suite.addTest(new DeleteObjectTest(manager.getObject(Shipment.class, "example2")));
    suite.addTest(new MTMPrivateOwnedWithValueholderDeleteObjectTest());
    suite.addTest(new DirectCollectionMappingDeleteNullValueTest());
    return suite;
}
Also used : TestSuite(org.eclipse.persistence.testing.framework.TestSuite) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) DeleteObjectTest(org.eclipse.persistence.testing.framework.DeleteObjectTest)

Example 5 with PopulationManager

use of org.eclipse.persistence.tools.schemaframework.PopulationManager in project eclipselink by eclipse-ee4j.

the class MappingTestModel method getUnitOfWorkCommitResumeTestSuite.

public static TestSuite getUnitOfWorkCommitResumeTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("UnitOfWorkCommitResumeTestSuite");
    suite.setDescription("This suite tests the unit of work commitResume feature within the mapping model.");
    PopulationManager manager = PopulationManager.getDefaultManager();
    suite.addTest(new UnitOfWorkCommitResumeTest(manager.getObject(Employee.class, "example2")));
    return suite;
}
Also used : TestSuite(org.eclipse.persistence.testing.framework.TestSuite) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager)

Aggregations

PopulationManager (org.eclipse.persistence.tools.schemaframework.PopulationManager)89 TestSuite (org.eclipse.persistence.testing.framework.TestSuite)37 Employee (org.eclipse.persistence.testing.models.employee.domain.Employee)16 LargeProject (org.eclipse.persistence.testing.models.employee.domain.LargeProject)11 SmallProject (org.eclipse.persistence.testing.models.employee.domain.SmallProject)11 ReadObjectTest (org.eclipse.persistence.testing.framework.ReadObjectTest)10 WriteObjectTest (org.eclipse.persistence.testing.framework.WriteObjectTest)8 Client (org.eclipse.persistence.testing.models.aggregate.Client)6 Employee (org.eclipse.persistence.testing.models.aggregate.Employee)6 SQLCall (org.eclipse.persistence.queries.SQLCall)5 Agent (org.eclipse.persistence.testing.models.aggregate.Agent)5 Builder (org.eclipse.persistence.testing.models.aggregate.Builder)5 EvaluationClient (org.eclipse.persistence.testing.models.aggregate.EvaluationClient)5 ComplexUpdateTest (org.eclipse.persistence.testing.tests.writing.ComplexUpdateTest)5 UpdateChangeNothingTest (org.eclipse.persistence.testing.tests.writing.UpdateChangeNothingTest)5 UpdateChangeObjectTest (org.eclipse.persistence.testing.tests.writing.UpdateChangeObjectTest)5 UpdateChangeValueTest (org.eclipse.persistence.testing.tests.writing.UpdateChangeValueTest)5 UpdateToNullTest (org.eclipse.persistence.testing.tests.writing.UpdateToNullTest)5 org.eclipse.persistence.testing.models.employee.domain (org.eclipse.persistence.testing.models.employee.domain)4 EmployeeDeleteTest (org.eclipse.persistence.testing.tests.employee.EmployeeDeleteTest)4