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()); }
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(); }
@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(); }
@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); }
@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()); }