Search in sources :

Example 1 with Phone

use of org.eclipse.persistence.testing.models.plsql.Phone in project eclipselink by eclipse-ee4j.

the class PLSQLTestModel method getRecordTestSuite.

public static TestSuite getRecordTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("PLSQLRecordTestSuite");
    suite.setDescription("This suite tests calling PLSQL procedures that take records.");
    Address address = new Address();
    address.setId(new BigDecimal(123));
    address.setNumber(17);
    address.setStreet("Bank");
    address.setCity("Ottawa");
    address.setState("ON");
    Address resultAddress = new Address();
    resultAddress.setId(new BigDecimal(1234));
    resultAddress.setNumber(17);
    resultAddress.setStreet("Bank");
    resultAddress.setCity("Ottawa");
    resultAddress.setState("ON");
    Phone phone = new Phone();
    phone.setAreaCode("613");
    phone.setNumber("7927711");
    Employee employee = new Employee();
    employee.setId(new BigDecimal(123));
    employee.setName("Bob Jones");
    employee.setAddress(address);
    employee.getPhones().add(phone);
    List args = new ArrayList();
    args.add(address);
    DatabaseRecord result = new DatabaseRecord();
    result.put("P_ADDRESS", resultAddress);
    PLSQLTest test = new PLSQLTest("AddressInOutObject", Address.class, args, result);
    test.setName("AddressInOutObjectTest");
    suite.addTest(test);
    args = new ArrayList();
    args.add(address.getId());
    args.add(address.getNumber());
    args.add(address.getStreet());
    args.add(address.getCity());
    args.add(address.getState());
    args.add("Local");
    result = new DatabaseRecord();
    result.put("ADDRESS_ID", resultAddress.getId());
    result.put("ADDRESS_NUM", resultAddress.getNumber());
    result.put("STREET", resultAddress.getStreet());
    result.put("CITY", resultAddress.getCity());
    result.put("STATE", resultAddress.getState());
    result.put("P_LOCAL", "Nepean");
    test = new PLSQLTest("AddressInOutData", Address.class, args);
    test.setName("AddressInOutDataTest");
    suite.addTest(test);
    args = new ArrayList();
    args.add(address.getId());
    args.add(address.getNumber());
    args.add(address.getStreet());
    args.add(address.getCity());
    args.add(address.getState());
    args.add("Local");
    test = new PLSQLTest("AddressInData", Address.class, args);
    test.setName("AddressInDataTest");
    suite.addTest(test);
    args = new ArrayList();
    args.add(address);
    test = new PLSQLTest("AddressInObject", Address.class, args);
    test.setName("AddressInObjectTest");
    suite.addTest(test);
    args = new ArrayList();
    result = new DatabaseRecord();
    result.put("P_ADDRESS", resultAddress);
    test = new PLSQLTest("AddressOutObject", Address.class, args, result);
    test.setName("AddressOutTest");
    suite.addTest(test);
    args = new ArrayList();
    result = new DatabaseRecord();
    result.put("ADDRESS_ID", resultAddress.getId());
    result.put("STREET_NUM", resultAddress.getNumber());
    result.put("STREET", resultAddress.getStreet());
    result.put("CITY", resultAddress.getCity());
    result.put("STATE", resultAddress.getState());
    result.put("P_LOCAL", "Local");
    test = new PLSQLTest("AddressOutData", Address.class, args, result);
    test.setName("AddressOutDataTest");
    suite.addTest(test);
    args = new ArrayList();
    args.add(employee);
    args.add("Nepean");
    test = new PLSQLTest("EmployeeInObject", Employee.class, args);
    test.setName("EmployeeInObjectTest");
    suite.addTest(test);
    args = new ArrayList();
    result = new DatabaseRecord();
    result.put("P_EMP", new Employee());
    result.put("P_CITY", "Nepean");
    test = new PLSQLTest("EmployeeOutObject", Employee.class, args, result);
    test.setName("EmployeeOutTest");
    suite.addTest(test);
    args = new ArrayList();
    result = new DatabaseRecord();
    result.put("P_EMP", employee);
    result.put("P_CITY", "Nepean");
    args.add(employee);
    args.add("Nepean");
    test = new PLSQLTest("EmployeeInOutObject", Employee.class, args, result);
    test.setName("EmployeeInOutObjectTest");
    suite.addTest(test);
    test = new PLSQLTest("AddressOutCursor", Address.class, new ArrayList(), new Vector());
    test.setName("AddressOutCursorTest");
    suite.addTest(test);
    test = new PLSQLTest("AddressRecOutCursor", Address.class, new ArrayList(), new Vector());
    test.setName("AddressRecOutCursorTest");
    suite.addTest(test);
    return suite;
}
Also used : Employee(org.eclipse.persistence.testing.models.plsql.Employee) Address(org.eclipse.persistence.testing.models.plsql.Address) DatabaseRecord(org.eclipse.persistence.sessions.DatabaseRecord) Phone(org.eclipse.persistence.testing.models.plsql.Phone) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Vector(java.util.Vector) BigDecimal(java.math.BigDecimal)

