Susan,
I think that you have chosen a very difficult assertion to test.
Unfortunately, your testcase does not actually test conformance to [ASM60002], so it is not
surprising that your testcase does not find an error here.
If a composite has @local=true, then the requirement is that all components contained within that
composite must run in the same operating system process. This does *NOT* mean that the components
within the composite must all offer local services - in principle they could all implement remotable
services and the composite would be valid. Your test checks if the services are local or remotable
- which is not what the conformance assertion is about.
To build a testcase that would really test for [ASM60002], it would be necessary to create a test in
which you have a composite marked @local=true where you are able to indicate to the SCA runtime that
you want specific components within the composite to be deployed onto different nodes (since each
node is a different process). Trying to deploy the composite in this way should then cause an error
of some kind.
Unfortunately, with the current implementation of Tuscany, there is no way of telling Tuscany to
deploy different components within one composite to different nodes. As a result, I don't think
there is any way of building a test for this conformance assertion.
Yours, Mike.
Shu Chao Wan wrote:
Hey,
I'm writing test case about conformance item ASM60002, and haven't got
the result I expected.
*Conformance Item ASM60002*
*----------------------------------------------------------------------------------------*
local : boolean (0..1) �C whether all the components within the
composite all run in the same operating system process. @local="true"
for a composite means that all the components within the composite MUST
run in the same operating system process. *[ASM60002]* local="false",
which is the default, means that different components within the
composite can run in different operating system processes and they can
even run on different nodes on a network.
*----------------------------------------------------------------------------------------*
According to the above description, I created the following composite
file *localcomponent.composite* with two conponents, one is a local
component (BComponent), the other is remote
one(HelloWorldServiceComponent). And the "local" attribute is set as
"true".
*localcomponennt.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-LocalComponent--Composite" *local="true"*>
<component name="HelloWorldServiceComponent">
<service name="HelloWorldService">
<interface.java
interface="helloworld.HelloWorldService" />
<binding.ws
uri="http://localhost:8085/HelloWorldService"/>
</service>
</component>
<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>
*----------------------------------------------------------------------------------------*
Then I create the testcase to invoke the services of the two components
individually, and supposed that ServiceRuntimeException exception will
be thrown. But actually I haven't got any exception, even without any
warning message in the console. Is there any problem with my testcase?
Thanks for any help in advance.
*Testcase*
*----------------------------------------------------------------------------------------*
/**
* Lines 1036-1037:
* <p>
* local="true" means that all the components must run in the same process.
* <p>
* ASM60002:
* <p>
* [EMAIL PROTECTED]"true" for a composite means that all the components within
the composite MUST run in the same operating system process.
*/
@Test(expected = ServiceRuntimeException.*class*)
*public* *void* ASM60002() *throws* Exception {
initDomain("localcomponent.composite");
HelloWorldService service =
ServiceFinder./getService/(HelloWorldService.*class*,
"HelloWorldServiceComponent");
Assert./assertEquals/("Hello, tester",
service.getGreetings("tester"));
BService bService = ServiceFinder./getService/(BService.*class*,
"BComponent");
Assert./assertEquals/("SomeStateFromB", bService.getState());
}
*----------------------------------------------------------------------------------------*
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