From a9ae52e2acbf98f31664f969e28d804a8a070fb7 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 21 Nov 2012 22:29:59 +0000 Subject: [PATCH] remove some system.out git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1412335 13f79535-47bb-0310-9956-ffa450edef68 --- .../redback/rest/services/AbstractRestServicesTest.java | 2 +- .../archiva/redback/role/AbstractRoleManagerTest.java | 6 +++++- .../tests/AbstractRbacManagerPerformanceTestCase.java | 8 ++++++-- .../archiva/redback/tests/RbacManagerEventTracker.java | 6 +++++- .../users/configurable/ConfigurableUserManager.java | 3 ++- .../archiva/redback/users/ldap/LdapUserManagerTest.java | 4 ++-- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/AbstractRestServicesTest.java b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/AbstractRestServicesTest.java index 580a11641..05d0c0a5c 100644 --- a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/AbstractRestServicesTest.java +++ b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/AbstractRestServicesTest.java @@ -78,7 +78,7 @@ public abstract class AbstractRestServicesTest protected String getSpringConfigLocation() { - return "classpath*:META-INF/spring-context.xml"; + return "classpath*:spring-context.xml,classpath*:META-INF/spring-context.xml"; } diff --git a/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/AbstractRoleManagerTest.java b/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/AbstractRoleManagerTest.java index 63b027246..ee992a0dc 100644 --- a/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/AbstractRoleManagerTest.java +++ b/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/AbstractRoleManagerTest.java @@ -30,6 +30,8 @@ import org.apache.archiva.redback.role.model.ModelTemplate; import org.apache.archiva.redback.role.util.RoleModelUtils; import org.junit.Test; import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -47,6 +49,8 @@ public abstract class AbstractRoleManagerTest extends TestCase { + protected Logger logger = LoggerFactory.getLogger( getClass() ); + protected RBACManager rbacManager; protected RoleManager roleManager; @@ -112,7 +116,7 @@ public abstract class AbstractRoleManagerTest for ( String roleName : assignments ) { - System.out.println( roleName ); + logger.info( roleName ); assertTrue( "Test Role".equals( roleName ) || "Foo 2 - frigid".equals( roleName ) || "Test Role 1".equals( roleName ) ); } } diff --git a/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/AbstractRbacManagerPerformanceTestCase.java b/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/AbstractRbacManagerPerformanceTestCase.java index 212f2f6e7..11eacdd10 100644 --- a/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/AbstractRbacManagerPerformanceTestCase.java +++ b/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/AbstractRbacManagerPerformanceTestCase.java @@ -29,6 +29,8 @@ import org.apache.archiva.redback.rbac.Operation; import org.apache.archiva.redback.tests.utils.RBACDefaults; import org.junit.Test; import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -43,6 +45,8 @@ public class AbstractRbacManagerPerformanceTestCase private RBACDefaults rbacDefaults; + protected Logger logger = LoggerFactory.getLogger( getClass() ); + public void setRbacManager( RBACManager store ) { this.rbacManager = store; @@ -92,7 +96,7 @@ public class AbstractRbacManagerPerformanceTestCase double ratio = (double) elapsed / (double) ONESECOND; // ratio of time to 1 second. double opsPerSecond = (double) iterations / ratio; - System.out.println( "Performance " + msg + ": " + opsPerSecond + " operations per second. (effective)" ); + logger.info( "Performance {}: {} operations per second. (effective)", msg, opsPerSecond ); if ( opsPerSecond < threshold ) { @@ -107,7 +111,7 @@ public class AbstractRbacManagerPerformanceTestCase stats.append( "\nRatio : " ).append( Double.toString( ratio ) ); stats.append( "\nOps per second : " ).append( Double.toString( opsPerSecond ) ); - System.out.println( stats.toString() ); + logger.info( stats.toString() ); fail( "Performance Error: " + msg + " expecting greater than [" + threshold + "], actual [" + opsPerSecond + "]" ); diff --git a/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/RbacManagerEventTracker.java b/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/RbacManagerEventTracker.java index 912e15058..26c8f9892 100644 --- a/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/RbacManagerEventTracker.java +++ b/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/RbacManagerEventTracker.java @@ -23,6 +23,8 @@ import org.apache.archiva.redback.rbac.RBACManagerListener; import org.apache.archiva.redback.rbac.Permission; import org.apache.archiva.redback.rbac.Role; import org.apache.archiva.redback.rbac.UserAssignment; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; @@ -48,6 +50,8 @@ public class RbacManagerEventTracker public List removedPermissionNames = new ArrayList(); + protected Logger logger = LoggerFactory.getLogger( getClass() ); + public void rbacInit( boolean freshdb ) { log( "Init - freshdb: " + freshdb ); @@ -107,6 +111,6 @@ public class RbacManagerEventTracker private void log( String msg ) { - System.out.println( "[RBAC Event Tracker] " + msg ); + logger.info( "[RBAC Event Tracker] : {}", msg ); } } diff --git a/redback-users/redback-users-providers/redback-users-configurable/src/main/java/org/apache/archiva/redback/users/configurable/ConfigurableUserManager.java b/redback-users/redback-users-providers/redback-users-configurable/src/main/java/org/apache/archiva/redback/users/configurable/ConfigurableUserManager.java index f4d5cf40a..9805d2da8 100644 --- a/redback-users/redback-users-providers/redback-users-configurable/src/main/java/org/apache/archiva/redback/users/configurable/ConfigurableUserManager.java +++ b/redback-users/redback-users-providers/redback-users-configurable/src/main/java/org/apache/archiva/redback/users/configurable/ConfigurableUserManager.java @@ -60,8 +60,9 @@ public class ConfigurableUserManager "User Manager Configuration Missing: " + USER_MANAGER_IMPL + " configuration property" ); } + log.info( "use userManager impl with key: '{}'", userManagerRole ); + userManagerImpl = applicationContext.getBean( "userManager#" + userManagerRole, UserManager.class ); - // (UserManager) container.lookup( UserManager.class.getName(), userManagerRole ); } public User addUser( User user ) diff --git a/redback-users/redback-users-providers/redback-users-ldap/src/test/java/org/apache/archiva/redback/users/ldap/LdapUserManagerTest.java b/redback-users/redback-users-providers/redback-users-ldap/src/test/java/org/apache/archiva/redback/users/ldap/LdapUserManagerTest.java index d60d0e470..e3c298b22 100644 --- a/redback-users/redback-users-providers/redback-users-ldap/src/test/java/org/apache/archiva/redback/users/ldap/LdapUserManagerTest.java +++ b/redback-users/redback-users-providers/redback-users-ldap/src/test/java/org/apache/archiva/redback/users/ldap/LdapUserManagerTest.java @@ -212,8 +212,8 @@ public class LdapUserManagerTest assertEquals( "jesse", jesse.getPrincipal().toString() ); assertEquals( "jesse@apache.org", jesse.getEmail() ); assertEquals( "foo", jesse.getFullName() ); - System.out.println( "=====>"+jesse.getEncodedPassword()); - System.out.println( "=====>"+passwordEncoder.encodePassword( "foo" )); + log.info( "=====>"+jesse.getEncodedPassword()); + log.info( "=====>"+passwordEncoder.encodePassword( "foo" )); assertTrue( passwordEncoder.isPasswordValid( jesse.getEncodedPassword(), "foo" ) ); } -- 2.39.5