Package org.sonatype.plexus.rest.representation

Examples of org.sonatype.plexus.rest.representation.XStreamRepresentation


    String responeText = response.getEntity().getText();
    Assert.assertTrue(
        "Expected sucess: Status was: " + response.getStatus() + "\nResponse:\n" + responeText,
        response.getStatus().isSuccess());

    XStreamRepresentation representation = new XStreamRepresentation(this.xstream, responeText, this.mediaType);
    ContentListResourceResponse listRepsonse = (ContentListResourceResponse) representation
        .getPayload(new ContentListResourceResponse());

    return listRepsonse.getData();

  }
View Full Code Here


  }

  public RepositoryGroupResource createGroup(final RepositoryGroupResource group)
      throws IOException
  {
    XStreamRepresentation representation = request(group);

    String payload = nexusRestClient.doPostForText(SERVICE_PART, representation, isSuccessful());

    return response(payload);
  }
View Full Code Here

  }

  public RepositoryGroupResource updateGroup(final RepositoryGroupResource group)
      throws IOException
  {
    XStreamRepresentation representation = request(group);

    String payload = nexusRestClient.doPutForText(SERVICE_PART + "/" + group.getId(), representation,
        isSuccessful());

    return response(payload);
View Full Code Here

    return response(payload);
  }

  private RepositoryGroupResource response(final String payload) {
    XStreamRepresentation representation = representation();

    representation.setText(payload);

    RepositoryGroupResourceResponse resourceResponse =
        (RepositoryGroupResourceResponse) representation.getPayload(new RepositoryGroupResourceResponse());

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

    return resourceResponse.getData();
  }

  private XStreamRepresentation request(final RepositoryGroupResource group) {
    XStreamRepresentation representation = representation();

    RepositoryGroupResourceResponse request = new RepositoryGroupResourceResponse();
    request.setData(group);
    representation.setPayload(request);
    return representation;
  }
View Full Code Here

    representation.setPayload(request);
    return representation;
  }

  private XStreamRepresentation representation() {
    return new XStreamRepresentation(xstream, "", mediaType);
  }
View Full Code Here

  {
    String responseText = nexusRestClient.doGetForText(SERVICE_PART + "/" + groupId);
    LOG.debug("responseText: \n" + responseText);

    // this should use call to: getResourceFromResponse
    XStreamRepresentation representation =
        new XStreamRepresentation(XStreamFactory.getXmlXStream(), responseText, MediaType.APPLICATION_XML);

    RepositoryGroupResourceResponse resourceResponse =
        (RepositoryGroupResourceResponse) representation.getPayload(new RepositoryGroupResourceResponse());

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

   * IMPORTANT: Make sure to release the Response in a finally block when you are done with it.
   */
  public Response sendMessage(Method method, RepositoryGroupResource resource, String id)
      throws IOException
  {
    XStreamRepresentation representation = new XStreamRepresentation(xstream, "", mediaType);

    String idPart = (method == Method.POST) ? "" : "/" + id;
    String serviceURI = SERVICE_PART + idPart;

    RepositoryGroupResourceResponse repoResponseRequest = new RepositoryGroupResourceResponse();
    repoResponseRequest.setData(resource);

    // now set the payload
    representation.setPayload(repoResponseRequest);

    LOG.debug("sendMessage: " + representation.getText());

    return nexusRestClient.sendMessage(serviceURI, method, representation);
  }
View Full Code Here

      throws IOException
  {
    String responseText = nexusRestClient.doGetForText(SERVICE_PART);
    LOG.debug("responseText: \n" + responseText);

    XStreamRepresentation representation =
        new XStreamRepresentation(XStreamFactory.getXmlXStream(), responseText, MediaType.APPLICATION_XML);

    RepositoryGroupListResourceResponse resourceResponse =
        (RepositoryGroupListResourceResponse) representation.getPayload(new RepositoryGroupListResourceResponse());

    return resourceResponse.getData();

  }
View Full Code Here

    // accepted return codes: OK or redirect
    final String responseText = nexusRestClient.doGetForText(SERVICE_PART + "/" + repoId, not(inError()));
    LOG.debug("responseText: \n" + responseText);

    // this should use call to: getResourceFromResponse
    XStreamRepresentation representation =
        new XStreamRepresentation(XStreamFactory.getXmlXStream(), responseText, MediaType.APPLICATION_XML);

    RepositoryResourceResponse resourceResponse =
        (RepositoryResourceResponse) representation.getPayload(new RepositoryResourceResponse());

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

TOP

Related Classes of org.sonatype.plexus.rest.representation.XStreamRepresentation

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.