summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-08-16 10:12:18 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-08-16 10:12:18 +0000
commitcdcd689895f3be768658011ac31277e9d10ebd0b (patch)
treeac76aff874d34e6be460fc41cb7ca2c115a2bbfc /sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java
parent47efc8c83cd6764e75c68fe06f864d60de24468c (diff)
TUSCANY-3916 - A test for interface miss-matches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1158181 13f79535-47bb-0310-9956-ffa450edef68
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/InerfaceMissmatchTestCase.java95
1 files changed, 95 insertions, 0 deletions
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
new file mode 100644
index 0000000000..a2db698334
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMissmatchTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * 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.io.File;
+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.Test;
+import org.oasisopen.sca.ServiceRuntimeException;
+
+public class InerfaceMissmatchTestCase {
+
+ @Test
+ public void testLocal() throws Exception {
+/*
+ TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+ Node node = tuscanyRuntime.createNode();
+ node.installContribution("MyContribution", "./target/classes", null, null);
+ node.startComposite("MyContribution", "org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchLocal.composite");
+*/
+ String [] contributions = {"./target/classes"};
+ Node node1 = NodeFactory.newInstance().createNode(URI.create("tuscany:InerfaceMissmatchTestCase"),
+ "org/apache/tuscany/sca/itest/interfaces/missmatch/local/MissmatchLocal.composite",
+ contributions);
+ node1.start();
+
+ ClientComponent local = node1.getService(ClientComponent.class, "LocalClientComponent");
+ ParameterObject po = new ParameterObject();
+
+ try {
+ local.foo1(po);
+ Assert.fail("Expection exteption indicating that interfaces don't match");
+ } catch (ServiceRuntimeException ex){
+ Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []"));
+ }
+ }
+
+
+ @Test
+ public void testDistributed() throws Exception {
+/*
+ TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+ Node node1 = tuscanyRuntime.createNode("uri:default");
+ node1.installContribution("MyContribution", "./target/classes", null, null);
+ node1.startComposite("MyContribution", "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedClient.composite");
+
+ Node node2 = tuscanyRuntime.createNode("uri:default");
+ node2.installContribution("MyContribution", "./target/classes", null, null);
+ node2.startComposite("MyContribution", "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchDistributedService.composite");
+*/
+
+ 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/MissmatchDistributedService.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 []"));
+ }
+
+ }
+}