From 9ceca02f8774188df9159b703dd38a31783ed956 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Tue, 11 May 2010 08:22:57 +0000 Subject: [PATCH] --- .../DefaultAuthorizationService.java | 2 -- .../AuthorizationServiceTest.java | 8 +++---- security/jpatest/pom.xml | 2 +- .../authentication/jpa/JpaUserSetTest.java | 4 ++-- .../support/persistence/DatabaseUtils.java | 24 +++++++++---------- .../support/persistence/JpaBuilder.java | 6 ++--- 6 files changed, 22 insertions(+), 24 deletions(-) diff --git a/security/impl/src/main/java/org/wamblee/security/authorization/DefaultAuthorizationService.java b/security/impl/src/main/java/org/wamblee/security/authorization/DefaultAuthorizationService.java index 7686c334..8e449b9e 100644 --- a/security/impl/src/main/java/org/wamblee/security/authorization/DefaultAuthorizationService.java +++ b/security/impl/src/main/java/org/wamblee/security/authorization/DefaultAuthorizationService.java @@ -96,9 +96,7 @@ public class DefaultAuthorizationService extends AbstractAuthorizationService { @Override public void setUserAdministration(UserAdministration aUserAdmin) { userAdmin = aUserAdmin; - System.out.println("Setting userAdmin"); for (AuthorizationRule rule: rules) { - System.out.println("Setting useradmin on " + rule); rule.setUserAdministration(userAdmin); } } diff --git a/security/impl/src/test/java/org/wamblee/security/authorization/AuthorizationServiceTest.java b/security/impl/src/test/java/org/wamblee/security/authorization/AuthorizationServiceTest.java index 50c73dca..d79ee55f 100644 --- a/security/impl/src/test/java/org/wamblee/security/authorization/AuthorizationServiceTest.java +++ b/security/impl/src/test/java/org/wamblee/security/authorization/AuthorizationServiceTest.java @@ -86,10 +86,10 @@ public class AuthorizationServiceTest extends TestCase { * @return Authorization service. */ protected AuthorizationService createService() { - DefaultAuthorizationService service = new DefaultAuthorizationService(); - service.setUserAccessor(getUserAccessor()); - service.setUserAdministration(getUserAdministration()); - return service; + DefaultAuthorizationService svc = new DefaultAuthorizationService(); + svc.setUserAccessor(getUserAccessor()); + svc.setUserAdministration(getUserAdministration()); + return svc; } protected AbstractAuthorizationRule createRule(AuthorizationResult aResult, diff --git a/security/jpatest/pom.xml b/security/jpatest/pom.xml index 6fc29ff0..f12b237c 100644 --- a/security/jpatest/pom.xml +++ b/security/jpatest/pom.xml @@ -28,7 +28,7 @@ test-jar test - + org.wamblee wamblee-test-enterprise diff --git a/security/jpatest/src/test/java/org/wamblee/security/authentication/jpa/JpaUserSetTest.java b/security/jpatest/src/test/java/org/wamblee/security/authentication/jpa/JpaUserSetTest.java index f5b5fa10..d981f2b0 100644 --- a/security/jpatest/src/test/java/org/wamblee/security/authentication/jpa/JpaUserSetTest.java +++ b/security/jpatest/src/test/java/org/wamblee/security/authentication/jpa/JpaUserSetTest.java @@ -96,8 +96,8 @@ public class JpaUserSetTest extends InMemoryUserSetTest { private GroupSet createGroupSetImpl() { TransactionProxyFactory factory = new TransactionProxyFactory( jpaTester.getJpaBuilder(), GroupSet.class); - GroupSet groupset = new JpaGroupSet(factory.getTransactionScopedEntityManager()); - GroupSet proxy = factory.getProxy(groupset); + GroupSet groups = new JpaGroupSet(factory.getTransactionScopedEntityManager()); + GroupSet proxy = factory.getProxy(groups); return proxy; } diff --git a/test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseUtils.java b/test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseUtils.java index cd7b3e26..9ad6c912 100644 --- a/test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseUtils.java +++ b/test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseUtils.java @@ -127,11 +127,11 @@ public class DatabaseUtils { public void executeOnTables(ITableFilterSimple aTables, final TableSetOperation aOperation) throws Exception { - final String[] tables = getTableNames(aTables); + final String[] tableNames = getTableNames(aTables); executeInTransaction(new JdbcUnitOfWork() { public Void execute(Connection aConnection) throws Exception { - for (int i = tables.length - 1; i >= 0; i--) { - aOperation.execute(tables[i]); + for (int i = tableNames.length - 1; i >= 0; i--) { + aOperation.execute(tableNames[i]); } return null; } @@ -140,16 +140,16 @@ public class DatabaseUtils { public void cleanDatabase(ITableFilterSimple aSelection) throws Exception { - final String[] tables = getTableNames(aSelection); + final String[] tableNames = getTableNames(aSelection); executeInTransaction(new JdbcUnitOfWork() { public Void execute(Connection aConnection) throws Exception { IDatabaseConnection connection = new DatabaseConnection( aConnection); ITableFilter filter = new DatabaseSequenceFilter(connection, - tables); + tableNames); IDataSet dataset = new FilteredDataSet(filter, connection - .createDataSet(tables)); + .createDataSet(tableNames)); DatabaseOperation.DELETE_ALL.execute(connection, dataset); return null; } @@ -186,10 +186,10 @@ public class DatabaseUtils { Connection connection = dataSource.getConnection(); try { - ResultSet tables = connection.getMetaData().getTables(null, + ResultSet tableNames = connection.getMetaData().getTables(null, SCHEMA_PATTERN, "%", new String[] { "TABLE" }); - while (tables.next()) { - String table = tables.getString("TABLE_NAME"); + while (tableNames.next()) { + String table = tableNames.getString("TABLE_NAME"); if (aSelection.accept(table)) { result.add(table); } @@ -234,16 +234,16 @@ public class DatabaseUtils { } public void dropTables(ITableFilterSimple aTables) throws Exception { - final String[] tables = getTableNames(aTables); + final String[] tableNames = getTableNames(aTables); String[] sortedTables = executeInTransaction(new JdbcUnitOfWork() { public String[] execute(Connection aConnection) throws Exception { IDatabaseConnection connection = new DatabaseConnection( aConnection); ITableFilter filter = new DatabaseSequenceFilter(connection, - tables); + tableNames); IDataSet dataset = new FilteredDataSet(filter, connection - .createDataSet(tables)); + .createDataSet(tableNames)); return dataset.getTableNames(); } }); diff --git a/test/enterprise/src/main/java/org/wamblee/support/persistence/JpaBuilder.java b/test/enterprise/src/main/java/org/wamblee/support/persistence/JpaBuilder.java index d3b7e179..8356ea2e 100644 --- a/test/enterprise/src/main/java/org/wamblee/support/persistence/JpaBuilder.java +++ b/test/enterprise/src/main/java/org/wamblee/support/persistence/JpaBuilder.java @@ -128,11 +128,11 @@ public class JpaBuilder { // jpaProps.put("javax.persistence.provider", // HibernatePersistence.class.getName()); - EntityManagerFactory factory = Persistence.createEntityManagerFactory( + EntityManagerFactory emf = Persistence.createEntityManagerFactory( persistenceUnit.getUnitName(), jpaProps); - LOGGER.info("Using " + factory.getClass()); - return factory; + LOGGER.info("Using " + emf.getClass()); + return emf; } /** -- 2.31.1