Susan,

The current SCA Assembly specification does not require an SCA runtime to report errors in any particular way. This has been discussed by the specification team but there was no agreement on the need to have a single way of reporting errors of this kind since different SCA runtimes may use very different techniques for deploying contributions to the runtime and for starting those contributions As a result, there is no requirement for the runtime to throw an exception when the second composite is loaded - although a runtime could choose to do this.

The main requirement that is made is that configurations that are in error must 
not be run.

So, for your testcase, it is clear that it is an error to deploy and run 2 composites that have the same "name" attribute on the <composite /> element.

It is also clear that the Tuscany runtime recognises and reports the error. And it is also clear that the composite that is in error (the second one to be loaded and run) is not run - when you try
to access its service(s), they are unobtainable.

So I believe that in this case, Tuscany is behaving in a reasonable way.

Since the order of loading of the 2 composites is not clear (there is nothing here which implies that component.composite is loaded before componentcopy.composite), then I suggest that the most appropriate way to write the testcase is to attempt to connect to the service of component.composite AND to the service of componentcopy.composite and to expect that at least ONE of these connections will fail. (I think it would be valid for the runtime to refuse to load both composites if it detected at deployment that they clashed).

I hope that this helps.


Yours,  Mike.


Shu Chao Wan wrote:

Hey, guys,

I'm doing conformance testing about tuscany. And here is the problem I met.

In the specification OASIS SCA assembly, conformance item ASM60001 says that "A composite name must be unique within the _namespace_ of the composite."
And I wrote a testcase to verify this item.

First, I initiate the SCA domain with two composite files, and both of them contain a component with the same name. When executing *SCADomain./newInstance/* method (see line 4 in the following testcase), I got the following warning message. WARNING: Composite {http://assembly-tests}Assembly-component--Composite has already been included. Then the ServiceRuntimeException exception will be thrown in domain.getService method ( see line 5 and line 6 in the following testcase), which means that only one composite file in this domain has taken effect, and the other one has been ignored.

And my question is:
To verify this item, is it a must to get an expection when executing *SCADomain./newInstance/* method? Or the expection thrown out in getService method is enough?

Another question is:
If there's some place else in this specification use words likes "MUST BE", does it means that if the condition is not satisfied, there will be an expection to be thrown immediately?

Thanks.

TestCase
-----------------------------------------------------------------------------------------------------
    /**
     * ASM60001:
     * <p>
* A composite name must be unique within the _namespace_ of the composite.
     * <p>
     * OSOA specification doesn't have such requirement.
     */
1    @Test(expected = ServiceRuntimeException.*class*)
2    *public* *void* ASM60001() *throws* Exception {
3        SCADomain domain =
4 SCADomain./newInstance/(/LOCAL_DOMAIN_URI/, "/", "component.composite", "componentcopy.composite");
5        domain.getService(AService.*class*, "AComponent");
6        domain.getService(CService.*class*, "CComponent");
7        domain.close();
8        domain = *null*;
9    }
-----------------------------------------------------------------------------------------------------

And the fragment of file component.composite and componentcopy.composite are shown as follows:

component.composite
-----------------------------------------------------------------------------------------------------
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        targetNamespace="http://assembly-tests";
        name="*Assembly-component--Composite*">

    <component name="AComponent">
<implementation.java class="org.apache.tuscany.sca.vtest.assembly.composite.impl.AServiceImpl"/>
            <reference name="b" target="BComponent"/>
            <reference name="b2" target="B2Component"/>
     </component>
     ....
</composite> -----------------------------------------------------------------------------------------------------

componentcopy.composite
-----------------------------------------------------------------------------------------------------
<composite _xmlns_="http://www.osoa.org/xmlns/sca/1.0";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        targetNamespace="http://assembly-tests";
        name="*Assembly-component--Composite*">
    <component name="CComponent">
<implementation.java class="_org_._apache_._tuscany_._sca_._vtest_.assembly.composite._impl_.CServiceImpl"/>
        <service name="CServiceImpl">
<interface.java interface="_org_._apache_._tuscany_._sca_._vtest_.assembly.composite.CService"/>
        </service>
</component> </composite> -----------------------------------------------------------------------------------------------------



Best Regards
Susan Wan��(���糬)
-------------------------
WebSphere Application Server System Verification Test, IBM China SoftWare Development Lab
Tel: 86-10-82453655
E-mail: [EMAIL PROTECTED] Address: 3/F, Diamond Building, ZhongGuanCun Software Park , Dongbeiwang West Road No.8, ShangDi, Haidian District, Beijing 100193, PRC

Reply via email to