summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing/itest/data-copy
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-09-12 09:33:18 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-09-12 09:33:18 +0000
commitb2113b81f93f6113ba8e0ec57f775824d5da95db (patch)
treec28eee37d77b4406b38b8074dfd6d582272385cb /sca-java-2.x/trunk/testing/itest/data-copy
parente7584f37352bfc0b0bc9a894fe4ca72817c16e8e (diff)
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
Diffstat (limited to 'sca-java-2.x/trunk/testing/itest/data-copy')
-rw-r--r--sca-java-2.x/trunk/testing/itest/data-copy/client/src/main/resources/helloworld-client.composite9
-rw-r--r--sca-java-2.x/trunk/testing/itest/data-copy/driver/src/test/java/itest/CrossContribTestCase.java22
-rw-r--r--sca-java-2.x/trunk/testing/itest/data-copy/service/src/main/resources/helloworld-service.composite2
3 files changed, 31 insertions, 2 deletions
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">
- <component name="ClientSCA">
+ <component name="ClientSCAAlternative">
<implementation.java class="itest.client.impl.ClientImpl"/>
<reference name="service" target="Service"/>
</component>
+
+ <component name="ClientSCA">
+ <implementation.java class="itest.client.impl.ClientImpl"/>
+ <reference name="service">
+ <binding.sca uri="Service"/>
+ </reference>
+ </component>
<component name="ClientWS">
<implementation.java class="itest.client.impl.ClientImpl"/>
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 @@
<component name="Service">
<implementation.java class="itest.service.impl.ServiceImpl"/>
<service name="ServiceIntf">
- <binding.sca name="sca"/>
<binding.ws name="ws" uri="http://localhost:8085/Service/ServiceIntf"/>
+ <binding.sca name="sca"/>
<tuscany:binding.rmi name="rmi" uri="rmi://localhost:8099/Service"/>
</service>
</component>