tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject svn commit: r416333 [3/5] - in /incubator/tuscany/sandbox/jboynes/sca: containers/ containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/ containers/container.java/ core2/src/main/java/org/apache/tuscany/core/bootstrap/ core2/sr...
Date Thu, 22 Jun 2006 11:20:33 GMT
Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemCompositeImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemCompositeImplementation.java?rev=416333&r1=416331&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemCompositeImplementation.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemCompositeImplementation.java Thu Jun 22 04:20:25 2006
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.tuscany.core.system.model;
+package org.apache.tuscany.core.implementation.system.model;
 
 import java.net.URL;
 

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java?rev=416333&r1=416331&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java Thu Jun 22 04:20:25 2006
@@ -14,10 +14,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.tuscany.core.system.model;
+package org.apache.tuscany.core.implementation.system.model;
 
 import org.apache.tuscany.spi.model.AtomicImplementation;
-import org.apache.tuscany.spi.model.PojoComponentType;
+import org.apache.tuscany.core.implementation.PojoComponentType;
 
 /**
  * Represents the system composite implementation

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemInboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemInboundWire.java?rev=416333&r1=416331&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemInboundWire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemInboundWire.java Thu Jun 22 04:20:25 2006
@@ -1,10 +1,10 @@
-package org.apache.tuscany.core.system.wire;
+package org.apache.tuscany.core.implementation.system.wire;
 
 import org.apache.tuscany.spi.wire.InboundWire;
 
 /**
- * Specified by a {@link org.apache.tuscany.core.system.model.SystemBinding}, a specialized inbound wire that returns a
- * direct reference to the target.
+ * Specified by a {@link org.apache.tuscany.core.implementation.system.model.SystemBinding}, a specialized inbound wire
+ * that returns a direct reference to the target.
  *
  * @version $$Rev$$ $$Date$$
  */

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemInboundWireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemInboundWireImpl.java?rev=416333&r1=416331&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemInboundWireImpl.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemInboundWireImpl.java Thu Jun 22 04:20:25 2006
@@ -1,4 +1,4 @@
-package org.apache.tuscany.core.system.wire;
+package org.apache.tuscany.core.implementation.system.wire;
 
 import java.lang.reflect.Method;
 import java.util.Collections;

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundAutowire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundAutowire.java?rev=416333&r1=416331&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundAutowire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundAutowire.java Thu Jun 22 04:20:25 2006
@@ -1,4 +1,4 @@
-package org.apache.tuscany.core.system.wire;
+package org.apache.tuscany.core.implementation.system.wire;
 
 import java.lang.reflect.Method;
 import java.util.Collections;

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundWire.java?rev=416333&r1=416331&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundWire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundWire.java Thu Jun 22 04:20:25 2006
@@ -1,10 +1,10 @@
-package org.apache.tuscany.core.system.wire;
+package org.apache.tuscany.core.implementation.system.wire;
 
 import org.apache.tuscany.spi.wire.OutboundWire;
 
 /**
- * Specified by a {@link org.apache.tuscany.core.system.model.SystemBinding}, a specialized outbound wire that returns a
- * direct reference to the target.
+ * Specified by a {@link org.apache.tuscany.core.implementation.system.model.SystemBinding}, a specialized outbound wire
+ * that returns a direct reference to the target.
  *
  * @version $$Rev$$ $$Date$$
  */

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundWireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundWireImpl.java?rev=416333&r1=416331&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundWireImpl.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/implementation/system/wire/SystemOutboundWireImpl.java Thu Jun 22 04:20:25 2006
@@ -1,4 +1,4 @@
-package org.apache.tuscany.core.system.wire;
+package org.apache.tuscany.core.implementation.system.wire;
 
 import java.lang.reflect.Method;
 import java.util.Collections;

Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java (from r415960, incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/ContextInjector.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java&p1=incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/ContextInjector.java&r1=415960&r2=416333&rev=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/ContextInjector.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java Thu Jun 22 04:20:25 2006
@@ -1,4 +1,4 @@
-package org.apache.tuscany.spi.injection;
+package org.apache.tuscany.core.injection;
 
 import org.apache.tuscany.spi.ObjectCreationException;
 

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java (from r415960, incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/EventInvoker.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java&p1=incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/EventInvoker.java&r1=415960&r2=416333&rev=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/EventInvoker.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java Thu Jun 22 04:20:25 2006
@@ -1,4 +1,4 @@
-package org.apache.tuscany.spi.injection;
+package org.apache.tuscany.core.injection;
 
 /**
  * Performs an invocation on an instance

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java?rev=416333&r1=416332&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java Thu Jun 22 04:20:25 2006
@@ -4,7 +4,6 @@
 
 import org.apache.tuscany.spi.ObjectCreationException;
 import org.apache.tuscany.spi.ObjectFactory;
-import org.apache.tuscany.spi.injection.Injector;
 
 /**
  * Injects a value created by an {@link org.apache.tuscany.spi.ObjectFactory} on a given field

Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java (from r415960, incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/InjectionRuntimeException.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java&p1=incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/InjectionRuntimeException.java&r1=415960&r2=416333&rev=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/InjectionRuntimeException.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java Thu Jun 22 04:20:25 2006
@@ -1,4 +1,4 @@
-package org.apache.tuscany.spi.injection;
+package org.apache.tuscany.core.injection;
 
 import org.apache.tuscany.spi.TuscanyRuntimeException;
 

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/Injector.java (from r415960, incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/Injector.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/Injector.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/Injector.java&p1=incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/Injector.java&r1=415960&r2=416333&rev=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/Injector.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/Injector.java Thu Jun 22 04:20:25 2006
@@ -11,7 +11,7 @@
  * 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.apache.tuscany.spi.injection;
+package org.apache.tuscany.core.injection;
 
 import org.apache.tuscany.spi.ObjectCreationException;
 

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/Injector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/Injector.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InvalidAccessorException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InvalidAccessorException.java?rev=416333&r1=416332&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InvalidAccessorException.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/InvalidAccessorException.java Thu Jun 22 04:20:25 2006
@@ -1,7 +1,5 @@
 package org.apache.tuscany.core.injection;
 
-import org.apache.tuscany.spi.injection.InjectionRuntimeException;
-
 /**
  * @version $$Rev$$ $$Date$$
  */

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java?rev=416333&r1=416332&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java Thu Jun 22 04:20:25 2006
@@ -3,9 +3,6 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-import org.apache.tuscany.spi.injection.EventInvoker;
-import org.apache.tuscany.spi.injection.ObjectCallbackException;
-
 /**
  * Performs an wire on a method of a given instance
  *

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java?rev=416333&r1=416332&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java Thu Jun 22 04:20:25 2006
@@ -5,7 +5,6 @@
 
 import org.apache.tuscany.spi.ObjectCreationException;
 import org.apache.tuscany.spi.ObjectFactory;
-import org.apache.tuscany.spi.injection.Injector;
 
 /**
  * Injects a value created by an {@link org.apache.tuscany.spi.ObjectFactory} using a given method

Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/NoAccessorException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/NoAccessorException.java?rev=416333&r1=416332&r2=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/NoAccessorException.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/NoAccessorException.java Thu Jun 22 04:20:25 2006
@@ -1,7 +1,5 @@
 package org.apache.tuscany.core.injection;
 
-import org.apache.tuscany.spi.injection.InjectionRuntimeException;
-
 /**
  * @version $$Rev$$ $$Date$$
  */

Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java (from r415960, incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/ObjectCallbackException.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java&p1=incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/ObjectCallbackException.java&r1=415960&r2=416333&rev=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/ObjectCallbackException.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java Thu Jun 22 04:20:25 2006
@@ -1,4 +1,4 @@
-package org.apache.tuscany.spi.injection;
+package org.apache.tuscany.core.injection;
 
 /**
  * Denotes an error when invoking on an object

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java (from r415960, incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/PojoObjectFactory.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java&p1=incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/PojoObjectFactory.java&r1=415960&r2=416333&rev=416333&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/injection/PojoObjectFactory.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java Thu Jun 22 04:20:25 2006
@@ -11,7 +11,7 @@
  * 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.apache.tuscany.spi.injection;
+package org.apache.tuscany.core.injection;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,55 @@
+package org.apache.tuscany.core.component.event;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EventTestCase extends MockObjectTestCase {
+
+    private CompositeComponent component;
+
+    public void testCompositeStart() {
+        CompositeStart event = new CompositeStart(this, component);
+        assertEquals(component, event.getComposite());
+    }
+
+    public void testCompositeStop() {
+        CompositeStop event = new CompositeStop(this, component);
+        assertEquals(component, event.getComposite());
+    }
+
+    public void testHttpSessionStart() {
+        Object id = new Object();
+        HttpSessionEvent event = new HttpSessionStart(this, id);
+        assertEquals(this, event.getSource());
+        assertEquals(id, event.getId());
+    }
+
+    public void testHttpSessionEnd() {
+        Object id = new Object();
+        HttpSessionEvent event = new HttpSessionEnd(this, id);
+        assertEquals(this, event.getSource());
+        assertEquals(id, event.getId());
+    }
+
+    public void testRequestStart() {
+        RequestStart event = new RequestStart(this);
+        assertEquals(this, event.getSource());
+    }
+
+    public void testReequestEnd() {
+        RequestEnd event = new RequestEnd(this);
+        assertEquals(this, event.getSource());
+    }
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        Mock mock = mock(CompositeComponent.class);
+        component = (CompositeComponent) mock.proxy();
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,121 @@
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.event.Event;
+import org.apache.tuscany.spi.event.EventFilter;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.event.TrueFilter;
+import org.apache.tuscany.spi.model.Scope;
+
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractScopeContainerTestCase extends MockObjectTestCase {
+
+    public void testSetWorkContext() {
+        TestContainer container = new TestContainer("foo");
+        WorkContext ctx = new WorkContextImpl();
+        container.setWorkContext(ctx);
+        assertEquals(ctx, container.getWorkContext());
+
+    }
+
+    public void testFireListener() {
+        TestContainer container = new TestContainer("foo");
+        Mock mock = mock(RuntimeEventListener.class);
+        Event event = new TestEvent();
+        mock.expects(once()).method("onEvent").with(eq(event));
+        RuntimeEventListener listener = (RuntimeEventListener) mock.proxy();
+        container.addListener(listener);
+        container.publish(event);
+    }
+
+    public void testRemoveListener() {
+        TestContainer container = new TestContainer("foo");
+        Mock mock = mock(RuntimeEventListener.class);
+        Event event = new TestEvent();
+        mock.expects(never()).method("onEvent").with(eq(event));
+        RuntimeEventListener listener = (RuntimeEventListener) mock.proxy();
+        container.addListener(listener);
+        container.removeListener(listener);
+        container.publish(event);
+    }
+
+    public void testFalseFilterListener() {
+        TestContainer container = new TestContainer("foo");
+        Mock mock = mock(RuntimeEventListener.class);
+        Event event = new TestEvent();
+        mock.expects(never()).method("onEvent").with(eq(event));
+        RuntimeEventListener listener = (RuntimeEventListener) mock.proxy();
+        container.addListener(new FalseFilter(), listener);
+        container.publish(event);
+    }
+
+    public void testTrueFilterListener() {
+        TestContainer container = new TestContainer("foo");
+        Mock mock = mock(RuntimeEventListener.class);
+        Event event = new TestEvent();
+        mock.expects(once()).method("onEvent").with(eq(event));
+        RuntimeEventListener listener = (RuntimeEventListener) mock.proxy();
+        container.addListener(new TrueFilter(), listener);
+        container.publish(event);
+    }
+
+    public void testToString() {
+        TestContainer container = new TestContainer("foo");
+        assertNotNull(container.toString());
+    }
+
+    public void testGetName() {
+        TestContainer container = new TestContainer("foo");
+        assertEquals("foo", container.getName());
+    }
+
+
+    private class TestContainer extends AbstractScopeContainer {
+
+        public TestContainer(String name) {
+            super(name, null);
+        }
+
+        protected InstanceWrapper getInstanceWrapper(AtomicComponent component) {
+            return null;
+        }
+
+        public Scope getScope() {
+            return null;
+        }
+
+        public void register(AtomicComponent component) {
+
+        }
+
+        public void onEvent(Event event) {
+
+        }
+
+        public WorkContext getWorkContext() {
+            return super.getWorkContext();
+        }
+    }
+
+    private class TestEvent implements Event {
+        public Object getSource() {
+            return null;
+        }
+    }
+
+    private class FalseFilter implements EventFilter {
+
+        public boolean match(Event event) {
+            return false;
+        }
+    }
+
+
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,99 @@
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponent;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.mock.component.SessionScopeInitDestroyComponent;
+
+/**
+ * @version $$Rev: 415162 $$ $$Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) $$
+ */
+public class BasicHttpSessionScopeTestCase extends TestCase {
+
+    private EventInvoker<Object> initInvoker;
+    private EventInvoker<Object> destroyInvoker;
+    private ObjectFactory<?> factory;
+
+    public void testLifecycleManagement() throws Exception {
+        WorkContext workContext = new WorkContextImpl();
+        HttpSessionScopeContainer scopeContext = new HttpSessionScopeContainer(workContext);
+        scopeContext.start();
+        SystemAtomicComponent atomicContext = createContext(scopeContext);
+        // start the request
+        Object session = new Object();
+        workContext.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
+        SessionScopeInitDestroyComponent o1 =
+            (SessionScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertTrue(o1.isInitialized());
+        assertFalse(o1.isDestroyed());
+        SessionScopeInitDestroyComponent o2 =
+            (SessionScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertSame(o1, o2);
+        scopeContext.onEvent(new HttpSessionEnd(this, session));
+        assertTrue(o1.isDestroyed());
+        scopeContext.stop();
+    }
+
+    public void testSessionIsolation() throws Exception {
+        WorkContext workContext = new WorkContextImpl();
+        HttpSessionScopeContainer scopeContext = new HttpSessionScopeContainer(workContext);
+        scopeContext.start();
+
+        SystemAtomicComponent atomicContext = createContext(scopeContext);
+
+        Object session1 = new Object();
+        workContext.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session1);
+        SessionScopeInitDestroyComponent o1 =
+            (SessionScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertTrue(o1.isInitialized());
+
+        Object session2 = new Object();
+        workContext.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session2);
+        SessionScopeInitDestroyComponent o2 =
+            (SessionScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertNotSame(o1, o2);
+
+        scopeContext.onEvent(new HttpSessionEnd(this, session1));
+        assertTrue(o1.isDestroyed());
+        assertFalse(o2.isDestroyed());
+        scopeContext.onEvent(new HttpSessionEnd(this, session2));
+        assertTrue(o2.isDestroyed());
+        scopeContext.stop();
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        factory = new PojoObjectFactory<SessionScopeInitDestroyComponent>(
+            SessionScopeInitDestroyComponent.class.getConstructor((Class[]) null), null);
+        initInvoker = new MethodEventInvoker<Object>(
+            SessionScopeInitDestroyComponent.class.getMethod("init", (Class[]) null));
+        destroyInvoker = new MethodEventInvoker<Object>(
+            SessionScopeInitDestroyComponent.class.getMethod("destroy", (Class[]) null));
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    private SystemAtomicComponent createContext(ScopeContainer scopeContainer) {
+        PojoConfiguration configuration = new PojoConfiguration();
+        configuration.setScopeContainer(scopeContainer);
+        configuration.addServiceInterface(SessionScopeInitDestroyComponent.class);
+        configuration.setObjectFactory(factory);
+        configuration.setInitInvoker(initInvoker);
+        configuration.setDestroyInvoker(destroyInvoker);
+        SystemAtomicComponentImpl context = new SystemAtomicComponentImpl("foo", configuration);
+        context.start();
+        return context;
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicModuleScopeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicModuleScopeTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicModuleScopeTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicModuleScopeTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,90 @@
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponent;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.mock.component.ModuleScopeInitDestroyComponent;
+
+/**
+ * @version $$Rev: 415162 $$ $$Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) $$
+ */
+public class BasicModuleScopeTestCase extends TestCase {
+
+    private EventInvoker<Object> initInvoker;
+    private EventInvoker<Object> destroyInvoker;
+    private ObjectFactory<?> factory;
+
+    public void testLifecycleManagement() throws Exception {
+        WorkContext workContext = new WorkContextImpl();
+        ModuleScopeContainer scopeContext = new ModuleScopeContainer(workContext);
+        scopeContext.start();
+        SystemAtomicComponent atomicContext = createContext(scopeContext);
+        // start the request
+        ModuleScopeInitDestroyComponent o1 =
+            (ModuleScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertTrue(o1.isInitialized());
+        assertFalse(o1.isDestroyed());
+        ModuleScopeInitDestroyComponent o2 =
+            (ModuleScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertEquals(o1, o2);
+        scopeContext.onEvent(new CompositeStop(this, null));
+        assertTrue(o1.isDestroyed());
+        scopeContext.stop();
+    }
+
+    public void testModuleIsolation() throws Exception {
+        WorkContext workContext = new WorkContextImpl();
+        ModuleScopeContainer scopeContext = new ModuleScopeContainer(workContext);
+        scopeContext.start();
+
+        SystemAtomicComponent atomicContext = createContext(scopeContext);
+
+        ModuleScopeInitDestroyComponent o1 =
+            (ModuleScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertTrue(o1.isInitialized());
+        assertFalse(o1.isDestroyed());
+
+        ModuleScopeInitDestroyComponent o2 =
+            (ModuleScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertSame(o1, o2);
+        scopeContext.onEvent(new CompositeStop(this, null));
+        assertTrue(o1.isDestroyed());
+        scopeContext.stop();
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        factory = new PojoObjectFactory<ModuleScopeInitDestroyComponent>(
+            ModuleScopeInitDestroyComponent.class.getConstructor((Class[]) null), null);
+        initInvoker = new MethodEventInvoker<Object>(ModuleScopeInitDestroyComponent.class.getMethod(
+            "init", (Class[]) null));
+        destroyInvoker = new MethodEventInvoker<Object>(ModuleScopeInitDestroyComponent.class.getMethod(
+            "destroy", (Class[]) null));
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    private SystemAtomicComponent createContext(ScopeContainer scopeContainer) {
+        PojoConfiguration configuration = new PojoConfiguration();
+        configuration.setScopeContainer(scopeContainer);
+        configuration.addServiceInterface(ModuleScopeInitDestroyComponent.class);
+        configuration.setObjectFactory(factory);
+        configuration.setInitInvoker(initInvoker);
+        configuration.setDestroyInvoker(destroyInvoker);
+        SystemAtomicComponentImpl context = new SystemAtomicComponentImpl("foo", configuration);
+        context.start();
+        return context;
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicModuleScopeTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicModuleScopeTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,87 @@
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.ScopeContainer;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.event.RequestEnd;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponent;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.mock.component.RequestScopeInitDestroyComponent;
+
+/**
+ * @version $$Rev: 415162 $$ $$Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) $$
+ */
+public class BasicRequestScopeTestCase extends TestCase {
+
+    private EventInvoker<Object> initInvoker;
+    private EventInvoker<Object> destroyInvoker;
+    private ObjectFactory<?> factory;
+
+    public void testLifecycleManagement() throws Exception {
+        RequestScopeContainer scopeContext = new RequestScopeContainer(null);
+        scopeContext.start();
+        SystemAtomicComponent atomicContext = createContext(scopeContext);
+        // start the request
+        RequestScopeInitDestroyComponent o1 =
+            (RequestScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertTrue(o1.isInitialized());
+        assertFalse(o1.isDestroyed());
+        RequestScopeInitDestroyComponent o2 =
+            (RequestScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertSame(o1, o2);
+        scopeContext.onEvent(new RequestEnd(this));
+        assertTrue(o1.isDestroyed());
+        scopeContext.stop();
+    }
+
+    public void testRequestIsolation() throws Exception {
+        RequestScopeContainer scopeContext = new RequestScopeContainer(null);
+        scopeContext.start();
+
+        SystemAtomicComponent atomicContext = createContext(scopeContext);
+
+        RequestScopeInitDestroyComponent o1 =
+            (RequestScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertTrue(o1.isInitialized());
+        scopeContext.onEvent(new RequestEnd(this));
+        assertTrue(o1.isDestroyed());
+
+        RequestScopeInitDestroyComponent o2 =
+            (RequestScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+        assertNotSame(o1, o2);
+        scopeContext.onEvent(new RequestEnd(this));
+        assertTrue(o2.isDestroyed());
+        scopeContext.stop();
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        factory = new PojoObjectFactory<RequestScopeInitDestroyComponent>(
+            RequestScopeInitDestroyComponent.class.getConstructor((Class[]) null), null);
+        initInvoker = new MethodEventInvoker<Object>(
+            RequestScopeInitDestroyComponent.class.getMethod("init", (Class[]) null));
+        destroyInvoker = new MethodEventInvoker<Object>(
+            RequestScopeInitDestroyComponent.class.getMethod("destroy", (Class[]) null));
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    private SystemAtomicComponent createContext(ScopeContainer scopeContainer) {
+        PojoConfiguration configuration = new PojoConfiguration();
+        configuration.setScopeContainer(scopeContainer);
+        configuration.addServiceInterface(RequestScopeInitDestroyComponent.class);
+        configuration.setObjectFactory(factory);
+        configuration.setInitInvoker(initInvoker);
+        configuration.setDestroyInvoker(destroyInvoker);
+        SystemAtomicComponentImpl component = new SystemAtomicComponentImpl("foo", configuration);
+        scopeContainer.register(component);
+        return component;
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,71 @@
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponent;
+import org.apache.tuscany.core.mock.component.StatelessComponent;
+import org.apache.tuscany.core.mock.component.StatelessComponentImpl;
+import org.apache.tuscany.core.mock.factories.MockFactory;
+
+/**
+ * Unit tests for the module scope container
+ *
+ * @version $Rev: 415162 $ $Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) $
+ */
+public class BasicStatelessScopeTestCase extends TestCase {
+
+    /**
+     * Tests instance identity is properly maintained
+     */
+    public void testInstanceManagement() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        StatelessScopeContainer scope = new StatelessScopeContainer(ctx);
+        scope.start();
+        SystemAtomicComponent context1 =
+            MockFactory.createAtomicComponent("comp1", scope, StatelessComponentImpl.class);
+        scope.register(context1);
+        SystemAtomicComponent context2 =
+            MockFactory.createAtomicComponent("comp2", scope, StatelessComponentImpl.class);
+        scope.register(context2);
+        StatelessComponentImpl comp1 = (StatelessComponentImpl) scope.getInstance(context1);
+        Assert.assertNotNull(comp1);
+        StatelessComponentImpl comp2 = (StatelessComponentImpl) scope.getInstance(context2);
+        Assert.assertNotNull(comp2);
+        Assert.assertNotSame(comp1, comp2);
+        scope.stop();
+    }
+
+    public void testRegisterContextAfterRequest() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        StatelessScopeContainer scope = new StatelessScopeContainer(ctx);
+
+        scope.start();
+        SystemAtomicComponent context1 =
+            MockFactory.createAtomicComponent("comp1", scope, StatelessComponentImpl.class);
+        scope.register(context1);
+        StatelessComponent comp1 = (StatelessComponentImpl) scope.getInstance(context1);
+        Assert.assertNotNull(comp1);
+        SystemAtomicComponent context2 =
+            MockFactory.createAtomicComponent("comp2", scope, StatelessComponentImpl.class);
+        scope.register(context2);
+        StatelessComponentImpl comp2 = (StatelessComponentImpl) scope.getInstance(context2);
+        Assert.assertNotNull(comp2);
+        scope.stop();
+    }
+
+
+    /**
+     * Tests setting no components in the scope
+     */
+    public void testSetNullComponents() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        StatelessScopeContainer scope = new StatelessScopeContainer(ctx);
+        scope.start();
+        scope.stop();
+    }
+
+
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,154 @@
+package org.apache.tuscany.core.component.scope;
+
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.RequestEnd;
+import org.apache.tuscany.core.component.event.RequestStart;
+import org.apache.tuscany.core.mock.component.OrderedDependentPojo;
+import org.apache.tuscany.core.mock.component.OrderedDependentPojoImpl;
+import org.apache.tuscany.core.mock.component.OrderedInitPojo;
+import org.apache.tuscany.core.mock.component.OrderedInitPojoImpl;
+import org.apache.tuscany.core.mock.factories.MockFactory;
+
+/**
+ * Tests dependencies are initalized and destroyed in the proper order (i.e. LIFO)
+ *
+ * @version $Rev: 415162 $ $Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) $
+ */
+public class DependencyLifecycleTestCase extends TestCase {
+
+    public void testInitDestroyOrderModuleScope() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        ModuleScopeContainer scopeCtx = new ModuleScopeContainer(ctx);
+        scopeCtx.start();
+        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+            OrderedDependentPojoImpl.class,
+            scopeCtx,
+            "target",
+            OrderedInitPojoImpl.class,
+            scopeCtx);
+        for (AtomicComponent component : contexts.values()) {
+            scopeCtx.register(component);
+        }
+        AtomicComponent sourceComponent = contexts.get("source");
+        AtomicComponent targetComponent = contexts.get("target");
+        scopeCtx.register(sourceComponent);
+        scopeCtx.register(targetComponent);
+        scopeCtx.onEvent(new CompositeStart(this, null));
+        OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+        OrderedInitPojo target = (OrderedInitPojo) scopeCtx.getInstance(targetComponent);
+        assertNotNull(source.getPojo());
+        assertNotNull(target);
+        assertEquals(2, source.getNumberInstantiated());
+        scopeCtx.onEvent(new CompositeStop(this, null));
+        assertEquals(0, source.getNumberInstantiated());
+        scopeCtx.stop();
+    }
+
+    public void testInitDestroyOrderAfterStartModuleScope() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        ModuleScopeContainer scopeCtx = new ModuleScopeContainer(ctx);
+        scopeCtx.start();
+        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+            OrderedDependentPojoImpl.class,
+            scopeCtx,
+            "target",
+            OrderedInitPojoImpl.class,
+            scopeCtx);
+        AtomicComponent sourceComponent = contexts.get("source");
+        AtomicComponent targetComponent = contexts.get("target");
+        scopeCtx.onEvent(new CompositeStart(this, null));
+        scopeCtx.register(sourceComponent);
+        scopeCtx.register(targetComponent);
+        OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+        OrderedInitPojo target = (OrderedInitPojo) scopeCtx.getInstance(targetComponent);
+        assertNotNull(source.getPojo());
+        assertNotNull(target);
+        assertEquals(2, source.getNumberInstantiated());
+        scopeCtx.onEvent(new CompositeStop(this, null));
+        assertEquals(0, source.getNumberInstantiated());
+        scopeCtx.stop();
+    }
+
+
+    public void testInitDestroyOrderSessionScope() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        HttpSessionScopeContainer scopeCtx = new HttpSessionScopeContainer(ctx);
+        scopeCtx.start();
+        Object session = new Object();
+        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+            OrderedDependentPojoImpl.class,
+            scopeCtx,
+            "target",
+            OrderedInitPojoImpl.class,
+            scopeCtx);
+        AtomicComponent sourceComponent = contexts.get("source");
+        AtomicComponent targetComponent = contexts.get("target");
+        scopeCtx.register(sourceComponent);
+        scopeCtx.register(targetComponent);
+        ctx.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
+        OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+        assertNotNull(source.getPojo());
+        assertEquals(2, source.getNumberInstantiated());
+        scopeCtx.onEvent(new HttpSessionEnd(this, session));
+        assertEquals(0, source.getNumberInstantiated());
+        scopeCtx.stop();
+    }
+
+
+    public void testInitDestroyOrderAfterStartSessionScope() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        HttpSessionScopeContainer scopeCtx = new HttpSessionScopeContainer(ctx);
+        scopeCtx.start();
+        Object session = new Object();
+        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+            OrderedDependentPojoImpl.class,
+            scopeCtx,
+            "target",
+            OrderedInitPojoImpl.class,
+            scopeCtx);
+        AtomicComponent sourceComponent = contexts.get("source");
+        AtomicComponent targetComponent = contexts.get("target");
+        ctx.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
+        scopeCtx.register(sourceComponent);
+        scopeCtx.register(targetComponent);
+        OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+        assertNotNull(source.getPojo());
+        assertEquals(2, source.getNumberInstantiated());
+        scopeCtx.onEvent(new HttpSessionEnd(this, session));
+        assertEquals(0, source.getNumberInstantiated());
+        scopeCtx.stop();
+    }
+
+    public void testInitDestroyOrderRequestScope() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        RequestScopeContainer scopeCtx = new RequestScopeContainer(ctx);
+        scopeCtx.start();
+        scopeCtx.onEvent(new RequestStart(this));
+        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+            OrderedDependentPojoImpl.class,
+            scopeCtx,
+            "target",
+            OrderedInitPojoImpl.class,
+            scopeCtx);
+        AtomicComponent sourceComponent = contexts.get("source");
+        AtomicComponent targetComponent = contexts.get("target");
+        scopeCtx.register(sourceComponent);
+        scopeCtx.register(targetComponent);
+        OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+        assertNotNull(source.getPojo());
+        assertEquals(2, source.getNumberInstantiated());
+        scopeCtx.onEvent(new RequestEnd(this));
+        assertEquals(0, source.getNumberInstantiated());
+        scopeCtx.stop();
+    }
+
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,147 @@
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.HttpSessionStart;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponent;
+import org.apache.tuscany.core.mock.component.OrderedEagerInitPojo;
+import org.apache.tuscany.core.mock.component.OrderedInitPojo;
+import org.apache.tuscany.core.mock.component.OrderedInitPojoImpl;
+import org.apache.tuscany.core.mock.component.RequestScopeDestroyOnlyComponent;
+import org.apache.tuscany.core.mock.component.RequestScopeInitDestroyComponent;
+import org.apache.tuscany.core.mock.component.RequestScopeInitOnlyComponent;
+import org.apache.tuscany.core.mock.factories.MockFactory;
+
+/**
+ * Lifecycle unit tests for the module scope container
+ *
+ * @version $Rev: 415162 $ $Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) $
+ */
+public class HttpSessionScopeInstanceLifecycleTestCase extends TestCase {
+
+    public void testInitDestroy() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        HttpSessionScopeContainer scope = new HttpSessionScopeContainer(ctx);
+        scope.start();
+
+        SystemAtomicComponent initDestroyContext = MockFactory.createAtomicComponent("InitDestroy",
+            scope,
+            RequestScopeInitDestroyComponent.class);
+        initDestroyContext.start();
+
+        SystemAtomicComponent initOnlyContext = MockFactory.createAtomicComponent("InitOnly",
+            scope,
+            RequestScopeInitOnlyComponent.class);
+        initOnlyContext.start();
+
+        SystemAtomicComponent destroyOnlyContext = MockFactory.createAtomicComponent("DestroyOnly",
+            scope,
+            RequestScopeDestroyOnlyComponent.class);
+        destroyOnlyContext.start();
+
+        Object session = new Object();
+        ctx.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
+        scope.onEvent(new HttpSessionStart(this, session));
+        RequestScopeInitDestroyComponent initDestroy =
+            (RequestScopeInitDestroyComponent) scope.getInstance(initDestroyContext);
+        Assert.assertNotNull(initDestroy);
+
+        RequestScopeInitOnlyComponent initOnly =
+            (RequestScopeInitOnlyComponent) scope.getInstance(initOnlyContext);
+        Assert.assertNotNull(initOnly);
+
+        RequestScopeDestroyOnlyComponent destroyOnly =
+            (RequestScopeDestroyOnlyComponent) scope.getInstance(destroyOnlyContext);
+        Assert.assertNotNull(destroyOnly);
+
+        Assert.assertTrue(initDestroy.isInitialized());
+        Assert.assertTrue(initOnly.isInitialized());
+        Assert.assertFalse(initDestroy.isDestroyed());
+        Assert.assertFalse(destroyOnly.isDestroyed());
+
+        // expire module
+        scope.onEvent(new HttpSessionEnd(this, session));
+
+        Assert.assertTrue(initDestroy.isDestroyed());
+        Assert.assertTrue(destroyOnly.isDestroyed());
+
+        scope.stop();
+    }
+
+    public void testDestroyOrder() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        HttpSessionScopeContainer scope = new HttpSessionScopeContainer(ctx);
+        scope.start();
+
+        SystemAtomicComponent oneCtx =
+            MockFactory.createAtomicComponent("one", scope, OrderedInitPojoImpl.class);
+        scope.register(oneCtx);
+        SystemAtomicComponent twoCtx =
+            MockFactory.createAtomicComponent("two", scope, OrderedInitPojoImpl.class);
+        scope.register(twoCtx);
+        SystemAtomicComponent threeCtx =
+            MockFactory.createAtomicComponent("three", scope, OrderedInitPojoImpl.class);
+        scope.register(threeCtx);
+
+        Object session = new Object();
+        ctx.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
+        scope.onEvent(new HttpSessionStart(this, session));
+        OrderedInitPojo one = (OrderedInitPojo) scope.getInstance(oneCtx);
+        Assert.assertNotNull(one);
+        Assert.assertEquals(1, one.getNumberInstantiated());
+        Assert.assertEquals(1, one.getInitOrder());
+
+        OrderedInitPojo two = (OrderedInitPojo) scope.getInstance(twoCtx);
+        Assert.assertNotNull(two);
+        Assert.assertEquals(2, two.getNumberInstantiated());
+        Assert.assertEquals(2, two.getInitOrder());
+
+        OrderedInitPojo three = (OrderedInitPojo) scope.getInstance(threeCtx);
+        Assert.assertNotNull(three);
+        Assert.assertEquals(3, three.getNumberInstantiated());
+        Assert.assertEquals(3, three.getInitOrder());
+
+        // expire module
+        scope.onEvent(new HttpSessionEnd(this, session));
+        Assert.assertEquals(0, one.getNumberInstantiated());
+        scope.stop();
+    }
+
+    public void testEagerInitDestroyOrder() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        HttpSessionScopeContainer scope = new HttpSessionScopeContainer(ctx);
+        scope.start();
+
+        SystemAtomicComponent oneCtx =
+            MockFactory.createAtomicComponent("one", scope, OrderedEagerInitPojo.class);
+        scope.register(oneCtx);
+        SystemAtomicComponent twoCtx =
+            MockFactory.createAtomicComponent("two", scope, OrderedEagerInitPojo.class);
+        scope.register(twoCtx);
+        SystemAtomicComponent threeCtx =
+            MockFactory.createAtomicComponent("three", scope, OrderedEagerInitPojo.class);
+        scope.register(threeCtx);
+
+        Object session = new Object();
+        ctx.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
+        scope.onEvent(new HttpSessionStart(this, session));
+        OrderedEagerInitPojo one = (OrderedEagerInitPojo) scope.getInstance(oneCtx);
+        Assert.assertNotNull(one);
+
+        OrderedEagerInitPojo two = (OrderedEagerInitPojo) scope.getInstance(twoCtx);
+        Assert.assertNotNull(two);
+
+        OrderedEagerInitPojo three = (OrderedEagerInitPojo) scope.getInstance(threeCtx);
+        Assert.assertNotNull(three);
+
+        // expire module
+        scope.onEvent(new HttpSessionEnd(this, session));
+        Assert.assertEquals(0, one.getNumberInstantiated());
+        scope.stop();
+    }
+
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,86 @@
+package org.apache.tuscany.core.component.scope;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.HttpSessionStart;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponent;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+
+/**
+ * Verifies the scope container properly disposes resources and canbe restarted
+ *
+ * @version $$Rev: 415162 $$ $$Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) $$
+ */
+public class HttpSessionScopeRestartTestCase extends TestCase {
+
+    public void testRestart() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        HttpSessionScopeContainer scope = new HttpSessionScopeContainer(ctx);
+        scope.start();
+        MethodEventInvoker<Object> initInvoker = new MethodEventInvoker<Object>(
+            HttpSessionScopeRestartTestCase.InitDestroyOnce.class.getMethod("init"));
+        MethodEventInvoker<Object> destroyInvoker =
+            new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("destroy"));
+        PojoConfiguration configuration = new PojoConfiguration();
+        configuration.setScopeContainer(scope);
+        configuration.addServiceInterface(HttpSessionScopeRestartTestCase.InitDestroyOnce.class);
+        configuration.setInitInvoker(initInvoker);
+        configuration.setDestroyInvoker(destroyInvoker);
+        Constructor<InitDestroyOnce> ctr = InitDestroyOnce.class.getConstructor((Class<?>[]) null);
+        configuration.setObjectFactory(new PojoObjectFactory<InitDestroyOnce>(ctr));
+        SystemAtomicComponent context = new SystemAtomicComponentImpl("InitDestroy", configuration);
+        context.start();
+
+        Object session = new Object();
+        ctx.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
+        scope.onEvent(new HttpSessionStart(this, session));
+        Object instance = context.getServiceInstance();
+        assertSame(instance, context.getServiceInstance());
+
+        scope.onEvent(new HttpSessionEnd(this, session));
+        scope.stop();
+        context.stop();
+
+        scope.start();
+        scope.onEvent(new HttpSessionStart(this, session));
+        context.start();
+        assertNotSame(instance, context.getServiceInstance());
+        scope.onEvent(new HttpSessionEnd(this, session));
+        scope.stop();
+        context.stop();
+    }
+
+    public static class InitDestroyOnce {
+
+        private boolean initialized;
+        private boolean destroyed;
+
+        public InitDestroyOnce() {
+        }
+
+        public void init() {
+            if (!initialized) {
+                initialized = true;
+            } else {
+                fail("Scope did not clean up properly - Init called more than once");
+            }
+        }
+
+        public void destroy() {
+            if (!destroyed) {
+                destroyed = true;
+            } else {
+                fail("Scope did not clean up properly - Destroyed called more than once");
+            }
+        }
+
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,58 @@
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.Lifecycle;
+import org.apache.tuscany.spi.component.AtomicComponent;
+
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+import org.jmock.core.Invocation;
+import org.jmock.core.Stub;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InstanceWrapperTestCase extends MockObjectTestCase {
+
+
+    public void testExceptionInit() throws Exception {
+        AtomicComponent component = getComponent();
+        InstanceWrapper wrapper = new InstanceWrapperImpl(component, new Object());
+        try {
+            wrapper.start();
+            fail();
+        } catch (SomeException e) {
+            // expected
+        }
+        assertEquals(Lifecycle.ERROR, wrapper.getLifecycleState());
+    }
+
+    public void testNonStart() throws Exception {
+        Mock mock = mock(AtomicComponent.class);
+        AtomicComponent comp = (AtomicComponent) mock.proxy();  // class-level one has an expects
+        InstanceWrapper wrapper = new InstanceWrapperImpl(comp, new Object());
+        try {
+            wrapper.getInstance();
+            fail();
+        } catch (IllegalStateException e) {
+            // expected
+        }
+    }
+
+    private AtomicComponent getComponent() throws Exception {
+        // do not use setUp() since we do not need this in all testcases
+        Mock mock = mock(AtomicComponent.class);
+        mock.expects(once()).method("init").will(new Stub() {
+            public Object invoke(Invocation invocation) throws Throwable {
+                throw new SomeException();
+            }
+
+            public StringBuffer describeTo(StringBuffer stringBuffer) {
+                return stringBuffer.append("bad init");
+            }
+        });
+        return (AtomicComponent) mock.proxy();
+    }
+
+    private class SomeException extends RuntimeException {
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeInstanceLifecycleTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeInstanceLifecycleTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeInstanceLifecycleTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeInstanceLifecycleTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,147 @@
+package org.apache.tuscany.core.component.scope;
+
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponent;
+import org.apache.tuscany.core.mock.component.ModuleScopeDestroyOnlyComponent;
+import org.apache.tuscany.core.mock.component.ModuleScopeInitDestroyComponent;
+import org.apache.tuscany.core.mock.component.ModuleScopeInitOnlyComponent;
+import org.apache.tuscany.core.mock.component.OrderedEagerInitPojo;
+import org.apache.tuscany.core.mock.component.OrderedInitPojo;
+import org.apache.tuscany.core.mock.component.OrderedInitPojoImpl;
+import org.apache.tuscany.core.mock.factories.MockFactory;
+
+/**
+ * Lifecycle unit tests for the module scope container
+ *
+ * @version $Rev: 415162 $ $Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) $
+ */
+public class ModuleScopeInstanceLifecycleTestCase extends TestCase {
+
+    public void testInitDestroy() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        ModuleScopeContainer scope = new ModuleScopeContainer(ctx);
+        scope.start();
+
+        SystemAtomicComponent initDestroyContext = MockFactory.createAtomicComponent("InitDestroy",
+            scope,
+            ModuleScopeInitDestroyComponent.class);
+        initDestroyContext.start();
+
+        SystemAtomicComponent initOnlyContext = MockFactory.createAtomicComponent("InitOnly",
+            scope,
+            ModuleScopeInitOnlyComponent.class);
+        initOnlyContext.start();
+
+        SystemAtomicComponent destroyOnlyContext = MockFactory.createAtomicComponent("DestroyOnly",
+            scope,
+            ModuleScopeDestroyOnlyComponent.class);
+        destroyOnlyContext.start();
+
+        scope.onEvent(new CompositeStart(this, null));
+        ModuleScopeInitDestroyComponent initDestroy =
+            (ModuleScopeInitDestroyComponent) scope.getInstance(initDestroyContext);
+        Assert.assertNotNull(initDestroy);
+
+        ModuleScopeInitOnlyComponent initOnly = (ModuleScopeInitOnlyComponent) scope.getInstance(initOnlyContext);
+        Assert.assertNotNull(initOnly);
+
+        ModuleScopeDestroyOnlyComponent destroyOnly =
+            (ModuleScopeDestroyOnlyComponent) scope.getInstance(destroyOnlyContext);
+        Assert.assertNotNull(destroyOnly);
+
+        Assert.assertTrue(initDestroy.isInitialized());
+        Assert.assertTrue(initOnly.isInitialized());
+        Assert.assertFalse(initDestroy.isDestroyed());
+        Assert.assertFalse(destroyOnly.isDestroyed());
+
+        // expire module
+        scope.onEvent(new CompositeStop(this, null));
+
+        Assert.assertTrue(initDestroy.isDestroyed());
+        Assert.assertTrue(destroyOnly.isDestroyed());
+
+        scope.stop();
+    }
+
+    public void testDestroyOrder() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        ModuleScopeContainer scope = new ModuleScopeContainer(ctx);
+        scope.start();
+
+        SystemAtomicComponent oneCtx = MockFactory.createAtomicComponent("one",
+            scope,
+            OrderedInitPojoImpl.class);
+        scope.register(oneCtx);
+        SystemAtomicComponent twoCtx = MockFactory.createAtomicComponent("two",
+            scope,
+            OrderedInitPojoImpl.class);
+        scope.register(twoCtx);
+        SystemAtomicComponent threeCtx = MockFactory.createAtomicComponent("three",
+            scope,
+            OrderedInitPojoImpl.class);
+        scope.register(threeCtx);
+
+        scope.onEvent(new CompositeStart(this, null));
+        OrderedInitPojo one = (OrderedInitPojo) scope.getInstance(oneCtx);
+        Assert.assertNotNull(one);
+        Assert.assertEquals(1, one.getNumberInstantiated());
+        Assert.assertEquals(1, one.getInitOrder());
+
+        OrderedInitPojo two = (OrderedInitPojo) scope.getInstance(twoCtx);
+        Assert.assertNotNull(two);
+        Assert.assertEquals(2, two.getNumberInstantiated());
+        Assert.assertEquals(2, two.getInitOrder());
+
+        OrderedInitPojo three = (OrderedInitPojo) scope.getInstance(threeCtx);
+        Assert.assertNotNull(three);
+        Assert.assertEquals(3, three.getNumberInstantiated());
+        Assert.assertEquals(3, three.getInitOrder());
+
+        // expire module
+        scope.onEvent(new CompositeStop(this, null));
+        Assert.assertEquals(0, one.getNumberInstantiated());
+        scope.stop();
+    }
+
+    public void testEagerInitDestroyOrder() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        ModuleScopeContainer scope = new ModuleScopeContainer(ctx);
+        scope.start();
+
+        SystemAtomicComponent oneCtx = MockFactory.createAtomicComponent("one",
+            scope,
+            OrderedEagerInitPojo.class);
+        scope.register(oneCtx);
+        SystemAtomicComponent twoCtx = MockFactory.createAtomicComponent("two",
+            scope,
+            OrderedEagerInitPojo.class);
+        scope.register(twoCtx);
+        SystemAtomicComponent threeCtx = MockFactory.createAtomicComponent("three",
+            scope,
+            OrderedEagerInitPojo.class);
+        scope.register(threeCtx);
+
+        scope.onEvent(new CompositeStart(this, null));
+        OrderedEagerInitPojo one = (OrderedEagerInitPojo) scope.getInstance(oneCtx);
+        Assert.assertNotNull(one);
+
+        OrderedEagerInitPojo two = (OrderedEagerInitPojo) scope.getInstance(twoCtx);
+        Assert.assertNotNull(two);
+
+        OrderedEagerInitPojo three = (OrderedEagerInitPojo) scope.getInstance(threeCtx);
+        Assert.assertNotNull(three);
+
+        // expire module
+        scope.onEvent(new CompositeStop(this, null));
+        Assert.assertEquals(0, one.getNumberInstantiated());
+        scope.stop();
+    }
+
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeInstanceLifecycleTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeInstanceLifecycleTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeObjectFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeObjectFactoryTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeObjectFactoryTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeObjectFactoryTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,13 @@
+package org.apache.tuscany.core.component.scope;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ModuleScopeObjectFactoryTestCase extends TestCase {
+
+    public void testCreation() {
+        assertNotNull(new ModuleScopeObjectFactory().getInstance());
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeObjectFactoryTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeObjectFactoryTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeRestartTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeRestartTestCase.java?rev=416333&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeRestartTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeRestartTestCase.java Thu Jun 22 04:20:25 2006
@@ -0,0 +1,84 @@
+package org.apache.tuscany.core.component.scope;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponent;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+
+/**
+ * Verifies the scope container properly disposes resources and canbe restarted
+ *
+ * @version $$Rev: 415162 $$ $$Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) $$
+ */
+public class ModuleScopeRestartTestCase extends TestCase {
+
+    public void testRestart() throws Exception {
+        WorkContext ctx = new WorkContextImpl();
+        ModuleScopeContainer scope = new ModuleScopeContainer(ctx);
+        scope.start();
+        MethodEventInvoker<Object> initInvoker =
+            new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("init"));
+        MethodEventInvoker<Object> destroyInvoker =
+            new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("destroy"));
+        PojoConfiguration configuration = new PojoConfiguration();
+        configuration.setScopeContainer(scope);
+        configuration.addServiceInterface(InitDestroyOnce.class);
+        configuration.setInitInvoker(initInvoker);
+        configuration.setDestroyInvoker(destroyInvoker);
+        Constructor<InitDestroyOnce> ctr = InitDestroyOnce.class.getConstructor((Class<?>[]) null);
+        configuration.setObjectFactory(new PojoObjectFactory<InitDestroyOnce>(ctr));
+        SystemAtomicComponent context = new SystemAtomicComponentImpl("InitDestroy", configuration);
+        context.start();
+
+        scope.onEvent(new CompositeStart(this, null));
+        Object instance = context.getServiceInstance();
+        assertSame(instance, context.getServiceInstance());
+
+        scope.onEvent(new CompositeStop(this, null));
+        scope.stop();
+        context.stop();
+
+        scope.start();
+        scope.onEvent(new CompositeStart(this, null));
+        context.start();
+        assertNotSame(instance, context.getServiceInstance());
+        scope.onEvent(new CompositeStop(this, null));
+        scope.stop();
+        context.stop();
+    }
+
+    public static class InitDestroyOnce {
+
+        private boolean initialized;
+        private boolean destroyed;
+
+        public InitDestroyOnce() {
+        }
+
+        public void init() {
+            if (!initialized) {
+                initialized = true;
+            } else {
+                fail("Scope did not clean up properly - Init called more than once");
+            }
+        }
+
+        public void destroy() {
+            if (!destroyed) {
+                destroyed = true;
+            } else {
+                fail("Scope did not clean up properly - Destroyed called more than once");
+            }
+        }
+
+    }
+}

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeRestartTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/component/scope/ModuleScopeRestartTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message