示例#1
0
  @Test
  public void testPutChangeConfig() throws Exception {
    // the test config starts off being setup for simple auth scheme, this test will update it for
    // DIGEST-MD5
    PlexusResource resource = getResource();

    LdapConnectionInfoResponse response = new LdapConnectionInfoResponse();
    LdapConnectionInfoDTO connectionInfo = new LdapConnectionInfoDTO();
    response.setData(connectionInfo);
    connectionInfo.setHost("localhost");
    connectionInfo.setPort(this.getLdapPort());
    connectionInfo.setSearchBase("o=sonatype");
    connectionInfo.setSystemPassword("secret");
    connectionInfo.setSystemUsername("admin");
    connectionInfo.setProtocol("ldap");
    connectionInfo.setAuthScheme("DIGEST-MD5");
    connectionInfo.setRealm("localhost");

    LdapConnectionInfoResponse result =
        (LdapConnectionInfoResponse) resource.put(null, null, null, response);
    this.validateConnectionDTO(connectionInfo, result.getData());

    // now how about that get
    result = (LdapConnectionInfoResponse) resource.get(null, null, null, null);
    this.validateConnectionDTO(connectionInfo, result.getData());
  }
  @Test
  public void testLdapConnectionInfoResponse() throws Exception {
    LdapConnectionInfoResponse resource = new LdapConnectionInfoResponse();
    LdapConnectionInfoDTO dto = new LdapConnectionInfoDTO();

    resource.setData(dto);

    dto.setAuthScheme("authScheme");
    dto.setHost("host");
    dto.setPort(123);
    dto.setProtocol("protocol");
    dto.setRealm("realm");
    dto.setSearchBase("searchBase");
    dto.setSystemPassword("systemPassword");
    dto.setSystemUsername("systemUsername");

    validateXmlHasNoPackageNames(resource);
  }