public static ReadObjectTest getReadInterfaceObjectTest() { TestSuite suite = new TestSuite(); PopulationManager manager = PopulationManager.getDefaultManager(); Contact contact = ((Employee) manager.getObject(Employee.class, "example1")).getContact(); ExpressionBuilder builder = new ExpressionBuilder(); Expression expression = builder.get("id").equal(contact.getEmp().getId()); ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(ContactHolder.class); query.setSelectionCriteria(expression); ReadObjectTest test = new ReadObjectTest(contact.getEmp()); test.setQuery(query); return test; }
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 employeeClass = Employee.class; Class largeProjectClass = LargeProject.class; Class smallProjectClass = 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"))); Project project = (Project) manager.getObject(largeProjectClass, "0001"); ReadObjectTest test = new ReadObjectTest(project); test.setQuery( new org.eclipse.persistence.queries.ReadObjectQuery( 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; }
public static TestSuite getReadObjectTestSuite() { TestSuite suite = new TestSuite(); suite.setName("EmployeeReadObjectTestSuite"); suite.setDescription( "[NLS_Japanese] This suite test the reading of each object in the employee demo."); Class employeeClass = NLSEmployee.class; Class largeProjectClass = LargeProject.class; Class smallProjectClass = 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"))); NLSEmployee employee = (NLSEmployee) manager.getObject(employeeClass, "0001"); suite.addTest( new ReadObjectCallTest( employeeClass, new SQLCall( "SELECT t0.\u306b\u304a\u3064\u3066\u3051\u305d\u305b, t1.\u304a\u3059\u305f_\u3051\u3048, t0.\u3057_\u305b\u3042\u3059\u304a, t0.\u304b_\u305b\u3042\u3059\u304a, t1.\u3066\u3042\u3057\u3042\u3064\u306e, t0.\u304a\u3059\u305f_\u3051\u3048, t0.\u304d\u304a\u305b\u3048\u304a\u3064, t0.\u304a\u305b\u3048_\u3048\u3042\u3068\u304a, t0.\u3066\u3068\u3042\u3064\u3068_\u3048\u3042\u3068\u304a, t0.\u3059\u3042\u305b\u3042\u304d\u304a\u3064_\u3051\u3048, t0.\u304a\u305b\u3048_\u3068\u3051\u3059\u304a, t0.\u3066\u3068\u3042\u3064\u3068_\u3068\u3051\u3059\u304a, t0.\u3042\u3048\u3048\u3064_\u3051\u3048 FROM \u304a\u3059\u305f t0, \u3066\u3042\u3057\u3042\u3064\u306e t1 WHERE t1.\u304a\u3059\u305f_\u3051\u3048 = t0.\u304a\u3059\u305f_\u3051\u3048 AND t0.\u304b_\u305b\u3042\u3059\u304a = '" + employee.getFirstName() + "' AND t0.\u3057_\u305b\u3042\u3059\u304a = '" + employee.getLastName() + "'"))); employee = (NLSEmployee) manager.getObject(employeeClass, "0002"); suite.addTest( new ReadObjectCallTest( employeeClass, new SQLCall( "SELECT t0.\u306b\u304a\u3064\u3066\u3051\u305d\u305b, t1.\u304a\u3059\u305f_\u3051\u3048, t0.\u3057_\u305b\u3042\u3059\u304a, t0.\u304b_\u305b\u3042\u3059\u304a, t1.\u3066\u3042\u3057\u3042\u3064\u306e, t0.\u304a\u3059\u305f_\u3051\u3048, t0.\u304d\u304a\u305b\u3048\u304a\u3064, t0.\u304a\u305b\u3048_\u3048\u3042\u3068\u304a, t0.\u3066\u3068\u3042\u3064\u3068_\u3048\u3042\u3068\u304a, t0.\u3059\u3042\u305b\u3042\u304d\u304a\u3064_\u3051\u3048, t0.\u304a\u305b\u3048_\u3068\u3051\u3059\u304a, t0.\u3066\u3068\u3042\u3064\u3068_\u3068\u3051\u3059\u304a, t0.\u3042\u3048\u3048\u3064_\u3051\u3048 FROM \u304a\u3059\u305f t0, \u3066\u3042\u3057\u3042\u3064\u306e t1 WHERE t1.\u304a\u3059\u305f_\u3051\u3048 = t0.\u304a\u3059\u305f_\u3051\u3048 AND t0.\u304b_\u305b\u3042\u3059\u304a = '" + employee.getFirstName() + "' AND t0.\u3057_\u305b\u3042\u3059\u304a = '" + employee.getLastName() + "'"))); employee = (NLSEmployee) manager.getObject(employeeClass, "0003"); suite.addTest( new ReadObjectCallTest( employeeClass, new SQLCall( "SELECT t0.\u306b\u304a\u3064\u3066\u3051\u305d\u305b, t1.\u304a\u3059\u305f_\u3051\u3048, t0.\u3057_\u305b\u3042\u3059\u304a, t0.\u304b_\u305b\u3042\u3059\u304a, t1.\u3066\u3042\u3057\u3042\u3064\u306e, t0.\u304a\u3059\u305f_\u3051\u3048, t0.\u304d\u304a\u305b\u3048\u304a\u3064, t0.\u304a\u305b\u3048_\u3048\u3042\u3068\u304a, t0.\u3066\u3068\u3042\u3064\u3068_\u3048\u3042\u3068\u304a, t0.\u3059\u3042\u305b\u3042\u304d\u304a\u3064_\u3051\u3048, t0.\u304a\u305b\u3048_\u3068\u3051\u3059\u304a, t0.\u3066\u3068\u3042\u3064\u3068_\u3068\u3051\u3059\u304a, t0.\u3042\u3048\u3048\u3064_\u3051\u3048 FROM \u304a\u3059\u305f t0, \u3066\u3042\u3057\u3042\u3064\u306e t1 WHERE t1.\u304a\u3059\u305f_\u3051\u3048 = t0.\u304a\u3059\u305f_\u3051\u3048 AND t0.\u304b_\u305b\u3042\u3059\u304a = '" + employee.getFirstName() + "' AND t0.\u3057_\u305b\u3042\u3059\u304a = '" + employee.getLastName() + "'"))); Project project = (Project) manager.getObject(largeProjectClass, "0001"); ReadObjectTest test = new ReadObjectTest(project); test.setQuery( new org.eclipse.persistence.queries.ReadObjectQuery( Project.class, new 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; }