Package org.sonatype.plexus.rest.representation

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


      else {
        resource.setProviderRole(Repository.class.getName());
      }
    }

    XStreamRepresentation representation = new XStreamRepresentation(xstream, "", mediaType);

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

    String serviceURI = SERVICE_PART + idPart;

    RepositoryResourceResponse repoResponseRequest = new RepositoryResourceResponse();
    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);

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

    return resourceResponse.getData();

  }
View Full Code Here

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

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

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

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

      throws IOException
  {
    String responseString = response.getEntity().getText();
    LOG.debug(" getRepositoryBaseResourceFromResponse: " + responseString);

    XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType);
    RepositoryResourceResponse resourceResponse =
        (RepositoryResourceResponse) representation.getPayload(new RepositoryResourceResponse());

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

    }
    finally {
      nexusRestClient.releaseResponse(response);
    }

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

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

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

  public void updateStatus(RepositoryStatusResource repoStatus)
      throws IOException
  {
    String uriPart = SERVICE_PART + "/" + repoStatus.getId() + "/status";

    XStreamRepresentation representation = new XStreamRepresentation(xstream, "", MediaType.APPLICATION_XML);
    RepositoryStatusResourceResponse resourceResponse = new RepositoryStatusResourceResponse();
    resourceResponse.setData(repoStatus);
    representation.setPayload(resourceResponse);

    Response response = null;
    final String responseText;
    try {
      response = nexusRestClient.sendMessage(uriPart, Method.PUT, representation);
      responseText = response.getEntity().getText();
      assertThat("Fail to update '" + repoStatus.getId() + "' repository status " + response.getStatus()
          + "\nResponse:\n"
          + responseText + "\nrepresentation:\n" + representation.getText(), response,
          isSuccessful());
    }
    finally {
      nexusRestClient.releaseResponse(response);
    }
View Full Code Here

  {
    String serviceURI = "service/local/repositories/" + repoId + "/index_content/";

    String responseText = nexusRestClient.doGetForText(serviceURI);

    XStreamRepresentation re =
        new XStreamRepresentation(XStreamFactory.getXmlXStream(), responseText, MediaType.APPLICATION_XML);
    return (ContentListResourceResponse) re.getPayload(new ContentListResourceResponse());
  }
View Full Code Here

  public Response changeStatus(RepositoryStatusResource status)
      throws IOException
  {
    String serviceURI = "service/local/repositories/" + status.getId() + "/status?undefined";

    XStreamRepresentation representation =
        new XStreamRepresentation(XStreamFactory.getXmlXStream(), "", MediaType.APPLICATION_XML);
    RepositoryStatusResourceResponse request = new RepositoryStatusResourceResponse();
    request.setData(status);
    representation.setPayload(request);

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

    if (response.getStatus().isError()) {
      Assert.fail(response.getStatus() + "\n" + responseText);
    }

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

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

    AuthenticationLoginResource resource = resourceResponse.getData();

    return resource.getClientPermissions().getPermissions();
  }
View Full Code Here

    XStream xstream = XStreamFactory.getXmlXStream();

    xstream.processAnnotations(IndexBrowserTreeNode.class);
    xstream.processAnnotations(IndexBrowserTreeViewResponseDTO.class);

    XStreamRepresentation re = new XStreamRepresentation(xstream, responseText, MediaType.APPLICATION_XML);
    IndexBrowserTreeViewResponseDTO resourceResponse =
        (IndexBrowserTreeViewResponseDTO) re.getPayload(new IndexBrowserTreeViewResponseDTO());

    IndexBrowserTreeNodeDTO content = resourceResponse.getData();

    for (IndexBrowserTreeNodeDTO child : content.getChildren()) {
      Assert.assertEquals(child.getNodeName(), "nexus1961");
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.