checkstyle
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Sun, 18 Apr 2010 19:45:54 +0000 (19:45 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Sun, 18 Apr 2010 19:45:54 +0000 (19:45 +0000)
52 files changed:
security/src/main/java/org/wamblee/security/authorization/AuthorizationRule.java
security/src/main/java/org/wamblee/security/authorization/UrlAuthorizationRule.java
security/src/main/java/org/wamblee/usermgt/JaasUserAccessor.java
security/src/main/java/org/wamblee/usermgt/hibernate/AuthorizationComponent.java
security/src/main/java/org/wamblee/usermgt/hibernate/AuthorizationLightComponent.java
security/src/main/java/org/wamblee/usermgt/hibernate/UserAdministrationComponent.java
security/src/test/java/org/wamblee/security/authorization/TestAuthorizationRule.java
security/src/test/java/org/wamblee/usermgt/InMemoryGroupSetTest.java
support/general/src/main/java/org/wamblee/observer/Observable.java
system/general/src/main/java/org/wamblee/system/adapters/ClassAdapter.java
system/general/src/main/java/org/wamblee/system/adapters/ClassConfiguration.java
system/general/src/main/java/org/wamblee/system/adapters/FixedValueProvider.java
system/general/src/main/java/org/wamblee/system/adapters/ObjectConfiguration.java
system/general/src/main/java/org/wamblee/system/adapters/SetterConfiguration.java
system/general/src/main/java/org/wamblee/system/core/DefaultRequiredInterface.java
system/general/src/main/java/org/wamblee/system/core/ProvidedInterfaceImplementation.java
system/general/src/main/java/org/wamblee/system/graph/component/CheckExternallyProvidedVisitor.java
system/general/src/main/java/org/wamblee/system/graph/component/CheckExternallyRequiredVisitor.java
system/general/src/main/java/org/wamblee/system/graph/component/CheckRequiredProvidedMultiplicityVisitor.java
system/general/src/test/java/org/wamblee/system/adapters/AdapterTestCase.java
system/general/src/test/java/org/wamblee/system/adapters/ClassAdapterTest.java
system/general/src/test/java/org/wamblee/system/adapters/ClassConfigurationTest.java
system/general/src/test/java/org/wamblee/system/adapters/ConstructorConfigurationTest.java
system/general/src/test/java/org/wamblee/system/adapters/DefaultContainerTest.java
system/general/src/test/java/org/wamblee/system/adapters/ObjectAdapterTest.java
system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java
system/general/src/test/java/org/wamblee/system/adapters/X1.java
system/general/src/test/java/org/wamblee/system/adapters/X2.java
system/general/src/test/java/org/wamblee/system/adapters/X3.java
system/general/src/test/java/org/wamblee/system/adapters/X4.java
system/general/src/test/java/org/wamblee/system/adapters/X5.java
system/general/src/test/java/org/wamblee/system/adapters/X8.java
system/general/src/test/java/org/wamblee/system/graph/CompositeEdgeFilterTest.java
system/spring/src/main/java/org/wamblee/system/spring/RequiredServiceBean.java
system/spring/src/main/java/org/wamblee/system/spring/StringResource.java
system/spring/src/main/java/org/wamblee/system/spring/component/HibernateComponent.java
system/spring/src/test/java/org/wamblee/system/spring/HelloService.java
system/spring/src/test/java/org/wamblee/system/spring/SpringComponentTest.java
test/eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/JndiSessionCustomizer.java
test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContext.java
test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContextFactory.java
test/enterprise/src/main/java/org/wamblee/support/persistence/AbstractDatabase.java
test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseBuilder.java
test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseDescription.java
test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseStarter.java
test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseUtils.java
test/enterprise/src/main/java/org/wamblee/support/persistence/DerbyDatabase.java
test/enterprise/src/main/java/org/wamblee/support/persistence/JpaBuilder.java
test/enterprise/src/test/java/org/wamblee/support/persistence/DatabaseUtilsTestBase.java
test/enterprise/src/test/java/org/wamblee/support/persistence/MyEntityExampleTestBase.java
test/enterprise/src/test/java/org/wamblee/support/persistence/MyTables.java
test/toplink-essentials/src/main/java/org/wamblee/support/persistence/toplink/JndiSessionCustomizer.java

index 8aab974ada61eae9acae7869091c6b554c4c9ed4..d968c836476f787e414c8a3df243d9e037cfce99 100644 (file)
@@ -42,13 +42,13 @@ public interface AuthorizationRule extends Persistent {
      * 
      * @param aResource
      *            Resource.
-     * @param anOperation
+     * @param aOperation
      *            Operation.
      * @param aUser
      *            Current user.
      * 
      * @return Authorization result.
      */
-    AuthorizationResult isAllowed(Object aResource, Operation anOperation,
+    AuthorizationResult isAllowed(Object aResource, Operation aOperation,
         User aUser);
 }
index 1d454e235f6c5919722688f1af655b7025789864..adeb93c157f0ebaa9522e20ef1fd01cabbcaf9e9 100644 (file)
@@ -146,14 +146,14 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent implements
      * .Object, org.wamblee.security.authorization.Operation)
      */
     public AuthorizationResult isAllowed(Object aResource,
-        Operation anOperation, User aUser) {
+        Operation aOperation, User aUser) {
         if (!resourceClass.isInstance(aResource)) {
             return UNSUPPORTED_RESOURCE;
         }
 
         String path = getResourcePath(aResource);
 
-        return isAllowed(path, anOperation, aUser);
+        return isAllowed(path, aOperation, aUser);
     }
 
     /**
index 8cb6506568cd9ad9ae7b07e83059cc5628980666..ec7a25afa36892557a9449be073833ce28dff816 100644 (file)
@@ -83,7 +83,7 @@ public class JaasUserAccessor implements UserAccessor {
     /**
      * Gets the user principal from the subject.
      * 
-     * @param subject
+     * @param aSubject
      *            Subject.
      * 
      * @return User principal.
@@ -92,8 +92,8 @@ public class JaasUserAccessor implements UserAccessor {
      *             In case there is a duplicate principal or the principal was
      *             not found.
      */
-    private Principal getUserPrincipal(Subject subject) {
-        Set<Principal> principals = subject.getPrincipals();
+    private Principal getUserPrincipal(Subject aSubject) {
+        Set<Principal> principals = aSubject.getPrincipals();
         Principal userPrincipal = null;
 
         for (Principal principal : principals) {
@@ -101,7 +101,7 @@ public class JaasUserAccessor implements UserAccessor {
                 if (userPrincipal != null) {
                     throw new IllegalArgumentException(
                         "Multiple principals for class '" + userPrincipalClass +
-                            "', subject: " + subject);
+                            "', subject: " + aSubject);
                 }
 
                 userPrincipal = principal;
@@ -111,7 +111,7 @@ public class JaasUserAccessor implements UserAccessor {
         if (userPrincipal == null) {
             throw new IllegalArgumentException(
                 "No user principal found for class '" + userPrincipalClass +
-                    "', subject: " + subject);
+                    "', subject: " + aSubject);
         }
 
         return userPrincipal;
index cc5417830338da035039e58316eee6f382656814..941ecfe5898c4c37b6cff1c445500ced34d199cc 100644 (file)
  */ 
 package org.wamblee.usermgt.hibernate;
 
-import org.springframework.orm.hibernate3.HibernateTemplate;
-
-import org.springframework.transaction.PlatformTransactionManager;
+import java.io.IOException;
 
-import org.wamblee.cache.EhCache;
+import javax.sql.DataSource;
 
+import org.springframework.orm.hibernate3.HibernateTemplate;
+import org.springframework.transaction.PlatformTransactionManager;
 import org.wamblee.security.authorization.AuthorizationService;
 import org.wamblee.security.authorization.hibernate.AuthorizationMappingFiles;
-
 import org.wamblee.system.adapters.DefaultContainer;
 import org.wamblee.system.adapters.ObjectConfiguration;
 import org.wamblee.system.components.ORMappingConfig;
@@ -31,16 +30,8 @@ import org.wamblee.system.core.Component;
 import org.wamblee.system.core.DefaultProvidedInterface;
 import org.wamblee.system.core.DefaultRequiredInterface;
 import org.wamblee.system.core.ProvidedInterface;
-import org.wamblee.system.core.Scope;
 import org.wamblee.system.spring.component.HibernateComponent;
-
 import org.wamblee.usermgt.UserAccessor;
-import org.wamblee.usermgt.UserAdministration;
-import org.wamblee.usermgt.UserGroupRepositoryComponent;
-
-import java.io.IOException;
-
-import javax.sql.DataSource;
 
 /**
  * 
@@ -48,13 +39,13 @@ import javax.sql.DataSource;
  * @version $Revision$
  */
 public class AuthorizationComponent extends DefaultContainer {
-    private ProvidedInterface TRANSACTION_MGR = new DefaultProvidedInterface(
+    private ProvidedInterface transactionMgr = new DefaultProvidedInterface(
         "transactionManager", PlatformTransactionManager.class);
 
-    private ProvidedInterface HIBERNATE_TEMPLATE = new DefaultProvidedInterface(
+    private ProvidedInterface hibernateTemplate = new DefaultProvidedInterface(
         "hibernateTemplate", HibernateTemplate.class);
 
-    private ProvidedInterface AUTHORIZATION_SERVICE = new DefaultProvidedInterface(
+    private ProvidedInterface authorizationService = new DefaultProvidedInterface(
         "authorizationService", AuthorizationService.class);
 
     /**
@@ -87,10 +78,10 @@ public class AuthorizationComponent extends DefaultContainer {
             ORMappingConfig.class));
 
         if (aExposeInternals) {
-            addProvidedInterface(TRANSACTION_MGR);
-            addProvidedInterface(HIBERNATE_TEMPLATE);
+            addProvidedInterface(transactionMgr);
+            addProvidedInterface(hibernateTemplate);
         }
 
-        addProvidedInterface(AUTHORIZATION_SERVICE);
+        addProvidedInterface(authorizationService);
     }
 }
index 23004b4936065093404664a7a921a4d05dab3124..39a37dae6bdbfaa9235808deeb81e3f706595d85 100644 (file)
  */ 
 package org.wamblee.usermgt.hibernate;
 
-import org.springframework.orm.hibernate3.HibernateTemplate;
+import java.util.HashMap;
+import java.util.Map;
 
+import org.springframework.orm.hibernate3.HibernateTemplate;
 import org.wamblee.security.authorization.AuthorizationService;
-
 import org.wamblee.system.core.DefaultProvidedInterface;
 import org.wamblee.system.core.DefaultRequiredInterface;
 import org.wamblee.system.core.ProvidedInterface;
 import org.wamblee.system.core.RequiredInterface;
 import org.wamblee.system.spring.SpringComponent;
-
-import org.wamblee.usermgt.GroupSet;
 import org.wamblee.usermgt.UserAccessor;
-import org.wamblee.usermgt.UserAdministration;
-import org.wamblee.usermgt.UserSet;
-
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * Light version of the user administration component that requires external
index 66211a0db36cbd6238b9fd603722362cac1eb6a4..65ee1e3db7fd516bf046fab86da7a1932447dc65 100644 (file)
@@ -44,16 +44,16 @@ import javax.sql.DataSource;
  * @version $Revision$
  */
 public class UserAdministrationComponent extends DefaultContainer {
-    private ProvidedInterface TRANSACTION_MGR = new DefaultProvidedInterface(
+    private ProvidedInterface transactionMgr = new DefaultProvidedInterface(
         "transactionManager", PlatformTransactionManager.class);
 
-    private ProvidedInterface USER_CACHE = new DefaultProvidedInterface(
+    private ProvidedInterface userCache = new DefaultProvidedInterface(
         "userCache", EhCache.class);
 
-    private ProvidedInterface HIBERNATE_TEMPLATE = new DefaultProvidedInterface(
+    private ProvidedInterface hibernateTemplate = new DefaultProvidedInterface(
         "hibernateTemplate", HibernateTemplate.class);
 
-    private ProvidedInterface USER_MGT = new DefaultProvidedInterface(
+    private ProvidedInterface userMgt = new DefaultProvidedInterface(
         "usermgt", UserAdministration.class);
 
     /**
@@ -88,11 +88,11 @@ public class UserAdministrationComponent extends DefaultContainer {
             ORMappingConfig.class));
 
         if (aExposeInternals) {
-            addProvidedInterface(TRANSACTION_MGR);
-            addProvidedInterface(USER_CACHE);
-            addProvidedInterface(HIBERNATE_TEMPLATE);
+            addProvidedInterface(transactionMgr);
+            addProvidedInterface(userCache);
+            addProvidedInterface(hibernateTemplate);
         }
 
-        addProvidedInterface(USER_MGT);
+        addProvidedInterface(userMgt);
     }
 }
index 9df7d37728754e49fc32c65f57b28ea3f5ef6876..9d6000b9f4d6e78c6363df81181b254d83318751 100644 (file)
@@ -72,8 +72,8 @@ public class TestAuthorizationRule extends UrlAuthorizationRule {
      */
     @Override
     public AuthorizationResult isAllowed(Object aResource,
-        Operation anOperation, User aUser) {
-        AuthorizationResult result = super.isAllowed(aResource, anOperation,
+        Operation aOperation, User aUser) {
+        AuthorizationResult result = super.isAllowed(aResource, aOperation,
             aUser);
 
         if (result.equals(GRANTED) || result.equals(DENIED)) {
index 6aa764a28c49c7e90f2d1b138f65b7e50da98099..a97adcca2bc41b86ba717b28d8bf1f8ca64313ea 100644 (file)
@@ -26,7 +26,7 @@ import java.util.Set;
  * implementations of group set.
  */
 public class InMemoryGroupSetTest extends TestCase {
-    protected GroupSet groups;
+    private GroupSet groups;
 
     /**
      * This method must be overriden in subclasses.
index 9842cff582491c39b789882de6ff919d424724b4..5c2e9a4f2ca5fe5c51710d568af35bc100fd669b 100644 (file)
@@ -127,23 +127,4 @@ public class Observable<ObservableType, Event> {
             notifier.update(observer, observable, aEvent);
         }
     }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see java.lang.Object#finalize()
-     */
-    @Override
-    protected void finalize() throws Throwable {
-        if (observers.size() > 0) {
-            LOGGER
-                .error("Still observers registered at finalization of observer!");
-
-            for (Observer observer : observers.values()) {
-                LOGGER.error("  observer: " + observer);
-            }
-        }
-
-        super.finalize();
-    }
 }
index 47bce6d77c445f54e9108635053014eb80504031..6bfa03f12efbe083d7834db6cd7ad0d01cc2dfa9 100644 (file)
@@ -26,7 +26,7 @@ import org.wamblee.system.core.Scope;
  * @author Erik Brakkee
  */
 public class ClassAdapter extends AbstractComponent<Object> {
-    private ClassConfiguration _classConfig;
+    private ClassConfiguration classConfig;
 
     /**
      * Creates a new ClassAdapter object.
@@ -36,13 +36,13 @@ public class ClassAdapter extends AbstractComponent<Object> {
         super(aName, aClassConfig.getProvidedInterfaces().toArray(
             new ProvidedInterface[0]), aClassConfig.getRequiredInterfaces()
             .toArray(new RequiredInterface[0]));
-        _classConfig = aClassConfig;
+        classConfig = aClassConfig;
     }
 
     @Override
     protected Object doStart(Scope aScope) {
-        Object obj = _classConfig.create(aScope);
-        _classConfig.inject(aScope, obj);
+        Object obj = classConfig.create(aScope);
+        classConfig.inject(aScope, obj);
 
         for (ProvidedInterface provided : getProvidedInterfaces()) {
             addInterface(provided, obj, aScope);
index f6da6911fada792342d8fc9bf1e2e2d90e8f9582..31e09f9286aa2b31bcb0e44f6efcceedfc7f7189 100644 (file)
@@ -30,7 +30,7 @@ import java.util.List;
  * @author Erik Brakkee
  */
 public class ClassConfiguration {
-    private Class _class;
+    private Class clazz;
 
     private ConstructorConfiguration constructorConfig;
 
@@ -44,7 +44,7 @@ public class ClassConfiguration {
      *            Class to construct.
      */
     public ClassConfiguration(Class aClass) {
-        _class = aClass;
+        clazz = aClass;
         constructorConfig = new ConstructorConfiguration(aClass);
         objectConfig = new ObjectConfiguration(aClass);
     }
@@ -83,7 +83,7 @@ public class ClassConfiguration {
 
     public List<ProvidedInterface> getProvidedInterfaces() {
         List<ProvidedInterface> result = new ArrayList<ProvidedInterface>();
-        result.add(new DefaultProvidedInterface("provided", _class));
+        result.add(new DefaultProvidedInterface("provided", clazz));
 
         return result;
     }
index e80567477ba2aa96a2b2b62ee6921a2ef808f5d6..4cbe97b23496fef22c336a7453159938ce89c5b2 100644 (file)
@@ -23,7 +23,7 @@ import org.wamblee.system.core.Scope;
  * @author Erik Brakkee
  */
 class FixedValueProvider implements ValueProvider {
-    private Object _value;
+    private Object value;
 
     /**
      * Constructs the value.
@@ -32,11 +32,11 @@ class FixedValueProvider implements ValueProvider {
      *            Value to construct.
      */
     public FixedValueProvider(Object aValue) {
-        _value = aValue;
+        value = aValue;
     }
 
     @Override
     public Object getValue(Scope aScope) {
-        return _value;
+        return value;
     }
 }
index 2bfe01ef0ebb9ed0bb035a0db24626753722c4d0..51a902463424f24629713f0daefe9bd7c08bbaaf 100644 (file)
@@ -27,7 +27,7 @@ import java.util.List;
  * @author Erik Brakkee
  */
 public class ObjectConfiguration {
-    private Class _class;
+    private Class clazz;
 
     private SetterConfiguration setterConfig;
 
@@ -36,7 +36,7 @@ public class ObjectConfiguration {
      * 
      */
     public ObjectConfiguration(Class aClass) {
-        _class = aClass;
+        clazz = aClass;
         setterConfig = new SetterConfiguration(aClass);
     }
 
@@ -65,6 +65,6 @@ public class ObjectConfiguration {
     }
 
     public boolean appliesTo(Object aObject) {
-        return _class.isInstance(aObject);
+        return clazz.isInstance(aObject);
     }
 }
index d66d7636b5445c337aa0b198629186824e2d559e..c8baeafb9dcdef0e4b117d49d783c43564712613 100644 (file)
@@ -51,7 +51,7 @@ import java.util.Set;
  * @author Erik Brakkee
  */
 public class SetterConfiguration {
-    private Class _class;
+    private Class clazz;
 
     private boolean publicOnly;
 
@@ -64,7 +64,7 @@ public class SetterConfiguration {
      *            Class which is being configured.
      */
     public SetterConfiguration(Class aClass) {
-        _class = aClass;
+        clazz = aClass;
         publicOnly = true;
         setters = new HashMap<Method, ParameterValues>();
     }
@@ -76,7 +76,7 @@ public class SetterConfiguration {
     public SetterConfiguration initAllSetters() {
         setters.clear();
 
-        for (Method method : getAllSetters(_class, publicOnly)) {
+        for (Method method : getAllSetters(clazz, publicOnly)) {
             setters.put(method, createParameterValues(method));
         }
 
@@ -140,9 +140,9 @@ public class SetterConfiguration {
      * 
      */
     public SetterConfiguration remove(Method aMethod) {
-        if (!aMethod.getDeclaringClass().isAssignableFrom(_class)) {
+        if (!aMethod.getDeclaringClass().isAssignableFrom(clazz)) {
             throw new RuntimeException("Method " + aMethod +
-                " not found in class " + _class + " or its superclasses");
+                " not found in class " + clazz + " or its superclasses");
         }
 
         for (Method method : setters.keySet()) {
@@ -169,7 +169,7 @@ public class SetterConfiguration {
     public SetterConfiguration add(final String aName) {
         int oldlen = setters.size();
         List<Method> methods = new ArrayList<Method>();
-        CollectionFilter.filter(getAllSetters(_class, publicOnly), methods,
+        CollectionFilter.filter(getAllSetters(clazz, publicOnly), methods,
             new Condition<Method>() {
                 @Override
                 public boolean matches(Method aObject) {
@@ -179,7 +179,7 @@ public class SetterConfiguration {
 
         if (methods.size() == 0) {
             throw new IllegalArgumentException("Method '" + aName +
-                "' not found in " + _class.getName());
+                "' not found in " + clazz.getName());
         }
 
         // TODO is it possible to get more than one setter here in case the
@@ -205,7 +205,7 @@ public class SetterConfiguration {
      */
     public SetterConfiguration addSetter(final Class aType) {
         List<Method> result = new ArrayList<Method>();
-        CollectionFilter.filter(getAllSetters(_class, publicOnly), result,
+        CollectionFilter.filter(getAllSetters(clazz, publicOnly), result,
             new Condition<Method>() {
                 @Override
                 public boolean matches(Method aObject) {
@@ -217,7 +217,7 @@ public class SetterConfiguration {
 
         if (result.size() == 0) {
             throw new IllegalArgumentException("No setter found in class '" +
-                _class.getName() + "' that has a setter with argument type '" +
+                clazz.getName() + "' that has a setter with argument type '" +
                 aType.getName() + "'");
         }
 
@@ -229,7 +229,7 @@ public class SetterConfiguration {
             }
 
             throw new IllegalArgumentException(
-                "Multiple setters found in class '" + _class.getName() +
+                "Multiple setters found in class '" + clazz.getName() +
                     " that accept type '" + aType.getName() + "': " + setters);
         }
 
@@ -301,9 +301,9 @@ public class SetterConfiguration {
      * 
      */
     public void inject(Scope aScope, Object aObject) {
-        if (!_class.isInstance(aObject)) {
+        if (!clazz.isInstance(aObject)) {
             throw new IllegalArgumentException("Object '" + aObject +
-                "' is not an instance of " + _class.getName());
+                "' is not an instance of " + clazz.getName());
         }
 
         for (Method method : setters.keySet()) {
index d7e76df51c2ef92c7cc4c568a8c933d70958752e..aa4a7253d54823ea1a3e8048e84a6cd18d72b617 100644 (file)
@@ -133,18 +133,18 @@ public class DefaultRequiredInterface implements RequiredInterface {
     }
 
     @Override
-    public boolean equals(Object obj) {
-        return this == obj;
+    public boolean equals(Object aObject) {
+        return this == aObject;
     }
 
     @Override
-    public boolean covers(RequiredInterface obj) {
+    public boolean covers(RequiredInterface aObject) {
         // TODO do more than equals.
-        if (!(obj instanceof DefaultRequiredInterface)) {
+        if (!(aObject instanceof DefaultRequiredInterface)) {
             return false;
         }
 
-        DefaultRequiredInterface descr = (DefaultRequiredInterface) obj;
+        DefaultRequiredInterface descr = (DefaultRequiredInterface) aObject;
 
         if (required.length != descr.required.length) {
             return false;
index bce21aaadbf6a154dca090dfbad2d50f7836cd65..61c80c7aeacc17680d622c2acab655e368e9cbdb 100644 (file)
@@ -21,9 +21,9 @@ package org.wamblee.system.core;
  * @author Erik Brakkee
  */
 class ProvidedInterfaceImplementation {
-    private ProvidedInterface _provided;
+    private ProvidedInterface provided;
 
-    private Object _implementation;
+    private Object implementation;
 
     /**
      * Constructs the object.
@@ -35,8 +35,8 @@ class ProvidedInterfaceImplementation {
      */
     public ProvidedInterfaceImplementation(ProvidedInterface aProvided,
         Object aImplementation) {
-        _provided = aProvided;
-        _implementation = aImplementation;
+        provided = aProvided;
+        implementation = aImplementation;
     }
 
     /**
@@ -44,7 +44,7 @@ class ProvidedInterfaceImplementation {
      * @return The provided interface.
      */
     public ProvidedInterface getProvided() {
-        return _provided;
+        return provided;
     }
 
     /**
@@ -57,6 +57,6 @@ class ProvidedInterfaceImplementation {
      * @return Implementation.
      */
     public <T> T getImplementation(Class<T> aType) {
-        return (T) _implementation;
+        return (T) implementation;
     }
 }
index fe6737c049de3e06e9dcfd644ac0b6cf65f0df9f..b68c6003238766adc5ae2c151b4c690155fb367c 100644 (file)
@@ -68,11 +68,11 @@ public class CheckExternallyProvidedVisitor implements Visitor {
     }
 
     private void createDuplicateException(String aMsg, Node aNode,
-        List<Edge> edges) {
+        List<Edge> aEdges) {
         StringBuffer buf = new StringBuffer();
         buf.append(aNode + ": " + aMsg + ": ");
 
-        for (Edge edge : edges) {
+        for (Edge edge : aEdges) {
             buf.append(edge.getTo() + "/ ");
         }
 
index 010205e93f6691cf37f371900130a85e36b4da2b..8e90ef4f2f132d77b843f2e4aa2866f2f49a0d49 100644 (file)
@@ -33,7 +33,7 @@ import java.util.List;
  * @author Erik Brakkee
  */
 public class CheckExternallyRequiredVisitor implements Visitor {
-    private Log LOG = LogFactory.getLog(CheckExternallyRequiredVisitor.class);
+    private static final Log LOG = LogFactory.getLog(CheckExternallyRequiredVisitor.class);
 
     private Graph graph;
 
index 01a0af902672f02437ffac3563b87fcb8a5637eb..fc8eaf27608dd4a218d0a6c842c7d83e7a87e619 100644 (file)
@@ -84,11 +84,11 @@ public class CheckRequiredProvidedMultiplicityVisitor implements Visitor {
     }
 
     private void createDuplicateException(String aMsg, Node aNode,
-        List<Edge> edges) {
+        List<Edge> aEdges) {
         StringBuffer buf = new StringBuffer();
         buf.append(aNode + ": " + aMsg + ": ");
 
-        for (Edge edge : edges) {
+        for (Edge edge : aEdges) {
             buf.append(edge.getTo() + "/ ");
         }
 
index 77a731557ab017a8c00eac68eb479a2b36f71eea..f68e285238419827569c29b4095b6da0a5f111a4 100644 (file)
@@ -29,10 +29,18 @@ import org.wamblee.test.EventTracker;
  * @version $Revision$
  */
 public class AdapterTestCase extends TestCase {
-    static EventTracker<String> EVENT_TRACKER;
+    private static EventTracker<String> EVENT_TRACKER;
 
-    protected Scope scope;
+    private Scope scope;
 
+    protected Scope getScope() {  
+        return scope; 
+    }
+    
+    public static EventTracker<String> getEventTracker() {
+        return EVENT_TRACKER;
+    }
+    
     @Override
     protected void setUp() throws Exception {
         super.setUp();
index 722adc704d35129d7e238bab8baa6fa68c635d5b..1a6f9b581447da3e769985d751a63bff7a695b42 100644 (file)
@@ -45,7 +45,7 @@ public class ClassAdapterTest extends AdapterTestCase {
 
         Scope scope = container.start();
         AssertionUtils.assertEquals(new String[] { "x1(hello)", "x4(x1)" },
-            EVENT_TRACKER.getEvents(Thread.currentThread()).toArray());
+            getEventTracker().getEvents(Thread.currentThread()).toArray());
 
         Object obj1 = scope.getRuntime(x1Adapter);
         assertTrue(obj1 instanceof X1);
@@ -80,7 +80,7 @@ public class ClassAdapterTest extends AdapterTestCase {
 
         Scope scope = container.start();
         AssertionUtils.assertEquals(new String[] { "x1(hello)", "x4(x1)",
-            "x8(x1)", "x8.setX4(x4)" }, EVENT_TRACKER.getEvents(
+            "x8(x1)", "x8.setX4(x4)" }, getEventTracker().getEvents(
             Thread.currentThread()).toArray());
 
         Object obj1 = scope.getRuntime(x1Adapter);
index 43eda33e6071a98db1f2f3946af942fb8c6ea3cc..86e6b077907bebcfa51c21fbaf0ad003d5fa16b6 100644 (file)
  */ 
 package org.wamblee.system.adapters;
 
+import java.util.Collections;
+import java.util.List;
+
 import org.wamblee.system.core.DefaultProvidedInterface;
 import org.wamblee.system.core.ProvidedInterface;
 import org.wamblee.system.core.RequiredInterface;
 import org.wamblee.system.core.RequiredInterfaceComparator;
-
+import org.wamblee.system.core.Scope;
 import org.wamblee.test.AssertionUtils;
 
-import java.util.Collections;
-import java.util.List;
-
 /**
  * 
  * @author $author$
@@ -46,11 +46,11 @@ public class ClassConfigurationTest extends AdapterTestCase {
 
         required.get(0).setProvider(provided);
 
-        scope.publishInterface(provided, "hello");
-        classConfig.create(scope);
+        getScope().publishInterface(provided, "hello");
+        classConfig.create(getScope());
 
         AssertionUtils.assertEquals(new String[] { "x1(hello)" },
-            AdapterTestCase.EVENT_TRACKER.getEvents(Thread.currentThread())
+            AdapterTestCase.getEventTracker().getEvents(Thread.currentThread())
                 .toArray());
     }
 
@@ -74,6 +74,7 @@ public class ClassConfigurationTest extends AdapterTestCase {
         required.get(0).setProvider(providedBoolean);
         required.get(1).setProvider(providedHost);
 
+        Scope scope = getScope();
         scope.publishInterface(providedBoolean, true);
         scope.publishInterface(providedHost, "host.name.org");
 
index ec7070dfddff15c218f11e9e445b7dc4e8675f20..d1ced96f9b7effb7f3c320203f3cacf0c56cf529 100644 (file)
  */ 
 package org.wamblee.system.adapters;
 
+import java.util.List;
+
 import org.wamblee.system.core.DefaultProvidedInterface;
 import org.wamblee.system.core.ProvidedInterface;
 import org.wamblee.system.core.RequiredInterface;
+import org.wamblee.system.core.Scope;
 import org.wamblee.system.core.SystemAssemblyException;
-
 import org.wamblee.test.AssertionUtils;
 
-import java.util.List;
-
 /**
  * 
  * @author $author$
@@ -42,11 +42,12 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
 
         required.get(0).setProvider(provided);
 
+        Scope scope = getScope();
         scope.publishInterface(provided, "hello");
         config.create(scope);
 
         AssertionUtils.assertEquals(new String[] { "x1(hello)" },
-            AdapterTestCase.EVENT_TRACKER.getEvents(Thread.currentThread())
+            AdapterTestCase.getEventTracker().getEvents(Thread.currentThread())
                 .toArray());
     }
 
@@ -72,11 +73,12 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
         assertEquals(1, required.size());
         required.get(0).setProvider(provided);
 
+        Scope scope = getScope();
         scope.publishInterface(provided, "hello");
         config.create(scope);
 
         AssertionUtils.assertEquals(new String[] { "x2(hello)" },
-            AdapterTestCase.EVENT_TRACKER.getEvents(Thread.currentThread())
+            AdapterTestCase.getEventTracker().getEvents(Thread.currentThread())
                 .toArray());
     }
 
@@ -85,10 +87,11 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
             .greedy();
         config.getParameters().setValue(0, "bla");
 
+        Scope scope = getScope();
         config.create(scope);
 
         AssertionUtils.assertEquals(new String[] { "x1(bla)" },
-            AdapterTestCase.EVENT_TRACKER.getEvents(Thread.currentThread())
+            AdapterTestCase.getEventTracker().getEvents(Thread.currentThread())
                 .toArray());
     }
 
@@ -104,11 +107,12 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
         assertEquals(1, required.size());
         required.get(0).setProvider(provided);
 
+        Scope scope = getScope();
         scope.publishInterface(provided, "hello");
         config.create(scope);
 
         AssertionUtils.assertEquals(new String[] { "x1(hello)" },
-            AdapterTestCase.EVENT_TRACKER.getEvents(Thread.currentThread())
+            AdapterTestCase.getEventTracker().getEvents(Thread.currentThread())
                 .toArray());
     }
 
@@ -118,10 +122,11 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
         config.getParameters().setOptional(0);
         assertTrue(config.getRequiredInterfaces().get(0).isOptional());
 
+        Scope scope = getScope();
         config.create(scope);
 
         AssertionUtils.assertEquals(new String[] { "x1(null)" },
-            AdapterTestCase.EVENT_TRACKER.getEvents(Thread.currentThread())
+            AdapterTestCase.getEventTracker().getEvents(Thread.currentThread())
                 .toArray());
     }
 
@@ -144,11 +149,12 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
 
         required.get(0).setProvider(provided);
 
+        Scope scope = getScope();
         scope.publishInterface(provided, "hello");
         config.create(scope);
 
         AssertionUtils.assertEquals(new String[] { "x3(hello)" },
-            AdapterTestCase.EVENT_TRACKER.getEvents(Thread.currentThread())
+            AdapterTestCase.getEventTracker().getEvents(Thread.currentThread())
                 .toArray());
     }
 }
index 8990d83b18a9968fdbf206e9de434453970bb5c1..e405b565a554635dffab74f988cb28dfe5e0f2f4 100644 (file)
@@ -38,7 +38,7 @@ public class DefaultContainerTest extends AdapterTestCase {
 
         Scope scope = container.start();
         AssertionUtils.assertEquals(new String[] { "x1(hello)", "x4(x1)" },
-            EVENT_TRACKER.getEvents(Thread.currentThread()).toArray());
+            getEventTracker().getEvents(Thread.currentThread()).toArray());
 
         Object obj = scope.getRuntime("x1");
         assertTrue(obj instanceof X1);
@@ -52,7 +52,7 @@ public class DefaultContainerTest extends AdapterTestCase {
         x1Config.getObjectConfig().getSetterConfig().initAllSetters();
 
         X8 x8 = new X8(null);
-        EVENT_TRACKER.clear();
+        getEventTracker().clear();
 
         ClassConfiguration x4Config = new ClassConfiguration(X4.class);
         x4Config.getObjectConfig().getSetterConfig().initAllSetters();
@@ -66,7 +66,7 @@ public class DefaultContainerTest extends AdapterTestCase {
 
         Scope scope = container.start();
         AssertionUtils.assertEquals(new String[] { "x1(hello)", "x4(x1)",
-            "x8.setX4(x4)" }, EVENT_TRACKER.getEvents(Thread.currentThread())
+            "x8.setX4(x4)" }, getEventTracker().getEvents(Thread.currentThread())
             .toArray());
 
         Object obj1 = scope.getRuntime("x1");
index d5e233cc015e0600d7c463d4fd7fe20f923ef074..23c3bd9cbd3c265652a9be2912562fd898f8d8c1 100644 (file)
@@ -56,11 +56,11 @@ public class ObjectAdapterTest extends AdapterTestCase {
             x4Adapter, x8Adapter }, new ProvidedInterface[0],
             new RequiredInterface[0]);
 
-        EVENT_TRACKER.clear();
+        getEventTracker().clear();
 
         Scope scope = container.start();
         AssertionUtils.assertEquals(new String[] { "x1(hello)", "x4(x1)",
-            "x8.setX4(x4)" }, EVENT_TRACKER.getEvents(Thread.currentThread())
+            "x8.setX4(x4)" }, getEventTracker().getEvents(Thread.currentThread())
             .toArray());
 
         Object obj1 = scope.getRuntime(x1Adapter);
index 9a956c357ffc4b505d6bfb833203d3a44d49ad2d..87855d9f9d39d60d7e3fe16a58ff7078022d0f5e 100644 (file)
  */ 
 package org.wamblee.system.adapters;
 
-import org.wamblee.system.core.DefaultProvidedInterface;
-import org.wamblee.system.core.ProvidedInterface;
-import org.wamblee.system.core.RequiredInterface;
-import org.wamblee.system.core.RequiredInterfaceComparator;
-
-import org.wamblee.test.AssertionUtils;
-
 import java.lang.reflect.Method;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -31,6 +23,13 @@ import java.util.List;
 
 import javax.sql.DataSource;
 
+import org.wamblee.system.core.DefaultProvidedInterface;
+import org.wamblee.system.core.ProvidedInterface;
+import org.wamblee.system.core.RequiredInterface;
+import org.wamblee.system.core.RequiredInterfaceComparator;
+import org.wamblee.system.core.Scope;
+import org.wamblee.test.AssertionUtils;
+
 /**
  * 
  * @author $author$
@@ -48,6 +47,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided);
+        Scope scope = getScope();
         scope.publishInterface(provided, "hello");
 
         X5 obj = new X5();
@@ -77,6 +77,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
             "janse", String.class);
         assertTrue(required.get(0).implementedBy(providedString));
         required.get(0).setProvider(providedString);
+        Scope scope = getScope();
         scope.publishInterface(providedString, "hello");
 
         ProvidedInterface providedInt = new DefaultProvidedInterface("xxx",
@@ -115,6 +116,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
             "janse", Boolean.class);
         assertTrue(required.get(0).implementedBy(providedBoolean));
         required.get(0).setProvider(providedBoolean);
+        Scope scope = getScope();
         scope.publishInterface(providedBoolean, true);
 
         ProvidedInterface providedString = new DefaultProvidedInterface(
@@ -151,6 +153,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         ProvidedInterface provided1 = new DefaultProvidedInterface("port",
@@ -177,6 +180,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided);
+        final Scope scope = getScope();
         scope.publishInterface(provided, "hello");
 
         final X6 obj = new X6();
@@ -198,6 +202,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
 
         X5 obj = new X5();
         assertNull(obj.getValue());
+        Scope scope = getScope();
         config.inject(scope, obj);
         assertEquals("bladibla", obj.getValue());
     }
@@ -214,6 +219,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         assertNull(obj.getHost());
         assertNull(obj.getPort());
 
+        Scope scope = getScope();
         config.inject(scope, obj);
 
         assertNull(obj.getHost());
@@ -232,6 +238,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         X6 obj = new X6();
@@ -255,6 +262,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         X6 obj = new X6();
@@ -324,6 +332,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         X6 obj = new X6();
@@ -348,6 +357,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         X6 obj = new X6();
index 4bba76405bbe4fb3ff7769ba3fe5982627bea00d..622268347e4a39a6af5a74fad4a80b2cda42f3a9 100644 (file)
@@ -25,7 +25,7 @@ public class X1 {
      * Creates a new X1 object.
      */
     public X1() {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x1()");
+        AdapterTestCase.getEventTracker().eventOccurred("x1()");
     }
 
     /**
@@ -33,6 +33,6 @@ public class X1 {
      * 
      */
     public X1(String aValue) {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x1(" + aValue + ")");
+        AdapterTestCase.getEventTracker().eventOccurred("x1(" + aValue + ")");
     }
 }
index 0a96e84e9ba2410e3986dd616fd546b57a2ffdf0..987a4ee0a8db84281b88a5d902731cc6a94f74fc 100644 (file)
@@ -26,7 +26,7 @@ public class X2 {
      * 
      */
     public X2(Integer aInteger) {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x2(" + aInteger + ")");
+        AdapterTestCase.getEventTracker().eventOccurred("x2(" + aInteger + ")");
     }
 
     /**
@@ -34,6 +34,6 @@ public class X2 {
      * 
      */
     public X2(String aValue) {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x2(" + aValue + ")");
+        AdapterTestCase.getEventTracker().eventOccurred("x2(" + aValue + ")");
     }
 }
index 7e9015e8c8f4518465957220ac5368e42a676941..60f9e10e08f6e6d2d8b84b77b40cee9ea53ce09c 100644 (file)
@@ -25,7 +25,7 @@ public class X3 {
      * Creates a new X3 object.
      */
     public X3() {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x3()");
+        AdapterTestCase.getEventTracker().eventOccurred("x3()");
     }
 
     /**
@@ -33,6 +33,6 @@ public class X3 {
      * 
      */
     protected X3(String aValue) {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x3(" + aValue + ")");
+        AdapterTestCase.getEventTracker().eventOccurred("x3(" + aValue + ")");
     }
 }
index d3995f2e2026e0d5262865ae36af4537a4f82559..25ab539454667216e8475b053c4d5ecf3bc027c7 100644 (file)
@@ -28,7 +28,7 @@ public class X4 {
      * 
      */
     public X4(X1 aX1) {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x4(x1)");
+        AdapterTestCase.getEventTracker().eventOccurred("x4(x1)");
         x1 = aX1;
     }
 
index 58dfb96e9c3f318a8f8a4668e5d7e8f98c6e6403..3efd316af8efb3e43f7c9bd611a197b01a1ba89a 100644 (file)
@@ -32,7 +32,7 @@ public class X5 {
     }
 
     public void setValue(String aValue) {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x5.setValue(" + aValue +
+        AdapterTestCase.getEventTracker().eventOccurred("x5.setValue(" + aValue +
             ")");
         value = aValue;
     }
index 2c4ff9f4cfc5a88e5dad400b06956aaf4b6f9069..5b507e1b4be522ed09115a7108917d8b9b420df2 100644 (file)
@@ -30,12 +30,12 @@ public class X8 {
      * 
      */
     public X8(X1 aX1) {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x8(x1)");
+        AdapterTestCase.getEventTracker().eventOccurred("x8(x1)");
         x1 = aX1;
     }
 
     public void setX4(X4 aX4) {
-        AdapterTestCase.EVENT_TRACKER.eventOccurred("x8.setX4(x4)");
+        AdapterTestCase.getEventTracker().eventOccurred("x8.setX4(x4)");
         x4 = aX4;
     }
 
index 909c3792cc677cb1d74ec65f4d9c66f1d12bbea3..3f16953126642eea043257b17e285c781bd7c115 100644 (file)
@@ -52,8 +52,8 @@ public class CompositeEdgeFilterTest extends TestCase {
             .get(0))));
     }
 
-    private void configureRestriction(EdgeFilter base, boolean aResult) {
-        stub(base.isViolated((Edge) anyObject())).toReturn(aResult);
+    private void configureRestriction(EdgeFilter aBase, boolean aResult) {
+        stub(aBase.isViolated((Edge) anyObject())).toReturn(aResult);
     }
 
     public void testOneRestriction() {
index b2db73735a6893a18385cd3d88573a16c9d8154e..133e3aa2088836bdefe33dccf1435c31ad9c50a2 100644 (file)
@@ -29,7 +29,7 @@ import java.util.List;
  * @author Erik Brakkee
  */
 class RequiredServiceBean implements FactoryBean {
-    private RequiredInterface _required;
+    private RequiredInterface required;
 
     /**
      * Constructs the bean.
@@ -38,12 +38,12 @@ class RequiredServiceBean implements FactoryBean {
      *            Id of the bean in the service registry.
      */
     public RequiredServiceBean(String aId) {
-        List<RequiredInterface> required = SpringComponent.THIS.get()
+        List<RequiredInterface> requiredInterfaces = SpringComponent.THIS.get()
             .getRequiredInterfaces();
 
-        for (RequiredInterface intf : required) {
+        for (RequiredInterface intf : requiredInterfaces) {
             if (intf.getName().equals(aId)) {
-                _required = intf;
+                required = intf;
 
                 return;
             }
@@ -56,7 +56,7 @@ class RequiredServiceBean implements FactoryBean {
     @Override
     public Object getObject() throws Exception {
         return SpringComponent.SCOPE.get().getInterfaceImplementation(
-            _required.getProvider(), Object.class);
+            required.getProvider(), Object.class);
     }
 
     @Override
index 5f2597c1642a4aebf0fea08138592ee5e72f5ffe..2f5cbb5d12b1d55cfd4732445c74f1d6e68cd876 100644 (file)
@@ -30,14 +30,14 @@ import java.net.URL;
  * @version $Revision$
  */
 class StringResource implements Resource {
-    private String _value;
+    private String value;
 
     /**
      * Creates a new StringResource object.
      * 
      */
     public StringResource(String aValue) {
-        _value = aValue;
+        value = aValue;
     }
 
     @Override
@@ -77,6 +77,6 @@ class StringResource implements Resource {
 
     @Override
     public InputStream getInputStream() throws IOException {
-        return new ByteArrayInputStream(_value.getBytes());
+        return new ByteArrayInputStream(value.getBytes());
     }
 }
index c52c87c3c4f849b3dfec4e4272ec2121bd55eac8..3f1720949513b158417b39dd74023ca9808d8740 100644 (file)
@@ -57,7 +57,7 @@ public class HibernateComponent extends SpringComponent {
 
     private static final String HIBERNATE_SPRING_CONFIG = "spring/org.wamblee.system.spring.component.hibernate.xml";
 
-    private final RequiredInterface CONFIG = new DefaultRequiredInterface(
+    private final RequiredInterface config = new DefaultRequiredInterface(
         "config", ORMappingConfig.class);
 
     /**
@@ -72,16 +72,16 @@ public class HibernateComponent extends SpringComponent {
         Properties props = new Properties();
         addProperties(HIBERNATE_PROPS_KEY, props);
 
-        addRequiredInterface(CONFIG);
+        addRequiredInterface(config);
     }
 
     @Override
     protected Scope doStart(Scope aExternalScope) {
-        ORMappingConfig config = aExternalScope.getInterfaceImplementation(
-            CONFIG.getProvider(), ORMappingConfig.class);
-        setProperty(HIBERNATE_SCHEMAUPDATE_PROP, "" + config.isSchemaUpdate());
+        ORMappingConfig orMappingConfig = aExternalScope.getInterfaceImplementation(
+            config.getProvider(), ORMappingConfig.class);
+        setProperty(HIBERNATE_SCHEMAUPDATE_PROP, "" + orMappingConfig.isSchemaUpdate());
 
-        DatabaseType db = config.getType();
+        DatabaseType db = orMappingConfig.getType();
         String dialect = db.handleCases(new DatabaseType.Switch<String>() {
             @Override
             public String handleMySqlInnoDb() {
index 8feead0563f27c16832b74468a5f90887ede2153..c3e623ce0792afadf16a95e3c96f5841daab022e 100644 (file)
@@ -28,7 +28,7 @@ public class HelloService {
      * 
      */
     public HelloService(String aMsg) {
-        SpringComponentTest.EVENT_TRACKER.eventOccurred(aMsg);
+        SpringComponentTest.getEventTracker().eventOccurred(aMsg);
         msg = aMsg;
     }
 
index e4029206dee6439df6bccab8770b5060ae071998..2e0bf5c0887f78d341a81467e7765a93e39221e8 100644 (file)
@@ -52,10 +52,14 @@ public class SpringComponentTest extends TestCase {
 
     private static final String PROPERTY_FILE = "test.org.wamblee.system.spring.properties";
 
-    public static EventTracker<String> EVENT_TRACKER;
+    private static EventTracker<String> EVENT_TRACKER;
 
     private Scope externalScope;
 
+    public static EventTracker<String> getEventTracker() { 
+        return EVENT_TRACKER;
+    }
+    
     @Override
     protected void setUp() throws Exception {
         super.setUp();
index 37a1cb3c8cc9f138be295d9845dd155d06682ed6..ca74ec5cebc45c908098524540171e1e0eff44eb 100644 (file)
@@ -45,7 +45,7 @@ public class JndiSessionCustomizer implements SessionCustomizer {
      * 
      * 
      */
-    public void customize(Session session) throws Exception {
+    public void customize(Session aSession) throws Exception {
         JNDIConnector connector = null;
         Context context = null;
 
@@ -53,7 +53,7 @@ public class JndiSessionCustomizer implements SessionCustomizer {
             context = new InitialContext();
 
             if (null != context) {
-                connector = (JNDIConnector) session.getLogin().getConnector(); // possible
+                connector = (JNDIConnector) aSession.getLogin().getConnector(); // possible
                                                                                // CCE
                 // Change from COMPOSITE_NAME_LOOKUP to STRING_LOOKUP
                 // Note: if both jta and non-jta elements exist this will only
@@ -66,11 +66,11 @@ public class JndiSessionCustomizer implements SessionCustomizer {
 
                 // Or, if you are specifying both JTA and non-JTA in your
                 // persistence.xml then set both connectors to be safe
-                JNDIConnector writeConnector = (JNDIConnector) session
+                JNDIConnector writeConnector = (JNDIConnector) aSession
                     .getLogin().getConnector();
                 writeConnector.setLookupType(JNDIConnector.STRING_LOOKUP);
 
-                JNDIConnector readConnector = (JNDIConnector) ((DatabaseLogin) ((ServerSession) session)
+                JNDIConnector readConnector = (JNDIConnector) ((DatabaseLogin) ((ServerSession) aSession)
                     .getReadConnectionPool().getLogin()).getConnector();
                 readConnector.setLookupType(JNDIConnector.STRING_LOOKUP);
 
index 8fd8494679bf290cb09469a3364d1794c11b6ce9..4db8a1126f4a3358e3d3aacf20af7f59740d9d94 100644 (file)
@@ -30,17 +30,17 @@ public class StubInitialContext extends InitialContext {
     }
 
     @Override
-    public void bind(String name, Object obj) throws NamingException {
-        bindings.put(name, obj);
+    public void bind(String aName, Object aObj) throws NamingException {
+        bindings.put(aName, aObj);
     }
 
     @Override
-    public Object lookup(String name) throws NamingException {
-        return bindings.get(name);
+    public Object lookup(String aName) throws NamingException {
+        return bindings.get(aName);
     }
 
     @Override
-    public Object lookup(Name name) throws NamingException {
-        return super.lookup(name.toString());
+    public Object lookup(Name aName) throws NamingException {
+        return super.lookup(aName.toString());
     }
 }
index c2869ea3237c9d56e3f032acdd3c743f6b26304e..8a9409d065c438b1e70f24e3277d23a57be4177d 100644 (file)
@@ -38,11 +38,11 @@ import javax.naming.spi.InitialContextFactory;
  */
 public class StubInitialContextFactory implements InitialContextFactory {
 
-    private static Context context;
+    private static Context CONTEXT;
 
     private static void initialize() {
         try {
-            context = new StubInitialContext();
+            CONTEXT = new StubInitialContext();
         } catch (NamingException e) { // can't happen.
             throw new RuntimeException(e);
         }
@@ -58,7 +58,7 @@ public class StubInitialContextFactory implements InitialContextFactory {
         // sets up the InitialContextFactoryForTest as default factory.
         System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
             StubInitialContextFactory.class.getName());
-        if (context == null) {
+        if (CONTEXT == null) {
             initialize();
         }
     }
@@ -68,11 +68,11 @@ public class StubInitialContextFactory implements InitialContextFactory {
      */
     public static void unregister() {
         System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "");
-        context = null;
+        CONTEXT = null;
     }
 
-    public Context getInitialContext(Hashtable<?, ?> environment)
+    public Context getInitialContext(Hashtable<?, ?> aEnvironment)
         throws NamingException {
-        return context;
+        return CONTEXT;
     }
 }
index 5a084e06b41cb9bdd42ffd4e211ea2e0d7d70ad2..0fc871f1d4b9a6a2700a1fc22aee5580b8408fa2 100644 (file)
@@ -51,8 +51,13 @@ public abstract class AbstractDatabase implements Database {
         // constructed object at the connection pool.
         PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(
             connectionFactory, connectionPool, null, null, false, true);
+        ingoredVariable(poolableConnectionFactory);
         itsDataSource = new PoolingDataSource(connectionPool);
     }
+    
+    private static void ingoredVariable(PoolableConnectionFactory aFactory) {
+        // Empty
+    }
 
     // / BELOW THIS LINE IS NOT OF INTEREST TO SUBCLASSES.
 
index f086c6d1abaacc5d9a1bddc32ccff27b3f77cb3f..d8807c389717b36a65142bf0ac44b7a222ad7f29 100644 (file)
@@ -62,7 +62,8 @@ public class DatabaseBuilder {
      */
     private static final String DB_CAPABILITIES_PROP = "TEST_DB_CAPABILITIES";
 
-    private static ServiceLoader<DatabaseProvider> LOADER = null;
+    private static ServiceLoader<DatabaseProvider> LOADER = 
+        ServiceLoader.load(DatabaseProvider.class);
 
     private DatabaseBuilder() {
         // Empty.
@@ -97,10 +98,9 @@ public class DatabaseBuilder {
                     aCapabilities = new String[] { DatabaseProvider.CAPABILITY_IN_MEMORY };
                 }
             }
-            LOGGER.info("Using capabilities: " + aCapabilities);
+            LOGGER.info("Using capabilities: " + Arrays.asList(aCapabilities));
         }
         synchronized (DatabaseBuilder.class) {
-            initLoader();
             for (DatabaseProvider db : LOADER) {
                 if (db.supportsCapabilities(aCapabilities)) {
                     return db.create();
@@ -118,7 +118,6 @@ public class DatabaseBuilder {
      * @return List of databases.
      */
     public static List<DatabaseDescription> getSupportedDatabases() {
-        initLoader();
         List<DatabaseDescription> descriptions = new ArrayList<DatabaseDescription>();
         for (DatabaseProvider db : LOADER) {
             descriptions.add(db.getDescription());
@@ -126,10 +125,4 @@ public class DatabaseBuilder {
         return descriptions;
     }
 
-    private static void initLoader() {
-        if (LOADER == null) {
-            LOADER = ServiceLoader.load(DatabaseProvider.class);
-        }
-    }
-
 }
index d476a8a390c64fb703a8e7fde19bfd77123ff68a..8427c1d8ce8ad9b26b6cb31ca85d982720060a6d 100644 (file)
@@ -48,13 +48,13 @@ public class DatabaseDescription {
     }
 
     private String printCapabilities() {
-        String res = "";
+        StringBuffer res = new StringBuffer();
         for (int i = 0; i < itsCapabilities.length; i++) {
-            res += "" + itsCapabilities[i];
+            res.append(itsCapabilities[i]);
             if (i < itsCapabilities.length - 1) {
-                res += ", ";
+                res.append(", "); 
             }
         }
-        return res;
+        return res.toString();
     }
 }
index 5fdaa25aca3c781deed6d8afbeef07b26edf4485..45e964999476eab3697e453d15e2518991203759 100644 (file)
@@ -37,10 +37,10 @@ public class DatabaseStarter {
      * where the database class name must be the name of a concrete subclass of
      * {@link Database}.
      * 
-     * @param args
+     * @param aArgs
      */
-    public static void main(String[] args) throws Exception {
-        String clazz = args[0];
+    public static void main(String[] aArgs) throws Exception {
+        String clazz = aArgs[0];
         try {
             new DatabaseStarter(Class.forName(clazz)).start();
         } catch (Exception e) {
index bc62274914081d199aa9cd427cd0943bca2b5433..5f26bd8e0dceab7d128684399eacb51727d950bc 100644 (file)
@@ -12,7 +12,7 @@
  * 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.support.persistence;
 
 import java.sql.Connection;
@@ -146,15 +146,20 @@ public class DatabaseUtils {
         LOG.fine("Getting database table names to clean (schema: '" +
             SCHEMA_PATTERN + "'");
 
-        ResultSet tables = dataSource.getConnection().getMetaData().getTables(
-            null, SCHEMA_PATTERN, "%", new String[] { "TABLE" });
-        while (tables.next()) {
-            String table = tables.getString("TABLE_NAME");
-            if (aSelection.accept(table)) {
-                result.add(table);
+        Connection connection = dataSource.getConnection();
+        try {
+            ResultSet tables = connection.getMetaData().getTables(null,
+                SCHEMA_PATTERN, "%", new String[] { "TABLE" });
+            while (tables.next()) {
+                String table = tables.getString("TABLE_NAME");
+                if (aSelection.accept(table)) {
+                    result.add(table);
+                }
             }
+            return (String[]) result.toArray(new String[0]);
+        } finally {
+            connection.close();
         }
-        return (String[]) result.toArray(new String[0]);
     }
 
     public void emptyTables() throws Exception {
@@ -363,7 +368,7 @@ public class DatabaseUtils {
         if (aObject instanceof Integer) {
             aStatement.setInt(aIndex, ((Integer) aObject).intValue());
         } else if (aObject instanceof Long) {
-            aStatement.setLong(aIndex, ((Integer) aObject).longValue());
+            aStatement.setLong(aIndex, ((Long) aObject).longValue());
         } else if (aObject instanceof String) {
             aStatement.setString(aIndex, (String) aObject);
         } else {
index 40e52afac29733d11dfb53d5908fc270f655fd33..33bd4f4491c5247186f4eb46ac2b8e5484ece7cf 100755 (executable)
@@ -12,7 +12,7 @@
  * 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.support.persistence;
 
 import java.io.File;
@@ -243,8 +243,8 @@ public class DerbyDatabase extends AbstractDatabase {
     private void shutdownDerby() {
         try {
             DriverManager.getConnection("jdbc:derby:;shutdown=true");
-            throw new RuntimeException("Derby did not shutdown, "
-                + " should always throw exception at shutdown");
+            throw new RuntimeException(
+                "Derby did not shutdown, should always throw exception at shutdown");
         } catch (Exception e) {
             LOGGER.info("Derby has been shut down.");
         }
index 4e824093b14d61c816f9c4a1d8daa8b964b45a65..4d1921f5abf5a7c8f7d06d5bbd0f1824f4f96b02 100644 (file)
@@ -52,13 +52,13 @@ public class JpaBuilder {
         /**
          * Executes the unit of work. A transaction has been started.
          * 
-         * @param em
+         * @param aEm
          *            Entity manager.
          * @return Result of the execute method. If you don't want to return
          *         anything use <code>Void</code> for the return type and return
          *         null from the implementation.
          */
-        T execute(EntityManager em);
+        T execute(EntityManager aEm) throws Exception;
     }
 
     private PersistenceUnitDescription persistenceUnit;
@@ -94,7 +94,7 @@ public class JpaBuilder {
         }
         factory = createFactory();
         execute(new JpaUnitOfWork<Void>() {
-            public Void execute(EntityManager em) {
+            public Void execute(EntityManager aEm) {
                 // Empty, just to trigger database schema creation.
                 return null;
             }
index 8ca1a156f479641d94ba31f79db6dd5102c77f1e..9012dbd575c5d0bcb193054ba39eb98e2b982d0c 100644 (file)
@@ -78,9 +78,9 @@ public class DatabaseUtilsTestBase {
 
         // Put some data in the database.
         builder.execute(new JpaUnitOfWork<Void>() {
-            public Void execute(EntityManager em) {
+            public Void execute(EntityManager aEm) {
                 MyEntity entity = new MyEntity("a", "b");
-                em.persist(entity);
+                aEm.persist(entity);
                 return null;
             }
         });
index 8bf094b3fa451c132d9f866ec4c4b54d807e2226..7cb81a929dd9b6fc581db5b069a5076f21927766 100644 (file)
@@ -85,9 +85,9 @@ public class MyEntityExampleTestBase {
         // as and execute the
         // unit of work.
         builder.execute(new JpaUnitOfWork<Void>() {
-            public Void execute(EntityManager em) {
+            public Void execute(EntityManager aEm) {
                 MyEntity entity = new MyEntity("a", "b");
-                em.persist(entity);
+                aEm.persist(entity);
                 return null;
             }
         });
index 9b5c9825538bc778c79212eee420a3c2eb232283..e0a337fe352e4a0a54e61e22f60691b4b85232b3 100644 (file)
@@ -34,8 +34,8 @@ public class MyTables implements ITableFilterSimple {
         // Empty.
     }
 
-    public boolean accept(String tableName) throws DataSetException {
-        return tableName.startsWith("XYZ_");
+    public boolean accept(String aTableName) throws DataSetException {
+        return aTableName.startsWith("XYZ_");
     }
 
 }
index cc2dbd3520d8916f29166f2311d0406d524f268a..bc4a23a091f8b8bd57d5c2869d07524daa518b5c 100644 (file)
@@ -45,7 +45,7 @@ public class JndiSessionCustomizer implements SessionCustomizer {
      * 
      * 
      */
-    public void customize(Session session) throws Exception {
+    public void customize(Session aSession) throws Exception {
         JNDIConnector connector = null;
         Context context = null;
 
@@ -53,7 +53,7 @@ public class JndiSessionCustomizer implements SessionCustomizer {
             context = new InitialContext();
 
             if (null != context) {
-                connector = (JNDIConnector) session.getLogin().getConnector(); // possible
+                connector = (JNDIConnector) aSession.getLogin().getConnector(); // possible
                                                                                // CCE
                 // Change from COMPOSITE_NAME_LOOKUP to STRING_LOOKUP
                 // Note: if both jta and non-jta elements exist this will only
@@ -66,11 +66,11 @@ public class JndiSessionCustomizer implements SessionCustomizer {
 
                 // Or, if you are specifying both JTA and non-JTA in your
                 // persistence.xml then set both connectors to be safe
-                JNDIConnector writeConnector = (JNDIConnector) session
+                JNDIConnector writeConnector = (JNDIConnector) aSession
                     .getLogin().getConnector();
                 writeConnector.setLookupType(JNDIConnector.STRING_LOOKUP);
 
-                JNDIConnector readConnector = (JNDIConnector) ((DatabaseLogin) ((ServerSession) session)
+                JNDIConnector readConnector = (JNDIConnector) ((DatabaseLogin) ((ServerSession) aSession)
                     .getReadConnectionPool().getLogin()).getConnector();
                 readConnector.setLookupType(JNDIConnector.STRING_LOOKUP);