From: Olivier Lamy Date: Mon, 18 Feb 2013 09:30:00 +0000 (+0000) Subject: add unit test X-Git-Tag: archiva-1.4-M4~176 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e807e6d8694202cdb448d3e8c22d13bafe55c231;p=archiva.git add unit test git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1447168 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRBACManager.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRBACManager.java index 416123b0a..b343cc7d4 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRBACManager.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/test/TestRBACManager.java @@ -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; + } } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/AbstractImplementationInformation.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/AbstractImplementationInformation.java index 443981303..0254edcc6 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/AbstractImplementationInformation.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/AbstractImplementationInformation.java @@ -92,7 +92,7 @@ public class AbstractImplementationInformation { return true; } - if ( !( o instanceof UserManagerImplementationInformation ) ) + if ( !( o instanceof AbstractImplementationInformation ) ) { return false; } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java index b81f35771..afec6005e 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java @@ -216,13 +216,13 @@ public class DefaultRedbackRuntimeConfigurationService for ( Map.Entry 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 ); } } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaRuntimeConfigurationServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaRuntimeConfigurationServiceTest.java index 5f221cf9e..3cd0b9476 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaRuntimeConfigurationServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaRuntimeConfigurationServiceTest.java @@ -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 infos = service.getRbacManagerImplementationInformations(); + Assertions.assertThat( infos ).isNotNull().isNotEmpty().contains( + new RBACManagerImplementationInformation( "jdo", null, false ) ); + + } + }