[utilities COMMIT] in /java-support/trunk/src: main/java/net/shibboleth/utilities/java/support/component/AbstractDest...

noreply at shibboleth.net noreply at shibboleth.net
Mon Mar 5 15:18:01 GMT 2012


Author: lajoie
Date: Mon Mar  5 15:18:01 2012
New Revision: 237

URL: http://svn.shibboleth.net/view/utilities?rev=237&view=rev
Log:
Component package unit tests - JSPT-6

Added:
    java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/component/AbstractDestrucableIdentifiableInitializableComponentTest.java   (with props)
    java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/component/AbstractDestructableInitializableComponentTest.java   (with props)
Modified:
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestrucableIdentifiableInitializableComponent.java
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestructableInitializableComponent.java
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractInitializableComponent.java
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/ComponentSupport.java
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/xml/BasicParserPool.java
    java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/component/AbstractIdentifiableInitializableComponentTest.java
    java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/component/AbstractInitializableComponentTest.java
    java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/component/ComponentSupportTest.java

Modified: java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestrucableIdentifiableInitializableComponent.java
URL: http://svn.shibboleth.net/view/utilities/java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestrucableIdentifiableInitializableComponent.java?rev=237&r1=236&r2=237&view=diff
==============================================================================
--- java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestrucableIdentifiableInitializableComponent.java (original)
+++ java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestrucableIdentifiableInitializableComponent.java Mon Mar  5 15:18:01 2012
@@ -44,9 +44,9 @@
      * @param componentId ID of the component
      */
     protected synchronized void setId(@Nonnull @NotEmpty String componentId) {
-        ifInitializedThrowUnmodifiabledComponentException(id);
-        ifDestroyedThrowDestroyedComponentException(id);
-        
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
         id = Assert.isNotNull(StringSupport.trimOrNull(componentId), "Component ID can not be null or empty");
     }
 }

Modified: java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestructableInitializableComponent.java
URL: http://svn.shibboleth.net/view/utilities/java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestructableInitializableComponent.java?rev=237&r1=236&r2=237&view=diff
==============================================================================
--- java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestructableInitializableComponent.java (original)
+++ java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/component/AbstractDestructableInitializableComponent.java Mon Mar  5 15:18:01 2012
@@ -16,10 +16,6 @@
  */
 
 package net.shibboleth.utilities.java.support.component;
-
-import javax.annotation.Nullable;
-
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 /** Base class for things that implement {@link DestructableComponent} and {@link InitializableComponent}. */
 public abstract class AbstractDestructableInitializableComponent implements DestructableComponent,
@@ -53,82 +49,13 @@
 
     /** {@inheritDoc} */
     public final synchronized void initialize() throws ComponentInitializationException {
-        ifDestroyedThrowDestroyedComponentException();
+        ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
         if (isInitialized()) {
             return;
         }
 
         doInitialize();
         isInitialized = true;
-    }
-
-    /** Checks if this component is destroyed and, if so, throws a {@link DestroyedComponentException}. */
-    protected void ifDestroyedThrowDestroyedComponentException() {
-        ifDestroyedThrowDestroyedComponentException(null);
-    }
-
-    /**
-     * Checks if this component is destroyed and, if so, throws a {@link DestroyedComponentException}.
-     * 
-     * @param componentId identifier of the component that has been destroyed; used to generate an exception message
-     */
-    protected void ifDestroyedThrowDestroyedComponentException(@Nullable String componentId) {
-        String trimmedId = StringSupport.trimOrNull(componentId);
-
-        if (isDestroyed) {
-            if (trimmedId != null) {

[... 604 lines stripped ...]


More information about the commits mailing list