Example 2 with Phone

use of org.eclipse.persistence.testing.models.plsql.Phone in project eclipselink by eclipse-ee4j.

the class PLSQLTestModel method getCollectionTestSuite.

public static TestSuite getCollectionTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("PLSQLCollectionTestSuite");
    suite.setDescription("This suite tests calling PLSQL procedures that take collections.");
    Address address = new Address();
    address.setId(new BigDecimal(123));
    address.setNumber(17);
    address.setStreet("Bank");
    address.setCity("Ottawa");
    address.setState("ON");
    Phone phone = new Phone();
    phone.setAreaCode("613");
    phone.setNumber("7927711");
    Employee employee = new Employee();
    employee.setId(new BigDecimal(123));
    employee.setName("Bob Jones");
    employee.setAddress(address);
    employee.getPhones().add(phone);
    List args = new ArrayList();
    DatabaseRecord result = new DatabaseRecord();
    List collection = new ArrayList();
    collection.add("Ottawa");
    result.put("P_CITY_LIST", collection);
    result.put("P_CITY", "Nepean");
    PLSQLTest test = new PLSQLTest("CityListOut", Address.class, args, result);
    test.setName("CityListOutTest");
    suite.addTest(test);
    args = new ArrayList();
    collection = new ArrayList(Arrays.asList("Ottawa", "Toronto"));
    args.add(collection);
    args.add("Nepean");
    result = new DatabaseRecord();
    result.put("P_CITY_LIST", collection);
    result.put("P_CITY", "Nepean");
    test = new PLSQLTest("CityListInOut", Address.class, args, result);
    test.setName("CityListInOutTest");
    suite.addTest(test);
    args = new ArrayList();
    args.add(new Object[] { address, address });
    args.add("Nepean");
    test = new PLSQLTest("AddressListIn", Address.class, args);
    test.setName("AddressListInTest");
    suite.addTest(test);
    args = new ArrayList();
    result = new DatabaseRecord();
    result.put("P_ADDRESS_LIST", new ArrayList());
    result.put("P_CITY", "Nepean");
    test = new PLSQLTest("AddressListOut", Address.class, args, result);
    test.setName("AddressListOutTest");
    suite.addTest(test);
    args = new ArrayList();
    collection = new ArrayList(Arrays.asList(address, address));
    args.add(collection);
    args.add("Nepean");
    result = new DatabaseRecord();
    result.put("P_ADDRESS_LIST", collection);
    result.put("P_CITY", "Nepean");
    test = new PLSQLTest("AddressListInOut", Address.class, args, result);
    test.setName("AddressListInOutTest");
    suite.addTest(test);
    args = new ArrayList();
    args.add(new Object[] { employee, employee });
    args.add("Nepean");
    test = new PLSQLTest("EmployeeListIn", Employee.class, args);
    test.setName("EmployeeListInTest");
    suite.addTest(test);
    args = new ArrayList();
    result = new DatabaseRecord();
    result.put("P_EMP_LIST", new ArrayList());
    result.put("P_CITY", "Nepean");
    test = new PLSQLTest("EmployeeListOut", Employee.class, args, result);
    test.setName("EmployeeListOutTest");
    suite.addTest(test);
    args = new ArrayList();
    collection = new ArrayList(Arrays.asList(employee, employee));
    args.add(collection);
    args.add("Nepean");
    result = new DatabaseRecord();
    result.put("P_EMP_LIST", collection);
    result.put("P_CITY", "Nepean");
    test = new PLSQLTest("EmployeeListInOut", Employee.class, args, result);
    test.setName("EmployeeListInOutTest");
    suite.addTest(test);
    return suite;
}
Also used : Employee(org.eclipse.persistence.testing.models.plsql.Employee) Address(org.eclipse.persistence.testing.models.plsql.Address) DatabaseRecord(org.eclipse.persistence.sessions.DatabaseRecord) Phone(org.eclipse.persistence.testing.models.plsql.Phone) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) BigDecimal(java.math.BigDecimal)

Aggregations

BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 DatabaseRecord (org.eclipse.persistence.sessions.DatabaseRecord)2 Address (org.eclipse.persistence.testing.models.plsql.Address)2 Employee (org.eclipse.persistence.testing.models.plsql.Employee)2 Phone (org.eclipse.persistence.testing.models.plsql.Phone)2 Vector (java.util.Vector)1