Author: jmarino
Date: Wed Mar  1 22:21:28 2006
New Revision: 382306

URL: http://svn.apache.org/viewcvs?rev=382306&view=rev
Log:
fix for TUSCANY-55: stateful scope references not working when target invoker 
is cached

Modified:
    
incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceTargetInvoker.java
    
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java
    
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/AbstractJavaComponentInvoker.java
    
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/ScopedJavaComponentInvoker.java
    
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/StaticJavaComponentTargetInvoker.java
    
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java
    
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooESTargetInvoker.java
    
incubator/tuscany/java/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoTargetInvoker.java
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/TargetInvoker.java
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandler.java
    
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java
    
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java

Modified: 
incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceTargetInvoker.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceTargetInvoker.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceTargetInvoker.java
 (original)
+++ 
incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceTargetInvoker.java
 Wed Mar  1 22:21:28 2006
@@ -93,4 +93,17 @@
         throw new UnsupportedOperationException();
     }
 
+    public Object clone() {
+        try {
+            ExternalWebServiceTargetInvoker invoker = 
(ExternalWebServiceTargetInvoker) super.clone();
+            invoker.container = container;
+            invoker.context = this.context;
+            invoker.esName = this.esName;
+            invoker.method = this.method;
+            invoker.serviceName = this.serviceName;
+            return invoker;
+        } catch (CloneNotSupportedException e) {
+            return null; // will not happen
+        }
+    }  
 }

Modified: 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java
 (original)
+++ 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java
 Wed Mar  1 22:21:28 2006
@@ -61,7 +61,7 @@
                 // the source scope is shorter than the target, so the invoker 
can cache the target instance
                 invoker.setCacheable(false);
             } else {
-                invoker.setCacheable(true);
+                invoker.setCacheable(true); //TODO set to true
             }
             sourceInvocationConfig.setTargetInvoker(invoker);
         }

Modified: 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/AbstractJavaComponentInvoker.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/AbstractJavaComponentInvoker.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/AbstractJavaComponentInvoker.java
 (original)
+++ 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/AbstractJavaComponentInvoker.java
 Wed Mar  1 22:21:28 2006
@@ -44,12 +44,13 @@
 
     public Object invokeTarget(Object payload) throws 
InvocationTargetException {
         try {
-            Object instance=getInstance();
+            Object instance = getInstance();
             if (!operation.getDeclaringClass().isInstance(instance)) {
-                Set 
methods=JavaIntrospectionHelper.getAllUniqueMethods(instance.getClass());
-                Method 
newOperation=JavaIntrospectionHelper.findClosestMatchingMethod(operation.getName(),
 operation.getParameterTypes(), methods);
-                if (newOperation!=null)
-                    operation=newOperation;
+                Set methods = 
JavaIntrospectionHelper.getAllUniqueMethods(instance.getClass());
+                Method newOperation = 
JavaIntrospectionHelper.findClosestMatchingMethod(operation.getName(), operation
+                        .getParameterTypes(), methods);
+                if (newOperation != null)
+                    operation = newOperation;
             }
             if (payload != null && !payload.getClass().isArray()) {
                 return operation.invoke(instance, payload);
@@ -79,4 +80,13 @@
         throw new IllegalStateException("This interceptor must be the last 
interceptor in an interceptor chain");
     }
 
+    public Object clone(){
+        try {
+            AbstractJavaComponentInvoker clone = 
(AbstractJavaComponentInvoker) super.clone();
+            clone.operation = this.operation;
+            return clone;
+        } catch (CloneNotSupportedException e) {
+            return null; // will not happen
+        }
+    }
 }

Modified: 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/ScopedJavaComponentInvoker.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/ScopedJavaComponentInvoker.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/ScopedJavaComponentInvoker.java
 (original)
+++ 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/ScopedJavaComponentInvoker.java
 Wed Mar  1 22:21:28 2006
@@ -44,7 +44,7 @@
         name = serviceName;
         this.container = container;
     }
-    
+
     /**
      * Returns whether the target is cacheable.
      */
@@ -75,4 +75,12 @@
         }
     }
 
