You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2006/08/11 08:31:59 UTC

Re: svn commit: r430621 - in /incubator/tuscany/java: samples/sca/helloworldws/ samples/sca/helloworldwsclient/ samples/sca/helloworldwsclient/src/main/java/helloworld/ samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/ sca/bindings/binding.ax

Hi, Rick.

With your check-in, I'm seeing the EchoBinding test case is failing with the 
following exception:

org.apache.tuscany.spi.loader.InvalidReferenceException: No target for 
service  [ClientService]
 at org.apache.tuscany.core.loader.ServiceLoader.load(ServiceLoader.java)
 at org.apache.tuscany.core.loader.ServiceLoader.load(ServiceLoader.java:1)
 at 
org.apache.tuscany.core.loader.LoaderRegistryImpl.load(LoaderRegistryImpl.java:90)
 at 
org.apache.tuscany.core.implementation.composite.CompositeLoader.load(CompositeLoader.java:75)
 at 
org.apache.tuscany.core.implementation.composite.CompositeLoader.load(CompositeLoader.java:50)
 at 
org.apache.tuscany.core.loader.LoaderRegistryImpl.load(LoaderRegistryImpl.java:90)
 at 
org.apache.tuscany.core.loader.LoaderRegistryImpl.load(LoaderRegistryImpl.java:107)
 at 
org.apache.tuscany.core.implementation.composite.CompositeComponentTypeLoader.loadFromSidefile(CompositeComponentTypeLoader.java:46)
 at 
org.apache.tuscany.core.implementation.composite.CompositeComponentTypeLoader.load(CompositeComponentTypeLoader.java:38)
 at 
org.apache.tuscany.core.implementation.composite.CompositeComponentTypeLoader.load(CompositeComponentTypeLoader.java:20)
 at 
org.apache.tuscany.core.loader.LoaderRegistryImpl.loadComponentType(LoaderRegistryImpl.java:157)
 at 
org.apache.tuscany.core.deployer.DeployerImpl.load(DeployerImpl.java:111)
 at 
org.apache.tuscany.core.deployer.DeployerImpl.deploy(DeployerImpl.java:90)
 at 
org.apache.tuscany.core.launcher.Launcher.bootApplication(Launcher.java:171)
 at org.apache.tuscany.test.SCATestCase.setUp(SCATestCase.java:63)
 at echo.BootstrapTestCase.setUp(BootstrapTestCase.java:23)
 at junit.framework.TestCase.runBare(TestCase.java:125)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
 at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

I adjusted the scdl file per SCA 0.95 spec:

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="echo.sample">
<service name="ClientService">
<interface.java class="echo.Client"/>
<binding.echo/>
<reference>Client</reference>
</service>
<component name="Client">
<implementation.java class="echo.ClientImpl"/>
<reference name="echoReference">EchoReference</reference>
</component>
<reference name="EchoReference">
<interface.java interface="echo.Echo"/>
<binding.echo/>
</reference>
</composite>

Now the ServiceLoader.java is problematic because it assumes it'll get 
"reference" before the "binding" which is not case per SCA 0.95 spec:

<service name="xs:NCName" multiplicity="0..1 or 1..1 or 0..n or 1..n"?>*
<interface/>
<binding uri="xs:anyURI"?/>*
<reference>wire-target-URI</reference>+
</service>

<component name="xs:NCName">*
<implementation/>
<property name="xs:NCName" source="sca:Property"?>*
property-value
</property>
<reference name="xs:NCName"/>*
wire-target-URI
</reference>
</component>

The ComponentLoader.java cannot handle the reference element either since 
the SCA spec 0.95 also use the element content instead of "target" 
attribute.

I attached a patch to fix the problem but some of the SCDLs and test cases 
need to be adjusted to conform to the SCA 0.95 spec.

Thanks,
Raymond

----- Original Message ----- 
From: <ri...@apache.org>
To: <tu...@ws.apache.org>
Sent: Thursday, August 10, 2006 6:59 PM
Subject: svn commit: r430621 - in /incubator/tuscany/java: 
samples/sca/helloworldws/ samples/sca/helloworldwsclient/ 
samples/sca/helloworldwsclient/src/main/java/helloworld/ 
samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/ 
sca/bindings/binding.ax...


