summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core
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/modules/core
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/modules/core')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java15
1 files changed, 14 insertions, 1 deletions
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;
}