summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation')
-rw-r--r--java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImplTestCase.java93
-rw-r--r--java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManagerTestCase.java50
-rw-r--r--java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseSorterTestCase.java67
3 files changed, 0 insertions, 210 deletions
diff --git a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImplTestCase.java b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImplTestCase.java
deleted file mode 100644
index 1302bed681..0000000000
--- a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/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.invocation.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-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;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class InvocationChainImplTestCase {
-
- @Test
- public void testInsertAtEnd() throws Exception {
- Operation op = newOperation("foo");
- InvocationChain chain = new InvocationChainImpl(op, op, true, new PhaseManager(new DefaultExtensionPointRegistry()));
- 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());
- }
-
- @Test
- public void testAddByPhase() throws Exception {
- Operation op = newOperation("foo");
- InvocationChain chain = new InvocationChainImpl(op, op, false, new PhaseManager(new DefaultExtensionPointRegistry()));
- 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());
- }
-
- 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/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManagerTestCase.java b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManagerTestCase.java
deleted file mode 100644
index 8fcead004d..0000000000
--- a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManagerTestCase.java
+++ /dev/null
@@ -1,50 +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.invocation.impl;
-
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PhaseManagerTestCase {
-
- @Test
- public void testDiscovery() {
- PhaseManager pm = new PhaseManager("org.apache.tuscany.sca.invocation.PhaseTest");
- List<String> phases = pm.getAllPhases();
- System.out.println(phases.size());
- System.out.println(phases);
- // Assert.assertEquals(15, phases.size());
- Assert.assertEquals("reference.first", phases.get(0));
-
- int rt = phases.indexOf("reference.transaction");
- Assert.assertTrue(rt > phases.indexOf("reference.interface"));
-
- int st = phases.indexOf("service.transaction");
- Assert.assertTrue(st > phases.indexOf("service.binding"));
-
- int it = phases.indexOf("implementation.transaction");
- Assert.assertTrue(it < phases.indexOf("implementation.policy"));
- }
-}
diff --git a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseSorterTestCase.java b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseSorterTestCase.java
deleted file mode 100644
index c268e133e4..0000000000
--- a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseSorterTestCase.java
+++ /dev/null
@@ -1,67 +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.invocation.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class PhaseSorterTestCase {
- private PhaseSorter<String> graph;
-
- @Before
- public void setUp() throws Exception {
- graph = new PhaseSorter<String>();
- }
-
- @Test
- public void testSort() {
- graph.addEdge("a", "b");
- graph.addEdge("a", "c");
- graph.addEdge("c", "d");
- graph.addEdge("b", "c");
- List<String> order = graph.topologicalSort(true);
- assertEquals(Arrays.asList("a", "b", "c", "d"), order);
- assertTrue(!graph.getVertices().isEmpty());
-
- graph.addEdge("d", "a");
- try {
- order = graph.topologicalSort(true);
- assertTrue("Should have failed", false);
- } catch (IllegalArgumentException e) {
- assertTrue(true);
- }
-
- graph.removeEdge("d", "a");
- order = graph.topologicalSort(false);
- assertEquals(Arrays.asList("a", "b", "c", "d"), order);
- assertTrue(graph.getVertices().isEmpty());
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
-}