コード例 #1
0
  private void resetGame() {
    final Reference reference = new Reference("http://localhost/clue/game");
    reference.setHostPort(port);

    final ClientResource resource = new ClientResource(reference);
    resource.setProtocol(Protocol.HTTP);
    resource.setChallengeResponse(getChallengeResponse());
    resource.delete();
    resource.release();

    assertEquals(324, getRemainingCount());
  }
コード例 #2
0
  private int getRemainingCount() {
    final Reference reference = new Reference("http://localhost/clue/game.json");
    reference.setHostPort(port);

    final ClientResource resource = new ClientResource(reference);
    resource.setProtocol(Protocol.HTTP);
    resource.setChallengeResponse(getChallengeResponse());

    final ClueServerStatus response = resource.get(ClueServerStatus.class);
    resource.release();
    return response.getRemainingTriples().size();
  }
コード例 #3
0
  @Test
  public void testGetProbabilities() throws ResourceException, IOException {
    final Reference reference = new Reference("http://localhost/clue/probability.json");
    reference.setHostPort(port);

    final ClientResource resource = new ClientResource(reference);
    resource.setProtocol(Protocol.HTTP);
    resource.setChallengeResponse(getChallengeResponse());

    System.out.println(resource.get().getText());
    final ProbabilityReport report = resource.get(ProbabilityReport.class);
    System.out.println(report.getMostLikelyRoom().getCardProbability());
    resource.release();
  }
コード例 #4
0
  @Test
  public void testServerGetStatus() throws Exception {
    final Reference reference = new Reference("http://localhost/clue/game.xml");
    reference.setHostPort(port);

    final ClientResource resource = new ClientResource(reference);
    resource.setProtocol(Protocol.HTTP);
    resource.setChallengeResponse(getChallengeResponse());

    final ClueServerStatus response = resource.get(ClueServerStatus.class);
    resource.release();

    assertNotNull(response);
  }
コード例 #5
0
  @Test
  public void testRemainingTriples() {
    final Reference reference = new Reference("http://localhost/clue/triples/remaining.json");
    reference.setHostPort(port);

    final ClientResource resource = new ClientResource(reference);
    resource.setProtocol(Protocol.HTTP);
    resource.setChallengeResponse(getChallengeResponse());

    final TripleList response = resource.get(TripleList.class);
    resource.release();

    assertNotNull(response);
    assertEquals(324, response.size());
  }