Author: svkrish
Date: Wed Apr  9 00:06:58 2008
New Revision: 646203

URL: http://svn.apache.org/viewvc?rev=646203&view=rev
Log:
adding testcase for verifying @Property - code contributed in 
https://issues.apache.org/jira/browse/TUSCANY-2211

Added:
    incubator/tuscany/java/sca/vtest/java-api/annotations/property/
    incubator/tuscany/java/sca/vtest/java-api/annotations/property/pom.xml   
(with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/
    incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java
   (with props)
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java
   (with props)
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
   (with props)
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/resources/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/resources/property.composite
   (with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
   (with props)
Modified:
    incubator/tuscany/java/sca/vtest/java-api/annotations/pom.xml

Modified: incubator/tuscany/java/sca/vtest/java-api/annotations/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/pom.xml?rev=646203&r1=646202&r2=646203&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/pom.xml (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/pom.xml Wed Apr  9 
00:06:58 2008
@@ -55,6 +55,7 @@
             <modules>
                 <module>reference</module>
                 <module>service</module>
+                <module>property</module>
                 <module>oneway</module>
                 <module>conversational</module>
            </modules>

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/property/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/property/pom.xml?rev=646203&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/property/pom.xml 
(added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/property/pom.xml Wed 
Apr  9 00:06:58 2008
@@ -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-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>vtest-java-api-annotations-property</artifactId>
+    <name>Apache Tuscany SCA Java APIs and Annoations Verification Tests - 
Annotations - @Property</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/vtest/java-api/annotations/property/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java?rev=646203&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java
 Wed Apr  9 00:06:58 2008
@@ -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;
+
+/**
+ * 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 getP13();
+
+    public String getP14();
+    
+    public boolean getP14SetterIsCalled();
+    
+    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();
+       
+}

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java?rev=646203&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java
 Wed Apr  9 00:06:58 2008
@@ -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;
+    }
+
+}

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java?rev=646203&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
 Wed Apr  9 00:06:58 2008
@@ -0,0 +1,261 @@
+/*
+ * 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.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Property;
+
[EMAIL PROTECTED](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
+
+       public String p13;                              // injected via field 
and un-annotated
+       
+       public String p14;                              // injected via setter 
and un-annotated
+
+       public boolean p14SetterIsCalled = false;
+       
+       @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;
+       }
+    
+       public void setP14(String p14) {
+               p14SetterIsCalled = true;
+               this.p14 = p14;
+       }
+       
+    @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 getP13() {
+               return p13;
+       }
+       
+       public String getP14() {
+               return p14;
+       }
+       
+       public boolean getP14SetterIsCalled() {
+               return p14SetterIsCalled;
+       }
+       
+       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;
+       }
+
+}
+

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/resources/property.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/resources/property.composite?rev=646203&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/resources/property.composite
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/resources/property.composite
 Wed Apr  9 00:06:58 2008
@@ -0,0 +1,77 @@
+<?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="p13">p13</property>
+                       <property name="p14">p14</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>
+       
+</composite>

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/resources/property.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/resources/property.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/main/resources/property.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java?rev=646203&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
 Wed Apr  9 00:06:58 2008
@@ -0,0 +1,184 @@
+/*
+ * 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 junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.AService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.Ignore;
+
+/**
+ * This test class tests the Property annotation described in section 1.2.3 and
+ * 1.8.13
+ */
+public class PropertyAnnotationTestCase {
+
+    protected static SCADomain domain;
+    protected static String compositeName = "property.composite";
+    protected static AService aService = null;
+
+    @BeforeClass
+    public static void init() throws Exception {
+        try {
+            System.out.println("Setting up");
+            domain = SCADomain.newInstance(compositeName);
+            aService = domain.getService(AService.class, "AComponent");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    @AfterClass
+    public static void destroy() throws Exception {
+
+        System.out.println("Cleaning up");
+        if (domain != null)
+            domain.close();
+
+    }
+
+    /**
+     * 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 - injected via field and un-annotated
+     */
+    @Test
+    @Ignore
+    // (Jira Tuscany-2210)
+    public void atProperty2() throws Exception {
+       Assert.assertEquals("p13", aService.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 - injected via setter and un-annotated
+     */
+    @Test
+    @Ignore
+    // (Jira Tuscany-2210)
+    public void atProperty3() throws Exception {
+       Assert.assertEquals("p14", aService.getP14());
+       Assert.assertTrue(aService.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));
+    }
+}

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to