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/09/09 08:55:04 UTC
svn commit: r441749 [2/2] - in /incubator/tuscany/java/sca:
containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/
kernel/core/src/main/java/org/apache/tuscany/core/builder/
kernel/core/src/main/java/org/apache/tuscany/core/comp...
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java Fri Sep 8 23:55:02 2006
@@ -30,7 +30,6 @@
import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
import org.apache.tuscany.core.mock.component.SimpleTarget;
import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
-import org.apache.tuscany.core.mock.wire.MockHandler;
import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
import org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler;
@@ -43,7 +42,7 @@
private Method echo;
- public void testHandlersInterceptorInvoke() throws Throwable {
+ public void testInterceptorInvoke() throws Throwable {
JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
ServiceContract<?> contract = registry.introspect(SimpleTarget.class);
Operation<?> operation = contract.getOperations().get("echo");
@@ -52,10 +51,6 @@
MockSyncInterceptor interceptor = new MockSyncInterceptor();
chain.addInterceptor(interceptor);
chain.setTargetInterceptor(new InvokerInterceptor());
- MockHandler requestHandler = new MockHandler();
- chain.addRequestHandler(requestHandler);
- MockHandler responseHandler = new MockHandler();
- chain.addResponseHandler(responseHandler);
chain.setTargetInvoker(invoker);
chain.prepare();
//chains.put(echo, chain);
@@ -65,8 +60,6 @@
JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire, new WorkContextImpl());
assertEquals("foo", handler.invoke(null, echo, new String[]{"foo"}));
assertEquals(1, interceptor.getCount());
- assertEquals(1, requestHandler.getCount());
- assertEquals(1, responseHandler.getCount());
}
public void setUp() throws Exception {
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InboundInvocationErrorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InboundInvocationErrorTestCase.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InboundInvocationErrorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InboundInvocationErrorTestCase.java Fri Sep 8 23:55:02 2006
@@ -31,7 +31,6 @@
import junit.framework.TestCase;
import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
-import org.apache.tuscany.core.mock.wire.MockHandler;
import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
import org.apache.tuscany.core.wire.jdk.JDKInboundInvocationHandler;
@@ -110,7 +109,6 @@
MockStaticInvoker invoker = new MockStaticInvoker(m, new InboundInvocationErrorTestCase.TestBeanImpl());
InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
chain.addInterceptor(new MockSyncInterceptor());
- chain.addRequestHandler(new MockHandler());
chain.setTargetInvoker(invoker);
chain.addInterceptor(new InvokerInterceptor());
chain.prepare();
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java Fri Sep 8 23:55:02 2006
@@ -20,21 +20,20 @@
import java.lang.reflect.Method;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
import org.apache.tuscany.spi.wire.InboundInvocationChain;
import org.apache.tuscany.spi.wire.Message;
import org.apache.tuscany.spi.wire.MessageImpl;
import org.apache.tuscany.spi.wire.OutboundInvocationChain;
-import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.model.Operation;
import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
import org.apache.tuscany.core.mock.component.SimpleTarget;
import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
-import org.apache.tuscany.core.mock.wire.MockHandler;
import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
-import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
/**
* Tests error propagation through an innvocation
@@ -61,82 +60,10 @@
hello = SimpleTarget.class.getMethod("hello", String.class);
}
- public void testInvokeWithHandlers() throws Exception {
- Operation operation = contract.getOperations().get("hello");
- OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
- MockHandler sourceRequestHandler = new MockHandler();
- MockHandler sourceResponseHandler = new MockHandler();
- MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
- source.addRequestHandler(sourceRequestHandler);
- source.addResponseHandler(sourceResponseHandler);
- source.addInterceptor(sourceInterceptor);
-
- InboundInvocationChain target = new InboundInvocationChainImpl(operation);
- MockHandler targetRequestHandler = new MockHandler();
- MockHandler targetResponseHandler = new MockHandler();
- MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
- target.addRequestHandler(targetRequestHandler);
- target.addResponseHandler(targetResponseHandler);
- target.addInterceptor(targetInterceptor);
- target.addInterceptor(new InvokerInterceptor());
-
- // connect the source to the target
- source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
- source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
- source.prepare();
- target.prepare();
- MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
- source.setTargetInvoker(invoker);
-
- Message msg = new MessageImpl();
- msg.setTargetInvoker(invoker);
- Message response = source.getHeadInterceptor().invoke(msg);
- assertTrue(response.getBody() instanceof IllegalArgumentException);
- assertEquals(1, sourceRequestHandler.getCount());
- assertEquals(1, sourceResponseHandler.getCount());
- assertEquals(1, sourceInterceptor.getCount());
- assertEquals(1, targetRequestHandler.getCount());
- assertEquals(1, targetResponseHandler.getCount());
- assertEquals(1, targetInterceptor.getCount());
- }
-
- public void testInvokeWithRequestHandlers() throws Exception {
- Operation operation = contract.getOperations().get("hello");
- OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
- MockHandler sourceRequestHandler = new MockHandler();
- MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
- source.addRequestHandler(sourceRequestHandler);
- source.addInterceptor(sourceInterceptor);
-
- InboundInvocationChain target = new InboundInvocationChainImpl(operation);
- MockHandler targetRequestHandler = new MockHandler();
- MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
- target.addRequestHandler(targetRequestHandler);
- target.addInterceptor(targetInterceptor);
- target.addInterceptor(new InvokerInterceptor());
-
- // connect the source to the target
- source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
- source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
- source.prepare();
- target.prepare();
- MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
- source.setTargetInvoker(invoker);
-
- Message msg = new MessageImpl();
- msg.setTargetInvoker(invoker);
- Message response = source.getHeadInterceptor().invoke(msg);
- assertTrue(response.getBody() instanceof IllegalArgumentException);
- assertEquals(1, sourceRequestHandler.getCount());
- assertEquals(1, sourceInterceptor.getCount());
- assertEquals(1, targetRequestHandler.getCount());
- assertEquals(1, targetInterceptor.getCount());
- }
-
/**
* Tests basic wiring of a source to a target, including handlers and interceptors
*/
- public void testInvokeWithInterceptorsOnly() throws Exception {
+ public void testInvokeWithInterceptors() throws Exception {
Operation operation = contract.getOperations().get("hello");
OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java Fri Sep 8 23:55:02 2006
@@ -33,7 +33,6 @@
import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
import org.apache.tuscany.core.mock.component.SimpleTarget;
import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
-import org.apache.tuscany.core.mock.wire.MockHandler;
import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
@@ -68,82 +67,7 @@
/**
* Tests basic wiring of a source to a target, including handlers and interceptors
*/
- public void testInvokeWithHandlers() throws Exception {
- OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
- MockHandler sourceRequestHandler = new MockHandler();
- MockHandler sourceResponseHandler = new MockHandler();
- MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
- source.addRequestHandler(sourceRequestHandler);
- source.addResponseHandler(sourceResponseHandler);
- source.addInterceptor(sourceInterceptor);
-
- InboundInvocationChain target = new InboundInvocationChainImpl(operation);
- MockHandler targetRequestHandler = new MockHandler();
- MockHandler targetResponseHandler = new MockHandler();
- MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
- target.addRequestHandler(targetRequestHandler);
- target.addResponseHandler(targetResponseHandler);
- target.addInterceptor(targetInterceptor);
- target.addInterceptor(new InvokerInterceptor());
-
- // connect the source to the target
- source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
- source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
- source.prepare();
- target.prepare();
- MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
- source.setTargetInvoker(invoker);
-
- Message msg = new MessageImpl();
- msg.setBody("foo");
- msg.setTargetInvoker(invoker);
- Message response = source.getHeadInterceptor().invoke(msg);
- assertEquals("foo", response.getBody());
- assertEquals(1, sourceRequestHandler.getCount());
- assertEquals(1, sourceResponseHandler.getCount());
- assertEquals(1, sourceInterceptor.getCount());
- assertEquals(1, targetRequestHandler.getCount());
- assertEquals(1, targetResponseHandler.getCount());
- assertEquals(1, targetInterceptor.getCount());
- }
-
- public void testInvokeWithRequestHandlers() throws Exception {
- OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
- MockHandler sourceRequestHandler = new MockHandler();
- MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
- source.addRequestHandler(sourceRequestHandler);
- source.addInterceptor(sourceInterceptor);
-
- InboundInvocationChain target = new InboundInvocationChainImpl(operation);
- MockHandler targetRequestHandler = new MockHandler();
- MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
- target.addRequestHandler(targetRequestHandler);
- target.addInterceptor(targetInterceptor);
- target.addInterceptor(new InvokerInterceptor());
-
- // connect the source to the target
- source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
- source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
- source.prepare();
- target.prepare();
- MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
- source.setTargetInvoker(invoker);
-
- Message msg = new MessageImpl();
- msg.setBody("foo");
- msg.setTargetInvoker(invoker);
- Message response = source.getHeadInterceptor().invoke(msg);
- assertEquals("foo", response.getBody());
- assertEquals(1, sourceRequestHandler.getCount());
- assertEquals(1, sourceInterceptor.getCount());
- assertEquals(1, targetRequestHandler.getCount());
- assertEquals(1, targetInterceptor.getCount());
- }
-
- /**
- * Tests basic wiring of a source to a target, including handlers and interceptors
- */
- public void testInvokeWithInterceptorsOnly() throws Exception {
+ public void testInvokeWithInterceptors() throws Exception {
OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
source.addInterceptor(sourceInterceptor);
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java Fri Sep 8 23:55:02 2006
@@ -31,7 +31,6 @@
import org.apache.tuscany.core.component.WorkContextImpl;
import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
-import org.apache.tuscany.core.mock.wire.MockHandler;
import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
import org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler;
@@ -102,7 +101,6 @@
MockStaticInvoker invoker = new MockStaticInvoker(m, new TestBeanImpl());
OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
chain.addInterceptor(new MockSyncInterceptor());
- chain.addRequestHandler(new MockHandler());
chain.setTargetInvoker(invoker);
chain.setTargetInterceptor(new InvokerInterceptor());
chain.prepare();
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java Fri Sep 8 23:55:02 2006
@@ -20,23 +20,22 @@
import java.lang.reflect.Method;
-import org.apache.tuscany.spi.wire.InboundInvocationChain;
-import org.apache.tuscany.spi.wire.OutboundInvocationChain;
-import org.apache.tuscany.spi.wire.OutboundWire;
-import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
import org.apache.tuscany.spi.idl.java.JavaIDLUtils;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
import org.apache.tuscany.core.mock.component.SimpleTarget;
import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
-import org.apache.tuscany.core.mock.wire.MockHandler;
import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
import org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler;
-import org.apache.tuscany.core.component.WorkContextImpl;
-import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
public class OutboundInvocationHandlerTestCase extends TestCase {
@@ -114,25 +113,16 @@
private OutboundInvocationChain createChain(Operation operation) {
OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
- MockHandler sourceRequestHandler = new MockHandler();
- MockHandler sourceResponseHandler = new MockHandler();
MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
- source.addRequestHandler(sourceRequestHandler);
- source.addResponseHandler(sourceResponseHandler);
source.addInterceptor(sourceInterceptor);
InboundInvocationChain target = new InboundInvocationChainImpl(operation);
- MockHandler targetRequestHandler = new MockHandler();
- MockHandler targetResponseHandler = new MockHandler();
MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
- target.addRequestHandler(targetRequestHandler);
- target.addResponseHandler(targetResponseHandler);
target.addInterceptor(targetInterceptor);
target.addInterceptor(new InvokerInterceptor());
// connect the source to the target
- source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
- source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
+ source.setTargetInterceptor(targetInterceptor);
source.prepare();
target.prepare();
Method method = JavaIDLUtils.findMethod(operation, SimpleTarget.class.getMethods());
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java Fri Sep 8 23:55:02 2006
@@ -26,7 +26,6 @@
import org.apache.tuscany.spi.wire.InboundWire;
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.OutboundInvocationChain;
import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
@@ -54,15 +53,6 @@
assertTrue(wire.isOptimizable());
}
- public void testSourceWireHandlerOptimization() throws Exception {
- OutboundWire<?> wire = new OutboundWireImpl();
- OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
- chain.addRequestHandler(new OptimizableHandler());
- chain.addResponseHandler(new OptimizableHandler());
- wire.addInvocationChain(operation, chain);
- assertTrue(wire.isOptimizable());
- }
-
public void testSourceWireNonInterceptorOptimization() throws Exception {
OutboundWire<?> wire = new OutboundWireImpl();
OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
@@ -71,25 +61,6 @@
assertFalse(wire.isOptimizable());
}
- public void testSourceWireNonRequestHandlerOptimization() throws Exception {
- OutboundWire<?> wire = new OutboundWireImpl();
- OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
- chain.addInterceptor(new OptimizableInterceptor());
- chain.addRequestHandler(new NonOptimizableHandler());
- wire.addInvocationChain(operation, chain);
- assertFalse(wire.isOptimizable());
- }
-
- public void testSourceWireNonResponseHandlerOptimization() throws Exception {
- OutboundWire<?> wire = new OutboundWireImpl();
- OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
- chain.addInterceptor(new OptimizableInterceptor());
- chain.addResponseHandler(new NonOptimizableHandler());
- wire.addInvocationChain(operation, chain);
- assertFalse(wire.isOptimizable());
- }
-
-
public void testTargetWireInterceptorOptimization() throws Exception {
InboundWire<?> wire = new InboundWireImpl();
InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
@@ -98,15 +69,6 @@
assertTrue(wire.isOptimizable());
}
- public void testTargetWireHandlerOptimization() throws Exception {
- InboundWire<?> wire = new InboundWireImpl();
- InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
- chain.addRequestHandler(new OptimizableHandler());
- chain.addResponseHandler(new OptimizableHandler());
- wire.addInvocationChain(operation, chain);
- assertTrue(wire.isOptimizable());
- }
-
public void testTargetWireNonInterceptorOptimization() throws Exception {
InboundWire<?> wire = new InboundWireImpl();
InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
@@ -115,24 +77,6 @@
assertFalse(wire.isOptimizable());
}
- public void testTargetWireNonRequestHandlerOptimization() throws Exception {
- InboundWire<?> wire = new InboundWireImpl();
- InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
- chain.addInterceptor(new OptimizableInterceptor());
- chain.addRequestHandler(new NonOptimizableHandler());
- wire.addInvocationChain(operation, chain);
- assertFalse(wire.isOptimizable());
- }
-
- public void testTargetWireNonResponseHandlerOptimization() throws Exception {
- InboundWire<?> wire = new InboundWireImpl();
- InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
- chain.addInterceptor(new OptimizableInterceptor());
- chain.addResponseHandler(new NonOptimizableHandler());
- wire.addInvocationChain(operation, chain);
- assertFalse(wire.isOptimizable());
- }
-
public void testTargetWireNonTargetInvokerOptimization() throws Exception {
InboundWire<?> wire = new InboundWireImpl();
InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
@@ -192,25 +136,4 @@
}
}
- private class OptimizableHandler implements MessageHandler {
-
- public boolean processMessage(Message message) {
- return false;
- }
-
- public boolean isOptimizable() {
- return true;
- }
- }
-
- private class NonOptimizableHandler implements MessageHandler {
-
- public boolean processMessage(Message message) {
- return false;
- }
-
- public boolean isOptimizable() {
- return false;
- }
- }
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java Fri Sep 8 23:55:02 2006
@@ -32,7 +32,6 @@
import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
import org.apache.tuscany.core.mock.component.SimpleTarget;
import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
-import org.apache.tuscany.core.mock.wire.MockHandler;
import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
@@ -48,27 +47,6 @@
private Method echo;
private Operation operation;
-
- public void testHandlersInterceptorInvoke() throws Throwable {
- Map<Method, InboundInvocationChain> chains = new HashMap<Method, InboundInvocationChain>();
- MockStaticInvoker invoker = new MockStaticInvoker(echo, new SimpleTargetImpl());
- InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
- MockSyncInterceptor interceptor = new MockSyncInterceptor();
- chain.addInterceptor(interceptor);
- chain.addInterceptor(new InvokerInterceptor());
- MockHandler requestHandler = new MockHandler();
- chain.addRequestHandler(requestHandler);
- MockHandler responseHandler = new MockHandler();
- chain.addResponseHandler(responseHandler);
- chain.setTargetInvoker(invoker);
- chain.prepare();
- chains.put(echo, chain);
- JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(chains);
- assertEquals("foo", handler.invoke(echo, new String[]{"foo"}));
- assertEquals(1, interceptor.getCount());
- assertEquals(1, requestHandler.getCount());
- assertEquals(1, responseHandler.getCount());
- }
public void testInterceptorInvoke() throws Throwable {
Map<Method, InboundInvocationChain> chains = new HashMap<Method, InboundInvocationChain>();
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java Fri Sep 8 23:55:02 2006
@@ -23,10 +23,8 @@
import org.apache.tuscany.spi.model.Operation;
/**
- * Implementations are responsible for managing the service side of a wire, including the invocation chains associated
- * with each service operation. A <Code>InboundWire</code> can be connected to another <code>InboundWire</code> when
- * connecting a {@link org.apache.tuscany.spi.component.Service} to an
- * {@link org.apache.tuscany.spi.component.AtomicComponent}.
+ * Implementations are responsible for managing the inbound side of a wire, including the invocation chains associated
+ * with each service operation.
*
* @version $$Rev$$ $$Date$$
*/
@@ -43,7 +41,7 @@
void setServiceName(String name);
/**
- * Returns the invocation configuration for each operation on a service specified by a reference or a target
+ * Returns the invocation chain for each operation on a service specified by a reference or a target
* service.
*/
Map<Operation<?>, InboundInvocationChain> getInvocationChains();
@@ -90,19 +88,19 @@
void setTargetWire(OutboundWire<T> wire);
/**
- * Creates an association between a message id and the address of the SCAObject that the corresponding
- * message originates from
+ * Creates an association between a message id and the address of the SCAObject that the corresponding message
+ * originates from
*/
void addMapping(Object messageId, Object fromAddress);
-
+
/**
* Retrieves the SCAObject address that is associated with a message id
*/
Object retrieveMapping(Object messageId);
/**
- * Removes an association between a message id and the address of the SCAObject that the corresponding
- * message originates from
+ * Removes an association between a message id and the address of the SCAObject that the corresponding message
+ * originates from
*/
void removeMapping(Object messageId);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java Fri Sep 8 23:55:02 2006
@@ -18,28 +18,21 @@
*/
package org.apache.tuscany.spi.wire;
-import java.util.List;
-
import org.apache.tuscany.spi.model.Operation;
/**
- * A source- or target-side invocation pipeline for a service operation. Invocation chains are associated with the
- * source or target side of a wire and are bridged when an assembly is processed.
- * <p/>
- * Invocation configurations contain at least one {@link Interceptor} and may have 0 to N {@link MessageHandler}s.
- * <code>Interceptors>/code> process invocations in a synchronous, around style manner while
- * <code>MessageHandler</code>s do so in a one-way manner.
- * <p/>
- * Source-side chains may only connect to target-side chains. Target-side chains may connect to other target-side
- * chains, for example, when invoking from a {@link org.apache.tuscany.spi.component.Service} to an {@link
- * org.apache.tuscany.spi.component.AtomicComponent}.
+ * An inbound or outbound invocation pipeline for a service operation. Wires consist of 1..n invocation chains
+ * associated with the operations of the service contract the wire represents. Invocation chains are associated with the
+ * outbound or inbound side of a wire are bridged or "connected" when an assembly is processed. Outbound chains are only
+ * connected to inbound chains and vice versa.
* <p/>
- * In some scenarios, a service proxy may only contain target-side invocaton chains, for example, when a service is
- * resolved through a locate operation by a non-component client. In this case, there will be no source-side wire chains
- * and the target invoker will be held by the target-side and passed down the pipeline.
+ * Invocation chains contain at least one {@link Interceptor} that process invocations in an around-style manner. In
+ * some scenarios, a service proxy may only contain inbound invocation chains, for example, when a service is resolved
+ * through a locate operation by a non-component client. In this case, there will be no outbound invocation chains and
+ * the target invoker will be held by the target-side and passed down the pipeline.
* <p/>
* A {@link Message} is used to pass data associated with an invocation through the chain. <code>Message</code>s contain
- * a {@link TargetInvoker} responsible for dispatching to a target instance and may be cached on the client-side.
+ * a {@link TargetInvoker} responsible for dispatching to a target instance and may be cached on the source-side.
* Caching allows various optimizations such as avoiding target instance resolution when the client-side lifecycle scope
* is a shorter duration than the target.
*
@@ -52,36 +45,6 @@
Operation getOperation();
/**
- * Adds a request handler to the invocation chain
- */
- void addRequestHandler(MessageHandler handler);
-
- /**
- * Adds a response handler to the invocation chain
- */
- void addResponseHandler(MessageHandler handler);
-
- /**
- * Returns the request handler chain
- */
- List<MessageHandler> getRequestHandlers();
-
- /**
- * Returns the response handler chain
- */
- List<MessageHandler> getResponseHandlers();
-
- /**
- * Returns the request channel for the chain
- */
- MessageChannel getRequestChannel();
-
- /**
- * Returns the response channel for the chain
- */
- MessageChannel getResponseChannel();
-
- /**
* Sets the target invoker to pass down the chain
*/
void setTargetInvoker(TargetInvoker invoker);
@@ -95,6 +58,13 @@
* Adds an interceptor to the chain
*/
void addInterceptor(Interceptor interceptor);
+
+ /**
+ * Adds an interceptor at the given position in the interceptor stack
+ *
+ * @param index the position in the interceptor stack to add the interceptor
+ * @param interceptor the interceptor to add
+ */
void addInterceptor(int index, Interceptor interceptor);
/**
@@ -116,26 +86,6 @@
* Returns the head interceptor of the birdged target-side chain
*/
Interceptor getTargetInterceptor();
-
- /**
- * Sets the target-side request channel when two chains are bidged
- */
- void setTargetRequestChannel(MessageChannel channel);
-
- /**
- * Sets the target-side response channel when two chains are bridged
- */
- void setTargetResponseChannel(MessageChannel channel);
-
- /**
- * Returns the target-side request channel when two chains are bridged
- */
- MessageChannel getTargetRequestChannel();
-
- /**
- * Returns the target-side response channel when two chains are bridged
- */
- MessageChannel getTargetResponseChannel();
/**
* Signals to the chain that its configuration is complete. Implementations may use this callback to prepare their
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java Fri Sep 8 23:55:02 2006
@@ -46,40 +46,30 @@
TargetInvoker getTargetInvoker();
/**
- * Returns the callback channel
- */
- MessageChannel getCallbackChannel();
-
- /**
- *
- */
- Message getRelatedCallbackMessage();
-
- /**
* Returns the 'address' of the SCAObject where this message originates
*/
Object getFromAddress();
-
+
/**
* Sets the 'address' of the SCAObject where this message originates
*/
void setFromAddress(Object fromAddress);
-
+
/**
* Returns the id of the message
*/
Object getMessageId();
-
+
/**
* Sets the id of the message
*/
void setMessageId(Object messageId);
-
+
/**
* Returns the correlation id of the message
*/
Object getCorrelationId();
-
+
/**
* Sets the correlation id of the message
*/
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java Fri Sep 8 23:55:02 2006
@@ -23,10 +23,9 @@
*
* @version $Rev $Date
*/
-public class MessageImpl implements Message, MessageChannel {
+public class MessageImpl implements Message {
private Object body;
- private Message relatedCallbackMessage;
private TargetInvoker invoker;
private Object fromAddress;
private Object messageId;
@@ -43,18 +42,6 @@
this.body = body;
}
- public MessageChannel getCallbackChannel() {
- return this;
- }
-
- public void send(Message message) {
- relatedCallbackMessage = message;
- }
-
- public Message getRelatedCallbackMessage() {
- return relatedCallbackMessage;
- }
-
public void setTargetInvoker(TargetInvoker invoker) {
this.invoker = invoker;
}
@@ -62,27 +49,27 @@
public TargetInvoker getTargetInvoker() {
return invoker;
}
-
+
public Object getFromAddress() {
return fromAddress;
}
-
+
public void setFromAddress(Object fromAddress) {
this.fromAddress = fromAddress;
}
-
+
public Object getMessageId() {
return messageId;
}
-
+
public void setMessageId(Object messageId) {
this.messageId = messageId;
}
-
+
public Object getCorrelationId() {
return correlationId;
}
-
+
public void setCorrelationId(Object correlationId) {
this.correlationId = correlationId;
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.java Fri Sep 8 23:55:02 2006
@@ -19,10 +19,7 @@
package org.apache.tuscany.spi.wire;
/**
- * A set of interceptors and handlers (contained in request and response message channels) associated with the outbound
- * side of a wire for a service operation. Outbound invocation chains always start with an {@link Interceptor} and may
- * contain 0..n {@link MessageHandler}s. <code>MessageHandlers</code> are part of a request or response chainnel, which
- * are invoked prior to and after dispatching to a target instance respectively.
+ * Responsible for flowing a request to a target service and invoking an operation.
*
* @version $$Rev$$ $$Date$$
*/
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java Fri Sep 8 23:55:02 2006
@@ -25,7 +25,7 @@
/**
* Implementations are responsible for managing the reference side of a wire, including the invocation chains associated
- * with each service operation. A <code>OutboundWire</code> is connected to a {@link InboundWire} through their
+ * with each service operation. An <code>OutboundWire</code> is connected to an {@link InboundWire} through their
* invocation chains.
*
* @version $$Rev$$ $$Date$$
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java?view=diff&rev=441749&r1=441748&r2=441749
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java Fri Sep 8 23:55:02 2006
@@ -158,7 +158,7 @@
*
* @param source The source service contract
* @param target The target service contract
- * @return
+ * @return true if the contracts are wireable
*/
boolean isWireable(ServiceContract<?> source, ServiceContract<?> target);
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org