Package org.sonatype.plexus.rest.representation

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


    // use test user
    TestContainer.getInstance().getTestContext().setUsername(TEST_USER_NAME);
    TestContainer.getInstance().getTestContext().setPassword(TEST_USER_PASSWORD);

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

    final String uriPart = RepositoryMessageUtil.SERVICE_PART + "/" + repoId + "/status";
    RequestFacade.doPutForStatus(uriPart, representation, respondsWithStatusCode(403));
  }
View Full Code Here


  public static Status save(final GlobalConfigurationResource globalConfig)
      throws IOException
  {
    Preconditions.checkNotNull(globalConfig);
    final GlobalConfigurationResourceResponse configResponse = wrapData(globalConfig);
    XStreamRepresentation representation = new XStreamRepresentation(xstream, "", MediaType.APPLICATION_XML);
    representation.setPayload(configResponse);
    return RequestFacade.doPutForStatus("service/local/global_settings/current", representation, null);
  }
View Full Code Here

    if (response.getStatus().isSuccess()) {
      String responseText = response.getEntity().getText();

      LOGGER.debug("Response Text: \n" + responseText);

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

      UserAccountRequestResponseWrapper responseDTO = (UserAccountRequestResponseWrapper) representation
          .getPayload(new UserAccountRequestResponseWrapper());

      return responseDTO.getData();
    }
    else {
View Full Code Here

    Assert.assertTrue("Status: " + response.getStatus(), response.getStatus().isSuccess());

    String responseText = response.getEntity().getText();

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

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

    AuthenticationLoginResource resource = resourceResponse.getData();

    return resource.getClientPermissions();
View Full Code Here

  public UserAccount updateAccount(UserAccount dto)
      throws IOException
  {
    String serviceURI = BASE_URL + dto.getUserId();

    XStreamRepresentation representation = new XStreamRepresentation(xmlXstream, "", MediaType.APPLICATION_XML);

    UserAccountRequestResponseWrapper requestDTO = new UserAccountRequestResponseWrapper();

    requestDTO.setData(dto);

    representation.setPayload(requestDTO);

    LOGGER.info("HTTP PUT: '" + serviceURI + "'");

    Response response = RequestFacade.sendMessage(serviceURI, Method.PUT, representation);
View Full Code Here

    resource.setNewPassword(newPassword);

    UserChangePasswordRequest request = new UserChangePasswordRequest();
    request.setData(resource);

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

    return RequestFacade.doPostForStatus(serviceURI, representation);

  }
View Full Code Here

    resource.setNewPassword(newPassword);

    UserChangePasswordRequest request = new UserChangePasswordRequest();
    request.setData(resource);

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

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

  public PrivilegeStatusResource getResourceFromResponse(Response response)
      throws IOException
  {
    String responseString = response.getEntity().getText();

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

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

    return resourceResponse.getData();

  }
View Full Code Here

  public List<PrivilegeStatusResource> getResourceListFromResponse(Response response)
      throws IOException
  {
    String responseString = response.getEntity().getText();

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

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

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

  public void testNoScheduledService()
      throws Exception
  {
    String jsonString =
        "{\"data\":{\"id\":null,\"name\":\"test\",\"typeId\":\"Synchronize Repositories\",\"schedule\":\"none\"}}}";
    XStreamRepresentation representation =
        new XStreamRepresentation(xstream, jsonString, MediaType.APPLICATION_JSON);

    ScheduledServiceResourceResponse response =
        (ScheduledServiceResourceResponse) representation.getPayload(new ScheduledServiceResourceResponse());

    assert response.getData().getId() == null;
    assert response.getData().getName().equals("test");
    assert response.getData().getTypeId().equals("Synchronize Repositories");
    assert response.getData().getSchedule().equals("none");
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.