[ https://issues.apache.org/jira/browse/TUSCANY-3904?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon Laws closed TUSCANY-3904. ------------------------------- Resolution: Fixed Fix Version/s: Java-SCA-2.0 Thanks for the patch Greg. Applied at r1153789 > SCAClientFactory.getService() may use wrong binding when referencing a > promoted service > --------------------------------------------------------------------------------------- > > Key: TUSCANY-3904 > URL: https://issues.apache.org/jira/browse/TUSCANY-3904 > Project: Tuscany > Issue Type: Bug > Affects Versions: Java-SCA-2.0 > Reporter: Greg Dritschler > Assignee: Simon Laws > Priority: Minor > Fix For: Java-SCA-2.0 > > Attachments: TUSCANY-3904.patch > > > SCAClientFactory.getService() doesn't work correctly when referencing a > promoted service. > Let's say I have composite A with component C1 > <component name="C1"> > <implementation.composite name="B"/> > <service name="S1Promoted"> > <binding.sca name="myscabinding"/> > </service> > </component> > and composite B with component C2 > <service name="S1Promoted" promote="C2"/> > <component name="C2"> > <implementation.java class="..."/> > <service name="S1"> > <binding.ws/> > </service> > </component> > When I use SCAClientFactory.getService("C1/S1Promoted/myscabinding") to > obtain the service, the invocation uses binding.ws, not binding.sca. This > doesn't sound correct to me. It certainly seems wrong to ignore the explicit > binding name and pick something else. But even I left out the binding name > and just asked for "C1/S1Promoted", I would expect binding.sca to be used > since that's the binding that's defined for that component service. > RuntimeComponentImpl.getServiceReference(Class<B> businessInterface, String > serviceName) checks for > implementation.composite and then uses the component context of the promoted > component to create a self-reference. > ComponentContextImpl.getEndpoint(ComponentService service, String > bindingName) searches for the endpoint in the promoted component's context. > It has a check for binding name, but if it can't find a match, logic added by > TUSCANY-3543 just picks the first endpoint. > The logic in getServiceReference() to use the promoted component's context > doesn't seem to be necessary. I deleted it and re-tested and got the desired > results (binding.sca was used). I am attaching a patch. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira