From 7d550f3ba9d89ba24b44fa4f2ee7eff519bdaaa2 Mon Sep 17 00:00:00 2001 From: slaws Date: Mon, 17 Oct 2011 12:55:31 +0000 Subject: TUSCANY-3959 - Correct interface matching so that it takes account of mayProvides intents. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1185139 13f79535-47bb-0310-9956-ffa450edef68 --- .../MissmatchPolicyDistributedClient.composite | 30 ++++++++++++++++ .../MissmatchPolicyDistributedService.composite | 31 ++++++++++++++++ .../interfaces/InerfaceMissmatchTestCase.java | 41 +++++++++++++++++++++- 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite create mode 100644 sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite (limited to 'sca-java-2.x/trunk/testing/itest/interface-matching/src') diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite new file mode 100644 index 0000000000..b8f51c9afc --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite new file mode 100644 index 0000000000..a90d9e0a3f --- /dev/null +++ b/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file 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 0c54e5f8e7..f12be0247f 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 @@ -201,6 +201,45 @@ public class InerfaceMissmatchTestCase { node2.stop(); Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []")); } - } + + /** + * Remotable client and service interfaces where the interfaces match and the service and reference + * have missmatching policy. + * Components running in the separate composite/JVM, i.e. there is a remote registry + * + * @throws Exception + */ + @Test + public void testPolicyDistributedRemotable() throws Exception { + + + String [] contributions = {"./target/classes"}; + Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedClient.composite", + contributions); + node1.start(); + + Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"), + "org/apache/tuscany/sca/itest/interfaces/missmatch/distributed/MissmatchPolicyDistributedService.composite", + contributions); + // force binding.ws on node2 to use a different port from node 1(which will default to 8080 + ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/"); + node2.start(); + + ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent"); + ParameterObject po = new ParameterObject(); + + try { + String response = local.foo1(po); + node1.stop(); + node2.stop(); + Assert.fail("Expected exception indicating that interfaces don't match"); + } catch (ServiceRuntimeException ex){ + node1.stop(); + node2.stop(); + Assert.assertTrue(ex.getMessage().startsWith("Unable to bind []")); + } + + } } -- cgit v1.2.3