+    public Object clone() {
+        ScopedJavaComponentInvoker invoker = (ScopedJavaComponentInvoker) 
super.clone();
+        invoker.target = null;
+        invoker.cacheable = this.cacheable;
+        invoker.container = this.container;
+        invoker.name = this.name;
+        return invoker;
+    }
 }

Modified: 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/StaticJavaComponentTargetInvoker.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/StaticJavaComponentTargetInvoker.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/StaticJavaComponentTargetInvoker.java
 (original)
+++ 
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/handler/StaticJavaComponentTargetInvoker.java
 Wed Mar  1 22:21:28 2006
@@ -19,8 +19,8 @@
 import java.lang.reflect.Method;
 
 /**
- * Caches component instances that do not need to be resolved for every 
invocation, e.g. an invocation originating from a lesser
- * scope intended for a target with a wider scope
+ * Caches component instances that do not need to be resolved for every 
invocation, e.g. an invocation originating from
+ * a lesser scope intended for a target with a wider scope
  * 
  * @version $Rev$ $Date$
  */
@@ -38,8 +38,13 @@
         return instance;
     }
 
-    public boolean isCacheable(){
+    public boolean isCacheable() {
         return true;
     }
 
+    public Object clone() {
+        StaticJavaComponentTargetInvoker invoker = 
(StaticJavaComponentTargetInvoker) super.clone();
+        invoker.instance = null;
+        return invoker;
+    }
 }

Modified: 
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java
 (original)
+++ 
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java
 Wed Mar  1 22:21:28 2006
@@ -86,6 +86,7 @@
         
Assert.assertTrue(!"foo".equals(source.getGenericComponent().getString()));
         source.getGenericComponent().setString("bar");
         Assert.assertEquals("bar",target2.getString());
+        Assert.assertEquals("bar",source.getGenericComponent().getString());
         //testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
                 
    }
@@ -122,7 +123,9 @@
         
Assert.assertTrue(!"foo".equals(source.getGenericComponent().getString()));
         source.getGenericComponent().setString("bar");
         Assert.assertEquals("bar",target2.getString());
