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/02/13 07:46:12 UTC
svn commit: r377314 - in /incubator/tuscany/java/sca:
container.java/src/main/java/org/apache/tuscany/container/java/builder/
container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/
core/src/main/java/org/apache/tuscany/core/bui...
Author: jmarino
Date: Sun Feb 12 22:46:10 2006
New Revision: 377314
URL: http://svn.apache.org/viewcvs?rev=377314&view=rev
Log:
unit tests for invocation framework
Added:
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationErrorTestCase.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationTestCase.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockHandler.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockJavaOperationType.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockScopeContext.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockSyncInterceptor.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSource.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSourceImpl.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTarget.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTargetImpl.java
Modified:
incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationConfiguration.java
Modified: incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java?rev=377314&r1=377313&r2=377314&view=diff
==============================================================================
--- incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java (original)
+++ incubator/tuscany/java/sca/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java Sun Feb 12 22:46:10 2006
@@ -34,25 +34,23 @@
public JavaTargetWireBuilder() {
}
- public void wire(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope, ScopeContext targetScopeContext)
- throws BuilderConfigException {
+ public void wire(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope,
+ ScopeContext targetScopeContext) throws BuilderConfigException {
if (!(JavaComponentRuntimeConfiguration.class.isAssignableFrom(targetType))) {
return;
}
-// for (ProxyFactory sourceFactory : ((Map<String, ProxyFactory>) source.getSourceProxyFactories()).values()) {
- for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration()
- .getInvocationConfigurations().values()) {
- ScopedJavaComponentInvoker invoker = new ScopedJavaComponentInvoker(sourceFactory.getProxyConfiguration()
- .getTargetName(), ((JavaOperationType) sourceInvocationConfig.getOperationType()).getJavaMethod(),
- targetScopeContext);
- if (downScope) {
- invoker.setCacheable(true);
- } else {
- invoker.setCacheable(false);
- }
- sourceInvocationConfig.setTargetInvoker(invoker);
+ for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations()
+ .values()) {
+ ScopedJavaComponentInvoker invoker = new ScopedJavaComponentInvoker(sourceFactory.getProxyConfiguration()
+ .getTargetName(), ((JavaOperationType) sourceInvocationConfig.getOperationType()).getJavaMethod(),
+ targetScopeContext);
+ if (downScope) {
+ // the source scope is shorter than the target, so the invoker can cache the target instance
+ invoker.setCacheable(true);
+ } else {
+ invoker.setCacheable(false);
}
-// }
-
+ sourceInvocationConfig.setTargetInvoker(invoker);
+ }
}
}
Modified: incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java?rev=377314&r1=377313&r2=377314&view=diff
==============================================================================
--- incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java (original)
+++ incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java Sun Feb 12 22:46:10 2006
@@ -11,8 +11,15 @@
*/
public class MockHandler implements MessageHandler {
+ private int count =0;
+
public boolean processMessage(Message message) {
//System.out.println("Invoking handler");
+ count++;
return true;
+ }
+
+ public int getCount(){
+ return count;
}
}
Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java?rev=377314&r1=377313&r2=377314&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java Sun Feb 12 22:46:10 2006
@@ -1,10 +1,42 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
package org.apache.tuscany.core.builder;
import org.apache.tuscany.core.context.ScopeContext;
import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+/**
+ * Responsible for creating a wire between a reference on a source component to a target service. Wires consist of a set
+ * of source invocation configurations held by a proxy factory conntected to corresponding target invocation
+ * configurations held by a proxy factory. Wire builders may optimize the invocation chains based on certain characteristics of th wire, such as
+ * source and target scopes.
+ *
+ * @version $Rev$ $Date$
+ */
public interface WireBuilder {
+ /**
+ * Connects invocation configurations of the source proxy factory to corresponding ones in the target proxy to
+ * factory to form a wire
+ *
+ * @param sourceFactory the source proxy factory
+ * @param targetFactory
+ * @param targetType
+ * @param downScope
+ * @param targetScopeContext
+ * @throws BuilderConfigException
+ */
public void wire(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope,
ScopeContext targetScopeContext) throws BuilderConfigException;
Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationConfiguration.java?rev=377314&r1=377313&r2=377314&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationConfiguration.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationConfiguration.java Sun Feb 12 22:46:10 2006
@@ -126,29 +126,10 @@
return responseHandlers;
}
-// public MessageHandler getHeadHandler() {
-// if (responseHandlers != null && responseHandlers.size() > 0) {
-// return responseHandlers.get(0);
-// } else {
-// return null;
-// }
-// }
-
/**
* Build the configuration, link the interceptors and handlers together
*/
public void build() {
-
- // Build target interceptor chain
- // FIXME Break
- // if (targetInvoker != null) {
- // if (targetInterceptorChainHead != null) {
- // targetInterceptorChainTail.setNext(targetInvoker);
- // } else {
- // targetInterceptorChainHead = targetInvoker;
- // }
- // }
- // FIXME Break
// Connect request handler chain to target interceptor chain
if (requestHandlers != null && targetInterceptorChainHead != null) {
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationErrorTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationErrorTestCase.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationErrorTestCase.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationErrorTestCase.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,162 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.tuscany.core.invocation;
+
+import java.lang.reflect.Method;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.invocation.impl.InvokerInterceptor;
+import org.apache.tuscany.core.invocation.mock.MockHandler;
+import org.apache.tuscany.core.invocation.mock.MockJavaOperationType;
+import org.apache.tuscany.core.invocation.mock.MockStaticInvoker;
+import org.apache.tuscany.core.invocation.mock.MockSyncInterceptor;
+import org.apache.tuscany.core.invocation.mock.SimpleTarget;
+import org.apache.tuscany.core.invocation.mock.SimpleTargetImpl;
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.message.channel.impl.MessageChannelImpl;
+import org.apache.tuscany.core.message.impl.PojoMessageImpl;
+import org.apache.tuscany.model.types.OperationType;
+
+/**
+ * Tests error propagation through an innvocation
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvocationConfigurationErrorTestCase extends TestCase {
+
+
+ private Method hello;
+ private Method goodbye;
+
+ public InvocationConfigurationErrorTestCase() {
+ super();
+ }
+
+ public InvocationConfigurationErrorTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ hello = SimpleTarget.class.getMethod("hello", new Class[]{String.class});
+ goodbye = SimpleTarget.class.getMethod("goodbye", new Class[]{String.class});
+ }
+
+ public void testInvokeWithHandlers() throws Exception{
+ OperationType operation = new MockJavaOperationType(hello);
+ InvocationConfiguration source = new InvocationConfiguration(operation);
+ MockHandler sourceRequestHandler = new MockHandler();
+ MockHandler sourceResponseHandler = new MockHandler();
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addRequestHandler(sourceRequestHandler);
+ source.addResponseHandler(sourceResponseHandler);
+ source.addSourceInterceptor(sourceInterceptor);
+
+ InvocationConfiguration target = new InvocationConfiguration(operation);
+ MockHandler targetRequestHandler = new MockHandler();
+ MockHandler targetResponseHandler = new MockHandler();
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addRequestHandler(targetRequestHandler);
+ target.addResponseHandler(targetResponseHandler);
+ target.addTargetInterceptor(targetInterceptor);
+ target.addTargetInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.addTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
+ source.addTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
+ source.build();
+ target.build();
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Message msg = new PojoMessageImpl();
+ msg.setTargetInvoker(invoker);
+ Message response = (Message) source.getSourceInterceptor().invoke(msg);
+ Assert.assertTrue(response.getPayload() instanceof IllegalArgumentException);
+ Assert.assertEquals(1,sourceRequestHandler.getCount());
+ Assert.assertEquals(1,sourceResponseHandler.getCount());
+ Assert.assertEquals(1,sourceInterceptor.getCount());
+ Assert.assertEquals(1,targetRequestHandler.getCount());
+ Assert.assertEquals(1,targetResponseHandler.getCount());
+ Assert.assertEquals(1,targetInterceptor.getCount());
+ }
+
+ public void testInvokeWithRequestHandlers() throws Exception{
+ OperationType operation = new MockJavaOperationType(hello);
+ InvocationConfiguration source = new InvocationConfiguration(operation);
+ MockHandler sourceRequestHandler = new MockHandler();
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addRequestHandler(sourceRequestHandler);
+ source.addSourceInterceptor(sourceInterceptor);
+
+ InvocationConfiguration target = new InvocationConfiguration(operation);
+ MockHandler targetRequestHandler = new MockHandler();
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addRequestHandler(targetRequestHandler);
+ target.addTargetInterceptor(targetInterceptor);
+ target.addTargetInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.addTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
+ source.addTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
+ source.build();
+ target.build();
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Message msg = new PojoMessageImpl();
+ msg.setTargetInvoker(invoker);
+ Message response = (Message) source.getSourceInterceptor().invoke(msg);
+ Assert.assertTrue(response.getPayload() instanceof IllegalArgumentException);
+ Assert.assertEquals(1,sourceRequestHandler.getCount());
+ Assert.assertEquals(1,sourceInterceptor.getCount());
+ Assert.assertEquals(1,targetRequestHandler.getCount());
+ Assert.assertEquals(1,targetInterceptor.getCount());
+ }
+
+ /**
+ * Tests basic wiring of a source to a target, including handlers and interceptors
+ */
+ public void testInvokeWithInterceptorsOnly() throws Exception{
+ OperationType operation = new MockJavaOperationType(hello);
+ InvocationConfiguration source = new InvocationConfiguration(operation);
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addSourceInterceptor(sourceInterceptor);
+
+ InvocationConfiguration target = new InvocationConfiguration(operation);
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addTargetInterceptor(targetInterceptor);
+ target.addTargetInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.addTargetInterceptor(target.getTargetInterceptor());
+ source.build();
+ target.build();
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Message msg = new PojoMessageImpl();
+ msg.setTargetInvoker(invoker);
+ Message response = (Message) source.getSourceInterceptor().invoke(msg);
+ Assert.assertTrue(response.getPayload() instanceof IllegalArgumentException);
+ Assert.assertEquals(1,sourceInterceptor.getCount());
+ Assert.assertEquals(1,targetInterceptor.getCount());
+
+ }
+
+
+
+}
+
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationTestCase.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationTestCase.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/InvocationConfigurationTestCase.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,163 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.tuscany.core.invocation;
+
+import java.lang.reflect.Method;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.invocation.impl.InvokerInterceptor;
+import org.apache.tuscany.core.invocation.mock.MockHandler;
+import org.apache.tuscany.core.invocation.mock.MockJavaOperationType;
+import org.apache.tuscany.core.invocation.mock.MockStaticInvoker;
+import org.apache.tuscany.core.invocation.mock.MockSyncInterceptor;
+import org.apache.tuscany.core.invocation.mock.SimpleTarget;
+import org.apache.tuscany.core.invocation.mock.SimpleTargetImpl;
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.message.channel.impl.MessageChannelImpl;
+import org.apache.tuscany.core.message.impl.PojoMessageImpl;
+import org.apache.tuscany.model.types.OperationType;
+
+public class InvocationConfigurationTestCase extends TestCase {
+
+
+ private Method hello;
+ private Method goodbye;
+
+ public InvocationConfigurationTestCase() {
+ super();
+ }
+
+ public InvocationConfigurationTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ hello = SimpleTarget.class.getMethod("hello", new Class[]{String.class});
+ goodbye = SimpleTarget.class.getMethod("goodbye", new Class[]{String.class});
+ }
+
+ /**
+ * Tests basic wiring of a source to a target, including handlers and interceptors
+ */
+ public void testInvokeWithHandlers() throws Exception{
+ OperationType operation = new MockJavaOperationType(hello);
+ InvocationConfiguration source = new InvocationConfiguration(operation);
+ MockHandler sourceRequestHandler = new MockHandler();
+ MockHandler sourceResponseHandler = new MockHandler();
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addRequestHandler(sourceRequestHandler);
+ source.addResponseHandler(sourceResponseHandler);
+ source.addSourceInterceptor(sourceInterceptor);
+
+ InvocationConfiguration target = new InvocationConfiguration(operation);
+ MockHandler targetRequestHandler = new MockHandler();
+ MockHandler targetResponseHandler = new MockHandler();
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addRequestHandler(targetRequestHandler);
+ target.addResponseHandler(targetResponseHandler);
+ target.addTargetInterceptor(targetInterceptor);
+ target.addTargetInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.addTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
+ source.addTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
+ source.build();
+ target.build();
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Message msg = new PojoMessageImpl();
+ msg.setPayload("foo");
+ msg.setTargetInvoker(invoker);
+ Message response = (Message) source.getSourceInterceptor().invoke(msg);
+ Assert.assertEquals("foo",response.getPayload());
+ Assert.assertEquals(1,sourceRequestHandler.getCount());
+ Assert.assertEquals(1,sourceResponseHandler.getCount());
+ Assert.assertEquals(1,sourceInterceptor.getCount());
+ Assert.assertEquals(1,targetRequestHandler.getCount());
+ Assert.assertEquals(1,targetResponseHandler.getCount());
+ Assert.assertEquals(1,targetInterceptor.getCount());
+ }
+
+ public void testInvokeWithRequestHandlers() throws Exception{
+ OperationType operation = new MockJavaOperationType(hello);
+ InvocationConfiguration source = new InvocationConfiguration(operation);
+ MockHandler sourceRequestHandler = new MockHandler();
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addRequestHandler(sourceRequestHandler);
+ source.addSourceInterceptor(sourceInterceptor);
+
+ InvocationConfiguration target = new InvocationConfiguration(operation);
+ MockHandler targetRequestHandler = new MockHandler();
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addRequestHandler(targetRequestHandler);
+ target.addTargetInterceptor(targetInterceptor);
+ target.addTargetInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.addTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
+ source.addTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
+ source.build();
+ target.build();
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Message msg = new PojoMessageImpl();
+ msg.setPayload("foo");
+ msg.setTargetInvoker(invoker);
+ Message response = (Message) source.getSourceInterceptor().invoke(msg);
+ Assert.assertEquals("foo",response.getPayload());
+ Assert.assertEquals(1,sourceRequestHandler.getCount());
+ Assert.assertEquals(1,sourceInterceptor.getCount());
+ Assert.assertEquals(1,targetRequestHandler.getCount());
+ Assert.assertEquals(1,targetInterceptor.getCount());
+ }
+
+ /**
+ * Tests basic wiring of a source to a target, including handlers and interceptors
+ */
+ public void testInvokeWithInterceptorsOnly() throws Exception{
+ OperationType operation = new MockJavaOperationType(hello);
+ InvocationConfiguration source = new InvocationConfiguration(operation);
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addSourceInterceptor(sourceInterceptor);
+
+ InvocationConfiguration target = new InvocationConfiguration(operation);
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addTargetInterceptor(targetInterceptor);
+ target.addTargetInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.addTargetInterceptor(target.getTargetInterceptor());
+ source.build();
+ target.build();
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Message msg = new PojoMessageImpl();
+ msg.setPayload("foo");
+ msg.setTargetInvoker(invoker);
+ Message response = (Message) source.getSourceInterceptor().invoke(msg);
+ Assert.assertEquals("foo",response.getPayload());
+ Assert.assertEquals(1,sourceInterceptor.getCount());
+ Assert.assertEquals(1,targetInterceptor.getCount());
+
+ }
+
+
+
+}
+
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandlerTestCase.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,117 @@
+package org.apache.tuscany.core.invocation.jdk;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.impl.InvokerInterceptor;
+import org.apache.tuscany.core.invocation.mock.MockHandler;
+import org.apache.tuscany.core.invocation.mock.MockJavaOperationType;
+import org.apache.tuscany.core.invocation.mock.MockStaticInvoker;
+import org.apache.tuscany.core.invocation.mock.MockSyncInterceptor;
+import org.apache.tuscany.core.invocation.mock.SimpleTarget;
+import org.apache.tuscany.core.invocation.mock.SimpleTargetImpl;
+import org.apache.tuscany.core.message.channel.impl.MessageChannelImpl;
+import org.apache.tuscany.core.message.impl.PojoMessageFactory;
+import org.apache.tuscany.model.types.OperationType;
+
+public class JDKInvocationHandlerTestCase extends TestCase {
+
+ private Method hello;
+
+ private Method goodbye;
+
+ public JDKInvocationHandlerTestCase() {
+ super();
+ }
+
+ public JDKInvocationHandlerTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ hello = SimpleTarget.class.getMethod("hello", new Class[] { String.class });
+ goodbye = SimpleTarget.class.getMethod("goodbye", new Class[] { String.class });
+ }
+
+ public void testBasicInvoke() throws Throwable {
+ Map<Method, InvocationConfiguration> configs = new HashMap();
+ configs.put(hello, getInvocationHandler(hello));
+ JDKInvocationHandler handler = new JDKInvocationHandler(new PojoMessageFactory(), configs);
+ Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] { "foo" }));
+ }
+
+ public void testErrorInvoke() throws Throwable {
+ Map<Method, InvocationConfiguration> configs = new HashMap();
+ configs.put(hello, getInvocationHandler(hello));
+ JDKInvocationHandler handler = new JDKInvocationHandler(new PojoMessageFactory(), configs);
+ try {
+ Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] {}));
+ fail("Expected " + IllegalArgumentException.class.getName());
+ } catch (IllegalArgumentException e) {
+ // should throw
+ }
+ }
+
+ public void testDirectErrorInvoke() throws Throwable {
+ OperationType operation = new MockJavaOperationType(hello);
+ InvocationConfiguration source = new InvocationConfiguration(operation);
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Map<Method, InvocationConfiguration> configs = new HashMap();
+ configs.put(hello, source);
+ JDKInvocationHandler handler = new JDKInvocationHandler(new PojoMessageFactory(), configs);
+ try {
+ Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] {}));
+ fail("Expected " + IllegalArgumentException.class.getName());
+ } catch (IllegalArgumentException e) {
+ // should throw
+ }
+ }
+
+ public void testDirectInvoke() throws Throwable {
+ OperationType operation = new MockJavaOperationType(hello);
+ InvocationConfiguration source = new InvocationConfiguration(operation);
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Map<Method, InvocationConfiguration> configs = new HashMap();
+ configs.put(hello, source);
+ JDKInvocationHandler handler = new JDKInvocationHandler(new PojoMessageFactory(), configs);
+ Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] { "foo" }));
+ }
+
+ private InvocationConfiguration getInvocationHandler(Method m) {
+ OperationType operation = new MockJavaOperationType(m);
+ InvocationConfiguration source = new InvocationConfiguration(operation);
+ MockHandler sourceRequestHandler = new MockHandler();
+ MockHandler sourceResponseHandler = new MockHandler();
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addRequestHandler(sourceRequestHandler);
+ source.addResponseHandler(sourceResponseHandler);
+ source.addSourceInterceptor(sourceInterceptor);
+
+ InvocationConfiguration target = new InvocationConfiguration(operation);
+ MockHandler targetRequestHandler = new MockHandler();
+ MockHandler targetResponseHandler = new MockHandler();
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addRequestHandler(targetRequestHandler);
+ target.addResponseHandler(targetResponseHandler);
+ target.addTargetInterceptor(targetInterceptor);
+ target.addTargetInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.addTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers()));
+ source.addTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers()));
+ source.build();
+ target.build();
+ MockStaticInvoker invoker = new MockStaticInvoker(m, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+ return source;
+ }
+}
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockHandler.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockHandler.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockHandler.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockHandler.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,25 @@
+/**
+ *
+ */
+package org.apache.tuscany.core.invocation.mock;
+
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.message.handler.MessageHandler;
+
+/**
+ *
+ */
+public class MockHandler implements MessageHandler {
+
+ private int count =0;
+
+ public boolean processMessage(Message message) {
+ //System.out.println("Invoking handler");
+ count++;
+ return true;
+ }
+
+ public int getCount(){
+ return count;
+ }
+}
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockJavaOperationType.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockJavaOperationType.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockJavaOperationType.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockJavaOperationType.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,71 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.core.invocation.mock;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import commonj.sdo.Type;
+
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.types.java.JavaOperationType;
+
+public class MockJavaOperationType implements JavaOperationType {
+
+ private Method method;
+
+ public MockJavaOperationType(Method m) {
+ method = m;
+ }
+
+ public Method getJavaMethod() {
+ return method;
+ }
+
+ public String getName() {
+ return method.getName();
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Type getInputType() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Type getOutputType() {
+ throw new UnsupportedOperationException();
+ }
+
+ public List<Type> getExceptionTypes() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void initialize(AssemblyModelContext modelContext) {
+ }
+
+ public void freeze() {
+ }
+
+ public boolean accept(AssemblyModelVisitor visitor) {
+ throw new UnsupportedOperationException();
+ }
+
+}
+
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockScopeContext.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockScopeContext.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockScopeContext.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockScopeContext.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,126 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.core.invocation.mock;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.core.builder.RuntimeConfiguration;
+import org.apache.tuscany.core.context.InstanceContext;
+import org.apache.tuscany.core.context.EventException;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.context.LifecycleEventListener;
+import org.apache.tuscany.core.context.ScopeContext;
+import org.apache.tuscany.core.context.ScopeRuntimeException;
+import org.apache.tuscany.core.context.SimpleComponentContext;
+import org.apache.tuscany.core.context.TargetException;
+import org.apache.tuscany.model.assembly.SimpleComponent;
+
+public class MockScopeContext implements ScopeContext {
+
+ Map<String, Object> components;
+
+ public MockScopeContext() {
+ components = new HashMap();
+ components.put("foo", new SimpleTargetImpl());
+ components.put("bar", new SimpleTargetImpl());
+ }
+
+ public MockScopeContext(Map<String,Object> instances) {
+ components = instances;
+ }
+
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+ public String getName() {
+ return "Mock Scope Container";
+ }
+
+ public boolean isCacheable() {
+ return false;
+ }
+
+ public int[] getEventTypes() {
+ return null;
+ }
+
+ public SimpleComponentContext getContext(String name) {
+ return null;
+ }
+
+ public Object getInstance(QualifiedName name) throws ScopeRuntimeException {
+ return components.get(name.getPartName());
+ }
+
+ public Object getInstance(QualifiedName componentName, boolean notify) throws TargetException {
+ return getInstance(componentName);
+ }
+
+ public SimpleComponentContext getContextByKey(String name, Object key) {
+ return null;
+ }
+
+ public void setComponent(SimpleComponent component) throws ScopeRuntimeException {
+ }
+
+ public void removeContext(String name) throws ScopeRuntimeException {
+ }
+
+ public void removeContextByKey(String name, Object key) throws ScopeRuntimeException {
+ }
+
+ public SimpleComponent[] getComponents() {
+ return null;
+ }
+
+ public void onEvent(int type, Object message) throws EventException {
+ }
+
+
+ public void registerConfigurations(List<RuntimeConfiguration<InstanceContext>> configurations) {
+ }
+
+ public void registerConfiguration(RuntimeConfiguration<InstanceContext> configuration) {
+ }
+
+ public int getLifecycleState(){
+ return RUNNING;
+ }
+
+
+ public void setLifecycleState(int state) {
+ }
+
+
+ public void setName(String name) {
+ }
+
+
+ public void addContextListener(LifecycleEventListener listener) {
+ }
+
+
+ public void removeContextListener(LifecycleEventListener listener) {
+ }
+}
+
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,60 @@
+package org.apache.tuscany.core.invocation.mock;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.core.invocation.Interceptor;
+import org.apache.tuscany.core.invocation.InvocationRuntimeException;
+import org.apache.tuscany.core.invocation.TargetInvoker;
+import org.apache.tuscany.core.message.Message;
+
+/**
+ * Caches component instances that do not need to be resolved for every invocation, e.g. an invocation originating from
+ * a lesser scope intended for a target with a wider scope
+ *
+ * @version $Rev: 377006 $ $Date: 2006-02-11 09:41:59 -0800 (Sat, 11 Feb 2006) $
+ */
+public class MockStaticInvoker implements TargetInvoker {
+
+ private Object instance;
+
+ private Method operation;
+
+ public MockStaticInvoker(Method operation, Object instance) {
+ this.operation = operation;
+ this.instance = instance;
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+ public Object invokeTarget(Object payload) throws InvocationTargetException {
+ try {
+ if (payload != null && !payload.getClass().isArray()) {
+ return operation.invoke(instance, payload);
+ } else {
+ return operation.invoke(instance, (Object[]) payload);
+ }
+ } catch (IllegalAccessException e) {
+ throw new InvocationRuntimeException(e);
+ }
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = invokeTarget(msg.getPayload());
+ msg.setPayload(resp);
+ } catch (InvocationTargetException e) {
+ msg.setPayload(e.getCause());
+ } catch (Throwable e) {
+ msg.setPayload(e);
+ }
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+ throw new IllegalStateException("This interceptor must be the last interceptor in an interceptor chain");
+ }
+
+}
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockSyncInterceptor.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockSyncInterceptor.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockSyncInterceptor.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockSyncInterceptor.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.core.invocation.mock;
+
+import org.apache.tuscany.core.invocation.Interceptor;
+import org.apache.tuscany.core.message.Message;
+
+public class MockSyncInterceptor implements Interceptor {
+
+ private int count;
+
+ private Interceptor next;
+
+ public MockSyncInterceptor() {
+ }
+
+ public Message invoke(Message msg) {
+ ++count;
+ //System.out.println("Invoking interceptor");
+ return next.invoke(msg);
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setNext(Interceptor next) {
+ this.next=next;
+ }
+}
+
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSource.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSource.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSource.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSource.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,25 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.core.invocation.mock;
+
+public interface SimpleSource {
+
+ public void invokeHello() throws Exception;
+
+ public void invokeGoodbye() throws Exception;
+}
+
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSourceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSourceImpl.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSourceImpl.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSourceImpl.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.core.invocation.mock;
+
+public class SimpleSourceImpl implements SimpleSource {
+
+ private SimpleTarget proxy;
+
+ public SimpleSourceImpl(SimpleTarget proxy) {
+ this.proxy = proxy;
+ }
+
+ public void invokeHello() throws Exception {
+ proxy.hello("hello");
+ }
+
+ public void invokeGoodbye() throws Exception {
+ proxy.goodbye("hello");
+ }
+
+}
+
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTarget.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTarget.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTarget.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTarget.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.core.invocation.mock;
+
+public interface SimpleTarget {
+
+ public String hello(String message) throws Exception;
+
+ public String goodbye(String message) throws Exception;
+
+ public String echo(String message) throws Exception;
+
+}
+
Added: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTargetImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTargetImpl.java?rev=377314&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTargetImpl.java (added)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTargetImpl.java Sun Feb 12 22:46:10 2006
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.core.invocation.mock;
+
+public class SimpleTargetImpl implements SimpleTarget {
+
+ public SimpleTargetImpl() {
+ super();
+ }
+
+ public String hello(String message) throws Exception {
+ return message;
+ }
+
+ public String goodbye(String message) throws Exception {
+ return message;
+ }
+
+ public String echo(String message) throws Exception {
+ return message;
+ }
+
+
+}
+