[ 
https://issues.apache.org/jira/browse/TUSCANY-2689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651555#action_12651555
 ] 

Simon Laws commented on TUSCANY-2689:
-------------------------------------

The problem with ASM60004 is that the fact that the 
promote="NoPromoteComponent" attribute doesn't actually reference a component 
is raise as a warning but the assembly builder but then the code that creates a 
reference to this service in the node doesn't take account of this promoting 
service not having a valid reference to a promoted service. I've added a test 
for the time being to check for this. 

A similar problem is happening with ASM60006 where a warning is logged and 
hence and exception is not thrown. I think on balance this is the kind of 
warning that should be an error hence causing and exception to be thrown. Can 
you raise a separate JIRA for this one. I'll go ahead and check the tests in 
with an @Ignore in. We can update the Ignore to reference the JIRA when you 
have created it. 



> NullPointerException occurs when verifying conformance item ASM60004
> --------------------------------------------------------------------
>
>                 Key: TUSCANY-2689
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2689
>             Project: Tuscany
>          Issue Type: Test
>          Components: Java SCA Assembly Model
>    Affects Versions: Java-SCA-1.3
>            Reporter: Shu Chao Wan
>            Assignee: Simon Laws
>         Attachments: composite.patch
>
>
> Here is a question about conformance item ASM60004 "A composite <service/> 
> element's promote attribute MUST identify one of the component services 
> within that composite."
> In order to verify this item, I create the following composite file in which 
> the value of promote attribute (NoPromoteComponent) is not any component 
> service within that composite.
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>     xmlns:assembly-tests="http://assembly-tests";
>       targetNamespace="http://assembly-tests";
>       name="Assembly-non-unique-serviename-Composite">
>     <service name="NoPromoteService" promote="NoPromoteComponent"/> 
>     <component name="BComponent">
>         <implementation.java 
> class="org.apache.tuscany.sca.vtest.assembly.composite.impl.BServiceImpl"/>
>         <property name="someProperty">some b component value</property>
>     </component>
> </composite>
> When I running testcase ASM60004 to invoke service NoPromoteService, I got a 
> NullPointerException exception instead of a expected ServiceRuntimeException. 
> java.lang.NullPointerException
>       at 
> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.getServiceReference(DefaultSCADomain.java:574)
>       at 
> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.getService(DefaultSCADomain.java:500)
>       at 
> org.apache.tuscany.sca.vtest.assembly.composite.ServiceFinder.getService(ServiceFinder.java:52)
>       at 
> org.apache.tuscany.sca.vtest.assembly.composite.CompositeTestCase.ASM60004(CompositeTestCase.java:118)
>       at 
> org.apache.tuscany.sca.vtest.assembly.composite.CompositeTestCase.main(CompositeTestCase.java:254)
> I looked into the file 
> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain,and found that in 
> the getServiceReference method there has the following statement, and the 
> variable componentContext will be set as null after the statement has been 
> executed. 
> componentContext = 
> (RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to