-   }
+        Assert.assertEquals("bar",source.getGenericComponent().getString());
+
+    }
     
     /**
      * Tests a module-to-stateless scoped wire is setup properly by the runtime
@@ -157,5 +160,550 @@
         source.getGenericComponent().setString("bar");
         Assert.assertTrue(!"bar".equals(target2.getString()));
    }
+    
+    /**
+     * Tests a session-to-session scoped wire is setup properly by the runtime
+     */
+    public void testSessionToSession() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.SESSION));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first session
+        Object session = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+        
+        //second session
+        Object session2 = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session2);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals(null,target2.getString());
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals("baz",source2.getGenericComponent().getString());
+        Assert.assertEquals("baz",target2.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,session2);
+       
+    }
+
+    
+    /**
+     * Tests a session-to-module scoped wire is setup properly by the runtime
+     */
+    public void testSessionToModule() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.MODULE));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first session
+        Object session = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+        
+        //second session
+        Object session2 = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session2);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals("foo",target2.getString());
+        Assert.assertEquals("foo",source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals("baz",source2.getGenericComponent().getString());
+        Assert.assertEquals("baz",target2.getString());
+        Assert.assertEquals("baz",target.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,session2);
+       
+    }
+
+    /**
+     * Tests a session-to-request scoped wire is setup properly by the runtime
+     */
+    public void testSessionToRequest() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.REQUEST));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first session
+        Object session = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+        
+        //second session
+        Object session2 = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session2);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals(null,target2.getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals("baz",target2.getString());
+        Assert.assertEquals("baz",source2.getGenericComponent().getString());
+        
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+        
+    }
+    
+    
+    /**
+     * Tests a session-to-stateless scoped wire is setup properly by the 
runtime
+     */
+    public void testSessionToStateless() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.INSTANCE));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first session
+        Object session = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals(null,target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+        
+        //second session
+        Object session2 = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session2);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals(null,target2.getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals(null,target2.getString()); //Note assumes no 
pooling
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        
+        Assert.assertEquals(null,target.getString()); //Note assumes no pooling
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+        
+    }
+
+    /**
+     * Tests a request-to-request scoped wire is setup properly by the runtime
+     */
+    public void testRequestToRequest() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.REQUEST));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+        
+        //second request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals(null,target2.getString());
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals("baz",source2.getGenericComponent().getString());
+        Assert.assertEquals("baz",target2.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+       
+    }
+
+    /**
+     * Tests a request-to-module scoped wire is setup properly by the runtime
+     */
+    public void testRequestToModule() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.MODULE));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+        
+        //second request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals("foo",target2.getString());
+        Assert.assertEquals("foo",source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals("baz",source2.getGenericComponent().getString());
+        Assert.assertEquals("baz",target2.getString());
+        Assert.assertEquals("baz",target.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+       
+    }
+
+    /**
+     * Tests a request-to-session scoped wire is setup properly by the runtime
+     */
+    public void testRequestToSession() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.SESSION));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first session
+        Object session = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+
+        //second request for session
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        GenericComponent targetR2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertEquals("foo",targetR2.getString());
+        GenericComponent sourceR2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(sourceR2);
+        Assert.assertEquals("foo",sourceR2.getGenericComponent().getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+
+        //second session
+        Object session2 = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session2);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals(null,target2.getString());
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals("baz",source2.getGenericComponent().getString());
+        Assert.assertEquals("baz",target2.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,session2);
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+         
+    }
+
+    
+    /**
+     * Tests a request-to-stateless scoped wire is setup properly by the 
runtime
+     */
+    public void testRequestToStateless() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.INSTANCE));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals(null,target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+        
+        //second request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals(null,target2.getString());
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        Assert.assertEquals(null,target2.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+       
+    }
+
+    
+    /**
+     * Tests a stateless-to-stateless scoped wire is setup properly by the 
runtime
+     */
+    public void testStatelessToStateless() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.INSTANCE));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals(null,target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+        
+        //second request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals(null,target2.getString());
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        Assert.assertEquals(null,target2.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+       
+    }
+    
+    /**
+     * Tests a stateless-to-request scoped wire is setup properly by the 
runtime
+     */
+    public void testStatelessToRequest() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.REQUEST));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+
+        GenericComponent targetR1 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(targetR1);
+        Assert.assertEquals("foo",target.getString());
+
+        //second request
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals(null,target2.getString());
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals("baz",source2.getGenericComponent().getString());
+        Assert.assertEquals("baz",target2.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+       
+    }
+
+    /**
+     * Tests a stateless-to-session scoped wire is setup properly by the 
runtime
+     */
+    public void testStatelessToSession() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.SESSION));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        // first session
+        Object session = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+
+        //second request for session
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        GenericComponent targetR2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertEquals("foo",targetR2.getString());
+        GenericComponent sourceR2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(sourceR2);
+        Assert.assertEquals("foo",sourceR2.getGenericComponent().getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+
+        //second session
+        Object session2 = new Object();
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session2);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals(null,target2.getString());
+        Assert.assertEquals(null,source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals("baz",source2.getGenericComponent().getString());
+        Assert.assertEquals("baz",target2.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,session2);
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        testCtx.fireEvent(EventContext.SESSION_NOTIFY,session);
+        testCtx.fireEvent(EventContext.REQUEST_END,session);
+         
+    }
+
+    
+    /**
+     * Tests a stateless-to-module scoped wire is setup properly by the runtime
+     */
+    public void testStatelessToModule() throws Exception{
+        RuntimeContext runtime = MockFactory.createJavaRuntime();
+        InstanceContext ctx = 
runtime.getSystemContext().getContext("tuscany.system.child");
+        Assert.assertNotNull(ctx);
+        
runtime.getRootContext().registerModelObject(MockFactory.createAggregateComponent("test"));
+        AggregateContext testCtx = (AggregateContext) 
runtime.getRootContext().getContext("test");
+        Assert.assertNotNull(testCtx);
+        
testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.MODULE));
+        testCtx.fireEvent(EventContext.MODULE_START,null);
+        
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source);
+        GenericComponent target = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+        Assert.assertNotNull(target);
+        source.getGenericComponent().setString("foo");
+        Assert.assertEquals("foo",target.getString());
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+
+        //second session
+        testCtx.fireEvent(EventContext.REQUEST_START,null);
+        GenericComponent source2 = 
(GenericComponent)testCtx.getContext("source").getInstance(null);
+        Assert.assertNotNull(source2);
+        GenericComponent target2 = 
(GenericComponent)testCtx.getContext("target").getInstance(null);
+
+        Assert.assertNotNull(target2);
+        Assert.assertEquals("foo",target2.getString());
+        Assert.assertEquals("foo",source2.getGenericComponent().getString());
+        source2.getGenericComponent().setString("baz");
+        Assert.assertEquals("baz",source2.getGenericComponent().getString());
+        Assert.assertEquals("baz",target2.getString());
+        
+        testCtx.fireEvent(EventContext.REQUEST_END,null);
+         
+    }
+
 }
 

