Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.Client.resource()


  }
 
  public void joinGame() {
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/server/join/1903/2");
      
    String result = r.accept(MediaType.APPLICATION_JSON_TYPE).get(String.class);
    System.out.println(result);
  }
 
View Full Code Here


  }
 
  public void addShipTest() {
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/game/addship/1802");
   
    Ship ship = new Ship();
    ArrayList<Cell> cells = new ArrayList<Cell>();
    ship.setCells(cells);
   
View Full Code Here

  }
 
  public void shotTest() {
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/game/shot/1802");
   
    Shot shot = new Shot();
    shot.setX(1);
    shot.setY(1);
   
View Full Code Here

   
    ArrayShip arrayShip = new ArrayShip();
    arrayShip.setShips(ships);
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/game/addship/2201");

    r.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, arrayShip);

  }
 
View Full Code Here

   
    ArrayShip arrayShip = new ArrayShip();
    arrayShip.setShips(ships);
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/game/addship/2251");

    r.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, arrayShip);

  }
View Full Code Here

  }

  @Test public void shot1Test() {
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/game/shot/2251");
   
    Shot shot = new Shot();
    shot.setX(1);
    shot.setY(1);
   
View Full Code Here

     * deletes the workspace again and ensures it's no longer available.
     */
    public void testCreateAndDestroyRESTSession() throws Exception {
        Client c = Client.create();
        c.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, false);
        WebResource r = c.resource("http://localhost:8080/client/work");
        try {
            r.post(String.class, "");
            fail("We should have been redirected to a new workspace.");
        }
        catch (UniformInterfaceException e) {
View Full Code Here

        }
        catch (UniformInterfaceException e) {
            ClientResponse response = e.getResponse();
            URI location = response.getLocation();
            assertTrue(location.toString().startsWith("http://localhost:8080/client/work/rest-"));
            WebResource r2 = c.resource(location);
            r2.get(String.class);           
            r2.delete();
            try {
                r2.get(String.class);
            }
View Full Code Here

        assertResources(gson, w2, "distribution", 1);
        assertResources(gson, w2, "distribution2target", 1);
        assertResources(gson, w2, "target", 1);
        w2.delete();
       
        WebResource t1versions = c.resource("http://localhost:8080/deployment/t1/versions");
        assertEquals("1.0.0\n", t1versions.get(String.class));
    }

    public void testDeployConfigurationTemplateToTargets() throws Exception {
        try {
View Full Code Here

            // just for debugging
            showLog();
            showBundles();
           
            WebResource t1versions = c.resource("http://localhost:8080/deployment/t4/versions");
            assertEquals("1.0.0\n", t1versions.get(String.class));
        }
        catch (Exception e) {
            showLog();
            throw e;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.