コード例 #1
0
  @Ignore
  public void testSetMember() throws Exception {
    final String Path = "/members";
    ClientRequest webResource = new ClientRequest(BASE_URI + Path);

    ClientResponse response = null;

    JSONObject json_data = new JSONObject();
    json_data.put("name", "Jose Osuna");
    json_data.put("email", "*****@*****.**");
    json_data.put("phoneNumber", "04149367375");

    System.out.println(json_data);

    ClientRequest resource = webResource;
    resource.formParameter("auth_token", AUTH_TOKEN).formParameter("member", json_data);

    response = resource.post(ClientResponse.class);

    assertTrue(response.getStatus() == HTTP_STATUS_CREATED);
  }
コード例 #2
0
  @Test
  public void testResteasy734() throws Exception {
    ClientRequest request = null;
    ClientResponse<String> response = null;

    request = new ClientRequest("http://localhost:8081/encoded/pathparam/bee bop");
    response = request.get(String.class);
    System.out.println("Received encoded path param: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee%20bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/decoded/pathparam/bee bop");
    response = request.get(String.class);
    System.out.println("Received decoded path param: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/encoded/matrix;m=bee bop");
    response = request.get(String.class);
    System.out.println("Received encoded matrix param: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee%20bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/decoded/matrix;m=bee bop");
    response = request.get(String.class);
    System.out.println("Received decoded matrix param: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/encoded/query?m=bee bop");
    response = request.get(String.class);
    System.out.println("Received encoded query param: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee%20bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/decoded/query?m=bee bop");
    response = request.get(String.class);
    System.out.println("Received decoded query param: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/encoded/form");
    request.formParameter("f", "bee bop");
    response = request.post(String.class);
    System.out.println("Received encoded form param: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee%20bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/decoded/form");
    request.formParameter("f", "bee bop");
    response = request.post(String.class);
    System.out.println("Received decoded form param: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/encoded/segment/bee bop");
    response = request.get(String.class);
    System.out.println("Received encoded path param from segment: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee%20bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/decoded/segment/bee bop");
    response = request.get(String.class);
    System.out.println("Received decoded path param from segment: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/encoded/segment/matrix/params;m=bee bop");
    response = request.get(String.class);
    System.out.println("Received encoded matrix param from segment: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee%20bop", response.getEntity());

    request = new ClientRequest("http://localhost:8081/decoded/segment/matrix/params;m=bee bop");
    response = request.get(String.class);
    System.out.println("Received decoded matrix param from segment: " + response.getEntity());
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("bee bop", response.getEntity());
  }