Examples of XStreamRepresentation


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

    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

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

    XStream xstream = XStreamFactory.getXmlXStream();

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

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

    assertThat("without index downloaded root node does not have children", resourceResponse.getData().getChildren(),
        is(nullValue()));

    // I changed my mind, I do wanna remote index
View Full Code Here

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

      throws IOException
  {
    ScheduledServiceResourceResponse request = new ScheduledServiceResourceResponse();
    request.setData(task);

    XStreamRepresentation representation = new XStreamRepresentation(xstream, "", MediaType.APPLICATION_XML);
    representation.setPayload(request);

    String serviceURI = "service/local/schedules";
    Matcher<Response> responseMatcher = allOf(matchers);
    return nexusRestClient.doPostForStatus(serviceURI, representation, responseMatcher);
  }
View Full Code Here

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

  private List<ScheduledServiceListResource> getTaskRequest(String uri)
      throws IOException
  {
    try {
      String entityText = nexusRestClient.doGetForText(uri, isSuccessful());
      XStreamRepresentation representation =
          new XStreamRepresentation(xstream, entityText, MediaType.APPLICATION_XML);

      ScheduledServiceListResourceResponse scheduleResponse =
          (ScheduledServiceListResourceResponse) representation.getPayload(
              new ScheduledServiceListResourceResponse());

      return scheduleResponse.getData();
    }
    catch (AssertionError e) {
View Full Code Here

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

      throws IOException
  {
    ScheduledServiceResourceResponse request = new ScheduledServiceResourceResponse();
    request.setData(task);

    XStreamRepresentation representation = new XStreamRepresentation(xstream, "", MediaType.APPLICATION_XML);
    representation.setPayload(request);

    String serviceURI = "service/local/schedules/" + task.getId();
    Matcher<Response> matcher = allOf(matchers);
    return nexusRestClient.doPutForStatus(serviceURI, representation, matcher);
  }
View Full Code Here

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

   */
  private Response sendMessage(Method method, RoleResource resource, String id)
      throws IOException
  {

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

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

    String serviceURI = "service/local/roles" + roleId;

    if (method == Method.POST || method == Method.PUT) {
      RoleResourceRequest userRequest = new RoleResourceRequest();
      userRequest.setData(resource);

      // now set the payload
      representation.setPayload(userRequest);
    }

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

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

    }
    finally {
      RequestFacade.releaseResponse(response);
    }

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

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

    return resourceResponse.getData();

  }
View Full Code Here

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

  }

  public RoleResource getResourceFromResponse(String responseString)
      throws IOException
  {
    XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType);
    RoleResourceRequest roleResourceRequest =
        (RoleResourceRequest) representation.getPayload(new RoleResourceRequest());

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

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

      throws IOException
  {
    RoleResourceRequest request = new RoleResourceRequest();
    request.setData(role);

    XStreamRepresentation representation = new XStreamRepresentation(xStream, "", MediaType.APPLICATION_XML);
    representation.setPayload(request);

    String serviceURI = "service/local/roles/" + role.getId();
    return RequestFacade.doPutForStatus(serviceURI, representation, isSuccessful());
  }
View Full Code Here

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

  }

  public Object parseResponseText(String responseString, Object responseType)
      throws IOException
  {
    XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType);

    return representation.getPayload(responseType);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.