Package com.openshift.internal.client.response

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


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


        } catch (UnauthorizedException e) {
            throw new InvalidCredentialsOpenShiftException(url, e, getRestResponse(e));
        } catch (NotFoundException e) {
            throw new NotFoundOpenShiftException(url, e, getRestResponse(e));
        } catch (HttpClientException e) {
          RestResponse restResponse = getRestResponse(e);
          String message = getMessage(restResponse, e);
      throw new OpenShiftEndpointException(
          url.toString(), e, restResponse, "Could not request {0}: {1}", url, message);
        } catch (SocketTimeoutException e) {
            throw new OpenShiftTimeoutException(url, e,
View Full Code Here

*/
public abstract class AbstractOpenShiftConnectionFactory {
 
  @SuppressWarnings("unchecked")
  protected IOpenShiftConnection getConnection(IRestService service, final String login, final String password) 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, service, (Map<String, Link>) response.getData());
  }
View Full Code Here

    }
  }

  private String getResponseMessage(HttpClientException clientException) {
    try {
      RestResponse restResponse = ResourceDTOFactory.get(clientException.getMessage());
      if (restResponse == null) {
        return null;
      }
      StringBuilder builder = new StringBuilder();
      for (Message message : restResponse.getMessages().getAll()) {
        builder.append(message.getText()).append('\n');         
      }
      return builder.toString();
    } catch (OpenShiftException e) {
      // unexpected json content
View Full Code Here

    if (link == null) {
      throw new OpenShiftException("Could not request resource, no link present");
    }
    // avoid concurrency issues, to prevent reading the links map while it
    // is still being retrieved
    final RestResponse response = resource.getService().request(link, parameters);
    if(response != null) {
      return response.getData();
    }
    return null;
  }
View Full Code Here

*/
public abstract class AbstractOpenShiftConnectionFactory {
 
  @SuppressWarnings("unchecked")
  protected IOpenShiftConnection getConnection(IRestService service, final String login, final String password) throws FileNotFoundException, IOException, OpenShiftException {
    RestResponse response =
        (RestResponse) service.request(new Link("Get API", "/api", HttpMethod.GET));
    return new APIResource(login, password, service, (Map<String, Link>) response.getData());
  }
View Full Code Here

      this.linkName = linkName;
    }

    protected <DTO> DTO execute(ServiceParameter... parameters) throws OpenShiftException {
      Link link = getLink(linkName);
      RestResponse response = getService().request(link, parameters);
     
      // in some cases, there is not response body, just a return code to
      // indicate that the operation was successful (e.g.: delete domain)
      if (response == null) {
        return null;
      }
           
      return response.getData();
    }
View Full Code Here

        } catch (UnauthorizedException e) {
            throw new InvalidCredentialsOpenShiftException(url, e, getRestResponse(e));
        } catch (NotFoundException e) {
            throw new NotFoundOpenShiftException(url, e, getRestResponse(e));
        } catch (HttpClientException e) {
          RestResponse restResponse = getRestResponse(e);
          String message = getMessage(restResponse, e);
      throw new OpenShiftEndpointException(
          url.toString(), e, restResponse, "Could not request {0}: {1}", url, message);
        } catch (SocketTimeoutException e) {
            throw new OpenShiftTimeoutException(url, e,
View Full Code Here

    return quickstartDTOs.get(0).getCartridges();
  }

  public static List<QuickstartDTO> getQuickstartDTOs(String quickstartsJson) {
    RestResponse restResponse = new QuickstartJsonDTOFactory().get(quickstartsJson);

    assertThat(restResponse).isNotNull();
    assertThat(restResponse.getData()).isInstanceOf(List.class);

    return restResponse.getData();
  }
View Full Code Here

      service.request(new TestLink("0 require parameter", "/broker/rest/domains", HttpMethod.POST),
          IHttpClient.NO_TIMEOUT, Collections.<Parameter> emptyList(), Collections.<Parameter> emptyList());
      // verifications
      fail("OpenShiftEndPointException expected, did not occurr");
    } catch (OpenShiftEndpointException e) {
      RestResponse restResponse = e.getRestResponse();
      assertThat(restResponse).isNotNull();
      assertThat(restResponse.getMessages().size()).isEqualTo(1);
      Message message = restResponse.getMessages().getAll().iterator().next();
      assertThat(new MessageAssert(message))
          .hasText("Namespace 'foobar' is already in use. Please choose another.")
          .hasSeverity(Severity.ERROR)
          .hasExitCode(103)
          .hasField(new Field("id"));
View Full Code Here

TOP

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

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.