Java 类com.amazonaws.mturk.requester.ParameterMapEntry 实例源码

项目:java-aws-mturk    文件:TestRequesterServiceRaw.java   
public void testCreateHITWithReviewPolicy() throws ServiceException {
  /* Create some review policies.
   * The policy details are nonsense and are not asserted on -- this test
   * just verifies that (1) the act of plugging in a review policy does not
   * cause createHIT to blow up, and that (2) said review policies appear in
   * the HIT's review results. */
  PolicyParameter[] skaParams = {
      new PolicyParameter("AnswerKey", null,
          new ParameterMapEntry[] { new ParameterMapEntry("1", new String[] {"correct answer"}) })
  };
  ReviewPolicy assignmentReviewPolicy = new ReviewPolicy("ScoreMyKnownAnswers/2011-09-01", skaParams);
  PolicyParameter[] phrParams = {
      new PolicyParameter("QuestionIds", new String[] {"1"}, null),
      new PolicyParameter("QuestionAgreementThreshold", new String[] {"50"}, null),
  };
  ReviewPolicy hitReviewPolicy = new ReviewPolicy("SimplePlurality/2011-09-01", phrParams);

  // Create the HIT with review policies
  HIT hit = service.createHIT(
      null, // hitTypeId
      defaultHITTitle + unique,
      defaultHITDescription,
      null, // keywords
      RequesterService.getBasicFreeTextQuestion(defaultQuestion),
      defaultReward,
      defaultAssignmentDurationInSeconds,
      defaultAutoApprovalDelayInSeconds,
      defaultLifetimeInSeconds,
      defaultMaxAssignments,
      null, // requesterAnnotation
      null, // qualificationRequirements
      null, // responseGroup
      null, // uniqueRequestToken
      assignmentReviewPolicy,
      hitReviewPolicy);

  // Make sure the policies were actually added to the created HIT
  GetReviewResultsForHITResult results = service.getReviewResultsForHIT(
      hit.getHITId(),
      new ReviewPolicyLevel[] {ReviewPolicyLevel.Assignment, ReviewPolicyLevel.HIT},
      true, // retrieveActions
      true, // retrieveResults
      1, // pageNumber
      1000, // pageSize
      null); // responseGroup
  assertEquals("Unexpected assignment policy", results.getAssignmentReviewPolicy().getPolicyName(), "ScoreMyKnownAnswers/2011-09-01");
  assertEquals("Unexpected HIT policy", results.getHITReviewPolicy().getPolicyName(), "SimplePlurality/2011-09-01");
}
项目:mturksdk-java-code-maven    文件:TestRequesterServiceRaw.java   
public void testCreateHITWithReviewPolicy() throws ServiceException {
  /* Create some review policies.
   * The policy details are nonsense and are not asserted on -- this test
   * just verifies that (1) the act of plugging in a review policy does not
   * cause createHIT to blow up, and that (2) said review policies appear in
   * the HIT's review results. */
  PolicyParameter[] skaParams = {
      new PolicyParameter("AnswerKey", null,
          new ParameterMapEntry[] { new ParameterMapEntry("1", new String[] {"correct answer"}) })
  };
  ReviewPolicy assignmentReviewPolicy = new ReviewPolicy("ScoreMyKnownAnswers/2011-09-01", skaParams);
  PolicyParameter[] phrParams = {
      new PolicyParameter("QuestionIds", new String[] {"1"}, null),
      new PolicyParameter("QuestionAgreementThreshold", new String[] {"50"}, null),
  };
  ReviewPolicy hitReviewPolicy = new ReviewPolicy("SimplePlurality/2011-09-01", phrParams);

  // Create the HIT with review policies
  HIT hit = service.createHIT(
      null, // hitTypeId
      defaultHITTitle + unique,
      defaultHITDescription,
      null, // keywords
      RequesterService.getBasicFreeTextQuestion(defaultQuestion),
      defaultReward,
      defaultAssignmentDurationInSeconds,
      defaultAutoApprovalDelayInSeconds,
      defaultLifetimeInSeconds,
      defaultMaxAssignments,
      null, // requesterAnnotation
      null, // qualificationRequirements
      null, // responseGroup
      null, // uniqueRequestToken
      assignmentReviewPolicy,
      hitReviewPolicy);

  // Make sure the policies were actually added to the created HIT
  GetReviewResultsForHITResult results = service.getReviewResultsForHIT(
      hit.getHITId(),
      new ReviewPolicyLevel[] {ReviewPolicyLevel.Assignment, ReviewPolicyLevel.HIT},
      true, // retrieveActions
      true, // retrieveResults
      1, // pageNumber
      1000, // pageSize
      null); // responseGroup
  assertEquals("Unexpected assignment policy", results.getAssignmentReviewPolicy().getPolicyName(), "ScoreMyKnownAnswers/2011-09-01");
  assertEquals("Unexpected HIT policy", results.getHITReviewPolicy().getPolicyName(), "SimplePlurality/2011-09-01");
}