public void testGetAssociation() throws ApplicationException { PrivateTeacher searchObject = new PrivateTeacher(); searchObject.setId(new Integer(1)); Collection results = getApplicationService() .search( "gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher", searchObject); assertNotNull(results); assertEquals(1, results.size()); Pupil pupil; for (Iterator i = results.iterator(); i.hasNext(); ) { PrivateTeacher result = (PrivateTeacher) i.next(); assertNotNull(result); assertNotNull(result.getId()); assertNotNull(result.getYearsExperience()); for (Iterator j = result.getPupilCollection().iterator(); j.hasNext(); ) { pupil = (Pupil) j.next(); assertNotNull(pupil); assertNotNull(pupil.getId()); assertNotNull(pupil.getName()); } } }
/** * Uses Nested Search 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 testEntireObjectNestedSearch1() throws ApplicationException { PrivateTeacher searchObject = new PrivateTeacher(); Collection results = getApplicationService() .search( "gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher", searchObject); assertNotNull(results); assertEquals(3, results.size()); for (Iterator i = results.iterator(); i.hasNext(); ) { PrivateTeacher result = (PrivateTeacher) i.next(); assertNotNull(result); assertNotNull(result.getId()); assertNotNull(result.getName()); assertNotNull(result.getYearsExperience()); } }
/** * 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 testEntireObjectCQL1() throws ApplicationException { CQLQuery cqlQuery = new CQLQuery(); CQLObject target = new CQLObject(); target.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher"); cqlQuery.setTarget(target); Collection results = getApplicationService().query(cqlQuery); assertNotNull(results); assertEquals(3, results.size()); for (Iterator i = results.iterator(); i.hasNext(); ) { PrivateTeacher result = (PrivateTeacher) i.next(); assertNotNull(result); assertNotNull(result.getId()); assertNotNull(result.getName()); assertNotNull(result.getYearsExperience()); } }