Package org.sonatype.plexus.rest.representation

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


    ldapServerLoginTestRequest.getData().getConfiguration().setUserAndGroupConfig(userGroupConf);

    ldapServerLoginTestRequest.getData().setUsername(encodeBase64("brianf"));
    ldapServerLoginTestRequest.getData().setPassword(encodeBase64("brianf123"));

    XStreamRepresentation repr =
        new XStreamRepresentation(this.getXMLXStream(), this.getXMLXStream().toXML(ldapServerLoginTestRequest),
            MediaType.APPLICATION_XML);

    RequestFacade.doPut(RequestFacade.SERVICE_LOCAL + "ldap/logintest", repr, respondsWithStatusCode(204));
  }
View Full Code Here


    try {
      response = RequestFacade.sendMessage(
          RequestFacade.SERVICE_LOCAL + "ldap/logintest"
              + (sendServerId ? "?ldapServerId=" + ldapServer.getId() : ""),
          Method.PUT,
          new XStreamRepresentation(xstream, xstream.toXML(resourceRequest), MediaType.APPLICATION_XML));

      if (response.getStatus().getCode() == 400) {
        final ErrorResponse errorResponse = this.getFromResponse(ErrorResponse.class, xstream, response);
        assertThat(errorResponse, is(notNullValue()));
View Full Code Here

    try {
      response = RequestFacade.sendMessage(
          RequestFacade.SERVICE_LOCAL + "ldap/test_user_conf"
              + (sendServerId ? "?ldapServerId=" + ldapServer.getId() : ""),
          Method.PUT,
          new XStreamRepresentation(xstream, xstream.toXML(resourceRequest), MediaType.APPLICATION_XML));

      if (response.getStatus().getCode() == 400) {
        final ErrorResponse errorResponse = this.getFromResponse(ErrorResponse.class, xstream, response);
        assertThat(errorResponse, is(notNullValue()));
View Full Code Here

    try {
      response = RequestFacade.sendMessage(
          RequestFacade.SERVICE_LOCAL + "ldap/test_auth"
              + (sendServerId ? "?ldapServerId=" + ldapServer.getId() : ""),
          Method.PUT,
          new XStreamRepresentation(xstream, xstream.toXML(resourceRequest), MediaType.APPLICATION_XML));

      if (response.getStatus().getCode() == 400) {
        final ErrorResponse errorResponse = this.getFromResponse(ErrorResponse.class, xstream, response);
        assertThat(errorResponse, is(notNullValue()));
View Full Code Here

    Response response = null;
    try {
      response = RequestFacade.sendMessage(
          RequestFacade.SERVICE_LOCAL + "user_search/LDAP",
          Method.PUT,
          new XStreamRepresentation(xstream, xstream.toXML(resourceRequest), MediaType.APPLICATION_XML));

      assertThat(response.getStatus().getCode(), is(200));

      final PlexusUserListResourceResponse userList = this.getFromResponse(
          PlexusUserListResourceResponse.class, xstream, response
View Full Code Here

    Response response = null;
    try {
      response = RequestFacade.sendMessage(
          RequestFacade.SERVICE_LOCAL + "ldap/servers",
          Method.POST,
          new XStreamRepresentation(xstream, xstream.toXML(serverRequest), MediaType.APPLICATION_XML));

      Assert.assertEquals(
          "Expected status 201, found: " + response.getStatus(),
          201,
          response.getStatus().getCode());
View Full Code Here

    Response response = null;
    try {
      response = RequestFacade.sendMessage(
          RequestFacade.SERVICE_LOCAL + "ldap/servers",
          Method.POST,
          new XStreamRepresentation(xstream, xstream.toXML(serverRequest), MediaType.APPLICATION_XML));

      Assert
          .assertEquals("Expected status 200, found: " + response.getStatus(), 400, response.getStatus().getCode());
      String responseText = response.getEntity().getText();
      Assert.assertTrue(
View Full Code Here

    serverRequest.getData().getUserAndGroupConfig().setLdapFilter(ldapFilter);

    XStream xstream = this.getXMLXStream();
    String responseText = RequestFacade.doPutForText(
        RequestFacade.SERVICE_LOCAL + "ldap/test_user_conf",
        new XStreamRepresentation(xstream, xstream.toXML(serverRequest), MediaType.APPLICATION_XML),
        respondsWithStatusCode(200));

    return this.getFromResponse(LdapUserListResponse.class, xstream, responseText).getData();
  }
View Full Code Here

   */
  public Response sendMessage(Method method, RepositoryTargetResource resource)
      throws IOException
  {

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

    String repoTargetId = (resource.getId() == null) ? "?undefined" : "/" + resource.getId();

    String serviceURI = "service/local/repo_targets" + repoTargetId;

    RepositoryTargetResourceResponse requestResponse = new RepositoryTargetResourceResponse();
    requestResponse.setData(resource);
    // now set the payload
    representation.setPayload(requestResponse);

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

  {

    String responseText = RequestFacade.doGetForText("service/local/repo_targets");
    LOG.debug("responseText: \n" + responseText);

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

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

    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.