Package org.cloudfoundry.client.lib.util

Examples of org.cloudfoundry.client.lib.util.RestUtil


  private ObjectMapper objectMapper;

  private final Map<URL, Map<String, Object>> infoCache = new HashMap<URL, Map<String, Object>>();

  public CloudControllerClientFactory(HttpProxyConfiguration httpProxyConfiguration, boolean trustSelfSignedCerts) {
    this.restUtil = new RestUtil();
    this.restTemplate = restUtil.createRestTemplate(httpProxyConfiguration, trustSelfSignedCerts);

    this.httpProxyConfiguration = httpProxyConfiguration;
    this.trustSelfSignedCerts = trustSelfSignedCerts;
View Full Code Here


    // When called directly without a proxy, expect an exception to be thrown due to byteman rules
    assertNetworkCallFails(restTemplate, new HttpComponentsClientHttpRequestFactory());
    // Repeat that with different request factory used in the code as this exercises different byteman rules
    assertNetworkCallFails(restTemplate, new SimpleClientHttpRequestFactory());
    // And with the actual one used by RestUtil, without a proxy configured
    assertNetworkCallFails(restTemplate, new RestUtil().createRequestFactory(null, false));

    // Test with the in-JVM proxy configured
    HttpProxyConfiguration localProxy = new HttpProxyConfiguration("127.0.0.1", inJvmProxyPort);
    ClientHttpRequestFactory requestFactory = new RestUtil().createRequestFactory(localProxy, CCNG_API_SSL);

    restTemplate.setRequestFactory(requestFactory);
    restTemplate.execute(CCNG_API_URL + "/info", HttpMethod.GET, null, null);

    // then executes fine, and the jetty proxy indeed received one request
View Full Code Here

    for (int i = 0; i < 100 && app.getRunningInstances() < 1; i++) {
      Thread.sleep(1000);
      app = connectedClient.getApplication(appName);
    }
    assertEquals(1, app.getRunningInstances());
    RestUtil restUtil = new RestUtil();
    RestTemplate rest = restUtil.createRestTemplate(httpProxyConfiguration, false);
    String results = rest.getForObject("http://" + app.getUris().get(0), String.class);
    assertTrue(results.contains("Hello world!"));
  }
View Full Code Here

TOP

Related Classes of org.cloudfoundry.client.lib.util.RestUtil

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.