summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.3.3/itest/references/src
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.3.3/itest/references/src')
-rw-r--r--branches/sca-java-1.3.3/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentWrongTargetImpl.java39
-rw-r--r--branches/sca-java-1.3.3/itest/references/src/main/resources/AutoWiredReferencesTest.composite9
-rw-r--r--branches/sca-java-1.3.3/itest/references/src/main/resources/ManualWiredReferencesTest.composite3
-rw-r--r--branches/sca-java-1.3.3/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java11
4 files changed, 61 insertions, 1 deletions
diff --git a/branches/sca-java-1.3.3/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentWrongTargetImpl.java b/branches/sca-java-1.3.3/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentWrongTargetImpl.java
new file mode 100644
index 0000000000..1cd7cb7fe5
--- /dev/null
+++ b/branches/sca-java-1.3.3/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentWrongTargetImpl.java
@@ -0,0 +1,39 @@
+/*
+ * 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 org.apache.tuscany.sca.itest.references;
+
+import org.osoa.sca.annotations.Reference;
+
+public class BComponentWrongTargetImpl implements BComponent {
+
+ protected CComponent cReference;
+
+ public BComponentWrongTargetImpl(@Reference(name = "cReference") CComponent cReference) {
+ this.cReference = cReference;
+ }
+
+ public String bFoo() {
+ return "BComponentWrongTarget";
+ }
+
+ public String fooC() {
+ return "B" + cReference.cFoo();
+ }
+
+}
diff --git a/branches/sca-java-1.3.3/itest/references/src/main/resources/AutoWiredReferencesTest.composite b/branches/sca-java-1.3.3/itest/references/src/main/resources/AutoWiredReferencesTest.composite
index 9f88f05abe..894f6681c2 100644
--- a/branches/sca-java-1.3.3/itest/references/src/main/resources/AutoWiredReferencesTest.composite
+++ b/branches/sca-java-1.3.3/itest/references/src/main/resources/AutoWiredReferencesTest.composite
@@ -37,7 +37,16 @@
<reference name="dServiceReferences" target="DComponent DComponent1" />
</component>
+
+ <component name="AComponentAutowire" autowire="true">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ </component>
+ <component name="BComponentWrongTarget">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.BComponentWrongTargetImpl" />
+ </component>
+
<component name="BComponent">
<implementation.java class="org.apache.tuscany.sca.itest.references.BComponentImpl" />
</component>
diff --git a/branches/sca-java-1.3.3/itest/references/src/main/resources/ManualWiredReferencesTest.composite b/branches/sca-java-1.3.3/itest/references/src/main/resources/ManualWiredReferencesTest.composite
index 3b546a34e0..708960974b 100644
--- a/branches/sca-java-1.3.3/itest/references/src/main/resources/ManualWiredReferencesTest.composite
+++ b/branches/sca-java-1.3.3/itest/references/src/main/resources/ManualWiredReferencesTest.composite
@@ -26,7 +26,8 @@
<component name="AComponent" >
<implementation.java class="org.apache.tuscany.sca.itest.references.AComponentImpl" />
<reference name="bReference" target="BComponent" />
- <reference name="cReference" target="CComponent/CComponent">
+ <reference name="cReference" target="CComponent/CComponentImpl">
+ <!-- reference name="cReference" target="CComponent"-->
<binding.sca uri="DComponent"/>
</reference>
<reference name="dReference1" >
diff --git a/branches/sca-java-1.3.3/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java b/branches/sca-java-1.3.3/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java
index b803f4bfa4..bfd542e2f2 100644
--- a/branches/sca-java-1.3.3/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java
+++ b/branches/sca-java-1.3.3/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java
@@ -29,11 +29,13 @@ import org.junit.Test;
public class AutoWiredReferenceTestCase {
private static SCADomain domain;
private static AComponent acomponent;
+ private static AComponent acomponentAutowire;
@BeforeClass
public static void init() throws Exception {
domain = SCADomain.newInstance("AutoWiredReferencesTest.composite");
acomponent = domain.getService(AComponent.class, "AComponent");
+ acomponentAutowire = domain.getService(AComponent.class, "AComponentAutowire");
}
@AfterClass
@@ -87,5 +89,14 @@ public class AutoWiredReferenceTestCase {
Assert.assertTrue(true);
}
}
+
+ @Test
+ public void testTargetPrecendence() {
+ try {
+ assertEquals("BComponent", acomponentAutowire.fooB());
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
}