Hi,

I'm trying to write a vtest for the conformance item ASM40002 and getting
kind of lost.  Hopefully someone from the group can set me right. :-)

The conformance item says:
[ASM40002] If present, the @constrainingType attribute of a <componentType/>
element MUST
reference a <constrainingType/> element in the Domain through its QName.

I have the following resources & testcase defined:
--------------------------------------------------------------------------
1. typefile.composite file:
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
 targetNamespace="http://assembly-tests";
 name="Assemby-component-typefile-Composite">
    <component name="AComponent">
     <implementation.java
class="org.apache.tuscany.sca.vtest.assembly.ctypefile.impl.AServiceImpl"/>
     <reference name="bService" target="BComponent/BService"/>
     <reference name="b2Service" target="BComponent/BService"/>
     </component>
    <component name="BComponent">
        <implementation.java
class="org.apache.tuscany.sca.vtest.assembly.ctypefile.impl.BServiceImpl"/>
        <property name="someProperty">compositeValue</property>
    </component>
</composite>

----------------------------------------------------------------------------
2. AService.componentType file (which has a constrainingType attribute
defined):
<?xml version="1.0" encoding="ASCII"?>
<componentType
 xmlns="http://www.osoa.org/xmlns/sca/1.0";
 targetNamespace="http://assembly-tests";
 constrainingType="xmlns:CT">
    <service name="AService">
           <interface.java
interface="org.apache.tuscany.sca.vtest.assembly.ctypefile.AService"/>

    </service>
</componentType>
--------------------------------------------------------------------------
My testcase:
    /**
     * Lines: ??
     *
     * ASM40002
     * <p>
     * If present, the @constrainingType attribute of a <componentType/>
element
     * MUST reference a <constrainingType/> element in the Domain through
its QName.
     * <p>
     * Description of how the OSOA function differs from the OASIS function:
     *
     * The OSOA spec doesn't have the same wording.
     *
     * Lines 2204-2205 mentions the following, however.
     *
     * A constrainingType can be applied to an implementation. In this case,

     * the implementation's componentType has a constrainingType attribute
set to
     * the QName of the constrainingType.
     */
    @Test
    public void ASM40002() throws Exception {
        ServiceFinder.init("typefile.composite");
        AService aService = ServiceFinder.getService(AService.class,
"AComponent/AService");
        ServiceFinder.cleanup();
    }
---------------------------------------------------

The test completed without errors, whereas I expected some kind of error
since I did not define a <constrainingType/>.

The test also completed successfully after I added the following
AService.constrainingType file:
------------------------------------------------------------------------------
<?xml version="1.0" encoding="ASCII"?>
<constrainingType
 xmlns="http://www.osoa.org/xmlns/sca/1.0";
 targetNamespace="http://assembly-tests";
 name="CT">
    <service name="AService">
        <interface.java
interface="org.apache.tuscany.sca.vtest.assembly.ctypefile.AService"/>
    </service>
</constrainingType>
------------------------------------------------------------------------------

Are there problems with my test program above?  I was not able to find the
same conformance item in the OSOA spec, though, not sure if this means
Tuscany might not have this requirement.

Any help is appreciated, thanks a lot in advance!

Best Regards,
Yiwen

Reply via email to