You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2013/02/01 16:30:36 UTC
svn commit: r1441487 - in
/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test:
java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java
security.properties
Author: olamy
Date: Fri Feb 1 15:30:35 2013
New Revision: 1441487
URL: http://svn.apache.org/viewvc?rev=1441487&view=rev
Log:
add more tests
Modified:
archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java
archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/security.properties
Modified: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java?rev=1441487&r1=1441486&r2=1441487&view=diff
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java (original)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java Fri Feb 1 15:30:35 2013
@@ -19,6 +19,7 @@ package org.apache.archiva.redback.rest.
*/
import org.apache.archiva.redback.components.apacheds.ApacheDs;
+import org.apache.archiva.redback.rest.api.model.LdapGroupMapping;
import org.apache.archiva.redback.rest.api.services.LdapGroupMappingService;
import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.fest.assertions.Assertions;
@@ -100,6 +101,24 @@ public class LdapGroupMappingServiceTest
public void stopServer()
throws Exception
{
+
+
+ // cleanup ldap entries
+ InitialDirContext context = apacheDs.getAdminContext();
+
+
+
+ for ( String group : this.groups )
+ {
+ context.unbind( createGroupDn( group ) );
+ }
+
+ context.unbind( suffix );
+
+ context.close();
+
+ apacheDs.stopServer();
+
super.stopServer();
}
@@ -147,15 +166,32 @@ public class LdapGroupMappingServiceTest
{
LdapGroupMappingService service = getLdapGroupMappingService( authorizationHeader );
- List<String> groups = service.getLdapGroups().getStrings();
+ List<String> allGroups = service.getLdapGroups().getStrings();
- Assertions.assertThat( groups ).isNotNull().isNotEmpty().hasSize( 3 ).contains( groups.toArray() );
+ Assertions.assertThat( allGroups ).isNotNull().isNotEmpty().hasSize( 3 ).contains( groups.toArray() );
}
catch ( Exception e )
{
log.error( e.getMessage(), e );
throw e;
}
+ }
+ @Test
+ public void getLdapGroupMappings() throws Exception
+ {
+ try
+ {
+ LdapGroupMappingService service = getLdapGroupMappingService( authorizationHeader );
+
+ List<LdapGroupMapping> mappings = service.getLdapGroupMappings();
+
+ Assertions.assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
+ }
+ catch ( Exception e )
+ {
+ log.error( e.getMessage(), e );
+ throw e;
+ }
}
}
Modified: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/security.properties
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/security.properties?rev=1441487&r1=1441486&r2=1441487&view=diff
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/security.properties (original)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-services/src/test/security.properties Fri Feb 1 15:30:35 2013
@@ -28,9 +28,9 @@
#ldap.config.mapper.attribute.user.id=uid
ldap.config.groups.base.dn=dc=archiva,dc=apache,dc=org
-#ldap.config.groups.role.archiva-admin=System Administrator
-#ldap.config.groups.role.snapshot-manager=Repository Manager - snapshots
-#ldap.config.groups.role.snapshot-observer=Repository Observer - snapshots
+ldap.config.groups.role.archiva-admin=System Administrator
+ldap.config.groups.role.snapshot-manager=Repository Manager - snapshots
+ldap.config.groups.role.snapshot-observer=Repository Observer - snapshots
#ldap.config.writable=true
#ldap.config.groups.use.rolename=true
\ No newline at end of file