> Author: rineholt
> Date: Thu Aug 10 18:59:40 2006
> New Revision: 430621
>
> URL: http://svn.apache.org/viewvc?rev=430621&view=rev
> Log:
> TUSCANY-575
> http://issues.apache.org/jira/browse/TUSCANY-575
> fix service element to use child reference element instead of target 
> attribute
> mock can be a pain
> feed java interface specified in service to service element (still a tad 
> of a hack)
>
> Added:
> 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java
> Modified:
>    incubator/tuscany/java/samples/sca/helloworldws/setup.bat
>    incubator/tuscany/java/samples/sca/helloworldwsclient/run.bat
> 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java
> 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java
> 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/default.scdl
> 
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
> 
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
> 
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java
> 
> incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java
> 
> incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java
> 
> incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl
> 
> incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl
>
> Modified: incubator/tuscany/java/samples/sca/helloworldws/setup.bat
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/setup.bat?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> --- incubator/tuscany/java/samples/sca/helloworldws/setup.bat (original)
> +++ incubator/tuscany/java/samples/sca/helloworldws/setup.bat Thu Aug 10 
> 18:59:40 2006
> @@ -11,3 +11,6 @@
> rem jar -xf 
> "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip"
> jar -xf 
> "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip"
> popd
> +rem hack
> +mkdir target\apache-tomcat-5.5.17\shared\extension
> +copy target\apache-tomcat-5.5.17\shared\lib\axis2-1.0-SNAPSHOT.jar 
> target\apache-tomcat-5.5.17\shared\extension
>
> Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/run.bat
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/run.bat?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> --- incubator/tuscany/java/samples/sca/helloworldwsclient/run.bat 
> (original)
> +++ incubator/tuscany/java/samples/sca/helloworldwsclient/run.bat Thu Aug 
> 10 18:59:40 2006
> @@ -4,4 +4,21 @@
> pushd target\standalone
> jar -xf 
> "%USERPROFILE%\.m2\repository\org\apache\tuscany\standalone\1.0-SNAPSHOT\standalone-1.0-SNAPSHOT-bin.zip"
> popd
> +move target\standalone\extension\axiom-api-1.0.jar target\standalone\boot
> +move target\standalone\extension\axiom-impl-1.0.jar 
> target\standalone\boot
> +move target\standalone\extension\axis2-kernel-1.0.jar 
> target\standalone\boot
> +move target\standalone\extension\common-2.2.1-SNAPSHOT.jar 
> target\standalone\boot
> +move target\standalone\extension\commons-codec-1.3.jar 
> target\standalone\boot
> +move target\standalone\extension\commons-httpclient-3.0.jar 
> target\standalone\boot
> +move target\standalone\extension\ecore-2.2.1-SNAPSHOT.jar 
> target\standalone\boot
> +move target\standalone\extension\ecore-change-2.2.1-SNAPSHOT.jar 
> target\standalone\boot
> +move target\standalone\extension\ecore-xmi-2.2.1-SNAPSHOT.jar 
> target\standalone\boot
> +move target\standalone\extension\junit-3.8.1.jar target\standalone\boot
> +move target\standalone\extension\neethi-1.0.1.jar target\standalone\boot
> +move target\standalone\extension\sdo-api-1.0-SNAPSHOT.jar 
> target\standalone\boot
> +move target\standalone\extension\tuscany-sdo-impl-1.0-SNAPSHOT.jar 
> target\standalone\boot
> +move target\standalone\extension\XmlSchema-1.0.2.jar 
> target\standalone\boot
> +move target\standalone\extension\xsd-2.2.1-SNAPSHOT.jar 
> target\standalone\boot
> +move target\standalone\extension\wstx-asl-2.9.3.jar 
> target\standalone\boot
> +move target\standalone\extension\commons-logging-1.0.3.jar 
> target\standalone\boot
> java %java_debug_set% -jar target\standalone\bin\launcher.jar  --classpath 
> "%USERPROFILE%\.m2\repository\org\apache\tuscany\samples\sca\sample-helloworldwsclient\1.0-SNAPSHOT\sample-helloworldwsclient-1.0-SNAPSHOT.jar" 
> %*
>
> Modified: 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java 
> (original)
> +++ 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java 
> Thu Aug 10 18:59:40 2006
> @@ -59,7 +59,7 @@
>
>         // Invoke the HelloWorld service
>         CompositeContext compositeContext = 
> CurrentCompositeContext.getContext();
> -        HelloWorldService helloWorldService= 
> compositeContext.locateService(HelloWorldService.class, 
> "HelloWorldService");
> +        HelloWorldService helloWorldService= 
> compositeContext.locateService(HelloWorldService.class, 
> "HelloWorldServiceComponent");
>         String value = helloWorldService.getGreetings("World");
>
>         System.out.println(value);
>
> Modified: 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java 
> (original)
> +++ 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java 
> Thu Aug 10 18:59:40 2006
> @@ -16,9 +16,10 @@
>  */
> package helloworld;
>
> -/**
> - * This is the business interface of the HelloWorld greetings service.
> - */
> +import org.osoa.sca.annotations.Service;
> +
> +
> +@Service
> public interface HelloWorldService {
>
>     public String getGreetings(String name);
>
> Added: 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java?rev=430621&view=auto
> ==============================================================================
> ---  
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java 
> (added)
> +++ 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java 
> Thu Aug 10 18:59:40 2006
> @@ -0,0 +1,55 @@
> +/**
> + *
> + *  Copyright 2005 The Apache Software Foundation or its licensors, as 
> applicable.
> + *
> + *  Licensed under the Apache License, Version 2.0 (the "License");
> + *  you may not use this file except in compliance with the License.
> + *  You may obtain a copy of the License at
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + *  Unless required by applicable law or agreed to in writing, software
> + *  distributed under the License is distributed on an "AS IS" BASIS,
> + *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
> implied.
> + *  See the License for the specific language governing permissions and
> + *  limitations under the License.
> + */
> +package helloworld;
> +
> +import org.osoa.sca.CompositeContext;
> +import org.osoa.sca.CurrentCompositeContext;
> +import org.osoa.sca.annotations.Scope;
> +
> +
> +
> +//import org.osoa.sca.CurrentModuleContext;
> +//import org.osoa.sca.ModuleContext;
> +//
> +//import org.apache.tuscany.core.client.TuscanyRuntime;
> +//import org.apache.tuscany.common.monitor.MonitorFactory;
> +//import 
> org.apache.tuscany.common.monitor.impl.JavaLoggingMonitorFactory;
> +
> +/**
> + * This client program shows how to create an SCA runtime, start it,
> + * locate the HelloWorld service and invoke it.
> + */
> +
> +
> +@Scope("MODULE")
> +public class HelloWorldServiceComponent implements HelloWorldService {
> +
> +    HelloWorldService helloWorldService;
> +
> +    public String getGreetings(String name) {
> +        // TODO Auto-generated method stub
> +        return helloWorldService.getGreetings(name);
> +    }
> +
> +    public HelloWorldService getHelloWorldService() {
> +        return helloWorldService;
> +    }
> +
> +    public void setHelloWorldService(HelloWorldService helloWorldService) 
> {
> +        this.helloWorldService = helloWorldService;
> +    }
> +}
>
> Modified: 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/default.scdl
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/default.scdl?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/default.scdl 
> (original)
> +++ 
> incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/default.scdl 
> Thu Aug 10 18:59:40 2006
> @@ -18,10 +18,17 @@
> 
> xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
>            name="sampleHelloworld">
>
> +    <component name="HelloWorldServiceComponent">
> +      <implementation.java 
> class="helloworld.HelloWorldServiceComponent"/>
> +      <references>
> +        <reference name="helloWorldService" target="HelloWorldService" />
> +       </references>
> +    </component>
> +
>     <reference name="HelloWorldService">
>         <interface.java interface="helloworld.HelloWorldService"/>
>         <binding.ws 
> endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
>  location="wsdl/helloworld.wsdl" />
>     </reference>
>
> -</composite>
> \ No newline at end of file
> +</composite>
>
> Modified: 
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java 
> (original)
> +++ 
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java 
> Thu Aug 10 18:59:40 2006
> @@ -32,8 +32,8 @@
>                            BoundServiceDefinition<WebServiceBinding> 
> serviceDefinition,
>                            DeploymentContext deploymentContext) {
>         WebServiceBinding wsBinding = serviceDefinition.getBinding();
> -        // FIXME need to get interface for the service
> -        Class<?> interfaze = null;
> +
> +        Class<?> interfaze = 
> serviceDefinition.getServiceContract().getInterfaceClass();
>         //FIXME: Axis2Service needs an instance of ServletHost as 
> parameter. How to get it?
>         return new Axis2Service(
>             serviceDefinition.getName(),
>
> Modified: 
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java 
> (original)
> +++ 
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java 
> Thu Aug 10 18:59:40 2006
> @@ -24,6 +24,7 @@
> import org.apache.tuscany.spi.wire.TargetInvoker;
>
> import org.apache.axiom.om.OMElement;
> +import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axis2.AxisFault;
> @@ -43,6 +44,7 @@
>     private SDODataBinding dataBinding;
>     private SOAPFactory soapFactory;
>     private OperationClient operationClient;
> +
>
>     public Axis2TargetInvoker(QName wsdlOperationName, Options options, 
> SDODataBinding dataBinding,
>                               SOAPFactory soapFactory,
> @@ -68,8 +70,20 @@
>             SOAPEnvelope env = soapFactory.getDefaultEnvelope();
>
>             if (payload != null && payload.getClass().isArray() && 
> ((Object[]) payload).length > 0) {
> -                OMElement requestOM = dataBinding.toOMElement((Object[]) 
> payload);
> -                env.getBody().addChild(requestOM);
> +//                OMElement requestOM = 
> dataBinding.toOMElement((Object[]) payload);
> +//                env.getBody().addChild(requestOM);
> +//TODO HACK
> +                OMFactory fac = env.getOMFactory();
> +                OMElement opE = fac.createOMElement("getGreetings" 
> ,"http://helloworld", "helloworld");
> +                //            <helloworld:name>World</helloworld:name>
> +
> +                OMElement parmE = fac.createOMElement("name" 
> ,"http://helloworld", "helloworld");
> +                opE.addChild(parmE);
> +                parmE.addChild(fac.createOMText(((Object[])payload)[0] + 
> ""));
> +                env.getBody().addChild((opE));
> +//TODO HACK
> +
> +
>             }
>
>             MessageContext requestMC = new MessageContext();
>
> Modified: 
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java 
> (original)
> +++ 
> incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java 
> Thu Aug 10 18:59:40 2006
> @@ -40,6 +40,7 @@
> import org.apache.tuscany.spi.extension.LoaderExtension;
> import org.apache.tuscany.spi.loader.LoaderException;
> import org.apache.tuscany.spi.loader.LoaderRegistry;
> +import org.apache.tuscany.spi.loader.LoaderUtil;
> import org.apache.tuscany.spi.services.wsdl.WSDLDefinitionRegistry;
> import org.osoa.sca.annotations.Scope;
> import org.xml.sax.InputSource;
> @@ -78,12 +79,14 @@
>         String uri = null;
>         endpointAttribute = reader.getAttributeValue(null, "endpoint");
>         wsdlLocation = reader.getAttributeValue(null, "location");
> +        LoaderUtil.skipToEndElement(reader);
>         try {
>             return createBinding(uri, endpointAttribute, 
> deploymentContext);
>         } catch (Exception e) {
>
>             throw new LoaderException(e);
>         }
> +
>     }
>
>     @SuppressWarnings("unchecked")
>
> Modified: 
> incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java 
> (original)
> +++ 
> incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java 
> Thu Aug 10 18:59:40 2006
> @@ -40,6 +40,8 @@
> import org.apache.tuscany.spi.model.ServiceDefinition;
> import org.apache.tuscany.spi.annotation.Autowire;
>
> +import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
> +
> /**
>  * Loads a service definition from an XML-based assembly file
>  *
> @@ -47,6 +49,7 @@
>  */
> public class ServiceLoader extends LoaderExtension<ServiceDefinition> {
>     private static final QName SERVICE = new QName(XML_NAMESPACE_1_0, 
> "service");
> +    private static final QName REFERENCE = new QName(XML_NAMESPACE_1_0, 
> "reference");
>
>     @Constructor({"registry"})
>     public ServiceLoader(@Autowire LoaderRegistry registry) {
> @@ -64,18 +67,25 @@
>         throws XMLStreamException, LoaderException {
>         assert SERVICE.equals(reader.getName());
>         String name = reader.getAttributeValue(null, "name");
> -        String target = reader.getAttributeValue(null, "target");
> +        String target = null ;
>         Binding binding = null;
>         ServiceContract serviceContract = null;
>         while (true) {
>             int i = reader.next();
>             switch (i) {
>                 case START_ELEMENT:
> -                    ModelObject o = registry.load(parent, reader, 
> deploymentContext);
> -                    if (o instanceof ServiceContract) {
> -                        serviceContract = (ServiceContract) o;
> -                    } else if (o instanceof Binding) {
> -                        binding = (Binding) o;
> +
> +                    //there is a reference already using this qname which 
> doesn't seem appropriate.
> +                    if(REFERENCE.equals(reader.getName())){
> +                        target= reader.getElementText();
> +                    }else{
> +
> +                        ModelObject o = registry.load(parent, reader, 
> deploymentContext);
> +                        if (o instanceof ServiceContract) {
> +                            serviceContract = (ServiceContract) o;
> +                        } else if (o instanceof Binding) {
> +                            binding = (Binding) o;
> +                        }
>                     }
>                     break;
>                 case END_ELEMENT:
>
> Modified: 
> incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java 
> (original)
> +++ 
> incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java 
> Thu Aug 10 18:59:40 2006
> @@ -40,6 +40,7 @@
>  */
> public class ServiceLoaderTestCase extends MockObjectTestCase {
>     private static final QName SERVICE = new QName(XML_NAMESPACE_1_0, 
> "service");
> +    private static final QName REFERENCE = new QName(XML_NAMESPACE_1_0, 
> "reference");
>
>     private ServiceLoader loader;
>     private DeploymentContext deploymentContext;
> @@ -48,12 +49,12 @@
>
>     public void testWithNoInterface() throws LoaderException, 
> XMLStreamException {
>         String name = "serviceDefinition";
> -        String target = "target";
> +//        String target = "target";
> 
> mockReader.expects(once()).method("getName").will(returnValue(SERVICE));
>         // todo figure out how to check ordering
> -        mockReader.expects(atLeastOnce()).method("getAttributeValue")
> +        mockReader.expects(once()).method("getAttributeValue")
>                 .with(ANYTHING, ANYTHING)
> -                .will(onConsecutiveCalls(returnValue(name), 
> returnValue(target)));
> +                .will(returnValue(name));
> 
> mockReader.expects(once()).method("next").will(returnValue(END_ELEMENT));
>         ServiceDefinition serviceDefinition = loader.load(null, 
> (XMLStreamReader) mockReader.proxy(), null);
>         assertNotNull(serviceDefinition);
> @@ -65,15 +66,21 @@
>         String target = "target";
>         ServiceContract sc = new ServiceContract() {
>         };
> - 
> mockReader.expects(once()).method("getName").will(returnValue(SERVICE));
> +        mockReader.expects(atLeastOnce()).method("getName")
> + 
> .will(onConsecutiveCalls(returnValue(SERVICE),returnValue(SERVICE)
> +                  ,returnValue(REFERENCE)));
>         // todo figure out how to check ordering
> -        mockReader.expects(atLeastOnce()).method("getAttributeValue")
> +        mockReader.expects(once()).method("getAttributeValue")
>                 .with(ANYTHING, ANYTHING)
> -                .will(onConsecutiveCalls(returnValue(name), 
> returnValue(target)));
> +                .will((returnValue(name)));
>         mockReader.expects(atLeastOnce()).method("next")
> -            .will(onConsecutiveCalls(returnValue(START_ELEMENT), 
> returnValue(END_ELEMENT)));
> +            .will(onConsecutiveCalls(returnValue(START_ELEMENT), 
> returnValue(START_ELEMENT), returnValue(END_ELEMENT)));
>         mockRegistry.expects(once()).method("load").with(eq(null), 
> eq(mockReader.proxy()), eq(deploymentContext))
>             .will(returnValue(sc));
> + 
> mockReader.expects(once()).method("getElementText").withNoArguments()
> +
> +        .will((returnValue(target)));
> +
>         ServiceDefinition serviceDefinition =
>             loader.load(null, (XMLStreamReader) mockReader.proxy(), 
> deploymentContext);
>         assertNotNull(serviceDefinition);
>
> Modified: 
> incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl 
> (original)
> +++ 
> incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl 
> Thu Aug 10 18:59:40 2006
> @@ -17,9 +17,10 @@
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> 
> xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
>            name="boot1">
> -    <service name="service" target="component">
> +    <service name="service" >
>         <interface.java 
> interface="org.apache.tuscany.core.mock.component.BasicInterface"/>
>         <system:binding.system/>
> +        <reference>component</reference>
>     </service>
>
>     <component name="component">
>
> Modified: 
> incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl?rev=430621&r1=430620&r2=430621&view=diff
> ==============================================================================
> ---  
> incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl 
> (original)
> +++ 
> incubator/tuscany/java/sca/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl 
> Thu Aug 10 18:59:40 2006
> @@ -23,9 +23,10 @@
>            name="boot2">
>
>     <!-- expose Deployer API as a service -->
> -    <service name="deployer" target="deployerImpl">
> +    <service name="deployer" >
>         <interface.java 
> interface="org.apache.tuscany.spi.deployer.Deployer"/>
>         <system:binding.system/>
> +        <reference>deployerImpl</reference>
>     </service>
>
>     <!-- Component that provides the Deployer service -->
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-commits-help@ws.apache.org
>