From: Olivier Lamy Date: Thu, 3 Jan 2013 17:28:32 +0000 (+0000) Subject: cosmetic formatting changes X-Git-Tag: redback-2.1~164 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=be41cf4c556206ab3b15619fdc9a5b7e5c6b68bc;p=archiva.git cosmetic formatting changes git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1428493 13f79535-47bb-0310-9956-ffa450edef68 --- 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 e00e62ed3..79a80ac2d 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 @@ -58,11 +58,6 @@ public class CachedRbacManagerTest public void setUp() throws Exception { - /* - CacheManager.getInstance().removeCache( "usersCache" ); - CacheManager.getInstance().removalAll(); - CacheManager.getInstance().shutdown(); - */ super.setUp(); CacheManager.getInstance().clearAll(); setRbacManager( rbacManager ); 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 132a1b5e3..e70d64f66 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 @@ -28,6 +28,8 @@ import org.apache.archiva.redback.rbac.RbacPermanentException; 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; @@ -35,17 +37,17 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Set; + import org.springframework.test.annotation.DirtiesContext; /** * AbstractRbacManagerTestCase * * @author Joakim Erdfelt - * */ -@RunWith( SpringJUnit4ClassRunner.class ) -@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) -@DirtiesContext( classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD ) +@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 { @@ -55,6 +57,8 @@ public abstract class AbstractRbacManagerTestCase private RBACDefaults rbacDefaults; + protected Logger log = LoggerFactory.getLogger( getClass() ); + public void setRbacManager( RBACManager store ) { this.rbacManager = store; @@ -131,13 +135,12 @@ public abstract class AbstractRbacManagerTestCase } public abstract void assertEventCount(); - - private void assertEventTracker(int addedRoleNameCount, int removedRoleNameCount, - int addedPermissionNames, int removedPermissionNames, - boolean freshness, boolean eventCount ) + + private void assertEventTracker( int addedRoleNameCount, int removedRoleNameCount, int addedPermissionNames, + int removedPermissionNames, boolean freshness, boolean eventCount ) { assertNotNull( eventTracker ); - if ( eventCount ) + if ( eventCount ) { assertEventCount(); } @@ -147,10 +150,10 @@ public abstract class AbstractRbacManagerTestCase assertEquals( removedPermissionNames, eventTracker.removedPermissionNames.size() ); if ( freshness ) { - assertTrue( eventTracker.lastDbFreshness.booleanValue() ); + assertTrue( eventTracker.lastDbFreshness.booleanValue() ); } } - + @Test public void testStoreInitialization() throws Exception @@ -204,7 +207,7 @@ public abstract class AbstractRbacManagerTestCase /* Assert some event tracker stuff */ assertEventTracker( 0, 0, 0, 0, true, true ); - + } @Test @@ -236,7 +239,7 @@ public abstract class AbstractRbacManagerTestCase assertNotNull( fetched ); /* Assert some event tracker stuff */ - assertEventTracker( 2, 0, 3, 0, true, true); + assertEventTracker( 2, 0, 3, 0, true, true ); } @@ -261,7 +264,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( develRole, actualDevel ); /* Assert some event tracker stuff */ - assertEventTracker( 2, 0, 2, 0, true, true); + assertEventTracker( 2, 0, 2, 0, true, true ); } @Test @@ -289,7 +292,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( 0, rbacManager.getAllPermissions().size() ); /* Assert some event tracker stuff */ - assertEventTracker( 1, 0, 0, 0, true, true); + assertEventTracker( 1, 0, 0, 0, true, true ); } @Test @@ -321,7 +324,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( 3, manager.getAllRoles().size() ); /* Assert some event tracker stuff */ - assertEventTracker( 3, 0, 3, 0, true, true); + assertEventTracker( 3, 0, 3, 0, true, true ); } @Test @@ -356,7 +359,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( 3, manager.getAllRoles().size() ); /* Assert some event tracker stuff */ - assertEventTracker( 3, 0, 3, 0, true, true); + assertEventTracker( 3, 0, 3, 0, true, true ); } @Test @@ -390,7 +393,7 @@ public abstract class AbstractRbacManagerTestCase assertNotNull( fetched ); /* Assert some event tracker stuff */ - assertEventTracker( 1, 0, 1, 0, true, true); + assertEventTracker( 1, 0, 1, 0, true, true ); } @Test @@ -447,7 +450,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( 1, assignedPermissions.size() ); /* Assert some event tracker stuff */ - assertEventTracker( 1, 0, 1, 0, true, true); + assertEventTracker( 1, 0, 1, 0, true, true ); } @Test @@ -476,7 +479,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( 1, manager.getAllResources().size() ); /* Assert some event tracker stuff */ - assertEventTracker( 0, 0, 2, 0, true, true); + assertEventTracker( 0, 0, 2, 0, true, true ); } @Test @@ -492,7 +495,7 @@ public abstract class AbstractRbacManagerTestCase manager.createPermission( "Delete Configuration", "delete-configuration", Resource.GLOBAL ) ); /* Assert some event tracker stuff */ - assertEventTracker( 0, 0, 2, 0, true, true); + assertEventTracker( 0, 0, 2, 0, true, true ); } @Test @@ -557,7 +560,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( "Should have 2 assignable roles.", 2, manager.getUnassignedRoles( bob.getPrincipal() ).size() ); /* Assert some event tracker stuff */ - assertEventTracker( 2, 0, 2, 0, true, true); + assertEventTracker( 2, 0, 2, 0, true, true ); } @@ -590,7 +593,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( 1, assignment.getRoleNames().size() ); /* Assert some event tracker stuff */ - assertEventTracker( 1, 0, 1, 0, true, true); + assertEventTracker( 1, 0, 1, 0, true, true ); } @@ -630,7 +633,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( 1, assignment.getRoleNames().size() ); /* Assert some event tracker stuff */ - assertEventTracker( 2, 0, 1, 0, true, true ); + assertEventTracker( 2, 0, 1, 0, true, true ); } @Test @@ -762,10 +765,10 @@ public abstract class AbstractRbacManagerTestCase } /* Assert some event tracker stuff */ - assertEventTracker( 2, 0, 2, 0, true, true); + assertEventTracker( 2, 0, 2, 0, true, true ); } - + @Test public void testGetRolesDeep() throws RbacManagerException @@ -783,7 +786,7 @@ public abstract class AbstractRbacManagerTestCase assertEquals( 1, rbacManager.getAllUserAssignments().size() ); assertEquals( 4, rbacManager.getAllRoles().size() ); assertEquals( 6, rbacManager.getAllPermissions().size() ); - + // Get the List of Assigned Roles for user bob. Role devel = rbacManager.getRole( "Developer" ); assertNotNull( devel ); @@ -888,7 +891,7 @@ public abstract class AbstractRbacManagerTestCase } // Assert some event tracker stuff - assertEventTracker( 2, 0, 3, 0, true, true); + assertEventTracker( 2, 0, 3, 0, true, true ); } @@ -944,7 +947,7 @@ public abstract class AbstractRbacManagerTestCase } // Assert some event tracker stuff - assertEventTracker( 2, 0, 3, 0, true, true); + assertEventTracker( 2, 0, 3, 0, true, true ); }