Package org.sonatype.plexus.rest.resource

Examples of org.sonatype.plexus.rest.resource.PlexusResource


  @Test
  public void testModifiable()
      throws Exception
  {
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapServerLoginTestPlexusResource");
    Assert.assertTrue(pr.isModifiable());
  }
View Full Code Here


  @Test
  public void testReadable()
      throws Exception
  {
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapServerLoginTestPlexusResource");
    Assert.assertFalse(pr.isReadable());
  }
View Full Code Here

        encodeBase64("JUNK")
    );

    Request request = this.buildRequest();
    Response response = new Response(request);
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapServerLoginTestPlexusResource");

    try {
      pr.put(null, request, response, ldapServerLoginTestRequest);
      Assert.fail("expected ResourceException");
    }
    catch (ResourceException e) {
      Assert.assertEquals(400, e.getStatus().getCode());
    }
View Full Code Here

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

    Request request = this.buildRequest();
    Response response = new Response(request);
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapServerLoginTestPlexusResource");

    try {
      pr.put(null, request, response, ldapServerLoginTestRequest);
      Assert.fail("expected ResourceException");
    }
    catch (ResourceException e) {
      Assert.assertEquals(400, e.getStatus().getCode());
    }
View Full Code Here

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

    Request request = this.buildRequest();
    Response response = new Response(request);
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapServerLoginTestPlexusResource");

    pr.put(null, request, response, ldapServerLoginTestRequest);

    Assert.assertEquals(204, response.getStatus().getCode());
  }
View Full Code Here

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

    Request request = this.buildRequest();
    Response response = new Response(request);
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapServerLoginTestPlexusResource");

    pr.put(null, request, response, ldapServerLoginTestRequest);

    Assert.assertEquals(204, response.getStatus().getCode());
  }
View Full Code Here

  @Test
  public void testModifiable()
      throws Exception
  {
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapUserAndGroupConfigTestPlexusResource");
    Assert.assertTrue(pr.isModifiable());
  }
View Full Code Here

  @Test
  public void testSuccess()
      throws Exception
  {
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapUserAndGroupConfigTestPlexusResource");

    LdapServerRequest ldapServerRequest = new LdapServerRequest();
    ldapServerRequest.setData(new LdapServerConfigurationDTO());

    ldapServerRequest.getData().setName("testSuccess");

    LdapConnectionInfoDTO connDto = new LdapConnectionInfoDTO();
    ldapServerRequest.getData().setConnectionInfo(connDto);
    connDto.setAuthScheme("simple");
    connDto.setHost("localhost");
    connDto.setPort(this.getLdapServer("default").getPort());
    connDto.setProtocol("ldap");
    connDto.setSystemPassword(encodeBase64("secret"));
    connDto.setSystemUsername(encodeBase64("uid=admin,ou=system"));
    connDto.setSearchBase("o=sonatype");

    LdapUserAndGroupAuthConfigurationDTO userGroupDto = new LdapUserAndGroupAuthConfigurationDTO();
    ldapServerRequest.getData().setUserAndGroupConfig(userGroupDto);

    userGroupDto.setGroupMemberFormat("cn=${username},ou=groups,o=sonatype");
    userGroupDto.setGroupObjectClass("organizationalRole");
    userGroupDto.setGroupBaseDn("ou=groups");
    userGroupDto.setGroupIdAttribute("cn");
    userGroupDto.setGroupMemberAttribute("uniqueMember");
    userGroupDto.setUserObjectClass("inetOrgPerson");
    userGroupDto.setUserBaseDn("ou=people");
    userGroupDto.setUserIdAttribute("uid");
    userGroupDto.setUserPasswordAttribute("userPassword");
    userGroupDto.setUserRealNameAttribute("sn");
    userGroupDto.setUserMemberOfAttribute("businesscategory");
    userGroupDto.setEmailAddressAttribute("mail");
    userGroupDto.setLdapGroupsAsRoles(true);

    Request request = new Request();
    Response response = new Response(request);

    LdapUserListResponse userListResponse = (LdapUserListResponse) pr.put(
        null,
        request,
        response,
        ldapServerRequest);
View Full Code Here

  @Test
  public void testFailure()
      throws Exception
  {

    PlexusResource pr = this.lookup(PlexusResource.class, "LdapUserAndGroupConfigTestPlexusResource");

    LdapServerRequest ldapServerRequest = new LdapServerRequest();
    ldapServerRequest.setData(new LdapServerConfigurationDTO());

    ldapServerRequest.getData().setName("testFailure");

    LdapConnectionInfoDTO connDto = new LdapConnectionInfoDTO();
    ldapServerRequest.getData().setConnectionInfo(connDto);
    connDto.setAuthScheme("simple");
    connDto.setHost("invalidHost");
    connDto.setPort(this.getLdapServer("default").getPort());
    connDto.setProtocol("ldap");
    connDto.setSystemPassword(encodeBase64("secret"));
    connDto.setSystemUsername(encodeBase64("uid=admin,ou=system"));
    connDto.setSearchBase("o=sonatype");

    LdapUserAndGroupAuthConfigurationDTO userGroupDto = new LdapUserAndGroupAuthConfigurationDTO();
    ldapServerRequest.getData().setUserAndGroupConfig(userGroupDto);

    userGroupDto.setGroupMemberFormat("cn=${username},ou=groups,o=sonatype");
    userGroupDto.setGroupObjectClass("organizationalRole");
    userGroupDto.setGroupBaseDn("ou=groups");
    userGroupDto.setGroupIdAttribute("cn");
    userGroupDto.setGroupMemberAttribute("uniqueMember");
    userGroupDto.setUserObjectClass("inetOrgPerson");
    userGroupDto.setUserBaseDn("ou=people");
    userGroupDto.setUserIdAttribute("uid");
    userGroupDto.setUserPasswordAttribute("userPassword");
    userGroupDto.setUserRealNameAttribute("sn");
    userGroupDto.setUserMemberOfAttribute("businesscategory");
    userGroupDto.setEmailAddressAttribute("mail");
    userGroupDto.setLdapGroupsAsRoles(true);

    Request request = new Request();
    Response response = new Response(request);

    try {
      pr.put(null, request, response, ldapServerRequest);
      Assert.fail("expected ResourceException");
    }
    catch (ResourceException e) {
      // expected
    }
View Full Code Here

  @Test
  public void testModifiable()
      throws Exception
  {
    PlexusResource pr = this.lookup(PlexusResource.class, "LdapSchemaTempleListPlexusResource");
    Assert.assertFalse(pr.isModifiable());
  }
View Full Code Here

TOP

Related Classes of org.sonatype.plexus.rest.resource.PlexusResource

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.