summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.3.2/vtest/java-api/annotations
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-08-31 13:09:18 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-08-31 13:09:18 +0000
commitbb3e993e62950b7907566d97bdc63c55d0fff38b (patch)
tree16b7e2106675f615330b7a104b3dbce7aa2f418e /branches/sca-java-1.3.2/vtest/java-api/annotations
parentbcbd8cb0b78cf576d73a0140476b2996a36e5245 (diff)
TUSCANY-2501 - raise an error if the user tries to mix annotated and unannotated references in a component. Change the vtests and validation tests to take account of this change.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@690691 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.3.2/vtest/java-api/annotations')
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java4
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java11
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java (renamed from branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.java)16
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite7
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java20
5 files changed, 50 insertions, 8 deletions
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
index 3322b542a9..b28704a3b4 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
@@ -48,4 +48,8 @@ public interface AService {
public boolean isB7SetterCalled();
public boolean isB16Null();
public boolean isB17Null();
+
+ public boolean isB4Null();
+ public boolean isB5Null();
+ public boolean isB6Null();
}
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
index 916ee25d7a..67299d322d 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
@@ -201,4 +201,15 @@ public class AServiceImpl implements AService {
return b17 == null;
}
+ public boolean isB4Null() {
+ return b4 == null;
+ }
+
+ public boolean isB5Null() {
+ return b5 == null;
+ }
+
+ public boolean isB6Null() {
+ return b6 == null;
+ }
}
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.java b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java
index 82cd8014cd..a819dfd87d 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java
@@ -24,7 +24,7 @@ import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.BService;
import org.osoa.sca.annotations.Service;
@Service(AService.class)
-public class AnotherAServiceImpl implements AService {
+public class AUnannotatedServiceImpl implements AService {
public BService b4; // field injection (public, un-annotated)
@@ -32,7 +32,7 @@ public class AnotherAServiceImpl implements AService {
public BService b6; // setter injection (public, un-annotated)
- public AnotherAServiceImpl() {
+ public AUnannotatedServiceImpl() {
}
public String getName() {
@@ -126,4 +126,16 @@ public class AnotherAServiceImpl implements AService {
public boolean isB17Null() {
return true;
}
+
+ public boolean isB4Null() {
+ return b4 == null;
+ }
+
+ public boolean isB5Null() {
+ return b5 == null;
+ }
+
+ public boolean isB6Null() {
+ return b6 == null;
+ }
}
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite
index 9937173894..b4ad1e77d5 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite
@@ -26,9 +26,6 @@
<reference name="b1" target="BComponent"/>
<reference name="b2" target="BComponent"/>
<reference name="b3" target="BComponent"/>
- <reference name="b4" target="BComponent"/>
- <reference name="b5" target="BComponent"/>
- <reference name="b6" target="BComponent"/>
<reference name="b7" target="BComponent"/>
<reference name="b8" target="BComponent"/>
<reference name="b9" target="BComponent"/>
@@ -40,8 +37,8 @@
<reference name="b15" multiplicity="1..n" target="BComponent BComponent"/>
</component>
- <component name="AnotherAComponent">
- <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AnotherAServiceImpl"/>
+ <component name="AUnannotatedComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AUnannotatedServiceImpl"/>
<reference name="b4" target="BComponent"/>
<reference name="b5" target="BComponent"/>
<reference name="b6" target="BComponent"/>
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
index a399d892cb..1fe50b4ea7 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
@@ -110,7 +110,12 @@ public class ReferenceAnnotationTestCase {
*/
@Test
public void atReference2() throws Exception {
- AService anotherA = ServiceFinder.getService(AService.class, "AnotherAComponent");
+ AService anotherA = ServiceFinder.getService(AService.class, "AUnannotatedComponent");
+
+ Assert.assertFalse(anotherA.isB4Null());
+ Assert.assertTrue(anotherA.isB5Null());
+ Assert.assertFalse(anotherA.isB6Null());
+
Assert.assertEquals("BService", anotherA.getB4Name());
try {
anotherA.getB5Name();
@@ -208,4 +213,17 @@ public class ReferenceAnnotationTestCase {
Assert.assertTrue(a.isB16Null());
Assert.assertTrue(a.isB17Null());
}
+
+ /**
+ * Java Component Implementation Spec
+ * Section 1.2.7
+ * Line 361 when @Property and @Reference annotations are present
+ * then unannotated fields are ignored
+ */
+ @Test
+ public void atReference8() throws Exception {
+ Assert.assertTrue(a.isB4Null());
+ Assert.assertTrue(a.isB5Null());
+ Assert.assertTrue(a.isB6Null());
+ }
}