From 942e173d4b21c613f468fe9dfe48547e5b6c424e Mon Sep 17 00:00:00 2001 From: Martin Schreier Date: Wed, 5 Jan 2022 18:12:26 +0100 Subject: [PATCH] Switching to new ehcache version --- pom.xml | 7 +------ .../resources/META-INF/spring-context.xml | 2 +- .../redback-common-integrations/pom.xml | 2 +- .../integration/mail/MailGeneratorTest.java | 2 -- .../redback-rest-services/pom.xml | 2 +- .../rest/services/DefaultUserService.java | 12 ----------- .../rest/services/v2/DefaultUserService.java | 11 ---------- .../redback-keys-cached/pom.xml | 2 +- .../redback/keys/cached/CachedKeyManager.java | 10 ++++++++++ .../keys/cached/CachedKeyManagerTest.java | 2 -- .../redback-rbac-cached/pom.xml | 2 +- .../rbac/cached/CachedRbacManager.java | 14 +++++++++++-- .../rbac/cached/CachedRbacManagerTest.java | 8 ++------ .../redback/rbac/jpa/JpaRbacManagerTest.java | 3 --- .../redback-rbac-ldap/pom.xml | 2 +- .../rbac/ldap/LdapRbacManagerTest.java | 17 +++++++++++++--- .../redback-rbac-role-manager/pom.xml | 2 +- .../archiva/redback/role/RoleManagerTest.java | 2 -- redback-rbac/redback-rbac-tests/pom.xml | 2 +- .../tests/AbstractRbacManagerTestCase.java | 20 ++++++------------- .../redback-users-cached/pom.xml | 2 +- .../users/cached/CachedUserManager.java | 13 ++++++++++++ .../users/cached/CachedUserManagerTest.java | 9 +-------- 23 files changed, 68 insertions(+), 80 deletions(-) diff --git a/pom.xml b/pom.xml index e61d523f..4b6875d6 100644 --- a/pom.xml +++ b/pom.xml @@ -357,7 +357,7 @@ ${archiva.comp.version} - net.sf.ehcache + org.ehcache ehcache ${ehcache.version} @@ -387,11 +387,6 @@ commons-lang3 ${commons.lang3.version} - - commons-digester - commons-digester - ${commons.digester.version} - commons-io commons-io diff --git a/redback-common/redback-common-ldap/src/main/resources/META-INF/spring-context.xml b/redback-common/redback-common-ldap/src/main/resources/META-INF/spring-context.xml index 04312f96..724f18a2 100644 --- a/redback-common/redback-common-ldap/src/main/resources/META-INF/spring-context.xml +++ b/redback-common/redback-common-ldap/src/main/resources/META-INF/spring-context.xml @@ -28,6 +28,6 @@ default-lazy-init="true"> - + \ No newline at end of file diff --git a/redback-integrations/redback-common-integrations/pom.xml b/redback-integrations/redback-common-integrations/pom.xml index f37fa128..275018b8 100644 --- a/redback-integrations/redback-common-integrations/pom.xml +++ b/redback-integrations/redback-common-integrations/pom.xml @@ -125,7 +125,7 @@ - net.sf.ehcache + org.ehcache ehcache runtime diff --git a/redback-integrations/redback-common-integrations/src/test/java/org/apache/archiva/redback/integration/mail/MailGeneratorTest.java b/redback-integrations/redback-common-integrations/src/test/java/org/apache/archiva/redback/integration/mail/MailGeneratorTest.java index 3b10691d..50375005 100644 --- a/redback-integrations/redback-common-integrations/src/test/java/org/apache/archiva/redback/integration/mail/MailGeneratorTest.java +++ b/redback-integrations/redback-common-integrations/src/test/java/org/apache/archiva/redback/integration/mail/MailGeneratorTest.java @@ -20,7 +20,6 @@ package org.apache.archiva.redback.integration.mail; */ import junit.framework.TestCase; -import net.sf.ehcache.CacheManager; import org.apache.archiva.redback.keys.AuthenticationKey; import org.apache.archiva.redback.keys.KeyManager; import org.apache.archiva.redback.keys.KeyManagerException; @@ -68,7 +67,6 @@ public class MailGeneratorTest public void setUp() throws Exception { - CacheManager.getInstance().clearAll(); super.setUp(); diff --git a/redback-integrations/redback-rest/redback-rest-services/pom.xml b/redback-integrations/redback-rest/redback-rest-services/pom.xml index 93bf9f70..0bd1ace6 100644 --- a/redback-integrations/redback-rest/redback-rest-services/pom.xml +++ b/redback-integrations/redback-rest/redback-rest-services/pom.xml @@ -118,7 +118,7 @@ spring-context - net.sf.ehcache + org.ehcache ehcache diff --git a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/DefaultUserService.java b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/DefaultUserService.java index da26a8b9..c08f5620 100644 --- a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/DefaultUserService.java +++ b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/DefaultUserService.java @@ -19,7 +19,6 @@ package org.apache.archiva.redback.rest.services; * under the License. */ -import net.sf.ehcache.CacheManager; import org.apache.archiva.components.cache.Cache; import org.apache.archiva.redback.authentication.AuthenticationException; import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource; @@ -39,7 +38,6 @@ import org.apache.archiva.redback.policy.UserSecurityPolicy; import org.apache.archiva.redback.rbac.RBACManager; import org.apache.archiva.redback.rbac.RbacManagerException; import org.apache.archiva.redback.rbac.UserAssignment; -import org.apache.archiva.redback.rest.api.model.ActionStatus; import org.apache.archiva.redback.rest.api.model.ErrorMessage; import org.apache.archiva.redback.rest.api.model.Operation; import org.apache.archiva.redback.rest.api.model.Permission; @@ -423,16 +421,6 @@ public class DefaultUserService usersCache.remove( userName ); } - CacheManager cacheManager = CacheManager.getInstance(); - String[] caches = cacheManager.getCacheNames(); - for ( String cacheName : caches ) - { - if ( StringUtils.startsWith( cacheName, "org.apache.archiva.redback.rbac.jdo" ) ) - { - cacheManager.getCache( cacheName ).removeAll(); - } - } - return -1; } diff --git a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/v2/DefaultUserService.java b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/v2/DefaultUserService.java index 46061ebe..810542f1 100644 --- a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/v2/DefaultUserService.java +++ b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/v2/DefaultUserService.java @@ -19,7 +19,6 @@ package org.apache.archiva.redback.rest.services.v2; * under the License. */ -import net.sf.ehcache.CacheManager; import org.apache.archiva.components.cache.Cache; import org.apache.archiva.components.rest.model.PagedResult; import org.apache.archiva.redback.authentication.AuthenticationException; @@ -518,16 +517,6 @@ public class DefaultUserService extends BaseRedbackService usersCache.remove( userId ); } - CacheManager cacheManager = CacheManager.getInstance( ); - String[] caches = cacheManager.getCacheNames( ); - for ( String cacheName : caches ) - { - if ( StringUtils.startsWith( cacheName, "org.apache.archiva.redback.rbac.jdo" ) ) - { - cacheManager.getCache( cacheName ).removeAll( ); - } - } - return Response.ok( ).build( ); } diff --git a/redback-keys/redback-keys-providers/redback-keys-cached/pom.xml b/redback-keys/redback-keys-providers/redback-keys-cached/pom.xml index da42b3e2..ae78cac1 100644 --- a/redback-keys/redback-keys-providers/redback-keys-cached/pom.xml +++ b/redback-keys/redback-keys-providers/redback-keys-cached/pom.xml @@ -59,7 +59,7 @@ - net.sf.ehcache + org.ehcache ehcache runtime diff --git a/redback-keys/redback-keys-providers/redback-keys-cached/src/main/java/org/apache/archiva/redback/keys/cached/CachedKeyManager.java b/redback-keys/redback-keys-providers/redback-keys-cached/src/main/java/org/apache/archiva/redback/keys/cached/CachedKeyManager.java index bd0fa6e9..706bf5fe 100644 --- a/redback-keys/redback-keys-providers/redback-keys-cached/src/main/java/org/apache/archiva/redback/keys/cached/CachedKeyManager.java +++ b/redback-keys/redback-keys-providers/redback-keys-cached/src/main/java/org/apache/archiva/redback/keys/cached/CachedKeyManager.java @@ -27,6 +27,7 @@ import org.apache.archiva.redback.keys.KeyManagerException; import org.apache.archiva.redback.keys.KeyNotFoundException; import org.springframework.stereotype.Service; +import javax.annotation.PreDestroy; import javax.inject.Inject; import javax.inject.Named; import java.util.List; @@ -149,4 +150,13 @@ public class CachedKeyManager { this.keysCache = keysCache; } + + public void clearCache() { + keysCache.clear(); + } + + @PreDestroy + void shutdown() { + clearCache( ); + } } diff --git a/redback-keys/redback-keys-providers/redback-keys-cached/src/test/java/org/apache/archiva/redback/keys/cached/CachedKeyManagerTest.java b/redback-keys/redback-keys-providers/redback-keys-cached/src/test/java/org/apache/archiva/redback/keys/cached/CachedKeyManagerTest.java index 7624cb62..953b2953 100644 --- a/redback-keys/redback-keys-providers/redback-keys-cached/src/test/java/org/apache/archiva/redback/keys/cached/CachedKeyManagerTest.java +++ b/redback-keys/redback-keys-providers/redback-keys-cached/src/test/java/org/apache/archiva/redback/keys/cached/CachedKeyManagerTest.java @@ -19,7 +19,6 @@ package org.apache.archiva.redback.keys.cached; * under the License. */ -import net.sf.ehcache.CacheManager; import org.apache.archiva.redback.keys.KeyManager; import org.apache.archiva.redback.keys.KeyManagerTestCase; import org.junit.Before; @@ -55,7 +54,6 @@ public class CachedKeyManagerTest protected void tearDown() throws Exception { - CacheManager.getInstance().removeAllCaches(); super.tearDown(); } } diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-cached/pom.xml b/redback-rbac/redback-rbac-providers/redback-rbac-cached/pom.xml index 071b5dc1..5b656fb1 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-cached/pom.xml +++ b/redback-rbac/redback-rbac-providers/redback-rbac-cached/pom.xml @@ -45,7 +45,7 @@ - net.sf.ehcache + org.ehcache ehcache diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java b/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java index 9a6258ce..8ad19dfd 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java +++ b/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java @@ -34,6 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; +import javax.annotation.PreDestroy; import javax.inject.Inject; import javax.inject.Named; import java.util.Collection; @@ -187,8 +188,7 @@ public class CachedRbacManager } finally { - // FIXME cleanup - //EhcacheUtils.clearAllCaches( log() ); + clearCache(); } } @@ -548,6 +548,11 @@ public class CachedRbacManager ( (RBACManagerListener) this.rbacImpl ).rbacInit( freshdb ); } // lookup all Cache and clear all ? + clearCache( ); + } + + public void clearCache( ) + { this.resourcesCache.clear(); this.operationsCache.clear(); this.permissionsCache.clear(); @@ -1054,4 +1059,9 @@ public class CachedRbacManager { return false; } + + @PreDestroy + void shutdown() { + clearCache( ); + } } diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/test/java/org/apache/archiva/redback/rbac/cached/CachedRbacManagerTest.java b/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/test/java/org/apache/archiva/redback/rbac/cached/CachedRbacManagerTest.java index 79a80ac2..5592e4b7 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/test/java/org/apache/archiva/redback/rbac/cached/CachedRbacManagerTest.java +++ b/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/test/java/org/apache/archiva/redback/rbac/cached/CachedRbacManagerTest.java @@ -19,16 +19,14 @@ package org.apache.archiva.redback.rbac.cached; * under the License. */ -import net.sf.ehcache.CacheManager; import org.apache.archiva.redback.rbac.RBACManager; import org.apache.archiva.redback.tests.AbstractRbacManagerTestCase; +import org.junit.After; import org.junit.Before; +import org.springframework.test.annotation.DirtiesContext; import javax.inject.Inject; import javax.inject.Named; -import org.junit.After; -import org.junit.BeforeClass; -import org.springframework.test.annotation.DirtiesContext; @DirtiesContext( classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD ) public class CachedRbacManagerTest @@ -59,7 +57,6 @@ public class CachedRbacManagerTest throws Exception { super.setUp(); - CacheManager.getInstance().clearAll(); setRbacManager( rbacManager ); assertTrue( getRbacManager() instanceof CachedRbacManager ); @@ -76,7 +73,6 @@ public class CachedRbacManagerTest public void testStoreInitialization() throws Exception { - CacheManager.getInstance().clearAll(); rbacManager.eraseDatabase(); super.testStoreInitialization(); } diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/test/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManagerTest.java b/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/test/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManagerTest.java index 89bcf1bb..5634e751 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/test/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManagerTest.java +++ b/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/test/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManagerTest.java @@ -107,7 +107,6 @@ public class JpaRbacManagerTest public void testLargeApplicationInit() throws RbacManagerException { - this.clearCache(); super.testLargeApplicationInit(); } @@ -115,7 +114,6 @@ public class JpaRbacManagerTest public void testGetRolesDeep() throws RbacManagerException { - this.clearCache(); super.testGetRolesDeep(); } @@ -124,7 +122,6 @@ public class JpaRbacManagerTest public void testStoreInitialization() throws Exception { - this.clearCache(); rbacManager.eraseDatabase(); eventTracker.rbacInit( true ); super.testStoreInitialization(); diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/pom.xml b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/pom.xml index e7094e8f..c7a22bbc 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/pom.xml +++ b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/pom.xml @@ -93,7 +93,7 @@ runtime - net.sf.ehcache + org.ehcache ehcache runtime diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/test/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManagerTest.java b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/test/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManagerTest.java index 4d142269..840cf15c 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/test/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManagerTest.java +++ b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/test/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManagerTest.java @@ -22,7 +22,10 @@ package org.apache.archiva.redback.rbac.ldap; import org.apache.archiva.components.apacheds.ApacheDs; import org.apache.archiva.redback.policy.PasswordEncoder; import org.apache.archiva.redback.policy.encoders.SHA1PasswordEncoder; +import org.apache.archiva.redback.rbac.RbacManagerException; +import org.apache.archiva.redback.rbac.RbacPermanentException; import org.apache.archiva.redback.rbac.Role; +import org.apache.archiva.redback.rbac.memory.MemoryRole; import org.apache.archiva.redback.tests.AbstractRbacManagerTestCase; import org.junit.After; import org.junit.Before; @@ -76,7 +79,6 @@ public class LdapRbacManagerTest throws Exception { super.setUp(); - this.clearCache(); setRbacManager( rbacManager ); assertTrue( getRbacManager() instanceof LdapRbacManager ); @@ -263,11 +265,20 @@ public class LdapRbacManagerTest public void testStoreInitialization() throws Exception { - this.clearCache(); for ( Role role : rbacManager.getAllRoles() ) { - rbacManager.removeRole( role ); + try + { + log.info( "permanent: {}, {}", role.isPermanent( ), role.getClass( ).getName( ) ); + // Workaround to avoid exception because of permanent role. + MemoryRole rRole = new MemoryRole( ); + rRole.setName( role.getName( ) ); + rbacManager.removeRole( rRole ); + } catch ( RbacPermanentException ex ) { + // Ignore this + } } + log.info( "Roles {}", rbacManager.getAllRoles( ).size( ) ); eventTracker.clear(); super.testStoreInitialization(); } diff --git a/redback-rbac/redback-rbac-role-manager/pom.xml b/redback-rbac/redback-rbac-role-manager/pom.xml index 04529b49..6e4c8035 100644 --- a/redback-rbac/redback-rbac-role-manager/pom.xml +++ b/redback-rbac/redback-rbac-role-manager/pom.xml @@ -81,7 +81,7 @@ test - net.sf.ehcache + org.ehcache ehcache test diff --git a/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/RoleManagerTest.java b/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/RoleManagerTest.java index 2b5d6d4b..a4d8256b 100644 --- a/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/RoleManagerTest.java +++ b/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/RoleManagerTest.java @@ -19,7 +19,6 @@ package org.apache.archiva.redback.role; * under the License. */ -import net.sf.ehcache.CacheManager; import org.apache.archiva.redback.rbac.RBACManager; import org.junit.Before; @@ -47,7 +46,6 @@ public class RoleManagerTest public void setUp() throws Exception { - CacheManager.getInstance().clearAll(); super.setUp(); rbacManager = rbacManagerMemory; diff --git a/redback-rbac/redback-rbac-tests/pom.xml b/redback-rbac/redback-rbac-tests/pom.xml index 66b6b588..7bb9b61c 100644 --- a/redback-rbac/redback-rbac-tests/pom.xml +++ b/redback-rbac/redback-rbac-tests/pom.xml @@ -45,7 +45,7 @@ - net.sf.ehcache + org.ehcache ehcache diff --git a/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/AbstractRbacManagerTestCase.java b/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/AbstractRbacManagerTestCase.java index 4994e218..fc00cf56 100644 --- a/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/AbstractRbacManagerTestCase.java +++ b/redback-rbac/redback-rbac-tests/src/main/java/org/apache/archiva/redback/tests/AbstractRbacManagerTestCase.java @@ -17,7 +17,6 @@ package org.apache.archiva.redback.tests; */ import junit.framework.TestCase; -import net.sf.ehcache.CacheManager; import org.apache.archiva.redback.rbac.Operation; import org.apache.archiva.redback.rbac.Permission; import org.apache.archiva.redback.rbac.RBACManager; @@ -146,10 +145,10 @@ public abstract class AbstractRbacManagerTestCase { assertEventCount(); } - assertEquals( addedRoleNameCount, eventTracker.addedRoleNames.size() ); - assertEquals( removedRoleNameCount, eventTracker.removedRoleNames.size() ); - assertEquals( addedPermissionNames, eventTracker.addedPermissionNames.size() ); - assertEquals( removedPermissionNames, eventTracker.removedPermissionNames.size() ); + assertEquals( "Wrong number of added roles", addedRoleNameCount, eventTracker.addedRoleNames.size() ); + assertEquals( "Wrong number of removed roles", removedRoleNameCount, eventTracker.removedRoleNames.size() ); + assertEquals( "Wrong number of added permissions", addedPermissionNames, eventTracker.addedPermissionNames.size() ); + assertEquals( "Wrong number of removed permissions", removedPermissionNames, eventTracker.removedPermissionNames.size() ); if ( freshness ) { assertTrue( eventTracker.lastDbFreshness.booleanValue() ); @@ -169,7 +168,7 @@ public abstract class AbstractRbacManagerTestCase Role added = rbacManager.saveRole( role ); - assertEquals( 1, rbacManager.getAllRoles().size() ); + assertEquals("Wrong number of roles in the rbac manager", 1, rbacManager.getAllRoles().size() ); assertNotNull( added ); @@ -842,7 +841,7 @@ public abstract class AbstractRbacManagerTestCase public void testGetAssignedPermissionsDeep() throws RbacManagerException { - this.clearCache(); + assertNotNull( rbacManager ); rbacManager.eraseDatabase(); rbacDefaults.createDefaults(); @@ -1008,11 +1007,4 @@ public abstract class AbstractRbacManagerTestCase // do nothing } - protected void clearCache() - { - for ( String cacheName : CacheManager.getInstance().getCacheNames() ) - { - CacheManager.getInstance().getCache( cacheName ).removeAll(); - } - } } diff --git a/redback-users/redback-users-providers/redback-users-cached/pom.xml b/redback-users/redback-users-providers/redback-users-cached/pom.xml index 4fa5108d..12344a15 100644 --- a/redback-users/redback-users-providers/redback-users-cached/pom.xml +++ b/redback-users/redback-users-providers/redback-users-cached/pom.xml @@ -71,7 +71,7 @@ - net.sf.ehcache + org.ehcache ehcache runtime diff --git a/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java b/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java index ebf42381..86f957c9 100644 --- a/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java +++ b/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java @@ -30,6 +30,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; +import javax.annotation.PreDestroy; import javax.inject.Inject; import javax.inject.Named; import java.util.List; @@ -358,4 +359,16 @@ public class CachedUserManager { return "archiva.redback.usermanager.cached"; } + + /** + * Clears the users cache + */ + public void clearCache() { + usersCache.clear( ); + } + + @PreDestroy + public void shutdown() { + this.clearCache( ); + } } diff --git a/redback-users/redback-users-providers/redback-users-cached/src/test/java/org/apache/archiva/redback/users/cached/CachedUserManagerTest.java b/redback-users/redback-users-providers/redback-users-cached/src/test/java/org/apache/archiva/redback/users/cached/CachedUserManagerTest.java index 0ea7c41c..9290348a 100644 --- a/redback-users/redback-users-providers/redback-users-cached/src/test/java/org/apache/archiva/redback/users/cached/CachedUserManagerTest.java +++ b/redback-users/redback-users-providers/redback-users-cached/src/test/java/org/apache/archiva/redback/users/cached/CachedUserManagerTest.java @@ -19,10 +19,7 @@ package org.apache.archiva.redback.users.cached; * under the License. */ -import net.sf.ehcache.CacheManager; - import org.apache.archiva.redback.users.UserManager; -import org.apache.archiva.redback.users.cached.CachedUserManager; import org.apache.archiva.redback.users.provider.test.AbstractUserManagerTestCase; import org.junit.After; import org.junit.AfterClass; @@ -63,9 +60,5 @@ public class CachedUserManagerTest super.tearDown(); } - @AfterClass - public static void cleanCache() - { - CacheManager.getInstance().removeAllCaches(); - } + }