• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RequesterService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.mturk.service.axis.RequesterService的典型用法代码示例。如果您正苦于以下问题:Java RequesterService类的具体用法?Java RequesterService怎么用?Java RequesterService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RequesterService类属于com.amazonaws.mturk.service.axis包,在下文中一共展示了RequesterService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testSearchHITsResponseGroups

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testSearchHITsResponseGroups() throws ServiceException {
  getTestHITId(); // make sure there is at least one HIT
  
  SearchHITsResult result = service.searchHITs(RequesterService.DEFAULT_SORT_DIRECTION,
      SearchHITsSortProperty.CreationTime, defaultPageNum, defaultPageSize,
      new String [] {"Minimal", "HITQuestion"});
  
  assertNotNull(result);
  assertNotNull(result.getHIT(0));
  HIT hit = result.getHIT(0);
  assertNotNull(hit.getQuestion());
  
  result = service.searchHITs(RequesterService.DEFAULT_SORT_DIRECTION,
      SearchHITsSortProperty.CreationTime, defaultPageNum, defaultPageSize,
      new String [] {"Minimal"});
  
  assertNotNull(result);
  assertNotNull(result.getHIT(0));
  hit = result.getHIT(0);
  assertNull(hit.getQuestion());
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:22,代码来源:TestRequesterServiceRaw.java


示例2: testUpdateHITTextAttributes

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testUpdateHITTextAttributes() throws ServiceException {
  HIT hit = service.createHIT(defaultHITTitle + unique, defaultHITDescription, defaultReward, 
      RequesterService.getBasicFreeTextQuestion(defaultQuestion), 
      defaultMaxAssignments, true);

  String newHITTypeId = service.updateHIT(hit.getHITId(), 
                    hit.getTitle() + " amended", 
      hit.getDescription() + " amended",
      "new, updated, improved, amended", null);

  HIT newHIT = service.getHIT(hit.getHITId());

  assertFalse(newHITTypeId.equals(hit.getHITTypeId()));
  assertEquals(newHITTypeId, newHIT.getHITTypeId());
  assertEquals(hit.getHITId(), newHIT.getHITId());
   assertTrue(newHIT.getTitle().endsWith(" amended"));
  assertTrue(newHIT.getDescription().endsWith(" amended"));
  assertTrue(newHIT.getKeywords().endsWith(" amended"));
  assertEquals(hit.getReward(), newHIT.getReward());
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:21,代码来源:TestRequesterService.java


示例3: testUpdateHITReward

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testUpdateHITReward() throws ServiceException {
  HIT hit = service.createHIT(defaultHITTitle + unique, defaultHITDescription, defaultReward, 
      RequesterService.getBasicFreeTextQuestion(defaultQuestion), 
      defaultMaxAssignments, true);

  String newHITTypeId = service.updateHIT(hit.getHITId(), 
      null, null, null, 0.50);

  HIT newHIT = service.getHIT(hit.getHITId());

  assertFalse(newHITTypeId.equals(hit.getHITTypeId()));
  assertEquals(newHITTypeId, newHIT.getHITTypeId());
  assertEquals(hit.getHITId(), newHIT.getHITId());
  assertEquals(hit.getTitle(), newHIT.getTitle());
  assertEquals(hit.getDescription(), newHIT.getDescription());
  assertEquals(hit.getKeywords(), newHIT.getKeywords());
  assertEquals(0.50, newHIT.getReward().getAmount().doubleValue());
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:19,代码来源:TestRequesterService.java


示例4: testParseAnswers

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testParseAnswers() throws ServiceException {
  QuestionFormAnswers qfa = RequesterService.parseAnswers(DEFAULT_ANSWER_XML);
  List<QuestionFormAnswersType.AnswerType> answers = 
    (List<QuestionFormAnswersType.AnswerType>) qfa.getAnswer();
  
  for (int i=0; i< answers.size(); i++) {
    QuestionFormAnswersType.AnswerType answer = answers.get(i);
    assertNotNull(null, RequesterService.getAnswerValue(null, answer));
    
    // check order
    String result = RequesterService.getAnswerValue("TEST_ASSIGNMENT_ID", answer, true);
    if (i == 0) {
      assertTrue(result.equals("freeText\tfreeText_answer"));
    } else if (i == 1) {
      assertTrue(result.equals("otherSelection\totherSelection_answer"));
    } else if (i == 2) {
      assertTrue(result.startsWith("url\t"));
    } else {
      assertTrue(result.equals("selectionIdentifier\tselection_answer|selection_answer2"));
    }
  }
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:24,代码来源:TestRequesterService.java


示例5: createHIT

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
protected HIT createHIT(QualificationRequirement qualRequirement) throws ServiceException {
  QualificationRequirement[] qualRequirements = null;
  if (qualRequirement != null) { 
    qualRequirements = new QualificationRequirement[] { qualRequirement };
  }
  
  HIT hit = service.createHIT(null, // HITTypeId 
      defaultHITTitle + unique, 
      defaultHITDescription, null, // keywords 
      RequesterService.getBasicFreeTextQuestion(defaultQuestion), defaultReward, 
      defaultAssignmentDurationInSeconds, defaultAutoApprovalDelayInSeconds, 
      defaultLifetimeInSeconds, defaultMaxAssignments, null, // requesterAnnotation 
      qualRequirements,
      null  // responseGroup
    );
    
  assertNotNull(hit);
  assertNotNull(hit.getHITId());
  
  return hit;
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:22,代码来源:TestBase.java


示例6: createHelloWorld

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
/**
 * Creates the simple HIT.
 * 
 */
public void createHelloWorld() {
  try {

    // The createHIT method is called using a convenience static method of
    // RequesterService.getBasicFreeTextQuestion that generates the QAP for
    // the HIT.
    HIT hit = service.createHIT(
            title,
            description,
            reward,
            RequesterService.getBasicFreeTextQuestion(
                "What is the weather like right now in Seattle, WA?"),
            numAssignments);

    System.out.println("Created HIT: " + hit.getHITId());

    System.out.println("You may see your HIT with HITTypeId '" 
        + hit.getHITTypeId() + "' here: ");
    System.out.println(service.getWebsiteURL() 
        + "/mturk/preview?groupId=" + hit.getHITTypeId());

  } catch (ServiceException e) {
    System.err.println(e.getLocalizedMessage());
  }
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:30,代码来源:MTurkHelloWorld.java


示例7: createMyHIT

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void createMyHIT() {
    try {

        // The createHIT method is called using a convenience static method of
        // RequesterService.getBasicFreeTextQuestion that generates the QAP for
        // the HIT.
        HIT hit = service.createHIT(
                title,
                description,
                reward,
                RequesterService.getBasicFreeTextQuestion(
                    "What is the current temperature now in Seattle, WA?"),
                numAssignments);

        System.out.println("Created HIT: " + hit.getHITId());

        System.out.println("You may see your HIT with HITTypeId '" 
            + hit.getHITTypeId() + "' here: ");
        System.out.println(service.getWebsiteURL() 
            + "/mturk/preview?groupId=" + hit.getHITTypeId());

      } catch (ServiceException e) {
        System.err.println(e.getLocalizedMessage());
      }
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:26,代码来源:MyHIT.java


示例8: MTurkSystem

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
/**
 * Instantiating an MTurkSystem should be enough to handle your human worker issues. It handles the rest, as in
 * booting up the jetty server, the API server, and a payments thread to go through and make payments to workers.
 */
public MTurkSystem() {
    humanSourceServer = new HumanSourceServer();
    new Thread(humanSourceServer).start();

    jettyServer = new JettyServer();
    new Thread(jettyServer).start();

    paymentsThread = new PaymentsThread(((jobRecord, amountOwed) -> payWorker(jobRecord.workerID, jobRecord.assignmentID, amountOwed)));
    new Thread(paymentsThread).start();

    try {
        mturkService = new RequesterService(new PropertiesClientConfig("/home/keenon/.aws/mturk.properties"));
    }
    catch (Exception e) {

    }

    mTurkServer = new MTurkServer(this::hireWorkers, this::numWorkersPaidFor);
    new Thread(mTurkServer).start();
}
 
开发者ID:keenon,项目名称:lense,代码行数:25,代码来源:MTurkSystem.java


示例9: createMovieSurvey

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
/**
 * Create a simple survey.
 *
 */
public void createMovieSurvey()
 {
     try {
         // The createHIT method is called using a convenience static method
         // RequesterService.getBasicFreeTextQuestion() that generates the question format
         // for the HIT.
         HIT hit = service.createHIT
         (
             title,
             description,
             reward,
             RequesterService.getBasicFreeTextQuestion(
             "How many movies have you seen this month?"),
             numAssignments);
             // Print out the HITId and the URL to view the HIT.
             System.out.println("Created HIT: " + hit.getHITId());
             System.out.println("HIT location: ");
             System.out.println(service.getWebsiteURL() + "/mturk/preview?groupId="
             + hit.getHITTypeId());
     } catch (ServiceException e) {
         System.err.println(e.getLocalizedMessage());
     }
 }
 
开发者ID:samini,项目名称:gort-public,代码行数:28,代码来源:MovieSurvey.java


示例10: getAnswers

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private String getAnswers(Assignment assignment) {
  String result = EMPTY;

  AssignmentStatus status = assignment.getAssignmentStatus(); 
  if (status == null) {
    return NO_ANSWER;
  }

  String answerXML = assignment.getAnswer();

  QuestionFormAnswers qfa = RequesterService.parseAnswers(answerXML);
  List<QuestionFormAnswersType.AnswerType> answers = 
    (List<QuestionFormAnswersType.AnswerType>) qfa.getAnswer();

  for (QuestionFormAnswersType.AnswerType answer : answers) {

    String assignmentId = assignment.getAssignmentId();
    String answerValue = RequesterService.getAnswerValue(assignmentId, answer, true);

    if (answerValue != null) {
      result += answerValue + DELIMITER;
    }
  }

  return result;
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:28,代码来源:HITResults.java


示例11: testChangeReward

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testChangeReward() throws ServiceException {
    Filter filter = new CheckRewardFilter();
    service.addFilter(filter);
    String hitId = service.createHIT(defaultHITTitle + unique, defaultHITDescription, defaultReward, 
        RequesterService.getBasicFreeTextQuestion(defaultQuestion), defaultMaxAssignments).getHITId();
    
    HIT hit = service.getHIT(hitId);  
    assertEquals(hit.getReward().getAmount().doubleValue(), 0.05);
    service.removeFilter(filter);
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:11,代码来源:TestFilter.java


示例12: testCreateHITIdempotency

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testCreateHITIdempotency() throws ServiceException {
  try {
    String uniqueRequestToken = "testCreateHITIdempotency" + unique;
    for (int i = 0; i < 2; i++) {
      service.createHIT(
          null, // hitTypeId
          defaultHITTitle + unique,
          defaultHITDescription,
          null, // keywords
          RequesterService.getBasicFreeTextQuestion(defaultQuestion),
          defaultReward,
          defaultAssignmentDurationInSeconds,
          defaultAutoApprovalDelayInSeconds,
          defaultLifetimeInSeconds,
          defaultMaxAssignments,
          null, // requesterAnnotation
          null, // qualificationRequirements
          null, // responseGroup
          uniqueRequestToken,
          null, // assignmentReviewPolicy
          null); // hitReviewPolicy
    }
    fail("Re-use of uniqueRequestToken did not cause an error");
  } catch (ServiceException e) {
    // expected
    assertTrue("createHIT failed, but not because of uniqueRequestToken re-use",
        e.getMessage().contains("AWS.MechanicalTurk.HITAlreadyExists"));
  }
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:30,代码来源:TestRequesterServiceRaw.java


示例13: testCreateHITWithInvalidReviewPolicy

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testCreateHITWithInvalidReviewPolicy() throws ServiceException {
  // create a SKA policy that is missing required parameter AnswerKey 
  ReviewPolicy assignmentReviewPolicy = new ReviewPolicy("ScoreMyKnownAnswers/2011-09-01",
      new PolicyParameter[] {});
  
  try {
    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,
        null); // hitReviewPolicy
    fail("createHIT succeeded, despite having an invalid review policy");
  } catch (ServiceException e) {
    // expected
    assertTrue("createHIT failed, but not because of an invalid review policy",
        e.getMessage().contains("The AnswerKey parameter is mandatory."));
  }
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:31,代码来源:TestRequesterServiceRaw.java


示例14: testSearchQualificationTypes

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testSearchQualificationTypes()
  throws ServiceException {
  SearchQualificationTypesResult result = service.searchQualificationTypes(
      defaultQuery, false, // mustBeRequestable
      false, // mustBeOwnedByCaller
      RequesterService.DEFAULT_SORT_DIRECTION,
      SearchQualificationTypesSortProperty.Name,
      defaultPageNum, defaultPageSize
    );
  
  assertNotNull(result);
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:13,代码来源:TestRequesterServiceRaw.java


示例15: testCreateHITAsync

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testCreateHITAsync() {
  AsyncReply reply = service.createHITAsync(
      null, // HITTypeId
      "Async_" + defaultHITTitle + unique,
      "Async_" + defaultHITDescription,
      null, // keywords
      RequesterService.getBasicFreeTextQuestion(defaultQuestion),
      defaultReward, defaultAssignmentDurationInSeconds,
      defaultAutoApprovalDelayInSeconds, defaultLifetimeInSeconds,
      defaultMaxAssignments, null, // requesterAnnotation
      null, 
      null,	// responseGroup
      null, // uniqueRequestToken
      null, // assignmentReviewPolicy
      null, // hitReviewPolicy
      null	// callback
  );

  assertNotNull(reply);
  assertNotNull(reply.getFuture());
  assertFalse(reply.getFuture().isDone());

  // wait for result
  HIT hit = ((HIT[]) reply.getResult())[0];

  assertNotNull(hit);
  assertNotNull(hit.getHITId());
  assertTrue(reply.getFuture().isDone());
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:30,代码来源:TestRequesterServiceRaw.java


示例16: main

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public static void main(String[] args) {
  QuestionFormAnswers qfa = RequesterService.parseAnswers(DEFAULT_ANSWER_XML);
  List<QuestionFormAnswersType.AnswerType> answers = 
    (List<QuestionFormAnswersType.AnswerType>) qfa.getAnswer();
  
  TestRunner.run(TestRequesterService.class);
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:8,代码来源:TestRequesterService.java


示例17: testCreateHITFreeText

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testCreateHITFreeText() throws ServiceException {
  HIT hit = service.createHIT(defaultHITTitle + unique, defaultHITDescription, defaultReward, 
      RequesterService.getBasicFreeTextQuestion(defaultQuestion), defaultMaxAssignments);
  
  assertNotNull(hit);
  assertNotNull(hit.getHITId());
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:8,代码来源:TestRequesterService.java


示例18: testCreateHITFullResponse

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void testCreateHITFullResponse() throws ServiceException {
  HIT hit = service.createHIT(defaultHITTitle + unique, defaultHITDescription, defaultReward, 
      RequesterService.getBasicFreeTextQuestion(defaultQuestion), 
      defaultMaxAssignments, true);
  
  assertNotNull(hit);
  assertNotNull(hit.getHITId());
  assertNotNull(hit.getQuestion());
  assertNotNull(hit.getCreationTime());
  assertNotNull(hit.getNumberOfAssignmentsCompleted());
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:12,代码来源:TestRequesterService.java


示例19: createSurvey

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void createSurvey() {
  try {

    QualificationRequirement[] requirements = null;
    if(haveQualifications) {
      requirements = new QualificationRequirement[4];
      requirements[0] = new QualificationRequirement(RequesterService.LOCALE_QUALIFICATION_TYPE_ID, Comparator.EqualTo, null, new Locale("US"), invisible); //USA! USA!
      requirements[1] = new QualificationRequirement(getQualificationTypeId(), Comparator.EqualTo, 1, null, invisible); //Completed the screener
      requirements[2] = new QualificationRequirement(RequesterService.APPROVAL_RATE_QUALIFICATION_TYPE_ID, Comparator.GreaterThanOrEqualTo, 95, null, invisible); //>=95% approval
      requirements[3] = new QualificationRequirement("00000000000000000040", Comparator.GreaterThanOrEqualTo, 1000, null, invisible); //>=1000 HITs
    }

    String[] responseGroup = new String[]{"Minimal"};

    HITQuestion question = new HITQuestion("fullsurveyquestion.xml");

    SurveyParameters p = parameters;

    String hitType = service.registerHITType(p.autoApprovalDelay, p.assignmentDuration, p.reward, p.title, p.keywords, p.description, requirements);

    HIT hit = service.createHIT(hitType, p.title, p.description, p.keywords, question.getQuestion(), p.reward, p.assignmentDuration, p.autoApprovalDelay, p.lifetime, p.numAssignments, p.annotation, requirements, responseGroup);

    System.out.println("Created HIT: " + hit.getHITId());

    System.out.println("You may see your HIT with HITTypeId '" 
        + hit.getHITTypeId() + "' here: ");
    System.out.println(service.getWebsiteURL() 
        + "/mturk/preview?groupId=" + hit.getHITTypeId());

    PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("hitid.txt", append))); //Should hopefully append the hit id.
    writer.println(hit.getHITId() + " " + service.getWebsiteURL() + "/mturk/preview?groupId=" + hit.getHITTypeId());
    writer.close();

  } catch (Exception e) {
    System.err.println(e.getLocalizedMessage());
  }
}
 
开发者ID:depstein,项目名称:mturk-screening-presurvey,代码行数:38,代码来源:FullSurvey.java


示例20: createScreener

import com.amazonaws.mturk.service.axis.RequesterService; //导入依赖的package包/类
public void createScreener() {
  try {

    QualificationRequirement[] requirements = null;
    if(haveQualifications) {
      requirements = new QualificationRequirement[3];
      requirements[0] = new QualificationRequirement(RequesterService.APPROVAL_RATE_QUALIFICATION_TYPE_ID, Comparator.GreaterThanOrEqualTo, 95, null, invisible); //>=95% approval
      requirements[1] = new QualificationRequirement("00000000000000000040", Comparator.GreaterThanOrEqualTo, 1000, null, invisible); //>=1000 HITs
      requirements[2] = new QualificationRequirement(RequesterService.LOCALE_QUALIFICATION_TYPE_ID, Comparator.EqualTo, null, new Locale("US"), invisible); //USA! USA!
    }

    String[] responseGroup = new String[]{"Minimal"};

    HITQuestion question = new HITQuestion("screenerquestion.xml");

    String hitType = service.registerHITType(autoApprovalDelay, assignmentDuration, reward, title, keywords, description, requirements);

    HIT hit = service.createHIT(hitType, title, description, keywords, question.getQuestion(), reward, assignmentDuration, autoApprovalDelay, lifetime, numAssignments, annotation, requirements, responseGroup);

    System.out.println("Created HIT: " + hit.getHITId());

    System.out.println("You may see your HIT with HITTypeId '" 
        + hit.getHITTypeId() + "' here: ");
    System.out.println(service.getWebsiteURL() + "/mturk/preview?groupId=" + hit.getHITTypeId());

    PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("hitid.txt", append))); //Should hopefully append the hit id.
    writer.println(hit.getHITId() + " " + service.getWebsiteURL() + "/mturk/preview?groupId=" + hit.getHITTypeId());
    writer.close();

  } catch (Exception e) {
    System.err.println(e.getLocalizedMessage());
  }
}
 
开发者ID:depstein,项目名称:mturk-screening-presurvey,代码行数:34,代码来源:ScreenerQuestion.java



注:本文中的com.amazonaws.mturk.service.axis.RequesterService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientCallBridge类代码示例发布时间:2022-05-23
下一篇:
Java NaccacheSternPrivateKeyParameters类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap