You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2008/06/10 09:01:59 UTC

svn commit: r665992 - in /incubator/tuscany/java/sca: itest/ itest/recursive-multi-level/ itest/recursive-multi-level/src/ itest/recursive-multi-level/src/main/ itest/recursive-multi-level/src/main/java/ itest/recursive-multi-level/src/main/java/mysca/...

Author: slaws
Date: Tue Jun 10 00:01:58 2008
New Revision: 665992

URL: http://svn.apache.org/viewvc?rev=665992&view=rev
Log:
TUSCANY-2360 - Correct operation of autowire within recursive composites. Stop autowire wiring to self. Make top level composite reference override promoted reference.

Added:
    incubator/tuscany/java/sca/itest/recursive-multi-level/   (with props)
    incubator/tuscany/java/sca/itest/recursive-multi-level/pom.xml   (with props)
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java   (with props)
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java   (with props)
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java   (with props)
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java   (with props)
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite   (with props)
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite   (with props)
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite   (with props)
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/
    incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java   (with props)
Modified:
    incubator/tuscany/java/sca/itest/pom.xml
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java

Modified: incubator/tuscany/java/sca/itest/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/pom.xml?rev=665992&r1=665991&r2=665992&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/pom.xml (original)
+++ incubator/tuscany/java/sca/itest/pom.xml Tue Jun 10 00:01:58 2008
@@ -101,6 +101,7 @@
 		<module>policy-security</module>
                 <module>properties</module>
                 <module>recursive</module>
+                <module>recursive-multi-level</module>
                 <module>recursive-ws</module>
                 <module>references</module>
                 <module>serialization</module>

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jun 10 00:01:58 2008
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: incubator/tuscany/java/sca/itest/recursive-multi-level/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-multi-level/pom.xml?rev=665992&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-multi-level/pom.xml (added)
+++ incubator/tuscany/java/sca/itest/recursive-multi-level/pom.xml Tue Jun 10 00:01:58 2008
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you 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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-itest</artifactId>
+        <version>2.0-incubating-SNAPSHOT</version>
+        <!--relativePath>../pom.xml</relativePath-->
+    </parent>
+    <artifactId>itest-recursive-multi-level</artifactId>
+    <name>Apache Tuscany SCA Recusive Multi-Level Integration Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>       
+    </dependencies>
+</project>

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java?rev=665992&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java (added)
+++ incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java Tue Jun 10 00:01:58 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 mysca.test.myservice;
+
+
+public interface MyService {
+    String getLocation();
+    String getYear();
+}

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java?rev=665992&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java Tue Jun 10 00:01:58 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 mysca.test.myservice;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+import mysca.test.myservice.MyService;
+
+@Service(MyService.class)
+public class MyServiceImpl implements MyService {
+	
+	@Property(name="location")
+	protected String location = "ABC";
+
+    @Property(name="year")
+    protected String year = "2006";
+    
+
+    public String getLocation()
+    {
+       return location;
+    }
+
+    public String getYear()
+    {
+        return year;
+    }
+	
+
+}

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java?rev=665992&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java (added)
+++ incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java Tue Jun 10 00:01:58 2008
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 mysca.test.myservice;
+
+public interface MySimpleTotalService {
+    String getLocation();
+    String getYear();
+}

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java?rev=665992&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java Tue Jun 10 00:01:58 2008
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 mysca.test.myservice;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import mysca.test.myservice.MyService;
+import mysca.test.myservice.MySimpleTotalService;
+
+@Service(MySimpleTotalService.class)
+public class MySimpleTotalServiceImpl implements MySimpleTotalService
+{
+    // default required==true so it is 1:1
+    @Reference
+    public MyService myService;
+
+
+    public String getLocation()
+    {
+        return myService.getLocation();
+    }
+
+    public String getYear()
+    {
+        return myService.getYear();
+    }
+
+}

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite?rev=665992&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite Tue Jun 10 00:01:58 2008
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+ -->
+<composite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+           xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           xmlns:foo="http://foo" 
+           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+           xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0" 
+           name="TotalComposite1Auto"
+           targetNamespace="http://foo" 
+           local="true" 
+           autowire="false">
+
+    <property name="newLocation" type="xsd:anyURI">Level 1</property>
+    <property name="newYear" type="xsd:anyURI">2001</property>
+
+    <component name="ServiceComponentLevel1Auto">
+        <implementation.java class="mysca.test.myservice.MyServiceImpl"/>
+        <property name="location" source="$newLocation"/>
+        <property name="year" source="$newYear"/>
+    </component>
+
+    <service name="MyServiceLevel1Auto" promote="TotalServiceComponentLevel1Auto/MySimpleTotalService">
+        <interface.java interface="mysca.test.myservice.MySimpleTotalService"/>
+    </service>
+    
+    <component name="TotalServiceComponentLevel1Auto">
+        <implementation.java class="mysca.test.myservice.MySimpleTotalServiceImpl"/>
+        <reference name="myService" autowire="true"/>
+    </component>
+
+    <reference name="myServiceReference1Auto" promote="TotalServiceComponentLevel1Auto/myService">
+        <interface.java interface="mysca.test.myservice.MyService"/>
+   </reference>
+</composite>
+

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite?rev=665992&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite Tue Jun 10 00:01:58 2008
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+ -->
+<composite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+           xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           xmlns:foo="http://foo" 
+           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+           xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0" 
+           name="TotalComposite2Auto"
+           targetNamespace="http://foo" 
+           local="true" 
+           autowire="false">
+    
+    <property name="newLocation" type="xsd:anyURI">Level 2</property>
+    <property name="newYear" type="xsd:anyURI">2002</property>
+  
+    <component name="ServiceComponentLevel2Auto">
+        <implementation.java class="mysca.test.myservice.MyServiceImpl"/>
+        <property name="location">Default 2</property>
+        <property name="year">1992</property>
+    </component>
+  
+    <service name="MyServiceLevel2Auto" promote="TotalServiceInRecursive2Auto/MyServiceLevel1Auto"/>
+  
+    <component name="TotalServiceInRecursive2Auto">
+        <implementation.composite name="foo:TotalComposite1Auto"/>
+        <reference name="myServiceReference1Auto" autowire="true"/>
+        <property name="newLocation" source="$newLocation"/>
+        <property name="newYear" source="$newYear"/>
+    </component>
+  
+    <reference name="myServiceReference2Auto" promote="TotalServiceInRecursive2Auto/myServiceReference1Auto"/>
+</composite>
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite?rev=665992&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite Tue Jun 10 00:01:58 2008
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+ -->
+<composite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+           xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           xmlns:foo="http://foo" 
+           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+           xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0" 
+           name="TotalComposite3Auto"
+           targetNamespace="http://foo" 
+           local="true" 
+           autowire="false">
+
+    <property name="newLocation" type="xsd:anyURI">Level 3</property>
+    <property name="newYear" type="xsd:anyURI">2003</property>
+
+    <component name="ServiceComponentLevel3Auto">
+        <implementation.java class="mysca.test.myservice.MyServiceImpl"/>
+        <property name="location">Default 3</property>
+        <property name="year">1993</property>
+    </component>
+  
+    <service name="MyServiceLevel3Auto" promote="TotalServiceInRecursive3Auto/MyServiceLevel2Auto">
+    </service>
+
+    <component name="TotalServiceInRecursive3Auto" autowire="true">
+        <implementation.composite name="foo:TotalComposite2Auto"/>
+        <reference name="myServiceReference2Auto"/>
+        <property name="newLocation" source="$newLocation"/>
+        <property name="newYear" source="$newYear"/>
+    </component>
+    
+    <reference name="myServiceReference3Auto" promote="TotalServiceInRecursive3Auto/myServiceReference2Auto">
+    </reference>
+
+</composite>
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java?rev=665992&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java Tue Jun 10 00:01:58 2008
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 test.sca.tests;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import mysca.test.myservice.MySimpleTotalService;
+import junit.framework.TestCase;
+
+
+/**
+ * Tests to make sure that autowiring and recusive composite work together
+ *
+ */
+public class MultiLevelTestCase extends TestCase
+{
+    private SCADomain domain1;
+    private SCADomain domain2;
+    private SCADomain domain3;
+    private MySimpleTotalService myService1;
+    private MySimpleTotalService myService2;
+    private MySimpleTotalService myService3;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        domain1 = SCADomain.newInstance("TotalService1Auto.composite");
+        domain2 = SCADomain.newInstance("TotalService2Auto.composite");
+        domain3 = SCADomain.newInstance("TotalService3Auto.composite");
+
+        myService1 = domain1.getService(MySimpleTotalService.class, "TotalServiceComponentLevel1Auto");
+        myService2 = domain2.getService(MySimpleTotalService.class, "TotalServiceInRecursive2Auto/MyServiceLevel1Auto");
+        myService3 = domain3.getService(MySimpleTotalService.class, "TotalServiceInRecursive3Auto/MyServiceLevel2Auto");
+    }
+   
+    public void testLevel1()
+    {
+        assertEquals("Level 1",myService1.getLocation());
+        assertEquals("2001",myService1.getYear());
+    }
+    
+    public void testLevel2()
+    {
+        assertEquals("Default 2",myService2.getLocation());
+        assertEquals("1992",myService2.getYear());
+    }
+
+    public void testLevel3()
+    {
+        assertEquals("Default 3",myService3.getLocation());
+        assertEquals("1993",myService3.getYear());
+    }
+}

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java?rev=665992&r1=665991&r2=665992&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java Tue Jun 10 00:01:58 2008
@@ -354,21 +354,31 @@
             // autowired reference
             Multiplicity multiplicity = componentReference.getMultiplicity();
             for (Component targetComponent : composite.getComponents()) {
-                for (ComponentService targetComponentService : targetComponent.getServices()) {
-                    if (componentReference.getInterfaceContract() == null ||
-                        interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
-                        
-                        Endpoint endpoint = endpointFactory.createEndpoint();
-                        endpoint.setTargetName(targetComponent.getName());
-                        endpoint.setSourceComponent(null); // TODO - fixed up at start
-                        endpoint.setSourceComponentReference(componentReference);
-                        endpoint.setTargetComponent(targetComponent);
-                        endpoint.setTargetComponentService(targetComponentService);
-                        endpoint.getCandidateBindings().addAll(componentReference.getBindings());
-                        endpoints.add(endpoint);
-                        
-                        if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) {
-                            break;
+                // prevent autowire connecting to self
+                boolean skipSelf = false;
+                for (ComponentReference targetComponentReference : targetComponent.getReferences()) {
+                    if (componentReference == targetComponentReference){
+                        skipSelf = true;
+                    }
+                }
+                
+                if (!skipSelf){
+                    for (ComponentService targetComponentService : targetComponent.getServices()) {
+                        if (componentReference.getInterfaceContract() == null ||
+                            interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+                            
+                            Endpoint endpoint = endpointFactory.createEndpoint();
+                            endpoint.setTargetName(targetComponent.getName());
+                            endpoint.setSourceComponent(null); // TODO - fixed up at start
+                            endpoint.setSourceComponentReference(componentReference);
+                            endpoint.setTargetComponent(targetComponent);
+                            endpoint.setTargetComponentService(targetComponentService);
+                            endpoint.getCandidateBindings().addAll(componentReference.getBindings());
+                            endpoints.add(endpoint);
+                            
+                            if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) {
+                                break;
+                            }
                         }
                     }
                 }
@@ -1035,15 +1045,28 @@
      * @param promotedReference
      */
     private void reconcileReferenceBindings(Reference reference, ComponentReference promotedReference) {
-        Set<Binding> bindings = new HashSet<Binding>();
-        bindings.addAll(promotedReference.getBindings());
-        bindings.addAll(reference.getBindings());
-        promotedReference.getBindings().clear();
-        for (Binding binding : bindings) {
+        List<Binding> bindings = new ArrayList<Binding>();
+        
+        // collect the top level bindings first
+        for (Binding binding : reference.getBindings()) {
             if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
-                promotedReference.getBindings().add(binding);
+                bindings.add(binding);
             }
         }
+        
+        // if there are not top level bindings to override the promoted bindings
+        // then collect the promoted bindings
+        if (bindings.size() == 0){
+            for (Binding binding : promotedReference.getBindings()) {
+                if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
+                    bindings.add(binding);
+                }
+            }
+        }
+        
+        promotedReference.getBindings().clear();
+        promotedReference.getBindings().addAll(bindings);
+        
         if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE || promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) {
             if (promotedReference.getBindings().size() > 1) {
                 warning("Component reference " + promotedReference.getName() + " has more than one wires",