Package com.openshift.internal.client.response

Examples of com.openshift.internal.client.response.Link


  @Test
  public void shouldNotAddEmptyServerAndEmptyServicePath() throws Exception {
    // pre-conditions
    String href = "/adietisheim-redhat";
    Link link = new TestLink("0 require parameter", href, HttpMethod.GET);
    String url = link.getHref(null, null);
    // verifications
    assertThat(url).isEqualTo(href);
  }
View Full Code Here


  @Test
  public void shouldAddParameters() throws Exception {
    // pre-conditions
    String href = "/broker/rest/adietisheim-redhat";
    Link link = new TestLink("0 require parameter", href, HttpMethod.GET);
    // operation
    String url = link.getHref(null, null, new Parameter("include", "cartridges"), new Parameter("exclude",
        "fridges"));
    // verifications
    assertThat(url).isEqualTo(href + "?include=cartridges&exclude=fridges");
  }
View Full Code Here

  @Test
  public void shouldSubstituteUrlVariables() throws Exception {
    // pre-conditions
    String href = "/broker/rest/:company/adietisheim/:language/openshift-java-client";
    Link link = new TestLink("", href, HttpMethod.GET);
    // operation
    String url = link.getHref(null, null, Arrays.<Parameter> asList(
        new StringParameter("company", "redhat"),
        new StringParameter("language", "java")),
        null);
    // verifications
    assertThat(url).isEqualTo("/broker/rest/redhat/adietisheim/java/openshift-java-client");
View Full Code Here

  @Test
  public void shouldNotSubstituteUrlVariables() throws Exception {
    // pre-conditions
    String href = "https://openshift.redhat.com/broker/rest/:company/adietisheim/:oss/openshift-java-client";
    Link link = new TestLink("", href, HttpMethod.GET);
    // operation
    String url = link.getHref(null, null, Arrays.<Parameter> asList(
        new StringParameter("company", "redhat"),
        new StringParameter("cloud", "redhat")),
        null);
    // verifications
    assertThat(url).isEqualTo(
View Full Code Here

  @Test
  public void shouldSubstituteUrlVariablesTwice() throws Exception {
    // pre-conditions
    String href = "https://openshift.redhat.com/broker/rest/:cloud_company/adietisheim/:cloud_company/openshift-java-client";
    Link link = new TestLink("", href, HttpMethod.GET);
    // operation
    String url = link.getHref(null, null,
        Arrays.<Parameter> asList(new StringParameter("cloud_company", "redhat")),
        null);
    // verifications
    assertThat(url).isEqualTo(
        "https://openshift.redhat.com/broker/rest/redhat/adietisheim/redhat/openshift-java-client");
View Full Code Here

    @SuppressWarnings("unchecked")
    protected APIResource getAPIResource(String username, String password, String token, IRestService service) {
      RestResponse response =
          (RestResponse) service.request(
              new Link("Get API", "/api", HttpMethod.GET),
              IHttpClient.NO_TIMEOUT,
              Collections.<Parameter> emptyList(),
              Collections.<Parameter> emptyList());
      return new APIResource(username, password, token, service, (Map<String, Link>) response.getData()) {};
    }
View Full Code Here

 
  @SuppressWarnings("unchecked")
  protected IOpenShiftConnection getConnection(IRestService service, final String login, final String password, final String token) throws IOException, OpenShiftException {
    RestResponse response =
        (RestResponse) service.request(
            new Link("Get API", "/api", HttpMethod.GET),
            IHttpClient.NO_TIMEOUT,
            Collections.<Parameter> emptyList(),
            Collections.<Parameter> emptyList());
    return new APIResource(login, password, token, service, (Map<String, Link>) response.getData());
  }
View Full Code Here

   * @return the link with the given name
   * @throws OpenShiftException
   *             thrown if no link with the given name exists
   */
  protected Link getLink(String linkName) throws OpenShiftException {
    Link link = null;
    if (getLinks() != null) {
      link = getLinks().get(linkName);
    }
    if (link == null) {
      throw new OpenShiftRequestException(
View Full Code Here

TOP

Related Classes of com.openshift.internal.client.response.Link

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.