Modified: 
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooESTargetInvoker.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooESTargetInvoker.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooESTargetInvoker.java
 (original)
+++ 
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooESTargetInvoker.java
 Wed Mar  1 22:21:28 2006
@@ -82,4 +82,16 @@
         throw new UnsupportedOperationException();
     }
 
+    public Object clone() {
+        try {
+            FooESTargetInvoker invoker = (FooESTargetInvoker) super.clone();
+            invoker.container = container;
+            invoker.context = this.context;
+            invoker.name = this.name;
+            return invoker;
+        } catch (CloneNotSupportedException e) {
+            return null; // will not happen
+        }
+    }
+
 }

Modified: 
incubator/tuscany/java/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoTargetInvoker.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoTargetInvoker.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoTargetInvoker.java
 (original)
+++ 
incubator/tuscany/java/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoTargetInvoker.java
 Wed Mar  1 22:21:28 2006
@@ -34,8 +34,8 @@
             }
             return target.invoke(operation, payload);
         } else {
-            return ((RhinoScript) 
container.getContext(name.getPartName()).getImplementationInstance()).invoke(operation,
-                    payload);
+            return ((RhinoScript) 
container.getContext(name.getPartName()).getImplementationInstance())
+                    .invoke(operation, payload);
         }
     }
 
@@ -65,4 +65,17 @@
         throw new IllegalStateException("This interceptor must be the last 
interceptor in an interceptor chain");
     }
 
+    public Object clone() {
+        try {
+            RhinoTargetInvoker invoker = (RhinoTargetInvoker) super.clone();
+            invoker.container = this.container;
+            invoker.cacheable = this.cacheable;
+            invoker.name = this.name;
+            invoker.operation = this.operation;
+            invoker.target = null;
+            return invoker;
+        } catch (CloneNotSupportedException e) {
+            return null; // will not happen
+        }
+    }
 }

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/TargetInvoker.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/TargetInvoker.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/TargetInvoker.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/TargetInvoker.java
 Wed Mar  1 22:21:28 2006
@@ -24,7 +24,7 @@
  * 
  * @version $Rev$ $Date$
  */
