use of org.eclipse.persistence.queries.SQLCall in project eclipselink by eclipse-ee4j.
the class NamedQueryLinesIGetSQLStringIsNotNullTest method setup.
@Override
protected void setup() {
getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
descriptorToModify = project.getDescriptors().get(Employee.class);
ReadObjectQuery testReadQuery = new ReadObjectQuery();
SQLCall testCall = new SQLCall("testString");
testReadQuery.setName("testQueryName");
// setting the SQLCall on ReadObjectQuery
testReadQuery.setCall(testCall);
descriptorToModify.getQueryManager().setReadObjectQuery(testReadQuery);
descriptorToModify.getQueryManager().addQuery(testReadQuery);
}
use of org.eclipse.persistence.queries.SQLCall in project eclipselink by eclipse-ee4j.
the class QueryManagerHasDeleteQueryIsSQLCallQueryTest method setup.
@Override
protected void setup() {
getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
descriptorToModify = project.getDescriptors().get(Employee.class);
DeleteObjectQuery testReadQuery = new DeleteObjectQuery();
SQLCall testCall = new SQLCall();
// setting the SQLCall on ReadObjectQuery
testReadQuery.setCall(testCall);
testReadQuery.setSQLString("testString");
descriptorToModify.getQueryManager().setDeleteQuery(testReadQuery);
}
use of org.eclipse.persistence.queries.SQLCall in project eclipselink by eclipse-ee4j.
the class QueryManagerHasReadObjectQueryIsSQLCallQueryTest method setup.
@Override
protected void setup() {
getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
project = new org.eclipse.persistence.testing.models.employee.relational.EmployeeProject();
descriptorToModify = project.getDescriptors().get(Employee.class);
ReadObjectQuery testReadQuery = new ReadObjectQuery();
SQLCall testCall = new SQLCall();
// setting the SQLCall on ReadObject
testReadQuery.setCall(testCall);
testReadQuery.setSQLString("testString");
descriptorToModify.getQueryManager().setReadObjectQuery(testReadQuery);
generator = new ProjectClassGenerator(project);
}
use of org.eclipse.persistence.queries.SQLCall in project eclipselink by eclipse-ee4j.
the class EmployeeBasicTestModel method getReadAllTestSuite.
public static TestSuite getReadAllTestSuite() {
TestSuite suite = getSRGReadAllTestSuite();
// Add new tests here ...
Expression orderBy = new ExpressionBuilder().get("firstName").ascending();
Call call = 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.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE t1.EMP_ID = t0.EMP_ID");
suite.addTest(new ReadAllCallWithOrderingTest(org.eclipse.persistence.testing.models.employee.domain.Employee.class, 12, call, orderBy));
return suite;
}
use of org.eclipse.persistence.queries.SQLCall 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;
}
Aggregations