summaryrefslogtreecommitdiffstats
path: root/java/sca-contrib/vtest/java-api/annotations/property
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca-contrib/vtest/java-api/annotations/property')
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/pom.xml46
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java82
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java48
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java32
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java38
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java35
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java240
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java116
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java32
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java87
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java87
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java87
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java88
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java88
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java88
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/main/resources/property.composite143
-rw-r--r--java/sca-contrib/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java299
17 files changed, 1636 insertions, 0 deletions
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/pom.xml b/java/sca-contrib/vtest/java-api/annotations/property/pom.xml
new file mode 100644
index 0000000000..0c36e98879
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/pom.xml
@@ -0,0 +1,46 @@
+<?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>java-api-annotations</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-property</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @Property</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java
new file mode 100644
index 0000000000..5cfea1b099
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java
@@ -0,0 +1,82 @@
+/*
+ * 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.vtest.javaapi.annotations.property;
+
+/**
+ * Simple Service
+ */
+public interface AService {
+
+ public String getName();
+
+ public String getP1();
+
+ public String getP2();
+
+ public String getP3();
+
+ public String getP4();
+
+ public String getP5();
+
+ public String getP6();
+
+ public String getP7AString();
+
+ public int getP7BInt();
+
+ public String getP8AString();
+
+ public int getP8BInt();
+
+ public String getP9AString();
+
+ public int getP9BInt();
+
+ public String getP10AString();
+
+ public int getP10BInt();
+
+ public String getP11AString();
+
+ public int getP11BInt();
+
+ public String getP12AString();
+
+ public int getP12BInt();
+
+ public String getP15();
+
+ public String getP16();
+
+ public String getP17();
+
+ public String getP18();
+
+ public int getP19Size();
+
+ public String getP20(int i);
+
+ public int getP20Size();
+
+ public int getP21(int i);
+
+ public int getP21Size();
+
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java
new file mode 100644
index 0000000000..5ddc59f8b6
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java
@@ -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 org.apache.tuscany.sca.vtest.javaapi.annotations.property;
+
+/**
+ * Simple Service
+ */
+public interface AnotherAService {
+
+ public String getName();
+
+ public String getP13();
+
+ public String getP14();
+
+ public String getP22();
+
+ public String getP23();
+
+ public String getP24();
+
+ public String getP25();
+
+ public boolean getP14SetterIsCalled();
+
+ public boolean getP23SetterIsCalled();
+
+ public boolean getP24SetterIsCalled();
+
+ public boolean getP25SetterIsCalled();
+
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java
new file mode 100644
index 0000000000..c39d4e2504
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java
@@ -0,0 +1,32 @@
+/*
+ * 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.vtest.javaapi.annotations.property;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ String getName();
+
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java
new file mode 100644
index 0000000000..5de3b5fcff
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java
@@ -0,0 +1,38 @@
+/*
+ * 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.vtest.javaapi.annotations.property;
+
+
+/**
+ * Simple Service used by another service
+ */
+public interface CService {
+
+ String getName();
+
+ public String getB1Name();
+
+ public String getP2();
+
+ public int getP3();
+
+ public String getP4();
+
+ public String getConstructor();
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java
new file mode 100644
index 0000000000..f30c4c69fc
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java
@@ -0,0 +1,35 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+/**
+ * A simple object to hold a string
+ */
+public class AObject {
+
+ public String aString;
+ public int bInt;
+
+ public AObject() {
+ this.aString = null;
+ this.bInt = 0;
+ }
+
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
new file mode 100644
index 0000000000..6dd91b598d
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
@@ -0,0 +1,240 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.AService;
+import org.oasisopen.sca.annotation.Service;
+import org.oasisopen.sca.annotation.Property;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Property
+ protected String p1; // simple Java type injected via field
+
+ @Property
+ public String p2; // simple Java type injected via field
+
+ protected String p3; // simple Java type injected via setter
+
+ public String p4; // simple Java type injected via setter
+
+ protected String p5; // simple Java type injected via constructor parameter
+
+ public String p6; // simple Java type injected via constructor parameter
+
+ @Property(required=true)
+ protected AObject p7; // complex Java type injected via field
+
+ @Property
+ public AObject p8; // complex Java type injected via field
+
+ protected AObject p9; // complex Java type injected via setter
+
+ public AObject p10; // complex Java type injected via setter
+
+ protected AObject p11; // complex Java type injected via constructor parameter
+
+ public AObject p12; // complex Java type injected via constructor parameter
+
+ @Property(name="pFifteen")
+ protected String p15; // injected via field with different name
+
+ protected String p16; // injected via setter with different name
+
+ @Property(name="p17", required=false)
+ public String p17; // injected via field but not defined in composite
+
+ public String p18; // injected via setter but not defined in composite
+
+ @Property(name="p19", required=true)
+ public List<String> p19; // a List and injected via field with no element
+
+ public List<String> p20; // a List and injected via setter
+
+ @Property(required=false)
+ public Integer[] p21; // an array and injected via field
+
+ public String getName() {
+ return "AService";
+ }
+
+ public AServiceImpl(
+ @Property(name = "p5") String p5,
+ @Property(name = "p6") String p6,
+ @Property(name = "p11") AObject p11,
+ @Property(name = "p12") AObject p12
+ ) {
+ super();
+ this.p5 = p5;
+ this.p6 = p6;
+ this.p11 = p11;
+ this.p12 = p12;
+ }
+
+ @Property
+ public void setP3(String p3) {
+ this.p3 = p3;
+ }
+
+ @Property(required=true)
+ public void setP4(String p4) {
+ this.p4 = p4;
+ }
+
+ @Property
+ public void setP9(AObject p9) {
+ this.p9 = p9;
+ }
+
+ @Property
+ public void setP10(AObject p10) {
+ this.p10 = p10;
+ }
+
+ @Property(name="pSixteen")
+ public void setP16(String p16) {
+ this.p16 = p16;
+ }
+
+ @Property(name="p18", required=false)
+ public void setP18(String p18) {
+ this.p18 = p18;
+ }
+
+ @Property(name="p20", required=true)
+ public void setP20(List<String> p20) {
+ this.p20 = p20;
+ }
+
+ public String getP1() {
+ return p1;
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public String getP3() {
+ return p3;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+
+ public String getP5() {
+ return p5;
+ }
+
+ public String getP6() {
+ return p6;
+ }
+
+ public String getP7AString() {
+ return p7.aString;
+ }
+
+ public int getP7BInt() {
+ return p7.bInt;
+ }
+
+ public String getP8AString() {
+ return p8.aString;
+ }
+
+ public int getP8BInt() {
+ return p8.bInt;
+ }
+
+ public String getP9AString() {
+ return p9.aString;
+ }
+
+ public int getP9BInt() {
+ return p9.bInt;
+ }
+
+ public String getP10AString() {
+ return p10.aString;
+ }
+
+ public int getP10BInt() {
+ return p10.bInt;
+ }
+
+ public String getP11AString() {
+ return p11.aString;
+ }
+
+ public int getP11BInt() {
+ return p11.bInt;
+ }
+
+ public String getP12AString() {
+ return p12.aString;
+ }
+
+ public int getP12BInt() {
+ return p12.bInt;
+ }
+
+ public String getP15() {
+ return p15;
+ }
+
+ public String getP16() {
+ return p16;
+ }
+
+ public String getP17() {
+ return p17;
+ }
+
+ public String getP18() {
+ return p18;
+ }
+
+ public int getP19Size() {
+ return p19.size();
+ }
+
+ public String getP20(int i) {
+ return p20.get(i);
+ }
+
+ public int getP20Size() {
+ return p20.size();
+ }
+
+ public int getP21(int i) {
+ return p21[i].intValue();
+ }
+
+ public int getP21Size() {
+ return p21.length;
+ }
+
+}
+
+
+
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java
new file mode 100644
index 0000000000..b6d51ef253
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java
@@ -0,0 +1,116 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.AnotherAService;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(AnotherAService.class)
+public class AnotherAServiceImpl implements AnotherAService {
+
+ public String p13; // injected via field and un-annotated
+
+ public String p14; // injected via setter and un-annotated
+
+ protected String p22; // unannotated protected field should not be injected
+
+ protected String p23; // un-annotated protected and has protected setter
+
+ protected String p24; // un-annotated protected field and has public setter
+
+ private String p25; // un-annotated private field and has public setter
+
+ public boolean p14SetterIsCalled = false;
+
+ public boolean p23SetterIsCalled = false;
+
+ public boolean p24SetterIsCalled = false;
+
+ public boolean p25SetterIsCalled = false;
+
+
+ public String getName() {
+ return "AService";
+ }
+
+ public void setP14(String p14) {
+ p14SetterIsCalled = true;
+ this.p14 = p14;
+ }
+
+ protected void setP23(String p23) {
+ p23SetterIsCalled = true;
+ this.p23 = p23;
+ }
+
+ public void setP24(String p24) {
+ p24SetterIsCalled = true;
+ this.p24 = p24;
+ }
+
+ public void setP25(String p25) {
+ p25SetterIsCalled = true;
+ this.p25 = p25;
+ }
+
+ public String getP13() {
+ return p13;
+ }
+
+ public String getP14() {
+ return p14;
+ }
+
+ public String getP22() {
+ return p22;
+ }
+
+ public String getP23() {
+ return p23;
+ }
+
+ public String getP24() {
+ return p24;
+ }
+
+ public String getP25() {
+ return p25;
+ }
+
+ public boolean getP14SetterIsCalled() {
+ return p14SetterIsCalled;
+ }
+
+
+ public boolean getP23SetterIsCalled() {
+ return p23SetterIsCalled;
+ }
+
+
+ public boolean getP24SetterIsCalled() {
+ return p24SetterIsCalled;
+ }
+
+
+ public boolean getP25SetterIsCalled() {
+ return p25SetterIsCalled;
+ }
+
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java
new file mode 100644
index 0000000000..d6a36f54a9
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java
new file mode 100644
index 0000000000..ace9da2904
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java
@@ -0,0 +1,87 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.oasisopen.sca.annotation.Constructor;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(CService.class)
+public class CServiceImpl1 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ @Constructor
+ public CServiceImpl1() {
+ constructor = "NoArgument";
+ }
+
+ public CServiceImpl1(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "AllArguments";
+ }
+
+ public CServiceImpl1(BService bOne, String pTwo, int pThree) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ constructor = "LessArguments";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java
new file mode 100644
index 0000000000..4396b6ce32
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java
@@ -0,0 +1,87 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.oasisopen.sca.annotation.Constructor;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(CService.class)
+public class CServiceImpl2 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl2() {
+ constructor = "NoArgument";
+ }
+
+ @Constructor()
+ public CServiceImpl2(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "AllArguments";
+ }
+
+ public CServiceImpl2(BService bOne, String pTwo, int pThree) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ constructor = "LessArguments";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java
new file mode 100644
index 0000000000..cd459f2dd1
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java
@@ -0,0 +1,87 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.oasisopen.sca.annotation.Constructor;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(CService.class)
+public class CServiceImpl3 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl3() {
+ constructor = "NoArgument";
+ }
+
+ @Constructor({"bOne", "pTwo", "pThree", "pFour"})
+ public CServiceImpl3(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "AllArguments";
+ }
+
+ public CServiceImpl3(BService bOne, String pTwo, int pThree) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ constructor = "LessArguments";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java
new file mode 100644
index 0000000000..c22ee08f95
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java
@@ -0,0 +1,88 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.oasisopen.sca.annotation.Constructor;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(CService.class)
+public class CServiceImpl4 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl4() {
+ constructor = "NoArgument";
+ }
+
+ public CServiceImpl4(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4, int extra) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "ExtraArguments";
+ }
+
+ @Constructor({"bOne", "pTwo", "pThree", "pFour"})
+ public CServiceImpl4(BService bOne, String pTwo, int pThree, String pFour) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ this.p4 = pFour;
+ constructor = "AllArguments";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java
new file mode 100644
index 0000000000..02892ca7f3
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java
@@ -0,0 +1,88 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.oasisopen.sca.annotation.Constructor;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(CService.class)
+public class CServiceImpl5 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl5() {
+ constructor = "NoArgument";
+ }
+
+ public CServiceImpl5(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4, int extra) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "ExtraArguments";
+ }
+
+ @Constructor({"bOne", "pFour", "pThree", "pTwo"})
+ public CServiceImpl5(BService bOne, String pTwo, int pThree, String pFour) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ this.p4 = pFour;
+ constructor = "SwitchedValues";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java
new file mode 100644
index 0000000000..ed2c3dc365
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java
@@ -0,0 +1,88 @@
+/*
+ * 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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.oasisopen.sca.annotation.Constructor;
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+@Service(CService.class)
+public class CServiceImpl6 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl6() {
+ constructor = "NoArgument";
+ }
+
+ public CServiceImpl6(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4, int extra) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "ExtraArguments";
+ }
+
+ @Constructor({"bOne", "pTwo", "pThree", "pWrong"})
+ public CServiceImpl6(BService bOne, String pTwo, int pThree, String pFour) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ this.p4 = pFour;
+ constructor = "WrongValues";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/main/resources/property.composite b/java/sca-contrib/vtest/java-api/annotations/property/src/main/resources/property.composite
new file mode 100644
index 0000000000..f7af170f33
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/main/resources/property.composite
@@ -0,0 +1,143 @@
+<?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="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Property-Composite">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.AServiceImpl" />
+ <property name="p1">p1</property>
+ <property name="p2">p2</property>
+ <property name="p3">p3</property>
+ <property name="p4">p4</property>
+ <property name="p5">p5</property>
+ <property name="p6">p6</property>
+ <property name="p7" type="AObject">
+ <AObject xmlns="">
+ <aString>p7.aString</aString>
+ <bInt>7</bInt>
+ </AObject>
+ </property>
+ <property name="p8" type="AObject">
+ <AObject xmlns="">
+ <aString>p8.aString</aString>
+ <bInt>8</bInt>
+ </AObject>
+ </property>
+ <property name="p9" type="AObject">
+ <AObject xmlns="">
+ <aString>p9.aString</aString>
+ <bInt>9</bInt>
+ </AObject>
+ </property>
+ <property name="p10" type="AObject">
+ <AObject xmlns="">
+ <aString>p10.aString</aString>
+ <bInt>10</bInt>
+ </AObject>
+ </property>
+ <property name="p11" type="AObject">
+ <AObject xmlns="">
+ <aString>p11.aString</aString>
+ <bInt>11</bInt>
+ </AObject>
+ </property>
+ <property name="p12" type="AObject">
+ <AObject xmlns="">
+ <aString>p12.aString</aString>
+ <bInt>12</bInt>
+ </AObject>
+ </property>
+ <property name="pFifteen">p15</property>
+ <property name="pSixteen">p16</property>
+ <property name="p19" many="true"></property>
+ <property name="p20" many="true">"p20"</property>
+ <property name="p21" many="true">2 1 21</property>
+ </component>
+
+ <component name="CComponent1">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl1" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent2">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl2" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent3">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl3" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent4">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl4" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent5">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl5" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent6">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl6" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.BServiceImpl"/>
+ </component>
+
+ <component name="AnotherAComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.AnotherAServiceImpl" />
+ <property name="p13">p13</property>
+ <property name="p14">p14</property>
+ <property name="p22">p22</property>
+ <property name="p23">p23</property>
+ <property name="p24">p24</property>
+ <property name="p25">p25</property>
+ </component>
+</composite>
diff --git a/java/sca-contrib/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java b/java/sca-contrib/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
new file mode 100644
index 0000000000..d5fbc568f7
--- /dev/null
+++ b/java/sca-contrib/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
@@ -0,0 +1,299 @@
+/*
+ * 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.vtest.javaapi.annotations.property;
+
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test class tests the Property annotation described in section 1.2.3
+ * including 1.8.5 and 1.8.13
+ */
+public class PropertyAnnotationTestCase {
+
+ protected static String compositeName = "property.composite";
+ protected static AService aService = null;
+ protected static CService cService1 = null;
+ protected static CService cService2 = null;
+ protected static CService cService3 = null;
+ protected static CService cService4 = null;
+ protected static CService cService5 = null;
+ protected static CService cService6 = null;
+ protected static AnotherAService anotherAService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ cService1 = ServiceFinder.getService(CService.class, "CComponent1");
+ cService2 = ServiceFinder.getService(CService.class, "CComponent2");
+ cService3 = ServiceFinder.getService(CService.class, "CComponent3");
+ cService4 = ServiceFinder.getService(CService.class, "CComponent4");
+ cService5 = ServiceFinder.getService(CService.class, "CComponent5");
+ cService6 = ServiceFinder.getService(CService.class, "CComponent6");
+ anotherAService = ServiceFinder.getService(AnotherAService.class, "AnotherAComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Lines 1343 to 1348:<br>
+ * The "@Property" annotation type is used to annotate a Java class field or
+ * a setter method that is used to inject an SCA property value. The type of
+ * the property injected, which can be a simple Java type or a complex Java
+ * type, is defined by the type of the Java class field or the type of the
+ * setter method input argument.<br>
+ * The "@Property" annotation may be used on protected or public fields and
+ * on setter methods or on a constructor method.<br>
+ * <p>
+ * p1 - simple Java type injected via field<br>
+ * p2 - simple Java type injected via field<br>
+ * p3 - simple Java type injected via setter<br>
+ * p4 - simple Java type injected via setter and required=true<br>
+ * p5 - simple Java type injected via constructor parameter<br>
+ * p6 - simple Java type injected via constructor parameter<br>
+ * p7 - complex Java type injected via field and required=true<br>
+ * p8 - complex Java type injected via field<br>
+ * p9 - complex Java type injected via setter<br>
+ * p10 - complex Java type injected via setter<br>
+ * p11 - complex Java type injected via constructor parameter<br>
+ * p12 - complex Java type injected via constructor parameter<br>
+ */
+ @Test
+ public void atProperty1() throws Exception {
+ Assert.assertEquals("p1", aService.getP1());
+ Assert.assertEquals("p2", aService.getP2());
+ Assert.assertEquals("p3", aService.getP3());
+ Assert.assertEquals("p4", aService.getP4());
+ Assert.assertEquals("p5", aService.getP5());
+ Assert.assertEquals("p6", aService.getP6());
+ Assert.assertEquals("p7.aString", aService.getP7AString());
+ Assert.assertEquals(7, aService.getP7BInt());
+ Assert.assertEquals("p8.aString", aService.getP8AString());
+ Assert.assertEquals(8, aService.getP8BInt());
+ Assert.assertEquals("p9.aString", aService.getP9AString());
+ Assert.assertEquals(9, aService.getP9BInt());
+ Assert.assertEquals("p10.aString", aService.getP10AString());
+ Assert.assertEquals(10, aService.getP10BInt());
+ Assert.assertEquals("p11.aString", aService.getP11AString());
+ Assert.assertEquals(11, aService.getP11BInt());
+ Assert.assertEquals("p12.aString", aService.getP12AString());
+ Assert.assertEquals(12, aService.getP12BInt());
+ }
+
+ /**
+ * Lines 1349 to 1352:<br>
+ * Properties may also be injected via public setter methods even when the
+ * "@Property" annotation is not present. However, the
+ *
+ * @Property annotation must be used in order to inject a property onto a
+ * non-public field. In the case where there is no "@Property"
+ * annotation, the name of the property is the same as the name of
+ * the field or setter.<br>
+ * <p>
+ * p13 is an un-annotated public field which should be injected
+ * via field<br>
+ */
+ @Test
+ public void atProperty2() throws Exception {
+ Assert.assertEquals("p13", anotherAService.getP13());
+ }
+
+ /**
+ * Line 1353:<br>
+ * Where there is both a setter method and a field for a property, the
+ * setter method is used.<br>
+ * <p>
+ * p14 is an un-annotated public field, it should be injected via public
+ * setter<br>
+ */
+ @Test
+ public void atProperty3() throws Exception {
+ Assert.assertEquals("p14", anotherAService.getP14());
+ Assert.assertTrue(anotherAService.getP14SetterIsCalled());
+ }
+
+ /**
+ * Lines 1355 to 1357:<br>
+ * The "@Property" annotation has the following attributes:<br>
+ * <li>name (optional) – the name of the property, defaults to the name of
+ * the field of the Java class</li>
+ * <li>required (optional) – specifies whether injection is required,
+ * defaults to false</li>
+ * <p>
+ * p15 - injected via field with different name "pFifteen"<br>
+ * p16 - injected via setter with different name "pSixteen"<br>
+ * p17 - injected via field but not defined in composite<br>
+ * p18 - injected via setter but not defined in composite<br>
+ *
+ * @TODO - Need to test required=true but not defined in composite (The
+ * specification does not describe the proper behaviour in this
+ * situation.)
+ */
+ @Test
+ public void atProperty4() throws Exception {
+ Assert.assertEquals("p15", aService.getP15());
+ Assert.assertEquals("p16", aService.getP16());
+ Assert.assertNull(aService.getP17());
+ Assert.assertNull(aService.getP18());
+ }
+
+ /**
+ * Lines 1369 to 1370:<br>
+ * If the property is defined as an array or as a java.util.Collection, then
+ * the implied component type has a property with a many attribute set to
+ * true.<br>
+ * <p>
+ * p19 - a List and injected via field with no element<br>
+ * p20 - a List and injected via setter<br>
+ * p21 - an array and injected via field<br>
+ */
+ @Test
+ public void atProperty5() throws Exception {
+ Assert.assertEquals(0, aService.getP19Size());
+ Assert.assertEquals(1, aService.getP20Size());
+ Assert.assertEquals("p20", aService.getP20(0));
+ Assert.assertEquals(3, aService.getP21Size());
+ Assert.assertEquals(2, aService.getP21(0));
+ Assert.assertEquals(1, aService.getP21(1));
+ Assert.assertEquals(21, aService.getP21(2));
+ }
+
+ /**
+ * Lines 1141 to 1162:<br>
+ * 1.8.5. "@Constructor"<br>
+ * ...<br>
+ * The "@Constructor" annotation is used to mark a particular constructor to
+ * use when instantiating a Java component implementation.<br>
+ * The "@Constructor" annotation has the following attribute:<br>
+ * <li>value (optional) – identifies the property/reference names that
+ * correspond to each of the constructor arguments. The position in the
+ * array determines which of the arguments are being named.</li>
+ * <p>
+ * cService1 - "@Constructor" without value and constructor arguments<br>
+ * cService2 - "@Constructor" without value but with constructor arguments<br>
+ * cService3 - "@Constructor" with values and constructor arguments<br>
+ * cService4 - "@Constructor" with values and constructor arguments where
+ * value, property and parameter names are same<br>
+ * cService5 - "@Constructor" with switched values and constructor arguments<br>
+ * cService6 - "@Constructor" with wrong values<br>
+ */
+ @Test
+ public void atProperty6() throws Exception {
+ Assert.assertNull(cService1.getB1Name());
+ Assert.assertNull(cService1.getP2());
+ Assert.assertEquals(0, cService1.getP3());
+ Assert.assertNull(cService1.getP4());
+ Assert.assertEquals("NoArgument", cService1.getConstructor());
+
+ Assert.assertEquals("BService", cService2.getB1Name());
+ Assert.assertEquals("p2", cService2.getP2());
+ Assert.assertEquals(3, cService2.getP3());
+ Assert.assertEquals("p4", cService2.getP4());
+ Assert.assertEquals("AllArguments", cService2.getConstructor());
+
+ Assert.assertEquals("BService", cService3.getB1Name());
+ Assert.assertEquals("p2", cService3.getP2());
+ Assert.assertEquals(3, cService3.getP3());
+ Assert.assertEquals("p4", cService3.getP4());
+ Assert.assertEquals("AllArguments", cService3.getConstructor());
+
+ Assert.assertEquals("BService", cService4.getB1Name());
+ Assert.assertEquals("p2", cService4.getP2());
+ Assert.assertEquals(3, cService4.getP3());
+ Assert.assertEquals("p4", cService4.getP4());
+ Assert.assertEquals("AllArguments", cService4.getConstructor());
+
+ Assert.assertEquals("BService", cService5.getB1Name());
+ Assert.assertEquals("p4", cService5.getP2());
+ Assert.assertEquals(3, cService5.getP3());
+ Assert.assertEquals("p2", cService5.getP4());
+ Assert.assertEquals("SwitchedValues", cService5.getConstructor());
+
+ try {
+ System.out.println(cService6.getB1Name());
+ fail("Should have failed to call this service");
+ } catch (Throwable t) {
+ }
+
+ }
+
+ /**
+ * Lines 1349 to 1352:<br>
+ * 1.8.13. "@Property"<br>
+ * ...<br>
+ * Properties may also be injected via public setter methods even when the
+ * "@Property" annotation is not present. However, the "@Property"
+ * annotation must be used in order to inject a property onto a non-public
+ * field. In the case where there is no "@Property" annotation, the name of
+ * the property is the same as the name of the field or setter.
+ * <p>
+ * p22 is unannotated protected field which should not be injected p23 is
+ * un-annotated protected which should not be injected via protected setter<br>
+ */
+ @Test
+ @Ignore("JIRA-2289 - p23 failed")
+ public void atProperty7() throws Exception {
+ Assert.assertNull(anotherAService.getP22());
+ Assert.assertNull(anotherAService.getP23());
+ Assert.assertFalse(anotherAService.getP23SetterIsCalled());
+ }
+
+ /**
+ * Lines 1349 to 1352:<br>
+ * 1.8.13. "@Property"<br>
+ * ...<br>
+ * Properties may also be injected via public setter methods even when the
+ * "@Property" annotation is not present. However, the "@Property"
+ * annotation must be used in order to inject a property onto a non-public
+ * field. In the case where there is no "@Property" annotation, the name of
+ * the property is the same as the name of the field or setter.
+ * <p>
+ * p24 is un-annotated protected field which should be injected via public
+ * setter<br>
+ * p25 is un-annotated private field which should be injected via public
+ * setter<br>
+ */
+ @Test
+ public void atProperty8() throws Exception {
+ Assert.assertEquals("p24", anotherAService.getP24());
+ Assert.assertTrue(anotherAService.getP24SetterIsCalled());
+ Assert.assertEquals("p25", anotherAService.getP25());
+ Assert.assertTrue(anotherAService.getP25SetterIsCalled());
+ }
+
+}