summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java')
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java96
-rw-r--r--sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java36
2 files changed, 132 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java b/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
new file mode 100644
index 0000000000..ac1bc5c5ff
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
@@ -0,0 +1,96 @@
+/*
+ * 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.itest.interfaces;
+
+import java.net.URI;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.oasisopen.sca.ServiceRuntimeException;
+
+public class InerfaceMatchTestCase {
+
+ /**
+ * Non-remoteable client and service interfaces where the interfaces match.
+ * Components running in the same composite/JVM, i.e. no remote registry
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testLocal() throws Exception {
+ String [] contributions = {"./target/classes"};
+ Node node1 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"),
+ "org/apache/tuscany/sca/itest/interfaces/missmatch/local/MatchLocal.composite",
+ contributions);
+ node1.start();
+
+ ClientComponent local = node1.getService(ClientComponent.class, "LocalClientComponent");
+ ParameterObject po = new ParameterObject();
+
+ try {
+ String response = local.foo1(po);
+ Assert.assertEquals("AComponent", response);
+ } catch (ServiceRuntimeException ex){
+ Assert.fail("Unexpected exception " + ex.toString());
+ }
+
+ node1.stop();
+ }
+
+ /**
+ * Remoteable client and service interfaces where the interfaces match.
+ * Components running in the seaprate composite/JVM, i.e. there is a remote registry
+ *
+ * @throws Exception
+ */
+ @Ignore("Remote interface matching doesn't take callback into account yet")
+ @Test
+ public void testDistributedRemotable() throws Exception {
+
+ String [] contributions = {"./target/classes"};
+ Node node1 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"),
+ "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite",
+ contributions);
+ node1.start();
+
+ Node node2 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"),
+ "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MatchDistributedService.composite",
+ contributions);
+ node2.start();
+
+ ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent");
+ ParameterObject po = new ParameterObject();
+
+ try {
+ String response = local.foo1(po);
+ Assert.assertEquals("AComponent", response);
+ } catch (ServiceRuntimeException ex){
+ Assert.fail("Unexpected exception " + ex.toString());
+ }
+
+ node1.stop();
+ node2.stop();
+
+ }
+}
diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java b/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java
index 203b1a4ce0..0dd6cab0c8 100644
--- a/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java
@@ -150,4 +150,40 @@ public class InerfaceMissmatchTestCase {
node2.stop();
}
+
+ /**
+ * Remoteable client and service interfaces where the parameter types of one of the operations don't match.
+ * Components running in the seaprate composite/JVM, i.e. there is a remote registry
+ * Both of the interfaces are converted to WSDL and Tuscany is able to detect miss-match.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCallbackDistributedRemotable() throws Exception {
+
+ String [] contributions = {"./target/classes"};
+ Node node1 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"),
+ "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite",
+ contributions);
+ node1.start();
+
+ Node node2 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"),
+ "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchCallbackDistributedService.composite",
+ contributions);
+ node2.start();
+
+ ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent");
+ ParameterObject po = new ParameterObject();
+
+ try {
+ local.foo1(po);
+ Assert.fail("Expected exception indicating that interfaces don't match");
+ } catch (ServiceRuntimeException ex){
+ Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []"));
+ }
+
+ node1.stop();
+ node2.stop();
+
+ }
}