コード例 #1
0
  /** This is a test which expands two paths with cardinalities 1-*-1-*-1 and 1-1-1-*-1. */
  public void testQueryJobsDeepExpandAndMultiple() {
    Query<Job> query =
        service
            .createJobQuery("/Job")
            .expand("jobParts/description/literals/language,jobPosting/name/literals/language");

    for (Job job : query) {
      String jobPostingPath = String.format("/Job(%d)/jobPosting", job.getId());

      JobPosting jobPosting = job.getJobPosting();

      Assert.assertNotNull("Should have fetched " + jobPostingPath, jobPosting);

      assertFullExpansionOfMultilingualField(jobPosting.getName(), jobPostingPath + "/name");

      if (job.getJobParts() != null) {

        for (JobPart jobPart : job.getJobParts()) {

          String jobPartDescriptionPath =
              String.format("/Job(%d)/jobParts(%d)/description", job.getId(), jobPart.getId());

          assertFullExpansionOfMultilingualField(jobPart.getDescription(), jobPartDescriptionPath);
        }
      }
    }
  }
コード例 #2
0
  /**
   * This test performs expansion and checks parsing of date forms with omitted seconds (Issue #946)
   * in the expanded hierarchy.
   */
  public void testJobExpansionAndParsingOfShortDates() {

    Query<Job> query =
        service
            .createJobQuery("/Job")
            .expand("jobParts/description/literals/language,jobPosting/name/literals/language");

    for (Job job : query) {
      Assert.assertNotNull("Failed to parse date, resulting to null value", job.getStartDate());
      Assert.assertNotNull("Failed to parse date, resulting to null value", job.getEndDate());

      if (job.getJobParts() != null) {

        for (JobPart jobPart : job.getJobParts()) {
          Assert.assertNotNull(
              "Failed to parse date, resulting to null value", jobPart.getStartDate());
          Assert.assertNotNull(
              "Failed to parse date, resulting to null value", jobPart.getEndDate());
        }
      }
    }
  }