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