/** * Uses CQL Search Criteria for inheritance as association in search Verifies that the results are * returned Verifies size of the result set Verifies that none of the attribute is null * * @throws ApplicationException */ public void testZeroAssociationCQL() throws ApplicationException { CQLQuery cqlQuery = new CQLQuery(); CQLObject target = new CQLObject(); CQLAssociation association = new CQLAssociation(); association.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher"); association.setAttribute(new CQLAttribute("name", CQLPredicate.EQUAL_TO, "Bad Name")); target.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.Teacher"); target.setAssociation(association); cqlQuery.setTarget(target); Collection results = getApplicationService().query(cqlQuery); assertNotNull(results); assertEquals(0, results.size()); }
/** * Uses CQL Criteria for search Verifies that the results are returned Verifies size of the result * set Verifies that none of the attribute is null * * @throws ApplicationException */ public void testEntireObjectCQL2() throws ApplicationException { CQLQuery cqlQuery = new CQLQuery(); CQLObject target = new CQLObject(); target.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.Pupil"); cqlQuery.setTarget(target); Collection results = getApplicationService().query(cqlQuery); assertNotNull(results); assertEquals(4, results.size()); for (Iterator i = results.iterator(); i.hasNext(); ) { Pupil result = (Pupil) i.next(); assertNotNull(result); assertNotNull(result.getId()); assertNotNull(result.getName()); } }
/** * Uses CQL Criteria for inheritance as association in search Verifies that the results are * returned Verifies size of the result set Verifies that none of the attribute is null * * @throws ApplicationException */ public void testAssociationCQL2() throws ApplicationException { CQLQuery cqlQuery = new CQLQuery(); CQLObject target = new CQLObject(); CQLAssociation association = new CQLAssociation(); association.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.Teacher"); association.setAttribute(new CQLAttribute("id", CQLPredicate.EQUAL_TO, "2")); target.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher"); target.setAssociation(association); cqlQuery.setTarget(target); Collection results = getApplicationService().query(cqlQuery); assertNotNull(results); assertEquals(1, results.size()); PrivateTeacher result = (PrivateTeacher) results.iterator().next(); assertNotNull(result); assertNotNull(result.getId()); assertEquals(new Integer(2), result.getId()); }