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 --- .../core/runtime/impl/EndpointReferenceBinderImpl.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sca-java-2.x/trunk/modules/core/src/main') diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java index 2a3e466b60..179c60a829 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java @@ -413,9 +413,22 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { } } else { // find the first endpoint that matches this endpoint reference + boolean findTargetSCABinding = false; + + // TUSCANY-3941 check for the case where the user has provided a + // binding.sca at the reference and make sure we pick + // a binding.sca at the service regardless of how many + // other bindings are provided + if (endpointReference.getBinding() != null && + endpointReference.getBinding() instanceof SCABinding ){ + findTargetSCABinding = true; + } + for (Endpoint endpoint : endpoints){ if (haveMatchingPolicy(endpointReference, endpoint, matchAudit, builderContext) && - haveMatchingInterfaceContracts(endpointReference, endpoint, matchAudit)){ + haveMatchingInterfaceContracts(endpointReference, endpoint, matchAudit) && + (findTargetSCABinding == false || + (findTargetSCABinding == true && endpoint.getBinding() instanceof SCABinding))){ matchedEndpoint = endpoint; break; } -- cgit v1.2.3