summaryrefslogtreecommitdiffstats
path: root/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire')
-rw-r--r--branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java62
-rw-r--r--branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java93
-rw-r--r--branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java73
3 files changed, 0 insertions, 228 deletions
diff --git a/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java b/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java
deleted file mode 100644
index 424f12800f..0000000000
--- a/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.sca.core.wire;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor;
-import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Message;
-import org.easymock.EasyMock;
-import org.osoa.sca.NoRegisteredCallbackException;
-
-/**
- * @version $Rev: 608822 $ $Date: 2008-01-04 04:59:56 -0800 (Fri, 04 Jan 2008) $
- */
-public class CallbackInterfaceInterceptorTestCase extends TestCase {
-
- public void testHasCallbackObject() {
- CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
- Interceptor next = EasyMock.createMock(Interceptor.class);
- EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null);
- EasyMock.replay(next);
- interceptor.setNext(next);
- Message msg = new MessageFactoryImpl().createMessage();
- msg.setFrom(new EndpointReferenceImpl("uri"));
- msg.getFrom().getReferenceParameters().setCallbackObjectID("ABC");
- interceptor.invoke(msg);
- EasyMock.verify(next);
- }
-
- public void testNoCallbackObject() {
- CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
- Message msg = new MessageFactoryImpl().createMessage();
- msg.setFrom(new EndpointReferenceImpl("uri"));
- msg.getFrom().getReferenceParameters().setCallbackObjectID(null);
- try {
- interceptor.invoke(msg);
- fail();
- } catch (NoRegisteredCallbackException e) {
- // expected
- }
- }
-
-}
diff --git a/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java b/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java
deleted file mode 100644
index 120fe861c8..0000000000
--- a/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.sca.core.wire;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.Phase;
-
-/**
- * @version $Rev: 632064 $ $Date: 2008-02-28 09:18:51 -0800 (Thu, 28 Feb 2008) $
- */
-public class InvocationChainImplTestCase extends TestCase {
-
- public void testInsertAtEnd() throws Exception {
- Operation op = newOperation("foo");
- InvocationChain chain = new InvocationChainImpl(op, op, true);
- Interceptor inter2 = new MockInterceptor();
- Interceptor inter1 = new MockInterceptor();
- chain.addInterceptor(inter1);
- chain.addInterceptor(inter2);
- Interceptor head = (Interceptor)chain.getHeadInvoker();
- assertEquals(inter1, head);
- assertEquals(inter2, head.getNext());
- assertEquals(inter2, chain.getTailInvoker());
-
- }
-
- public void testAddByPhase() throws Exception {
- Operation op = newOperation("foo");
- InvocationChain chain = new InvocationChainImpl(op, op, false);
- Interceptor inter1 = new MockInterceptor();
- Interceptor inter2 = new MockInterceptor();
- Interceptor inter3 = new MockInterceptor();
- Interceptor inter4 = new MockInterceptor();
- chain.addInterceptor(inter3); // SERVICE
- chain.addInterceptor(Phase.IMPLEMENTATION_POLICY, inter4);
- chain.addInterceptor(Phase.SERVICE_POLICY, inter2);
- chain.addInterceptor(Phase.SERVICE_BINDING, inter1);
- Interceptor head = (Interceptor)chain.getHeadInvoker();
- assertEquals(inter1, head);
- assertEquals(inter2, inter1.getNext());
- assertEquals(inter3, inter2.getNext());
- assertEquals(inter4, inter3.getNext());
- assertEquals(inter4, chain.getTailInvoker());
- }
-
- private class MockInterceptor implements Interceptor {
-
- private Invoker next;
-
- public Message invoke(Message msg) {
- return null;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- }
-
- private static Operation newOperation(String name) {
- Operation operation = new OperationImpl();
- operation.setName(name);
- return operation;
- }
-}
diff --git a/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java b/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java
deleted file mode 100644
index 971d9493c8..0000000000
--- a/branches/sca-android/modules/core-android/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.sca.core.wire;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.getCurrentArguments;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.work.WorkScheduler;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-
-/**
- * @version $Rev: 576235 $ $Date: 2007-09-16 19:07:54 -0700 (Sun, 16 Sep 2007) $
- */
-public class NonBlockingInterceptorTestCase extends TestCase {
-
- public void testInvoke() throws Exception {
- WorkScheduler scheduler = createMock(WorkScheduler.class);
- scheduler.scheduleWork(isA(Runnable.class));
- expectLastCall().andStubAnswer(new IAnswer<Object>() {
- public Object answer() throws Throwable {
- Runnable runnable = (Runnable) getCurrentArguments()[0];
- runnable.run();
- return null;
- }
- });
- replay(scheduler);
- Message context = createMock(Message.class);
- //String convID = "convID";
- //TODO port to the new way of dealing with conversation IDs later
- //EasyMock.expect(context.getConversationID()).andReturn(convID);
- EasyMock.replay(context);
- ThreadMessageContext.setMessageContext(context);
- Message msg = createMock(Message.class);
- //TODO port to the new way of dealing with conversation IDs later
- //msg.setConversationID(convID);
- Interceptor next = EasyMock.createMock(Interceptor.class);
- EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
- EasyMock.replay(next);
- EasyMock.replay(msg);
- Interceptor interceptor = new NonBlockingInterceptor(scheduler, next);
- interceptor.invoke(msg);
- verify(context);
- verify(next);
- verify(msg);
- }
-
-}