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


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