-public interface TargetInvoker extends Interceptor {
+public interface TargetInvoker extends Interceptor, Cloneable{
 
     /**
      * Responsible for invoking an operation on a target with the given payload
@@ -39,4 +39,6 @@
      * Determines whether the proxy can be cached on the client/source side
      */
     public boolean isCacheable();
+    
+    public Object clone();
 }

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandler.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandler.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandler.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandler.java
 Wed Mar  1 22:21:28 2006
@@ -19,10 +19,13 @@
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.tuscany.core.context.TargetException;
 import org.apache.tuscany.core.invocation.Interceptor;
 import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.TargetInvoker;
 import org.apache.tuscany.core.message.Message;
 import org.apache.tuscany.core.message.MessageFactory;
 
@@ -35,7 +38,14 @@
 
     private MessageFactory messageFactory;
 
-    private Map<Method, InvocationConfiguration> configuration;
+    /*
+     * an association of an operation to configuration holder. The holder 
contains the master invocation configuration
+     * and a locale clone of the master TargetInvoker. TargetInvokers will be 
cloned by the handler and placed in the
+     * holder if they are cacheable. This allows optimizations such as 
avoiding target resolution when a source refers
+     * to a target of greater scope since the target reference can be 
maintained by the invoker. When a target invoker
+     * is not cacheable, the master associated with the invocation 
configuration will be used.
+     */
+    private Map<Method, ConfigHolder> configuration;
 
     // ----------------------------------
     // Constructors
@@ -43,7 +53,11 @@
 
     public JDKInvocationHandler(MessageFactory messageFactory, Map<Method, 
InvocationConfiguration> configuration) {
         assert (configuration != null) : "Configuration not specified";
-        this.configuration = configuration;
+        this.configuration = new HashMap(configuration.size());
+        for (Map.Entry<Method, InvocationConfiguration> entry : 
configuration.entrySet()) {
+            this.configuration.put(entry.getKey(), new 
ConfigHolder(entry.getValue()));
+        }
+        // this.configuration = configuration;
         this.messageFactory = messageFactory;
     }
 
@@ -56,10 +70,30 @@
      */
     public Object invoke(Object proxy, Method method, Object[] args) throws 
Throwable {
         Interceptor headInterceptor = null;
-        InvocationConfiguration config = configuration.get(method);
+        ConfigHolder holder = configuration.get(method);
+        if (holder == null) {
+            TargetException e = new TargetException("Operation not 
configured");
+            e.setIdentifier(method.getName());
+            throw e;
+        }
+        InvocationConfiguration config = holder.config;
         if (config != null) {
             headInterceptor = config.getSourceInterceptor();
         }
+
+        TargetInvoker invoker = null;
+
+        if (holder.cachedInvoker == null) {
+            if (config.getTargetInvoker().isCacheable()) {
+                // clone and store the invoker locally
+                holder.cachedInvoker = (TargetInvoker) 
config.getTargetInvoker().clone();
+                invoker = holder.cachedInvoker;
+            } else {
+                invoker = config.getTargetInvoker();
+            }
+        } else {
+            invoker = config.getTargetInvoker();
+        }
         if (headInterceptor == null) {
             try {
                 // short-circuit the dispatch and invoke the target directly
@@ -73,7 +107,7 @@
             }
         } else {
             Message msg = messageFactory.createMessage();
-            msg.setTargetInvoker(config.getTargetInvoker());
+            msg.setTargetInvoker(invoker);// config.getTargetInvoker());
             msg.setBody(args);
             // dispatch the invocation down the chain and get the response
             Message resp = headInterceptor.invoke(msg);
@@ -84,6 +118,21 @@
             }
             return body;
         }
+    }
+
+    /**
+     * A holder used to associate an invocation configuration with a local 
copy of a target invoker that was previously
+     * cloned from the configuration master
+     */
+    private class ConfigHolder {
+
+        public ConfigHolder(InvocationConfiguration config) {
+            this.config = config;
+        }
+
+        InvocationConfiguration config;
+
+        TargetInvoker cachedInvoker;
     }
 
 }

Modified: 
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java
 Wed Mar  1 22:21:28 2006
@@ -1,7 +1,6 @@
 package org.apache.tuscany.core.invocation.jdk;
 
 import java.lang.reflect.Method;
-import java.util.HashMap;
 import java.util.Map;
 
 import junit.framework.Assert;

Modified: 
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java?rev=382306&r1=382305&r2=382306&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java
 Wed Mar  1 22:21:28 2006
@@ -57,4 +57,14 @@
         throw new IllegalStateException("This interceptor must be the last 
interceptor in an interceptor chain");
     }
 
+    public Object clone() {
+        try {
+            MockStaticInvoker invoker = (MockStaticInvoker) super.clone();
+            invoker.instance = this.instance;
+            invoker.operation = this.operation;
+            return invoker;
+        } catch (CloneNotSupportedException e) {
+            return null; // will not happen
+        }
+    }
 }


Reply via email to