]> source.dussan.org Git - archiva.git/commitdiff
add unit test
authorOlivier Lamy <olamy@apache.org>
Mon, 18 Feb 2013 09:30:00 +0000 (09:30 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 18 Feb 2013 09:30:00 +0000 (09:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1447168 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRBACManager.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/AbstractImplementationInformation.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaRuntimeConfigurationServiceTest.java

index 416123b0ab37d28b115d91321d3ba61cbd206526..b343cc7d4949ecdba59f15c0e5584ca500e18f9b 100644 (file)
@@ -400,4 +400,9 @@ public class TestRBACManager implements RBACManager
     {
         //To change body of implemented methods use File | Settings | File Templates.
     }
+
+    public boolean isReadOnly()
+    {
+        return false;
+    }
 }
index 4439813033e3c0a7ae5f21c3657e2bc21bb49ef1..0254edcc6e4feac640e134313ffc005ccbd9ed28 100644 (file)
@@ -92,7 +92,7 @@ public class AbstractImplementationInformation
         {
             return true;
         }
-        if ( !( o instanceof UserManagerImplementationInformation ) )
+        if ( !( o instanceof AbstractImplementationInformation ) )
         {
             return false;
         }
index b81f35771008c55fd8592b6119456b548dd06892..afec6005ec6c1cb20a9f4c724e104b4fd45afa5d 100644 (file)
@@ -216,13 +216,13 @@ public class DefaultRedbackRuntimeConfigurationService
 
         for ( Map.Entry<String, RBACManager> entry : beans.entrySet() )
         {
-            UserManager userManager = applicationContext.getBean( entry.getKey(), UserManager.class );
-            if ( userManager.isFinalImplementation() )
+            RBACManager rbacManager = applicationContext.getBean( entry.getKey(), RBACManager.class );
+            if ( rbacManager.isFinalImplementation() )
             {
                 RBACManagerImplementationInformation information = new RBACManagerImplementationInformation();
                 information.setBeanId( StringUtils.substringAfter( entry.getKey(), "#" ) );
-                information.setDescriptionKey( userManager.getDescriptionKey() );
-                information.setReadOnly( userManager.isReadOnly() );
+                information.setDescriptionKey( rbacManager.getDescriptionKey() );
+                information.setReadOnly( rbacManager.isReadOnly() );
                 informations.add( information );
             }
         }
index 5f221cf9ed647819330975e4755b4e488be8bb1f..3cd0b9476cefdf74f73d07867c7bb89ad0f01f3e 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.archiva.rest.services;
  */
 
 import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
+import org.apache.archiva.rest.api.model.RBACManagerImplementationInformation;
 import org.apache.archiva.rest.api.model.UserManagerImplementationInformation;
 import org.apache.archiva.rest.api.services.RedbackRuntimeConfigurationService;
 import org.fest.assertions.api.Assertions;
@@ -71,4 +72,15 @@ public class ArchivaRuntimeConfigurationServiceTest
 
     }
 
+    @Test
+    public void rbacmanagersinformations()
+        throws Exception
+    {
+        RedbackRuntimeConfigurationService service = getArchivaRuntimeConfigurationService();
+        List<RBACManagerImplementationInformation> infos = service.getRbacManagerImplementationInformations();
+        Assertions.assertThat( infos ).isNotNull().isNotEmpty().contains(
+            new RBACManagerImplementationInformation( "jdo", null, false ) );
+
+    }
+
 }