コード例 #1
0
  /**
   * Uses Nested 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 testAssociationNestedSearch2() throws ApplicationException {
    PrivateTeacher searchObject = new PrivateTeacher();
    searchObject.setId(new Integer(1));
    Collection results =
        getApplicationService()
            .search("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.Teacher", searchObject);

    assertNotNull(results);
    assertEquals(1, results.size());

    Teacher result = (Teacher) results.iterator().next();
    assertNotNull(result);
    assertNotNull(result.getId());
    assertEquals(new Integer(1), result.getId());
  }
コード例 #2
0
  /**
   * 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 testAssociationCQL1() 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("id", CQLPredicate.EQUAL_TO, "1"));

    target.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.Teacher");
    target.setAssociation(association);
    cqlQuery.setTarget(target);

    Collection results = getApplicationService().query(cqlQuery);

    assertNotNull(results);
    assertEquals(1, results.size());

    Teacher result = (Teacher) results.iterator().next();
    assertNotNull(result);
    assertNotNull(result.getId());
    assertEquals(new Integer(1), result.getId());
  }