From ec1318b47ca29aec660079ecd0bbfc03e1aeec81 Mon Sep 17 00:00:00 2001 From: skygo Date: Sun, 2 Sep 2012 16:01:16 +0000 Subject: [PATCH] some fix for rbac provider test and jdk 7 git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1380002 13f79535-47bb-0310-9956-ffa450edef68 --- .../tests/AbstractRbacManagerTestCase.java | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) 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 e3dc48dab..b806e4396 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 @@ -35,6 +35,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Set; +import org.springframework.test.annotation.DirtiesContext; /** * AbstractRbacManagerTestCase @@ -44,6 +45,7 @@ import java.util.Set; */ @RunWith( SpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) +@DirtiesContext( classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD ) public abstract class AbstractRbacManagerTestCase extends TestCase { @@ -53,6 +55,7 @@ public abstract class AbstractRbacManagerTestCase private RBACDefaults rbacDefaults; + private static final int EVENTCOUNT = 2; public void setRbacManager( RBACManager store ) { this.rbacManager = store; @@ -150,7 +153,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - //assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); //assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 1, eventTracker.addedRoleNames.size() ); @@ -186,7 +189,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 0, eventTracker.addedRoleNames.size() ); @@ -225,7 +228,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 2, eventTracker.addedRoleNames.size() ); @@ -256,7 +259,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 2, eventTracker.addedRoleNames.size() ); @@ -291,7 +294,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 1, eventTracker.addedRoleNames.size() ); @@ -330,7 +333,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 3, eventTracker.addedRoleNames.size() ); @@ -372,7 +375,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 3, eventTracker.addedRoleNames.size() ); @@ -413,7 +416,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 1, eventTracker.addedRoleNames.size() ); @@ -477,7 +480,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 1, eventTracker.addedRoleNames.size() ); @@ -513,7 +516,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 0, eventTracker.addedRoleNames.size() ); @@ -536,7 +539,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 0, eventTracker.addedRoleNames.size() ); @@ -608,7 +611,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 2, eventTracker.addedRoleNames.size() ); @@ -647,7 +650,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 1, eventTracker.addedRoleNames.size() ); @@ -693,7 +696,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 2, eventTracker.addedRoleNames.size() ); @@ -909,7 +912,7 @@ public abstract class AbstractRbacManagerTestCase // Assert some event tracker stuff assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 2, eventTracker.addedRoleNames.size() ); @@ -963,7 +966,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 2, eventTracker.addedRoleNames.size() ); @@ -1025,7 +1028,7 @@ public abstract class AbstractRbacManagerTestCase // Assert some event tracker stuff assertNotNull( eventTracker ); - assertEquals( 1, eventTracker.initCount ); + assertEquals( EVENTCOUNT, eventTracker.initCount ); assertTrue( eventTracker.lastDbFreshness.booleanValue() ); assertEquals( 2, eventTracker.addedRoleNames.size() ); -- 2.39.5