diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-12 09:33:18 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-12 09:33:18 +0000 |
commit | b2113b81f93f6113ba8e0ec57f775824d5da95db (patch) | |
tree | c28eee37d77b4406b38b8074dfd6d582272385cb /sca-java-2.x/trunk/modules | |
parent | e7584f37352bfc0b0bc9a894fe4ca72817c16e8e (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/modules')
2 files changed, 19 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java index 4463248164..5dc0e40684 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java @@ -325,6 +325,11 @@ public class EndpointReferenceBuilderImpl { // so that the binder can test it against the fully populated // registry endpoint = createEndpoint(component, uri); + if (binding instanceof SCABinding) { + // TUSCANY-3941 + // if it's an SCA binding we store it to influence the matching at runtime + endpointRef.setBinding(binding); + } endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI); } catch (Exception ex) { // the target string definitely isn't an SCA target string 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; } |