Package com.openshift.internal.client.httpclient.request

Examples of com.openshift.internal.client.httpclient.request.FormUrlEncodedMediaType


    }
    try {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      out.write(url.getBytes());
      out.write(IHttpClient.QUESTION_MARK);
      new FormUrlEncodedMediaType().writeTo(new ParameterValueMap(urlParameters), out);
      return out.toString();
    } catch (IOException e) {
      throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
    } catch (EncodingException e) {
      throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
View Full Code Here


    }
    try {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      out.write(url.getBytes());
      out.write(IHttpClient.QUESTION_MARK);
      new FormUrlEncodedMediaType().writeTo(new ParameterValueMap(urlParameters), out);
      return out.toString();
    } catch (IOException e) {
      throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
    } catch (EncodingException e) {
      throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
View Full Code Here

    assertThat(response).isEqualTo("");
  }

  @Test
  public void canPost() throws Throwable {
    String response = httpClient.post(serverFake.getUrl(), new FormUrlEncodedMediaType(), IHttpClient.NO_TIMEOUT);
    assertThat(response).startsWith("POST");
  }
View Full Code Here

  }

  @Test
  public void canPut() throws SocketTimeoutException, HttpClientException, MalformedURLException,
      EncodingException {
    String response = httpClient.put(serverFake.getUrl(), new FormUrlEncodedMediaType(), IHttpClient.NO_TIMEOUT);
    assertThat(response).startsWith("PUT");
  }
View Full Code Here

    assertThat(response).startsWith("DELETE");
  }

  @Test
  public void canPatch() throws Throwable {
    String response = httpClient.patch(serverFake.getUrl(), new FormUrlEncodedMediaType(), IHttpClient.NO_TIMEOUT);
    assertThat(response).startsWith("POST");
    assertTrue(response.contains("X-Http-Method-Override: PATCH"));
  }
View Full Code Here

      OpenShiftException {
    // pre-conditions
    IHttpClient httpClient = new PayLoadReturningHttpClientFake(IHttpClient.MEDIATYPE_APPLICATION_JSON, "1.0");
    // operation
    String response = httpClient.post(serverFake.getUrl(),
        new FormUrlEncodedMediaType(),
        IHttpClient.NO_TIMEOUT,
        new StringParameter("adietish", "redhat"),
        new StringParameter("xcoulon", "redhat"));

    // verification
View Full Code Here

    assertThat(timeout).isLessThan(IHttpClient.DEFAULT_READ_TIMEOUT);
    WaitingHttpServerFake serverFake = startWaitingHttpServerFake(serverDelay);
    long startTime = System.currentTimeMillis();
    // operations
    try {
      httpClient.post(serverFake.getUrl(), new FormUrlEncodedMediaType(), timeout);
      fail("Timeout expected.");
    } catch (SocketTimeoutException e) {
      // assert
      assertThat(System.currentTimeMillis() - startTime).isGreaterThan(timeout)
          .isLessThan(serverDelay)
View Full Code Here

    assertThat(timeout).isLessThan(IHttpClient.DEFAULT_READ_TIMEOUT);
    WaitingHttpServerFake serverFake = startWaitingHttpServerFake(serverDelay);
    long startTime = System.currentTimeMillis();
    // operations
    try {
      httpClient.put(serverFake.getUrl(), new FormUrlEncodedMediaType(), timeout);
      fail("Timeout expected.");
    } catch (SocketTimeoutException e) {
      // assert
      assertThat(System.currentTimeMillis() - startTime).isGreaterThan(timeout)
          .isLessThan(serverDelay)
View Full Code Here

TOP

Related Classes of com.openshift.internal.client.httpclient.request.FormUrlEncodedMediaType

Copyright © 2018 www.massapicom. 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.