On Thu, Jan 15, 2009 at 9:58 AM, Shuchao Wan <[email protected]> wrote:

> I have a question about conformance item 50011 and hope some one could help
> me.
>
> Conformance item 50011 tells something about some constraints about
> interface of <component>'s <reference>.  And here is the detailed
> description:
>  "A reference has zero or one interface, which describes the operations
> required by the reference. The interface is described by an interface
> element which is a child element of the reference element. If no interface
> is specified, then the interface specified for the reference in the
> componentType of the implementation is in effect. If an interface is
> declared for a component reference it MUST provide a compatible superset of
> the interface declared for the equivalent reference in the componentType of
> the implementation, i.e. provide the same operations or a superset of the
> operations defined by the implementation for the reference. "
> In my opinion, I think it is to say that interface declared for a component
> reference must have equal or more operations than its implementation
> acturally need. So I write a composite file wire.composite and testcase to
> verify it.
>
> -----------------------------
> wire.composite
> -----------------------------
> <composite>...
>    <component name="FComponent">
>      <implementation.java
> class="org.apache.tuscany.sca.vtest.assembly.composite.impl.FServiceImpl"/>
>      <reference name="d">
>         <interface.java
> interface="org.apache.tuscany.sca.vtest.assembly.composite.DSubService" />
>      </reference>
>      <reference name="c">
>          <interface.java
> interface="org.apache.tuscany.sca.vtest.assembly.composite.CSubService" />
>      </reference>
>   </component>
>    <component name="CComponent">
>         <implementation.java
> class="org.apache.tuscany.sca.vtest.assembly.composite.impl.CServiceImpl"/>
>         <service name="CService">
>             <interface.java
> interface="org.apache.tuscany.sca.vtest.assembly.composite.CService"/>
>         </service>
>     </component>
>     <component name="DComponent">
>         <implementation.java
> class="org.apache.tuscany.sca.vtest.assembly.composite.impl.DServiceImpl"/>
>         <service name="DService">
>             <interface.java
> interface="org.apache.tuscany.sca.vtest.assembly.composite.DService" />
>         </service>
>     </component>
>     <wire source="FComponent/d" target="DComponent" />
>     <wire source="FComponent/c" target="CComponent" />
> </composite>
>
> ---------------------------
> FServiceImpl.java
> ---------------------------
> @Service(FService.class)
> public class FServiceImpl implements FService {
>     @Reference
>     protected CService c;
>
>     @Reference
>     protected DService d;
> }
>
> Here, CSubService and DSubService are sub sets of CService and DService
> respectively.
>
> When loading this composite file, I haven't got any error message or even
> warning message, which supposed to appear.
> And when I switch the CSubService to  CSuperService and DSubService to
> DSuperService (CSuperService and DSuperService are super sets of CService
> and DService respectively), I got warning message this time.
> WARNING: Component reference interface incompatible with reference
> interface: Component = FComponent Reference = d
> WARNING: Component reference interface incompatible with reference
> interface: Component = FComponent Reference = c
>
> It seems that it works just on the opposite to the specification. Is there
> anything wrong with it? Thanks.
>
>
Hi Susan

I'd have to look at the code to be sure I understand precisely ho your test
works. On the face of it though this looks like a problem. Can you raise a
JIRA and attach the test case to it so we can talk some more about it?

Regards

Simon

Reply via email to