public LdapUserAndGroupConfigurationDTO getResourceFromResponse(Response response)
      throws IOException {
    String responseString = response.getEntity().getText();
    LOG.debug(" getResourceFromResponse: " + responseString);

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

    return resourceResponse.getData();
  }
  public Response sendMessage(Method method, LdapUserAndGroupConfigurationDTO resource)
      throws IOException {

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

    String serviceURI = SERVICE_PART;

    LdapUserAndGroupConfigurationResponse repoResponseRequest =
        new LdapUserAndGroupConfigurationResponse();
    repoResponseRequest.setData(resource);

    // now set the payload
    representation.setPayload(repoResponseRequest);

    LOG.debug("sendMessage: " + representation.getText());

    return RequestFacade.sendMessage(serviceURI, method, representation);
  }
Ejemplo n.º 3
0
  @Test
  public void testLdapUserAndGroupConfigurationResponse() throws Exception {
    LdapUserAndGroupConfigurationResponse resource = new LdapUserAndGroupConfigurationResponse();
    LdapUserAndGroupConfigurationDTO dto = new LdapUserAndGroupConfigurationDTO();

    resource.setData(dto);

    dto.setUserMemberOfAttribute("userMemberOfAttribute");
    dto.setEmailAddressAttribute("emailAddressAttribute");
    dto.setGroupBaseDn("groupBaseDn");
    dto.setGroupIdAttribute("groupIdAttribute");
    dto.setGroupMemberFormat("groupMemberFormat");
    dto.setGroupMemberAttribute("groupMemberAttribute");
    dto.setGroupMemberFormat("groupMemberFormat");
    dto.setGroupObjectClass("groupObjectClass");
    dto.setUserBaseDn("userBaseDn");
    dto.setUserIdAttribute("userIdAttribute");
    dto.setUserObjectClass("userObjectClass");
    dto.setUserPasswordAttribute("userPasswordAttribute");
    dto.setUserRealNameAttribute("userRealNameAttribute");
    dto.setUserSubtree(true);

    validateXmlHasNoPackageNames(resource);
  }