source code formatting.
[utils] / security / src / test / java / org / wamblee / usermgt / hibernate / HibernateGroupSetTest.java
index 43bf8c899052fcba7c936dd6cffeb7d95c4fab57..4f0cb111a376f8fa2e8a3ab1ac134bdfcb14237a 100644 (file)
@@ -1,60 +1,86 @@
 /*
  * Copyright 2005 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 java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.wamblee.system.adapters.DefaultContainer;
 import org.wamblee.system.adapters.ObjectConfiguration;
 import org.wamblee.system.core.Scope;
 import org.wamblee.system.spring.component.DatabaseTesterComponent;
+
 import org.wamblee.test.spring.TestTransactionCallback;
+
 import org.wamblee.usermgt.GroupSet;
 import org.wamblee.usermgt.InMemoryGroupSetTest;
 
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
 /**
- * Tests for {@link org.wamblee.usermgt.hibernate.HibernateGroupSet} 
+ * Tests for {@link org.wamblee.usermgt.hibernate.HibernateGroupSet}
  *
  * @author Erik Brakkee
  */
 public class HibernateGroupSetTest extends InMemoryGroupSetTest {
-    
-    private static final String GROUP_TABLE = "GROUPS"; 
-    
-    private static final String GROUP_QUERY = "select * from " + GROUP_TABLE + " where name = ?";
-    
+    /**
+     * DOCUMENT ME!
+     */
+    private static final String GROUP_TABLE = "GROUPS";
+
+    /**
+     * DOCUMENT ME!
+     */
+    private static final String GROUP_QUERY = "select * from " + GROUP_TABLE
+        + " where name = ?";
+
+    /**
+     * DOCUMENT ME!
+     */
     private DefaultContainer container;
+
+    /**
+     * DOCUMENT ME!
+     */
     private Scope scope;
-    
+
+    /**
+     * DOCUMENT ME!
+     */
     private DatabaseTesterComponent databaseTester;
-    private GroupSet groupSet; 
-    
+
+    /**
+     * DOCUMENT ME!
+     */
+    private GroupSet groupSet;
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @throws Exception DOCUMENT ME!
+     */
     @Override
     protected void setUp() throws Exception {
-        
         container = new UserMgtRepositoryTestContainer("top");
-        
-        ObjectConfiguration config = new ObjectConfiguration(
-                HibernateGroupSetTest.class);
-        config.getSetterConfig().clear().add(
-                "setGroupSet").add("setDatabaseTester");
+
+        ObjectConfiguration config = new ObjectConfiguration(HibernateGroupSetTest.class);
+        config.getSetterConfig().clear().add("setGroupSet")
+        .add("setDatabaseTester");
         container.addComponent("testcase", this, config);
 
         scope = container.start();
@@ -63,16 +89,31 @@ public class HibernateGroupSetTest extends InMemoryGroupSetTest {
         super.setUp();
     }
 
+    /**
+     * DOCUMENT ME!
+     *
+     * @throws Exception DOCUMENT ME!
+     */
     @Override
-    protected void tearDown() throws Exception { 
+    protected void tearDown() throws Exception {
         container.stop(scope);
-       super.tearDown();
+        super.tearDown();
     }
-    
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param aDatabaseTester DOCUMENT ME!
+     */
     public void setDatabaseTester(DatabaseTesterComponent aDatabaseTester) {
         databaseTester = aDatabaseTester;
     }
-   
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param aGroupSet DOCUMENT ME!
+     */
     public void setGroupSet(GroupSet aGroupSet) {
         groupSet = aGroupSet;
     }
@@ -80,53 +121,82 @@ public class HibernateGroupSetTest extends InMemoryGroupSetTest {
     /* (non-Javadoc)
      * @see org.wamblee.usermgt.InMemoryGroupSetTest#checkGroupCount(int)
      */
+    /**
+     * DOCUMENT ME!
+     *
+     * @param aSize DOCUMENT ME!
+     *
+     * @throws SQLException DOCUMENT ME!
+     */
     @Override
     protected void checkGroupCount(int aSize) throws SQLException {
-        databaseTester.flush(); 
+        databaseTester.flush();
         super.checkGroupCount(aSize);
         assertEquals(aSize, databaseTester.getTableSize(GROUP_TABLE));
     }
-    
+
     /* (non-Javadoc)
      * @see org.wamblee.usermgt.InMemoryGroupSetTest#checkGroupExists(java.lang.String)
      */
+    /**
+     * DOCUMENT ME!
+     *
+     * @param aGroup DOCUMENT ME!
+     *
+     * @throws SQLException DOCUMENT ME!
+     */
     @Override
-    protected void checkGroupExists(final String aGroup) throws SQLException {
+    protected void checkGroupExists(final String aGroup)
+        throws SQLException {
         databaseTester.flush();
-        Map<String,Integer> result = 
-        databaseTester.executeTransaction(new TestTransactionCallback()  { 
-            /* (non-Javadoc)
-             * @see org.wamblee.test.TestTransactionCallback#execute()
-             */
-            @Override
-            public Map execute() throws Exception {
-                ResultSet result = databaseTester.executeQuery(GROUP_QUERY, aGroup);
-                Map<String,Integer> res = new HashMap<String,Integer>(); 
-                res.put("result", databaseTester.countResultSet(result));
-                return res; 
-            }
-        }); 
-      
+
+        Map<String, Integer> result = databaseTester.executeTransaction(new TestTransactionCallback() {
+                    /* (non-Javadoc)
+                     * @see org.wamblee.test.TestTransactionCallback#execute()
+                     */
+                    @Override
+                    public Map execute() throws Exception {
+                        ResultSet            result = databaseTester
+                            .executeQuery(GROUP_QUERY, aGroup);
+                        Map<String, Integer> res = new HashMap<String, Integer>();
+                        res.put("result", databaseTester.countResultSet(result));
+
+                        return res;
+                    }
+                });
+
         int count = result.get("result");
         assertEquals(1, count);
     }
-    
+
     /* (non-Javadoc)
      * @see org.wamblee.usermgt.InMemoryGroupSetTest#checkGroupNotExists(java.lang.String)
      */
+    /**
+     * DOCUMENT ME!
+     *
+     * @param aGroup DOCUMENT ME!
+     *
+     * @throws SQLException DOCUMENT ME!
+     */
     @Override
     protected void checkGroupNotExists(String aGroup) throws SQLException {
-       databaseTester.flush(); 
-       ResultSet result = databaseTester.executeQuery(GROUP_QUERY, aGroup); 
-       assertEquals(0, databaseTester.countResultSet(result));
+        databaseTester.flush();
+
+        ResultSet result = databaseTester.executeQuery(GROUP_QUERY, aGroup);
+        assertEquals(0, databaseTester.countResultSet(result));
     }
-    
+
     /* (non-Javadoc)
      * @see org.wamblee.usermgt.InMemoryGroupSetTest#createGroupSet()
      */
+    /**
+     * DOCUMENT ME!
+     *
+     * @return DOCUMENT ME!
+     */
     @Override
     protected GroupSet createGroupSet() {
-        return groupSet; 
+        return groupSet;
     }
-    
 }