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());
}
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);
}
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;
}
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;
}
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;
}
Aggregations