use of org.eclipse.persistence.testing.models.insurance.Address in project eclipselink by eclipse-ee4j.
the class StoredProcedureVARRAYParametersTest method verify.
@Override
public void verify() {
if ((results2.size() != 1) && (results3.size() != 1)) {
throw new TestErrorException("Collections returned did not contain expected number of results");
}
// check that a Struct was returned for address
Object addressOut = ((DatabaseRecord) results2.get(0)).get("address");
if ((addressOut == null) || (!(addressOut instanceof Struct))) {
throw new TestErrorException("Address returned by SProc_Read_PHolders was null or not a Struct :" + addressOut);
}
// This is an Address instance instead of struct since it picks up the address class from the value passed in.
Address addressInOut = ((Address) ((DatabaseRecord) results3.get(0)).get("address"));
if ((addressInOut == null) || !originalAddress.getStreet().equals(addressInOut.getStreet())) {
throw new TestErrorException("Address in did not equal the address returned out by SProc_Delete_PHolders " + addressInOut);
}
Vector childrenRead = ((Vector) ((DatabaseRecord) results2.get(0)).get("childrenNames"));
if ((childrenNames.size() != childrenRead.size()) && (!childrenNames.get(0).equals(childrenRead.get(0)))) {
throw new TestErrorException("First Child's Name did not match what was returned out by SProc_Read_PHolders");
}
childrenRead = ((Vector) ((DatabaseRecord) results3.get(0)).get("childrenNames"));
if ((childrenNames.size() != childrenRead.size()) && (!childrenNames.get(0).equals(childrenRead.get(0)))) {
throw new TestErrorException("First Child's Name did not match what was returned out by SProc_Delete_PHolders");
}
Vector phonesRead = ((Vector) ((DatabaseRecord) results2.get(0)).get("phones"));
if ((phoneNumbers.size() != phonesRead.size()) && (!phoneNumbers.get(0).equals(childrenRead.get(0)))) {
throw new TestErrorException("First phone did not match what was returned out by SProc_Read_PHolders");
}
phonesRead = ((Vector) ((DatabaseRecord) results3.get(0)).get("phones"));
if ((phoneNumbers.size() != phonesRead.size()) && (!phoneNumbers.get(0).equals(phonesRead.get(0)))) {
throw new TestErrorException("First phone did not match what was returned out by SProc_Delete_PHolders");
}
}
use of org.eclipse.persistence.testing.models.insurance.Address in project eclipselink by eclipse-ee4j.
the class StoredProcedureObjectRelationalParameters method verify.
@Override
public void verify() {
if ((results2.size() != 1) && (results3.size() != 1)) {
throw new TestErrorException("Collections returned did not contain expected number of results");
}
Address addressRead = ((Address) ((DatabaseRecord) results2.get(0)).get("address"));
if (!originalAddress.getStreet().equals(addressRead.getStreet())) {
throw new TestErrorException("Address in did not equal the address returned out by SProc_Read_PHolders");
}
Address addressRemoved = ((Address) ((DatabaseRecord) results3.get(0)).get("address"));
if (!originalAddress.getStreet().equals(addressRemoved.getStreet())) {
throw new TestErrorException("Address in did not equal the address returned out by SProc_Delete_PHolders");
}
}
use of org.eclipse.persistence.testing.models.insurance.Address in project eclipselink by eclipse-ee4j.
the class DeleteOrderUnitOfWorkTest method test.
@Override
protected void test() {
ExpressionBuilder builder = new ExpressionBuilder();
Expression expression = builder.get("id").equal(303);
UnitOfWork uow = getSession().acquireUnitOfWork();
Claim claim = (Claim) uow.readObject(org.eclipse.persistence.testing.models.insurance.Claim.class, expression);
Policy policy = claim.getPolicy();
PolicyHolder holder = policy.getPolicyHolder();
Address address = holder.getAddress();
uow.deleteObject(claim);
uow.deleteObject(address);
uow.deleteObject(policy);
uow.deleteObject(holder);
uow.commit();
}
use of org.eclipse.persistence.testing.models.insurance.Address in project eclipselink by eclipse-ee4j.
the class ComplexJoinedAttributeQueryTest method test.
@Override
public void test() {
ReadAllQuery query = new ReadAllQuery(Address.class);
Expression zipCodeExpression = new ExpressionBuilder().get("zipCode").equal("28150");
Expression ssnExpression = new ExpressionBuilder().get("policyHolder").get("ssn").equal(1111);
Expression expression = zipCodeExpression.or(ssnExpression);
Expression policyExpression = new ExpressionBuilder().get("policyHolder").anyOf("policies").get("policyNumber").equal(200);
Expression phoneExpression = new ExpressionBuilder().get("policyHolder").anyOf("phones").get("areaCode").equal(123);
expression = expression.and(policyExpression).and(phoneExpression);
query.setSelectionCriteria(expression);
query.addJoinedAttribute(new ExpressionBuilder().get("policyHolder"));
query.addJoinedAttribute(new ExpressionBuilder().get("policyHolder").anyOf("policies"));
query.addJoinedAttribute(new ExpressionBuilder().get("policyHolder").anyOf("phones"));
Collection<Address> result = (Collection<Address>) getSession().executeQuery(query);
if (result != null && result.size() == 1) {
queryResult = (Address) result.toArray()[0];
}
}
Aggregations