From b2113b81f93f6113ba8e0ec57f775824d5da95db Mon Sep 17 00:00:00 2001 From: slaws Date: Mon, 12 Sep 2011 09:33:18 +0000 Subject: TUSCANY-3941 - If a reference specifies target in an SCA binding then we expect there to be an SCA binding at the service. In this case don't just select the first binding in the list. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1169664 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/resources/helloworld-client.composite | 9 ++++++++- .../src/test/java/itest/CrossContribTestCase.java | 22 ++++++++++++++++++++++ .../main/resources/helloworld-service.composite | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) (limited to 'sca-java-2.x/trunk/testing/itest/data-copy') diff --git a/sca-java-2.x/trunk/testing/itest/data-copy/client/src/main/resources/helloworld-client.composite b/sca-java-2.x/trunk/testing/itest/data-copy/client/src/main/resources/helloworld-client.composite index 461ec33c89..5108e1eae1 100644 --- a/sca-java-2.x/trunk/testing/itest/data-copy/client/src/main/resources/helloworld-client.composite +++ b/sca-java-2.x/trunk/testing/itest/data-copy/client/src/main/resources/helloworld-client.composite @@ -22,10 +22,17 @@ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" targetNamespace="http://itest" name="ClientComposite"> - + + + + + + + + diff --git a/sca-java-2.x/trunk/testing/itest/data-copy/driver/src/test/java/itest/CrossContribTestCase.java b/sca-java-2.x/trunk/testing/itest/data-copy/driver/src/test/java/itest/CrossContribTestCase.java index d94115a1e4..cc1f542769 100644 --- a/sca-java-2.x/trunk/testing/itest/data-copy/driver/src/test/java/itest/CrossContribTestCase.java +++ b/sca-java-2.x/trunk/testing/itest/data-copy/driver/src/test/java/itest/CrossContribTestCase.java @@ -25,8 +25,12 @@ import itest.common.intf.ClientIntf; import java.net.URI; +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.impl.NodeImpl; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Ignore; @@ -52,6 +56,24 @@ public class CrossContribTestCase { assertNotNull(client); client.callJAXBCrossContribution(); } + + // TUSCANY-3941 - make sure binding.sca is matched properly when + // it's used to carry the target URI. Not much to do with + // JAXB but this is a convenient test + @Test + public void testJAXBCrossContributionSCAAlternative() throws Exception { + ClientIntf client = node.getService(ClientIntf.class, "ClientSCAAlternative"); + assertNotNull(client); + client.callJAXBCrossContribution(); + + // Get the binding from the ClientSCA component + Binding binding = ((NodeImpl)node).getDomainComposite().getComponents().get(2).getReferences().get(0).getEndpointReferences().get(0).getBinding(); + assertEquals(true, binding instanceof SCABinding); + + // Get the binding from the ClientSCAAlternative component + Binding alternativeBinding = ((NodeImpl)node).getDomainComposite().getComponents().get(1).getReferences().get(0).getEndpointReferences().get(0).getBinding(); + assertEquals(true, alternativeBinding instanceof WebServiceBinding); + } @Test diff --git a/sca-java-2.x/trunk/testing/itest/data-copy/service/src/main/resources/helloworld-service.composite b/sca-java-2.x/trunk/testing/itest/data-copy/service/src/main/resources/helloworld-service.composite index 14a7801cf1..78b49eaa2c 100644 --- a/sca-java-2.x/trunk/testing/itest/data-copy/service/src/main/resources/helloworld-service.composite +++ b/sca-java-2.x/trunk/testing/itest/data-copy/service/src/main/resources/helloworld-service.composite @@ -25,8 +25,8 @@ - + -- cgit v1.2.3