copyright messages updated in all java filees.
[utils] / security / src / test / java / org / wamblee / usermgt / hibernate / HibernateUserAdministrationTest.java
index d62fbdd6bfafbc702df836cfb7c21d43ed501161..074a5eac8eb7f550d501767d0d31b82716f11f31 100644 (file)
@@ -1,18 +1,18 @@
 /*
- * Copyright 2005 the original author or authors.
- *
+ * Copyright 2005-2010 the original author or authors.
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- */
+ */ 
 package org.wamblee.usermgt.hibernate;
 
 import org.apache.commons.logging.Log;
@@ -39,55 +39,33 @@ import java.lang.reflect.Method;
 
 import java.sql.SQLException;
 
-
 /**
- * User administration tests with persistence based on Hibernate. This
- * executes the same test cases as {@link
- * org.wamblee.usermgt.UserAdministrationImplTest} with in addition, one test
- * case that executes all Hibernate test cases separately with each test case
- * in its own transaction.
- *
+ * User administration tests with persistence based on Hibernate. This executes
+ * the same test cases as {@link org.wamblee.usermgt.UserAdministrationImplTest}
+ * with in addition, one test case that executes all Hibernate test cases
+ * separately with each test case in its own transaction.
+ * 
  * @author Erik Brakkee
  */
 public class HibernateUserAdministrationTest extends UserAdministrationImplTest {
-    /**
-     * DOCUMENT ME!
-     */
-    private static final Log LOG = LogFactory.getLog(HibernateUserAdministrationTest.class);
+    private static final Log LOG = LogFactory
+        .getLog(HibernateUserAdministrationTest.class);
 
-    /**
-     * DOCUMENT ME!
-     */
     private DefaultContainer container;
 
-    /**
-     * DOCUMENT ME!
-     */
     private Scope scope;
 
-    /**
-     * DOCUMENT ME!
-     */
     private DatabaseTesterComponent databaseTester;
 
-    /**
-     * DOCUMENT ME!
-     */
     private EhCache<Serializable, Serializable> userCache;
 
-    /**
-     * DOCUMENT ME!
-     */
     private UserAdministration userAdmin;
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.wamblee.usermgt.UserAdministrationImplTest#setUp()
      */
-    /**
-     * DOCUMENT ME!
-     *
-     * @throws Exception DOCUMENT ME!
-     */
     @Override
     protected void setUp() throws Exception {
         container = new DefaultContainer("top");
@@ -95,13 +73,15 @@ public class HibernateUserAdministrationTest extends UserAdministrationImplTest
         container.addComponent(new DatasourceComponent("datasource"));
         container.addComponent(new UserAdministrationComponent("admin", true));
 
-        ClassConfiguration dbtesterConfig = new ClassConfiguration(DatabaseTesterComponent.class);
+        ClassConfiguration dbtesterConfig = new ClassConfiguration(
+            DatabaseTesterComponent.class);
         dbtesterConfig.getObjectConfig().getSetterConfig().initAllSetters();
         container.addComponent("databaseTester", dbtesterConfig);
 
-        ObjectConfiguration config = new ObjectConfiguration(HibernateUserAdministrationTest.class);
-        config.getSetterConfig().clear().add("setUserCache")
-        .add("setDatabaseTester").add("setUserAdmin");
+        ObjectConfiguration config = new ObjectConfiguration(
+            HibernateUserAdministrationTest.class);
+        config.getSetterConfig().clear().add("setUserCache").add(
+            "setDatabaseTester").add("setUserAdmin");
         container.addComponent("testcase", this, config);
 
         scope = container.start();
@@ -112,38 +92,18 @@ public class HibernateUserAdministrationTest extends UserAdministrationImplTest
         clearUserCache();
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @param aUserCache DOCUMENT ME!
-     */
     public void setUserCache(EhCache<Serializable, Serializable> aUserCache) {
         userCache = aUserCache;
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @param aDatabaseTester DOCUMENT ME!
-     */
     public void setDatabaseTester(DatabaseTesterComponent aDatabaseTester) {
         databaseTester = aDatabaseTester;
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @param aUserAdmin DOCUMENT ME!
-     */
     public void setUserAdmin(UserAdministration aUserAdmin) {
         userAdmin = aUserAdmin;
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @throws Exception DOCUMENT ME!
-     */
     @Override
     protected void tearDown() throws Exception {
         container.stop(scope);
@@ -152,25 +112,14 @@ public class HibernateUserAdministrationTest extends UserAdministrationImplTest
 
     /*
      * (non-Javadoc)
-     *
+     * 
      * @see org.wamblee.usermgt.UserAdministrationImplTest#createAdmin()
      */
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
     @Override
     protected UserAdministration createAdmin() {
         return userAdmin;
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @throws SQLException DOCUMENT ME!
-     * @throws RuntimeException DOCUMENT ME!
-     */
     public void testAllTestsInASeparateTransaction() throws SQLException {
         Method[] methods = UserAdministrationImplTest.class.getMethods();
 
@@ -178,19 +127,21 @@ public class HibernateUserAdministrationTest extends UserAdministrationImplTest
             if (method.getName().startsWith("test")) {
                 databaseTester.cleanDatabase();
                 clearUserCache();
-                databaseTester.executeTransaction(new TestTransactionCallbackWithoutResult() {
+                databaseTester
+                    .executeTransaction(new TestTransactionCallbackWithoutResult() {
                         public void execute() throws Exception {
                             LOG.info("Running test " + method.getName());
 
                             try {
-                                method.invoke(HibernateUserAdministrationTest.this);
+                                method
+                                    .invoke(HibernateUserAdministrationTest.this);
                             } catch (Throwable t) {
-                                LOG.error("Test " + method.getName()
-                                    " failed");
+                                LOG.error("Test " + method.getName() +
+                                    " failed");
                                 throw new RuntimeException(t.getMessage(), t);
                             } finally {
-                                LOG.info("Test " + method.getName()
-                                    " finished");
+                                LOG.info("Test " + method.getName() +
+                                    " finished");
                             }
                         }
                     });
@@ -198,9 +149,6 @@ public class HibernateUserAdministrationTest extends UserAdministrationImplTest
         }
     }
 
-    /**
-     * 
-     */
     private void clearUserCache() {
         userCache.clear();
     }