You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/05/30 01:47:53 UTC
svn commit: r410164 [2/4] - in /incubator/tuscany/sandbox/jboynes/sca:
containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/
containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/
containers/container.ja...
Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemInboundWire.java (from r410152, incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemServiceWire.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemInboundWire.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemInboundWire.java&p1=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemServiceWire.java&r1=410152&r2=410164&rev=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemServiceWire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemInboundWire.java Mon May 29 16:47:49 2006
@@ -8,28 +8,28 @@
import org.apache.tuscany.spi.context.ComponentContext;
import org.apache.tuscany.spi.context.TargetException;
import org.apache.tuscany.spi.wire.RuntimeWire;
-import org.apache.tuscany.spi.wire.ServiceInvocationChain;
-import org.apache.tuscany.spi.wire.ServiceWire;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
/**
* The source side of a wire configured to use the {@link org.apache.tuscany.core.system.model.SystemBinding}
*
* @version $$Rev$$ $$Date$$
*/
-public class SystemServiceWire<T> implements ServiceWire<T> {
+public class SystemInboundWire<T> implements InboundWire<T> {
private String serviceName;
private Class<T> businessInterface;
private ComponentContext<?> componentContext;
private RuntimeWire<T> wire; // a bridge to another target wire
private QualifiedName targetName;
- public SystemServiceWire(String serviceName, Class<T> businessInterface, ComponentContext<?> target) {
+ public SystemInboundWire(String serviceName, Class<T> businessInterface, ComponentContext<?> target) {
this.serviceName = serviceName;
this.businessInterface = businessInterface;
this.componentContext = target;
}
- public SystemServiceWire(Class<T> businessInterface, ComponentContext<?> target) {
+ public SystemInboundWire(Class<T> businessInterface, ComponentContext<?> target) {
this.businessInterface = businessInterface;
this.componentContext = target;
}
@@ -70,11 +70,11 @@
this.targetName = targetName;
}
- public Map<Method, ServiceInvocationChain> getInvocationChains() {
+ public Map<Method, InboundInvocationChain> getInvocationChains() {
return Collections.emptyMap();
}
- public void addInvocationChain(Method method, ServiceInvocationChain chain) {
+ public void addInvocationChain(Method method, InboundInvocationChain chain) {
throw new UnsupportedOperationException();
}
Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundAutowire.java (from r410152, incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemReferenceAutowire.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundAutowire.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundAutowire.java&p1=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemReferenceAutowire.java&r1=410152&r2=410164&rev=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemReferenceAutowire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundAutowire.java Mon May 29 16:47:49 2006
@@ -5,11 +5,11 @@
import java.util.Map;
import org.apache.tuscany.core.context.AutowireContext;
-import org.apache.tuscany.core.wire.ReferenceAutowire;
+import org.apache.tuscany.core.wire.OutboundAutowire;
import org.apache.tuscany.spi.QualifiedName;
import org.apache.tuscany.spi.context.TargetException;
-import org.apache.tuscany.spi.wire.ReferenceInvocationChain;
-import org.apache.tuscany.spi.wire.ServiceWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.RuntimeWire;
/**
@@ -17,12 +17,12 @@
*
* @version $$Rev$$ $$Date$$
*/
-public class SystemReferenceAutowire<T> implements ReferenceAutowire<T> {
+public class SystemOutboundAutowire<T> implements OutboundAutowire<T> {
private String referenceName;
private Class<T> businessInterface;
private AutowireContext<?> context;
- public SystemReferenceAutowire(String referenceName, Class<T> businessInterface, AutowireContext<?> context) {
+ public SystemOutboundAutowire(String referenceName, Class<T> businessInterface, AutowireContext<?> context) {
this.referenceName = referenceName;
this.businessInterface = businessInterface;
this.context = context;
@@ -63,11 +63,11 @@
throw new UnsupportedOperationException();
}
- public Map<Method, ReferenceInvocationChain> getInvocationChains() {
+ public Map<Method, OutboundInvocationChain> getInvocationChains() {
return Collections.emptyMap();
}
- public void addInvocationChain(Method method, ReferenceInvocationChain chains) {
+ public void addInvocationChain(Method method, OutboundInvocationChain chains) {
throw new UnsupportedOperationException();
}
@@ -79,7 +79,7 @@
throw new UnsupportedOperationException();
}
- public void setTargetWire(ServiceWire<T> wire) {
+ public void setTargetWire(InboundWire<T> wire) {
}
public boolean isOptimizable() {
Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundWire.java (from r410152, incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemReferenceWire.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundWire.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundWire.java&p1=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemReferenceWire.java&r1=410152&r2=410164&rev=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemReferenceWire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundWire.java Mon May 29 16:47:49 2006
@@ -6,8 +6,8 @@
import org.apache.tuscany.spi.QualifiedName;
import org.apache.tuscany.spi.context.TargetException;
-import org.apache.tuscany.spi.wire.ReferenceInvocationChain;
-import org.apache.tuscany.spi.wire.ReferenceWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.RuntimeWire;
/**
@@ -15,13 +15,13 @@
*
* @version $$Rev$$ $$Date$$
*/
-public class SystemReferenceWire<T> implements ReferenceWire<T> {
+public class SystemOutboundWire<T> implements OutboundWire<T> {
private String referenceName;
private QualifiedName targetName;
private Class<T> businessInterface;
private RuntimeWire<T> targetWire;
- public SystemReferenceWire(String referenceName, QualifiedName targetName, Class<T> businessInterface) {
+ public SystemOutboundWire(String referenceName, QualifiedName targetName, Class<T> businessInterface) {
this.referenceName = referenceName;
this.targetName = targetName;
this.businessInterface = businessInterface;
@@ -62,11 +62,11 @@
return new Class[0];
}
- public Map<Method, ReferenceInvocationChain> getInvocationChains() {
+ public Map<Method, OutboundInvocationChain> getInvocationChains() {
return Collections.emptyMap();
}
- public void addInvocationChain(Method method, ReferenceInvocationChain chains) {
+ public void addInvocationChain(Method method, OutboundInvocationChain chains) {
throw new UnsupportedOperationException();
}
Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/BridgingHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/BridgingHandler.java?rev=410164&r1=410163&r2=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/BridgingHandler.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/BridgingHandler.java Mon May 29 16:47:49 2006
@@ -4,7 +4,7 @@
import org.apache.tuscany.spi.wire.Message;
/**
- * Bridges between handlers in two {@link org.apache.tuscany.spi.wire.ServiceInvocationChain}s
+ * Bridges between handlers in two {@link org.apache.tuscany.spi.wire.InboundInvocationChain}s
*
* @version $$Rev$$ $$Date$$
*/
Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/BridgingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/BridgingInterceptor.java?rev=410164&r1=410163&r2=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/BridgingInterceptor.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/BridgingInterceptor.java Mon May 29 16:47:49 2006
@@ -5,7 +5,7 @@
import org.apache.tuscany.spi.wire.MessageChannel;
/**
- * Bridges between interceptors in two {@link org.apache.tuscany.spi.wire.ServiceInvocationChain}s
+ * Bridges between interceptors in two {@link org.apache.tuscany.spi.wire.InboundInvocationChain}s
*
* @version $$Rev$$ $$Date$$
*/
Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/InboundInvocationChainImpl.java (from r410151, incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/ServiceInvocationChainImpl.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/InboundInvocationChainImpl.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/InboundInvocationChainImpl.java&p1=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/ServiceInvocationChainImpl.java&r1=410151&r2=410164&rev=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/ServiceInvocationChainImpl.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/InboundInvocationChainImpl.java Mon May 29 16:47:49 2006
@@ -16,19 +16,19 @@
import java.lang.reflect.Method;
import org.apache.tuscany.spi.wire.MessageHandler;
-import org.apache.tuscany.spi.wire.ServiceInvocationChain;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
/**
* Contains a target-side invocation chain
*
* @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $
*/
-public class ServiceInvocationChainImpl extends InvocationChainImpl implements ServiceInvocationChain {
+public class InboundInvocationChainImpl extends InvocationChainImpl implements InboundInvocationChain {
/**
* Creates an new target-side chain for the given operation
*/
- public ServiceInvocationChainImpl(Method operation) {
+ public InboundInvocationChainImpl(Method operation) {
super(operation);
}
Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundAutowire.java (from r410151, incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/ReferenceAutowire.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundAutowire.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundAutowire.java&p1=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/ReferenceAutowire.java&r1=410151&r2=410164&rev=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/ReferenceAutowire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundAutowire.java Mon May 29 16:47:49 2006
@@ -1,11 +1,11 @@
package org.apache.tuscany.core.wire;
-import org.apache.tuscany.spi.wire.ReferenceWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
/**
* The source side of an wire configured to autowire
*
* @version $$Rev$$ $$Date$$
*/
-public interface ReferenceAutowire<T> extends ReferenceWire<T> {
+public interface OutboundAutowire<T> extends OutboundWire<T> {
}
Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundInvocationChainImpl.java (from r410151, incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/ReferenceInvocationChainImpl.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundInvocationChainImpl.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundInvocationChainImpl.java&p1=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/ReferenceInvocationChainImpl.java&r1=410151&r2=410164&rev=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/ReferenceInvocationChainImpl.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundInvocationChainImpl.java Mon May 29 16:47:49 2006
@@ -18,19 +18,19 @@
import org.apache.tuscany.spi.wire.Interceptor;
import org.apache.tuscany.spi.wire.MessageHandler;
-import org.apache.tuscany.spi.wire.ReferenceInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
/**
* Contains a source-side invocation pipeline for a service operation.
*
* @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $
*/
-public class ReferenceInvocationChainImpl extends InvocationChainImpl implements ReferenceInvocationChain {
+public class OutboundInvocationChainImpl extends InvocationChainImpl implements OutboundInvocationChain {
/**
* Creates an new source wire configuration
*/
- public ReferenceInvocationChainImpl(Method operation) {
+ public OutboundInvocationChainImpl(Method operation) {
super(operation);
}
@@ -62,7 +62,7 @@
if (targetInterceptorChainHead != null) {
// Connect source interceptor chain directly to target interceptor chain
interceptorChainTail.setNext(targetInterceptorChainHead);
- } else {
+ } else if (!(interceptorChainTail instanceof InvokerInterceptor)){
// Connect source interceptor chain to the target request channel
Interceptor channelInterceptor = new RequestResponseInterceptor(null, targetRequestChannel, null,
targetResponseChannel);
Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInboundWire.java (from r410152, incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKServiceWire.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInboundWire.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInboundWire.java&p1=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKServiceWire.java&r1=410152&r2=410164&rev=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKServiceWire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInboundWire.java Mon May 29 16:47:49 2006
@@ -8,9 +8,9 @@
import org.apache.tuscany.spi.context.TargetException;
import org.apache.tuscany.spi.wire.Interceptor;
import org.apache.tuscany.spi.wire.MessageHandler;
-import org.apache.tuscany.spi.wire.ServiceInvocationChain;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
import org.apache.tuscany.spi.wire.ServiceInvocationHandler;
-import org.apache.tuscany.spi.wire.ServiceWire;
+import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.RuntimeWire;
import org.apache.tuscany.spi.QualifiedName;
@@ -21,10 +21,10 @@
*
* @version $Rev: 394431 $ $Date: 2006-04-15 21:27:44 -0700 (Sat, 15 Apr 2006) $
*/
-public class JDKServiceWire<T> implements ServiceWire<T> {
+public class JDKInboundWire<T> implements InboundWire<T> {
private Class[] businessInterfaces;
- private Map<Method, ServiceInvocationChain> invocationChains = new MethodHashMap<ServiceInvocationChain>();
+ private Map<Method, InboundInvocationChain> invocationChains = new MethodHashMap<InboundInvocationChain>();
private String serviceName;
private QualifiedName targetName;
@@ -67,15 +67,15 @@
this.targetName = targetName;
}
- public Map<Method, ServiceInvocationChain> getInvocationChains() {
+ public Map<Method, InboundInvocationChain> getInvocationChains() {
return invocationChains;
}
- public void addInvocationChains(Map<Method, ServiceInvocationChain> chains) {
+ public void addInvocationChains(Map<Method, InboundInvocationChain> chains) {
invocationChains.putAll(chains);
}
- public void addInvocationChain(Method method, ServiceInvocationChain chain) {
+ public void addInvocationChain(Method method, InboundInvocationChain chain) {
invocationChains.put(method, chain);
}
@@ -84,7 +84,7 @@
}
public boolean isOptimizable() {
- for (ServiceInvocationChain chain : invocationChains.values()) {
+ for (InboundInvocationChain chain : invocationChains.values()) {
if (chain.getTargetInvoker() != null && !chain.getTargetInvoker().isOptimizable()) {
return false;
}
Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundWire.java (from r410152, incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKReferenceWire.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundWire.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundWire.java&p1=incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKReferenceWire.java&r1=410152&r2=410164&rev=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKReferenceWire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundWire.java Mon May 29 16:47:49 2006
@@ -22,8 +22,8 @@
import org.apache.tuscany.spi.context.TargetException;
import org.apache.tuscany.spi.wire.Interceptor;
import org.apache.tuscany.spi.wire.MessageHandler;
-import org.apache.tuscany.spi.wire.ReferenceInvocationChain;
-import org.apache.tuscany.spi.wire.ReferenceWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.ReferenceInvocationHandler;
import org.apache.tuscany.spi.wire.RuntimeWire;
@@ -33,10 +33,10 @@
*
* @version $Rev: 394431 $ $Date: 2006-04-15 21:27:44 -0700 (Sat, 15 Apr 2006) $
*/
-public class JDKReferenceWire<T> implements ReferenceWire<T> {
+public class JDKOutboundWire<T> implements OutboundWire<T> {
private Class<T>[] businessInterfaces;
- private Map<Method, ReferenceInvocationChain> invocationChains = new MethodHashMap<ReferenceInvocationChain>();
+ private Map<Method, OutboundInvocationChain> invocationChains = new MethodHashMap<OutboundInvocationChain>();
private String referenceName;
private QualifiedName targetName;
private RuntimeWire<T> targetWire;
@@ -72,15 +72,15 @@
this.targetWire = wire;
}
- public Map<Method, ReferenceInvocationChain> getInvocationChains() {
+ public Map<Method, OutboundInvocationChain> getInvocationChains() {
return invocationChains;
}
- public void addInvocationChains(Map<Method, ReferenceInvocationChain> chains) {
+ public void addInvocationChains(Map<Method, OutboundInvocationChain> chains) {
invocationChains.putAll(chains);
}
- public void addInvocationChain(Method method, ReferenceInvocationChain chain) {
+ public void addInvocationChain(Method method, OutboundInvocationChain chain) {
invocationChains.put(method, chain);
}
@@ -102,7 +102,7 @@
public boolean isOptimizable() {
- for (ReferenceInvocationChain chain : invocationChains.values()) {
+ for (OutboundInvocationChain chain : invocationChains.values()) {
if (chain.getHeadInterceptor() != null || !chain.getRequestHandlers().isEmpty()
|| !chain.getResponseHandlers().isEmpty()) {
Interceptor current = chain.getHeadInterceptor();
Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryService.java?rev=410164&r1=410163&r2=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryService.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryService.java Mon May 29 16:47:49 2006
@@ -13,8 +13,8 @@
*/
package org.apache.tuscany.core.wire.jdk;
-import org.apache.tuscany.spi.wire.ReferenceWire;
-import org.apache.tuscany.spi.wire.ServiceWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.WireFactoryService;
import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Scope;
@@ -39,12 +39,12 @@
public void init() {
}
- public ServiceWire createServiceWire() {
- return new JDKServiceWire();
+ public InboundWire createServiceWire() {
+ return new JDKInboundWire();
}
- public ReferenceWire createReferenceWire() {
- return new JDKReferenceWire();
+ public OutboundWire createReferenceWire() {
+ return new JDKOutboundWire();
}
public boolean isProxy(Object object) {
Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/system/WireServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/system/WireServiceImpl.java?rev=410164&r1=410163&r2=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/system/WireServiceImpl.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/system/WireServiceImpl.java Mon May 29 16:47:49 2006
@@ -4,17 +4,17 @@
import java.util.Set;
import org.apache.tuscany.core.util.JavaIntrospectionHelper;
-import org.apache.tuscany.core.wire.ReferenceInvocationChainImpl;
-import org.apache.tuscany.core.wire.ServiceInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
import org.apache.tuscany.spi.model.Reference;
import org.apache.tuscany.spi.model.Service;
import org.apache.tuscany.spi.annotation.Autowire;
import org.apache.tuscany.spi.builder.BuilderConfigException;
import org.apache.tuscany.spi.policy.PolicyBuilderRegistry;
-import org.apache.tuscany.spi.wire.ReferenceInvocationChain;
-import org.apache.tuscany.spi.wire.ReferenceWire;
-import org.apache.tuscany.spi.wire.ServiceInvocationChain;
-import org.apache.tuscany.spi.wire.ServiceWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.WireFactoryService;
import org.apache.tuscany.spi.wire.WireService;
import org.osoa.sca.annotations.Init;
@@ -61,16 +61,16 @@
public void init() {
}
- public ReferenceWire createReferenceWire(Reference reference) throws BuilderConfigException {
+ public OutboundWire createReferenceWire(Reference reference) throws BuilderConfigException {
String name = reference.getName();
Class interfaze = reference.getServiceContract().getInterfaceClass();
- ReferenceWire<?> wire = wireFactoryService.createReferenceWire();
+ OutboundWire<?> wire = wireFactoryService.createReferenceWire();
wire.setBusinessInterface(interfaze);
wire.setReferenceName(name);
Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(interfaze);
for (Method method : javaMethods) {
- ReferenceInvocationChain chain = new ReferenceInvocationChainImpl(method);
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(method);
wire.addInvocationChain(method, chain);
}
if (policyRegistry != null) {
@@ -80,16 +80,16 @@
return wire;
}
- public ServiceWire createServiceWire(Service service) {
+ public InboundWire createServiceWire(Service service) {
String name = service.getName();
Class interfaze = service.getServiceContract().getInterfaceClass();
- ServiceWire<?> wire = wireFactoryService.createServiceWire();
+ InboundWire<?> wire = wireFactoryService.createServiceWire();
wire.setBusinessInterface(interfaze);
wire.setServiceName(name);
Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(interfaze);
for (Method method : javaMethods) {
- ServiceInvocationChain chain = new ServiceInvocationChainImpl(method);
+ InboundInvocationChain chain = new InboundInvocationChainImpl(method);
wire.addInvocationChain(method, chain);
}
if (policyRegistry != null) {
Copied: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java (from r410152, incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/ReferenceToServiceConnectTestCase.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java?p2=incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java&p1=incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/ReferenceToServiceConnectTestCase.java&r1=410152&r2=410164&rev=410164&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/ReferenceToServiceConnectTestCase.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java Mon May 29 16:47:49 2006
@@ -8,38 +8,38 @@
import org.apache.tuscany.core.mock.wire.MockHandler;
import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
import org.apache.tuscany.core.wire.InvokerInterceptor;
-import org.apache.tuscany.core.wire.ReferenceInvocationChainImpl;
-import org.apache.tuscany.core.wire.ServiceInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
import org.apache.tuscany.spi.wire.Interceptor;
import org.apache.tuscany.spi.wire.Message;
import org.apache.tuscany.spi.wire.MessageHandler;
import org.apache.tuscany.spi.wire.MessageImpl;
-import org.apache.tuscany.spi.wire.ReferenceInvocationChain;
-import org.apache.tuscany.spi.wire.ServiceInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
import org.apache.tuscany.spi.wire.TargetInvoker;
import org.jmock.Mock;
import org.jmock.MockObjectTestCase;
/**
- * Verifies connection strategies between {@link org.apache.tuscany.spi.wire.ReferenceInvocationChain}s and
- * {@link org.apache.tuscany.spi.wire.ServiceInvocationChain}s
+ * Verifies connection strategies between {@link org.apache.tuscany.spi.wire.OutboundInvocationChain}s and
+ * {@link org.apache.tuscany.spi.wire.InboundInvocationChain}s
*
* @version $$Rev$$ $$Date$$
*/
-public class ReferenceToServiceConnectTestCase extends MockObjectTestCase {
+public class OutboundToInboundConnectTestCase extends MockObjectTestCase {
@SuppressWarnings("unchecked")
public void testNoInterceptorsNoHandlers() throws Exception {
ConnectorImpl connector = new ConnectorImpl();
- ServiceInvocationChain serviceChain = setupTarget(null, null, null);
- ReferenceInvocationChain referenceChain = setupSource(null, null, null);
+ InboundInvocationChain inboundChain = setupTarget(null, null, null);
+ OutboundInvocationChain outboundChain = setupSource(null, null, null);
String[] val = new String[]{"foo"};
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invokeTarget").with(eq(val)).will(returnValue(val));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- assertEquals(val, referenceChain.getTargetInvoker().invokeTarget(val));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ assertEquals(val, outboundChain.getTargetInvoker().invokeTarget(val));
}
@@ -53,17 +53,17 @@
List<Interceptor> interceptors = new ArrayList<Interceptor>();
interceptors.add(interceptor);
- ReferenceInvocationChain referenceChain = setupSource(interceptors, null, null);
- ServiceInvocationChain serviceChain = setupTarget(null, null, null);
+ OutboundInvocationChain outboundChain = setupSource(interceptors, null, null);
+ InboundInvocationChain inboundChain = setupTarget(null, null, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, interceptor.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, interceptor.getCount());
}
@@ -77,17 +77,17 @@
List<Interceptor> interceptors = new ArrayList<Interceptor>();
interceptors.add(interceptor);
- ReferenceInvocationChain referenceChain = setupSource(null, null, null);
- ServiceInvocationChain serviceChain = setupTarget(interceptors, null, null);
+ OutboundInvocationChain outboundChain = setupSource(null, null, null);
+ InboundInvocationChain inboundChain = setupTarget(interceptors, null, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, interceptor.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, interceptor.getCount());
}
@@ -104,18 +104,18 @@
List<Interceptor> targetInterceptors = new ArrayList<Interceptor>();
targetInterceptors.add(targetInterceptor);
- ReferenceInvocationChain referenceChain = setupSource(sourceInterceptors, null, null);
- ServiceInvocationChain serviceChain = setupTarget(targetInterceptors, null, null);
+ OutboundInvocationChain outboundChain = setupSource(sourceInterceptors, null, null);
+ InboundInvocationChain inboundChain = setupTarget(targetInterceptors, null, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, sourceInterceptor.getCount());
assertEquals(0, targetInterceptor.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, sourceInterceptor.getCount());
assertEquals(1, targetInterceptor.getCount());
}
@@ -133,18 +133,18 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(interceptors, handlers, null);
- ServiceInvocationChain serviceChain = setupTarget(null, null, null);
+ OutboundInvocationChain outboundChain = setupSource(interceptors, handlers, null);
+ InboundInvocationChain inboundChain = setupTarget(null, null, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, interceptor.getCount());
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, interceptor.getCount());
assertEquals(1, handler.getCount());
}
@@ -162,18 +162,18 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(null, null, null);
- ServiceInvocationChain serviceChain = setupTarget(interceptors, handlers, null);
+ OutboundInvocationChain outboundChain = setupSource(null, null, null);
+ InboundInvocationChain inboundChain = setupTarget(interceptors, handlers, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, interceptor.getCount());
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, interceptor.getCount());
assertEquals(1, handler.getCount());
}
@@ -192,18 +192,18 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(interceptors, null, handlers);
- ServiceInvocationChain serviceChain = setupTarget(null, null, null);
+ OutboundInvocationChain outboundChain = setupSource(interceptors, null, handlers);
+ InboundInvocationChain inboundChain = setupTarget(null, null, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, interceptor.getCount());
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, interceptor.getCount());
assertEquals(1, handler.getCount());
}
@@ -221,18 +221,18 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(null, null, null);
- ServiceInvocationChain serviceChain = setupTarget(interceptors, null, handlers);
+ OutboundInvocationChain outboundChain = setupSource(null, null, null);
+ InboundInvocationChain inboundChain = setupTarget(interceptors, null, handlers);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, interceptor.getCount());
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, interceptor.getCount());
assertEquals(1, handler.getCount());
}
@@ -250,18 +250,18 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(interceptors, handlers, handlers);
- ServiceInvocationChain serviceChain = setupTarget(null, null, null);
+ OutboundInvocationChain outboundChain = setupSource(interceptors, handlers, handlers);
+ InboundInvocationChain inboundChain = setupTarget(null, null, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, interceptor.getCount());
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, interceptor.getCount());
assertEquals(2, handler.getCount());
}
@@ -279,18 +279,18 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(null, null, handlers);
- ServiceInvocationChain serviceChain = setupTarget(interceptors, handlers, null);
+ OutboundInvocationChain outboundChain = setupSource(null, null, handlers);
+ InboundInvocationChain inboundChain = setupTarget(interceptors, handlers, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, interceptor.getCount());
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, interceptor.getCount());
assertEquals(2, handler.getCount());
}
@@ -305,17 +305,17 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(null, handlers, handlers);
- ServiceInvocationChain serviceChain = setupTarget(null, null, null);
+ OutboundInvocationChain outboundChain = setupSource(null, handlers, handlers);
+ InboundInvocationChain inboundChain = setupTarget(null, null, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(2, handler.getCount());
}
@@ -329,17 +329,17 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(null, null, null);
- ServiceInvocationChain serviceChain = setupTarget(null, handlers, handlers);
+ OutboundInvocationChain outboundChain = setupSource(null, null, null);
+ InboundInvocationChain inboundChain = setupTarget(null, handlers, handlers);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(2, handler.getCount());
}
@@ -353,17 +353,17 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(null, handlers, null);
- ServiceInvocationChain serviceChain = setupTarget(null, null, null);
+ OutboundInvocationChain outboundChain = setupSource(null, handlers, null);
+ InboundInvocationChain inboundChain = setupTarget(null, null, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, handler.getCount());
}
@@ -377,17 +377,17 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(null, null, null);
- ServiceInvocationChain serviceChain = setupTarget(null, handlers, null);
+ OutboundInvocationChain outboundChain = setupSource(null, null, null);
+ InboundInvocationChain inboundChain = setupTarget(null, handlers, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, handler.getCount());
}
@@ -401,17 +401,17 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(null, null, handlers);
- ServiceInvocationChain serviceChain = setupTarget(null, null, null);
+ OutboundInvocationChain outboundChain = setupSource(null, null, handlers);
+ InboundInvocationChain inboundChain = setupTarget(null, null, null);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, handler.getCount());
}
@@ -425,22 +425,22 @@
List<MessageHandler> handlers = new ArrayList<MessageHandler>();
handlers.add(handler);
- ReferenceInvocationChain referenceChain = setupSource(null, null, null);
- ServiceInvocationChain serviceChain = setupTarget(null, null, handlers);
+ OutboundInvocationChain outboundChain = setupSource(null, null, null);
+ InboundInvocationChain inboundChain = setupTarget(null, null, handlers);
Message msg = new MessageImpl();
Mock mock = mock(TargetInvoker.class);
mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
TargetInvoker invoker = (TargetInvoker) mock.proxy();
assertEquals(0, handler.getCount());
- connector.connect(referenceChain, serviceChain, invoker);
- serviceChain.build();
- msg.setTargetInvoker(referenceChain.getTargetInvoker());
- assertEquals(msg, referenceChain.getHeadInterceptor().invoke(msg));
+ connector.connect(outboundChain, inboundChain, invoker);
+ inboundChain.build();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
assertEquals(1, handler.getCount());
}
- public ServiceInvocationChain setupTarget(List<Interceptor> interceptors,
+ public InboundInvocationChain setupTarget(List<Interceptor> interceptors,
List<MessageHandler> requestHandlers,
List<MessageHandler> responseHandlers) {
@@ -450,7 +450,7 @@
} catch (NoSuchMethodException e) {
throw new AssertionError();
}
- ServiceInvocationChainImpl chain = new ServiceInvocationChainImpl(echo);
+ InboundInvocationChainImpl chain = new InboundInvocationChainImpl(echo);
if (interceptors != null) {
for (Interceptor interceptor : interceptors) {
chain.addInterceptor(interceptor);
@@ -470,7 +470,7 @@
return chain;
}
- public ReferenceInvocationChain setupSource(List<Interceptor> interceptors,
+ public OutboundInvocationChain setupSource(List<Interceptor> interceptors,
List<MessageHandler> requestHandlers,
List<MessageHandler> responseHandlers) {
@@ -480,7 +480,7 @@
} catch (NoSuchMethodException e) {
throw new AssertionError();
}
- ReferenceInvocationChainImpl chain = new ReferenceInvocationChainImpl(echo);
+ OutboundInvocationChainImpl chain = new OutboundInvocationChainImpl(echo);
if (interceptors != null) {
for (Interceptor interceptor : interceptors) {
chain.addInterceptor(interceptor);
Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/ReferenceToReferenceConnectTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/ReferenceToReferenceConnectTestCase.java?rev=410164&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/ReferenceToReferenceConnectTestCase.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/test/java/org/apache/tuscany/core/builder/ReferenceToReferenceConnectTestCase.java Mon May 29 16:47:49 2006
@@ -0,0 +1,420 @@
+package org.apache.tuscany.core.builder;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.core.mock.component.SimpleTarget;
+import org.apache.tuscany.core.mock.wire.MockHandler;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageHandler;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+import org.jmock.core.Stub;
+import org.jmock.core.Invocation;
+
+/**
+ * Verifies connection strategies between {@link org.apache.tuscany.spi.wire.OutboundInvocationChain}s and
+ * {@link org.apache.tuscany.spi.wire.InboundInvocationChain}s
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ReferenceToReferenceConnectTestCase extends MockObjectTestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testNoInterceptorsNoHandlers() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ OutboundInvocationChain sourceChain = setupChain(null, null, null);
+ OutboundInvocationChain targetChain = setupTerminatingChain(null, null, null);
+ String[] val = new String[]{"foo"};
+ Mock mock = mock(TargetInvoker.class);
+ mock.expects(once()).method("invokeTarget").with(eq(val)).will(returnValue(val));
+ TargetInvoker invoker = (TargetInvoker) mock.proxy();
+ connector.connect(sourceChain, targetChain, invoker);
+ sourceChain.build();
+ assertEquals(val, sourceChain.getTargetInvoker().invokeTarget(val));
+ }
+
+
+ /**
+ * Verifies an invocation with a single source interceptor
+ */
+ @SuppressWarnings("unchecked")
+ public void testSourceInterceptor() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+ OutboundInvocationChain sourceChain = setupChain(interceptors, null, null);
+ OutboundInvocationChain targetChain = setupTerminatingChain(null, null, null);
+ Message msg = new MessageImpl();
+ Mock mock = mock(TargetInvoker.class);
+ mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
+ TargetInvoker invoker = (TargetInvoker) mock.proxy();
+ assertEquals(0, interceptor.getCount());
+ connector.connect(sourceChain, targetChain, invoker);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ }
+
+ /**
+ * Verifies an invocation with a single target interceptor
+ */
+ @SuppressWarnings("unchecked")
+ public void testTargetInterceptor() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+
+ OutboundInvocationChain sourceChain = setupChain(null, null, null);
+ OutboundInvocationChain targetChain = setupTerminatingChain(interceptors, null, null);
+ Message msg = new MessageImpl();
+ Mock mock = mock(TargetInvoker.class);
+ mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
+ TargetInvoker invoker = (TargetInvoker) mock.proxy();
+ assertEquals(0, interceptor.getCount());
+ connector.connect(sourceChain, targetChain, invoker);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ }
+
+ /**
+ * Verifies an invocation with a source and target interceptor
+ */
+ @SuppressWarnings("unchecked")
+ public void testSourceTargetInterceptor() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ List<Interceptor> sourceInterceptors = new ArrayList<Interceptor>();
+ sourceInterceptors.add(sourceInterceptor);
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ List<Interceptor> targetInterceptors = new ArrayList<Interceptor>();
+ targetInterceptors.add(targetInterceptor);
+
+ OutboundInvocationChain sourceChain = setupChain(sourceInterceptors, null, null);
+ OutboundInvocationChain targetChain = setupTerminatingChain(targetInterceptors, null, null);
+ Message msg = new MessageImpl();
+ Mock mock = mock(TargetInvoker.class);
+ mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
+ TargetInvoker invoker = (TargetInvoker) mock.proxy();
+ assertEquals(0, sourceInterceptor.getCount());
+ assertEquals(0, targetInterceptor.getCount());
+ connector.connect(sourceChain, targetChain, invoker);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, sourceInterceptor.getCount());
+ assertEquals(1, targetInterceptor.getCount());
+ }
+
+ /**
+ * Verifies an invocation with a source interceptor and a request handler
+ */
+ @SuppressWarnings("unchecked")
+ public void testSourceInterceptorSourceRequestHandler() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+ MockHandler handler = new MockHandler();
+ List<MessageHandler> handlers = new ArrayList<MessageHandler>();
+ handlers.add(handler);
+
+ OutboundInvocationChain sourceChain = setupChain(interceptors, handlers, null);
+ OutboundInvocationChain targetChain = setupTerminatingChain(null, null, null);
+ Message msg = new MessageImpl();
+ Mock mock = mock(TargetInvoker.class);
+ mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
+ TargetInvoker invoker = (TargetInvoker) mock.proxy();
+ assertEquals(0, interceptor.getCount());
+ assertEquals(0, handler.getCount());
+ connector.connect(sourceChain, targetChain, invoker);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ assertEquals(1, handler.getCount());
+ }
+
+ /**
+ * Verifies an invocation with a target interceptor and a request handler
+ */
+ @SuppressWarnings("unchecked")
+ public void testTargetInterceptorTargetRequestHandler() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+ MockHandler handler = new MockHandler();
+ final Message msg = new MessageImpl();
+ Mock terminatingHandler = mock(MessageHandler.class);
+ terminatingHandler.expects(once()).method("processMessage").with(eq(msg)).will(new Stub(){
+ public Object invoke(Invocation invocation) throws Throwable {
+ return true;
+ }
+
+ public StringBuffer describeTo(StringBuffer stringBuffer) {
+ return null;
+ }
+ });
+ List<MessageHandler> handlers = new ArrayList<MessageHandler>();
+ handlers.add(handler);
+ handlers.add((MessageHandler)terminatingHandler.proxy());
+ OutboundInvocationChain sourceChain = setupChain(null, null, null);
+ OutboundInvocationChain targetChain = setupChain(interceptors, handlers, null);
+ assertEquals(0, interceptor.getCount());
+ assertEquals(0, handler.getCount());
+ connector.connect(sourceChain, targetChain, null);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ assertEquals(1, handler.getCount());
+ }
+
+
+ /**
+ * Verifies an invocation with a source interceptor and response handler
+ */
+ @SuppressWarnings("unchecked")
+ public void testSourceInterceptorSourceResponseHandler() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+ MockHandler handler = new MockHandler();
+ List<MessageHandler> handlers = new ArrayList<MessageHandler>();
+ handlers.add(handler);
+
+ OutboundInvocationChain sourceChain = setupChain(interceptors, null, handlers);
+ OutboundInvocationChain targetChain = setupTerminatingChain(null, null, null);
+ Message msg = new MessageImpl();
+ Mock mock = mock(TargetInvoker.class);
+ mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
+ TargetInvoker invoker = (TargetInvoker) mock.proxy();
+ assertEquals(0, interceptor.getCount());
+ assertEquals(0, handler.getCount());
+ connector.connect(sourceChain, targetChain, invoker);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ assertEquals(1, handler.getCount());
+ }
+
+ /**
+ * Verifies an invocation with a source interceptor and response handler
+ */
+ @SuppressWarnings("unchecked")
+ public void testTargetInterceptorTargetResponseHandler() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+ MockHandler handler = new MockHandler();
+ final Message msg = new MessageImpl();
+ Mock terminatingHandler = mock(MessageHandler.class);
+ terminatingHandler.expects(once()).method("processMessage").with(eq(msg)).will(new Stub(){
+ public Object invoke(Invocation invocation) throws Throwable {
+ return true;
+ }
+
+ public StringBuffer describeTo(StringBuffer stringBuffer) {
+ return null;
+ }
+ });
+ List<MessageHandler> handlers = new ArrayList<MessageHandler>();
+ handlers.add(handler);
+ handlers.add((MessageHandler)terminatingHandler.proxy());
+
+ OutboundInvocationChain sourceChain = setupChain(null, null, null);
+ OutboundInvocationChain targetChain = setupChain(interceptors, null, handlers);
+ assertEquals(0, interceptor.getCount());
+ assertEquals(0, handler.getCount());
+ connector.connect(sourceChain, targetChain, null);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ assertEquals(1, handler.getCount());
+ }
+
+ /**
+ * Verifies an invocation with a source interceptor, request handler, and response handler
+ */
+ @SuppressWarnings("unchecked")
+ public void testSourceInterceptorSourceRequestResponseHandler() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+ MockHandler handler = new MockHandler();
+ List<MessageHandler> handlers = new ArrayList<MessageHandler>();
+ handlers.add(handler);
+
+ OutboundInvocationChain sourceChain = setupChain(interceptors, handlers, handlers);
+ OutboundInvocationChain targetChain = setupTerminatingChain(null, null, null);
+ Message msg = new MessageImpl();
+ Mock mock = mock(TargetInvoker.class);
+ mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
+ TargetInvoker invoker = (TargetInvoker) mock.proxy();
+ assertEquals(0, interceptor.getCount());
+ assertEquals(0, handler.getCount());
+ connector.connect(sourceChain, targetChain, invoker);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ assertEquals(2, handler.getCount());
+ }
+
+ /**
+ * Verifies an invocation with a target interceptor, request handler, and response handler
+ */
+ @SuppressWarnings("unchecked")
+ public void testTargetInterceptorTargetRequestResponseHandler() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+ MockHandler handler = new MockHandler();
+ final Message msg = new MessageImpl();
+ Mock terminatingHandler = mock(MessageHandler.class);
+ terminatingHandler.expects(atLeastOnce()).method("processMessage").with(eq(msg)).will(new Stub(){
+ public Object invoke(Invocation invocation) throws Throwable {
+ return true;
+ }
+
+ public StringBuffer describeTo(StringBuffer stringBuffer) {
+ return null;
+ }
+ });
+ List<MessageHandler> handlers = new ArrayList<MessageHandler>();
+ handlers.add(handler);
+ handlers.add((MessageHandler)terminatingHandler.proxy());
+
+ OutboundInvocationChain sourceChain = setupChain(null, null, handlers);
+ OutboundInvocationChain targetChain = setupChain(interceptors, handlers, null);
+
+ assertEquals(0, interceptor.getCount());
+ assertEquals(0, handler.getCount());
+ connector.connect(sourceChain, targetChain, null);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ assertEquals(2, handler.getCount());
+ }
+
+ /**
+ * Verifies an invocation with a source request handler and response handler
+ */
+ @SuppressWarnings("unchecked")
+ public void testSourceRequestResponseHandler() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockHandler handler = new MockHandler();
+ List<MessageHandler> handlers = new ArrayList<MessageHandler>();
+ handlers.add(handler);
+
+ OutboundInvocationChain sourceChain = setupChain(null, handlers, handlers);
+ OutboundInvocationChain targetChain = setupTerminatingChain(null, null, null);
+ Message msg = new MessageImpl();
+ Mock mock = mock(TargetInvoker.class);
+ mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
+ TargetInvoker invoker = (TargetInvoker) mock.proxy();
+ assertEquals(0, handler.getCount());
+ connector.connect(sourceChain, targetChain, invoker);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(2, handler.getCount());
+ }
+
+ /**
+ * Verifies an invocation with a single source request handler
+ */
+ @SuppressWarnings("unchecked")
+ public void testSourceRequestHandler() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockHandler handler = new MockHandler();
+ List<MessageHandler> handlers = new ArrayList<MessageHandler>();
+ handlers.add(handler);
+
+ OutboundInvocationChain sourceChain = setupChain(null, handlers, null);
+ OutboundInvocationChain targetChain = setupTerminatingChain(null, null, null);
+ Message msg = new MessageImpl();
+ Mock mock = mock(TargetInvoker.class);
+ mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
+ TargetInvoker invoker = (TargetInvoker) mock.proxy();
+ assertEquals(0, handler.getCount());
+ connector.connect(sourceChain, targetChain, invoker);
+ sourceChain.build();
+ targetChain.build();
+ msg.setTargetInvoker(sourceChain.getTargetInvoker());
+ assertEquals(msg, sourceChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, handler.getCount());
+ }
+
+
+
+ public OutboundInvocationChain setupChain(List<Interceptor> interceptors,
+ List<MessageHandler> requestHandlers,
+ List<MessageHandler> responseHandlers) {
+
+ Method echo;
+ try {
+ echo = SimpleTarget.class.getMethod("echo", String.class);
+ } catch (NoSuchMethodException e) {
+ throw new AssertionError();
+ }
+ OutboundInvocationChainImpl chain = new OutboundInvocationChainImpl(echo);
+ if (interceptors != null) {
+ for (Interceptor interceptor : interceptors) {
+ chain.addInterceptor(interceptor);
+ }
+ }
+ if (requestHandlers != null) {
+ for (MessageHandler handler : requestHandlers) {
+ chain.addRequestHandler(handler);
+ }
+ }
+ if (responseHandlers != null) {
+ for (MessageHandler handler : responseHandlers) {
+ chain.addResponseHandler(handler);
+ }
+ }
+ return chain;
+ }
+
+ public OutboundInvocationChain setupTerminatingChain(List<Interceptor> interceptors,
+ List<MessageHandler> requestHandlers,
+ List<MessageHandler> responseHandlers) {
+ OutboundInvocationChain chain = setupChain(interceptors, requestHandlers, responseHandlers);
+ chain.addInterceptor(new InvokerInterceptor()); // add tail interceptor
+ return chain;
+
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org