[ 
http://issues.apache.org/jira/browse/TUSCANY-1000?page=comments#action_12459741 
] 
            
Lou Amodeo commented on TUSCANY-1000:
-------------------------------------

I also added some trace to this locate code and it doesnt look like the 
componentName/serviceName comes into play with this matching logic?

[[INFO] [tuscany-itest:start {execution: start}]
[INFO] Starting Tuscany...
[INFO] [tuscany-itest:test {execution: test}]
[INFO] Executing tests...
LAA: locateService for ServiceName:ConversationsClient/ConversationsClient
LAA: Child:[AnotherService] in state [RUNNING]
LAA: Child:[ConversationLifeCycleService] in state [RUNNING]
LAA: Child:[ConversationsClient] in state [RUNNING]
LAA: Child:[ConversationsService] in state [RUNNING]
LAA: Child keys:AnotherService
LAA: Child keys:ConversationLifeCycleService
LAA: Child keys:ConversationsClient
LAA: Child keys:ConversationsService
[INFO] Test results: {skipped=0, completedCount=1, failures=0, errors=1}
[INFO] ------------------------------------------------------------------------

CompositeComponentExtension.java 

   public <T> T locateService(Class<T> serviceInterface, String name) {
        
        System.out.println("LAA: locateService for ServiceName:" + name);
        for (SCAObject child : children.values()) {
           System.out.println("LAA: Child:" +  child.toString());
        } 

      for (String child : children.keySet()) {
           System.out.println("LAA: Child keys:" +  child);
        } 


        SCAObject target = children.get(name);
        if (target == null) {
            TargetNotFoundException e = new TargetNotFoundException(name);
            e.addContextName(getName());
            throw e;
        }
        return serviceInterface.cast(target.getServiceInstance());
    }


> Components do not support multiple services
> -------------------------------------------
>
>                 Key: TUSCANY-1000
>                 URL: http://issues.apache.org/jira/browse/TUSCANY-1000
>             Project: Tuscany
>          Issue Type: Bug
>    Affects Versions: Java-M2
>            Reporter: Lou Amodeo
>         Assigned To: Jim Marino
>
> I have a component that implements multiple service interfaces at runtime the 
> locateService() receives an exception indicating that components can only 
> have 1 service.  The C&I spec states that a component can declare using 
> @Service an array of interfaces.  
> @Service(interfaces={ConversationsClient.class,ConversationsClient2.class})
> public class ConversationsClientImpl implements ConversationsClient, 
> ConversationsClient2, ConversationsCallback {    
> -------------------------------------------------------------------------------
> Test set: org.apache.tuscany.sca.test.ConversationsITest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.02 sec <<< 
> FAILURE!
> testCallBackSetCallback(org.apache.tuscany.sca.test.ConversationsITest)  Time 
> elapsed: 0 sec  <<< ERROR!
> org.apache.tuscany.spi.component.TargetException: Component must have exactly 
> one service
>       at 
> org.apache.tuscany.core.implementation.java.JavaAtomicComponent.getServiceInstance(JavaAtomicComponent.java:72)
>       at 
> org.apache.tuscany.spi.extension.CompositeComponentExtension.locateService(CompositeComponentExtension.java:268)
>       at 
> org.apache.tuscany.core.launcher.CompositeContextImpl.locateService(CompositeContextImpl.java:65)
>       at 
> org.apache.tuscany.sca.test.ConversationsITest.setUp(ConversationsITest.java:17)
>       at junit.framework.TestCase.runBare(TestCase.java:125)
>       at junit.framework.TestResult$1.protect(TestResult.java:106)
>       at junit.framework.TestResult.runProtected(TestResult.java:124)
>       at junit.framework.TestResult.run(TestResult.java:109)
>       at junit.framework.TestCase.run(TestCase.java:118)
>       at junit.framework.TestSuite.runTest(TestSuite.java:208)
>       at junit.framework.TestSuite.run(TestSuite.java:203)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:615)
>       at 
> org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)
>       at 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135)
>       at 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122)
>       at 
> org.apache.tuscany.sca.plugin.itest.TuscanyITestMojo.run(TuscanyITestMojo.java:122)
>       at 
> org.apache.tuscany.sca.plugin.itest.TuscanyITestMojo.runSurefire(TuscanyITestMojo.java:88)
>       at 
> org.apache.tuscany.sca.plugin.itest.TuscanyITestMojo.execute(TuscanyITestMojo.java:77)
>       at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>       at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:615)
>       at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>       at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>       at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>       at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>           

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to