summaryrefslogtreecommitdiffstats
path: root/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation')
-rw-r--r--tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java53
-rw-r--r--tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java53
-rw-r--r--tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java154
-rw-r--r--tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java38
-rw-r--r--tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java45
-rw-r--r--tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java25
-rw-r--r--tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java36
-rw-r--r--tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java28
-rw-r--r--tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java39
9 files changed, 0 insertions, 471 deletions
diff --git a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java b/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java
deleted file mode 100644
index e560af6fd3..0000000000
--- a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *
- * 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.container.java.invocation;
-
-import java.lang.reflect.Method;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.container.java.invocation.mock.SimpleTargetImpl;
-import org.apache.tuscany.core.message.Message;
-import org.apache.tuscany.core.message.MessageFactory;
-import org.apache.tuscany.core.message.impl.MessageFactoryImpl;
-
-/**
- * Tests invoking on a different interface from the one actually implemented by the target
- *
- * @version $Rev$ $Date$
- */
-public class MediationTestCase extends TestCase {
-
- private Method hello;
-
- private MessageFactory msgFactory = new MessageFactoryImpl();
-
- public void setUp() throws Exception {
- hello = Hello.class.getMethod("hello", String.class);
- }
-
- public void testMediation() throws Exception {
- StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(hello, new SimpleTargetImpl());
- Message msg = msgFactory.createMessage();
- msg.setBody("foo");
- Assert.assertEquals("foo", invoker.invoke(msg).getBody());
- }
-
- public interface Hello {
-
- public String hello(String message) throws Exception;
-
- }
-}
diff --git a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java b/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java
deleted file mode 100644
index f4337fe3cb..0000000000
--- a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *
- * 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.container.java.invocation;
-
-import java.lang.reflect.Method;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.container.java.invocation.mock.SimpleTarget;
-import org.apache.tuscany.container.java.mock.MockScopeContext;
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.context.ScopeContext;
-
-public class ScopedPojoInvokerTestCase extends TestCase {
-
- private Method echoMethod;
-
- public ScopedPojoInvokerTestCase() {
- super();
- }
-
- public ScopedPojoInvokerTestCase(String arg0) {
- super(arg0);
- }
-
- public void setUp() throws Exception {
- echoMethod = SimpleTarget.class.getDeclaredMethod("echo", String.class);
- Assert.assertNotNull(echoMethod);
- }
-
- public void testScopedInvoke() throws Exception {
- ScopeContext container = new MockScopeContext();
- ScopedJavaComponentInvoker invoker = new ScopedJavaComponentInvoker(new QualifiedName("foo"), echoMethod, container,false);
- Object ret = invoker.invokeTarget("foo");
- Assert.assertEquals("foo", ret);
- }
-
-}
diff --git a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java b/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java
deleted file mode 100644
index 31e7e3c64e..0000000000
--- a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- *
- * 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.container.java.invocation;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import static java.lang.Integer.*;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-public class StaticPojoInvokerTestCase extends TestCase {
-
- private Method echoMethod;
- private Method arrayMethod;
- private Method nullParamMethod;
- private Method primitiveMethod;
- private Method checkedMethod;
- private Method runtimeMethod;
-
- public StaticPojoInvokerTestCase() {
-
- }
-
- public StaticPojoInvokerTestCase(String arg0) {
- super(arg0);
- }
-
- public void setUp() throws Exception {
- echoMethod = TestBean.class.getDeclaredMethod("echo", String.class);
- arrayMethod = TestBean.class.getDeclaredMethod("arrayEcho", String[].class);
- nullParamMethod = TestBean.class.getDeclaredMethod("nullParam", (Class[]) null);
- primitiveMethod = TestBean.class.getDeclaredMethod("primitiveEcho", TYPE);
- checkedMethod = TestBean.class.getDeclaredMethod("checkedException", (Class[]) null);
- runtimeMethod = TestBean.class.getDeclaredMethod("runtimeException", (Class[]) null);
- Assert.assertNotNull(echoMethod);
- Assert.assertNotNull(checkedMethod);
- Assert.assertNotNull(runtimeMethod);
- }
-
- public void testObjectInvoke() throws Throwable {
- TestBean bean = new TestBean();
- StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(echoMethod, bean);
- Object ret = invoker.invokeTarget("foo");
- Assert.assertEquals("foo", ret);
- }
-
- public void testArrayInvoke() throws Throwable {
- TestBean bean = new TestBean();
- StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(arrayMethod, bean);
- String[] args = new String[]{"foo", "bar"};
- Object ret = invoker.invokeTarget(new Object[]{args});
- String[] retA = (String[]) ret;
- Assert.assertNotNull(retA);
- Assert.assertEquals(2, retA.length);
- Assert.assertEquals("foo", retA[0]);
- Assert.assertEquals("bar", retA[1]);
- }
-
- public void testNullInvoke() throws Throwable {
- TestBean bean = new TestBean();
- StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(nullParamMethod, bean);
- Object ret = invoker.invokeTarget(null);
- String retS = (String) ret;
- Assert.assertEquals("foo", retS);
- }
-
- public void testPrimitiveInvoke() throws Throwable {
- TestBean bean = new TestBean();
- StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(primitiveMethod, bean);
- Object ret = invoker.invokeTarget(new Integer[]{1});
- Integer retI = (Integer) ret;
- Assert.assertEquals(1, retI.intValue());
- }
-
- public void testInvokeCheckedException() throws Throwable {
- TestBean bean = new TestBean();
- StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(checkedMethod, bean);
- try {
- invoker.invokeTarget(null);
- } catch (InvocationTargetException e) {
- if (e.getCause() != null && TestException.class.equals(e.getCause().getClass())) {
- return;
- }
- } catch (Throwable e) {
- }
- fail(TestException.class.getName() + " should have been thrown");
- }
-
- public void testInvokeRuntimeException() throws Throwable {
- TestBean bean = new TestBean();
- StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(runtimeMethod, bean);
- try {
- invoker.invokeTarget(null);
- } catch (InvocationTargetException e) {
- if (e.getCause() != null && e.getCause() instanceof TestRuntimeException) {
- return;
- }
- }
- fail(TestException.class.getName() + " should have been thrown");
- }
-
- private class TestBean {
-
- public String echo(String msg) throws Exception {
- Assert.assertEquals("foo", msg);
- return msg;
- }
-
- public String[] arrayEcho(String[] msg) throws Exception {
- Assert.assertNotNull(msg);
- Assert.assertEquals(2, msg.length);
- Assert.assertEquals("foo", msg[0]);
- Assert.assertEquals("bar", msg[1]);
- return msg;
- }
-
- public String nullParam() throws Exception {
- return "foo";
- }
-
- public int primitiveEcho(int i) throws Exception {
- return i;
- }
-
- public void checkedException() throws TestException {
- throw new TestException();
- }
-
- public void runtimeException() throws TestRuntimeException {
- throw new TestRuntimeException();
- }
- }
-
- public class TestException extends Exception {
- }
-
- public class TestRuntimeException extends RuntimeException {
- }
-}
diff --git a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java b/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java
deleted file mode 100644
index cda09e8540..0000000000
--- a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * 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.container.java.invocation.mock;
-
-import org.apache.tuscany.core.wire.MessageHandler;
-import org.apache.tuscany.core.message.Message;
-
-/**
- *
- */
-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;
- }
-}
diff --git a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java b/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java
deleted file mode 100644
index 24b22a641a..0000000000
--- a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- * 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.container.java.invocation.mock;
-
-import org.apache.tuscany.core.wire.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;
- }
-}
-
diff --git a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java b/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java
deleted file mode 100644
index 213caab7e9..0000000000
--- a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- *
- * 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.container.java.invocation.mock;
-
-public interface SimpleSource {
-
- public void invokeHello() throws Exception;
-
- public void invokeGoodbye() throws Exception;
-}
-
diff --git a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java b/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java
deleted file mode 100644
index 2e7bd75f11..0000000000
--- a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * 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.container.java.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");
- }
-
-}
-
diff --git a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java b/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java
deleted file mode 100644
index cbd3037529..0000000000
--- a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- * 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.container.java.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;
-
-}
-
diff --git a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java b/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java
deleted file mode 100644
index 18abf6108a..0000000000
--- a/tags/java-M1-final/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * 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.container.java.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;
- }
-
-
-}
-