Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.WebResource.type()


   
    ArrayShip arrayShip = new ArrayShip();
    arrayShip.setShips(ships);

   
    r.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, arrayShip);
  }
 
  public void shotTest() {
   
    Client c = Client.create();
View Full Code Here


   
    Shot shot = new Shot();
    shot.setX(1);
    shot.setY(1);
   
    r.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, shot);

  }     

 
  public void configure1Test() {
View Full Code Here

    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);

  }
 
  @Test public void configure2Test() {
   
View Full Code Here

    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);

  }

  @Test public void shot1Test() {
   
View Full Code Here

   
    Shot shot = new Shot();
    shot.setX(1);
    shot.setY(1);
   
    r.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, shot);

  }     

 
}
View Full Code Here

    RegistrationResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/register/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
      .post(RegistrationResponse.class, createDummyJSONRegister());
    LOG.info("Returned from Server responce=" + response);
    Assert.assertEquals(response.getResponseStatus(), RegistrationStatus.OK);
  }
View Full Code Here

    HeartBeatResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/heartbeat/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(HeartBeatResponse.class, createDummyHeartBeat());
    LOG.info("Returned from Server: "
        + " response=" +   response);
    Assert.assertEquals(response.getResponseId(), 0L);
  }
View Full Code Here

    RegistrationResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/register/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(RegistrationResponse.class, createDummyJSONRegister());
    LOG.info("Returned from Server responce=" + response);
    Assert.assertEquals(response.getResponseStatus(), RegistrationStatus.OK);
  }
View Full Code Here

    HeartBeatResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/heartbeat/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(HeartBeatResponse.class, createDummyHeartBeat());
    LOG.info("Returned from Server: "
        + " response=" + response);
    Assert.assertEquals(response.getResponseId(), 0L);
  }
View Full Code Here

    HeartBeatResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/heartbeat/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(HeartBeatResponse.class, createDummyHeartBeatWithAgentEnv());
    LOG.info("Returned from Server: "
        + " response=" + response);
    Assert.assertEquals(response.getResponseId(), 0L);
  }
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.