Package org.sonatype.plexus.rest.representation

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


      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

  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

      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

   */
  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

    }
    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

  }

  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

      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

  }

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

    return representation.getPayload(responseType);
  }
View Full Code Here

      throws IOException
  {

    String entityText = RequestFacade.doGetForText("service/local/users/" + userId);

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

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

    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.