Author: kwilliams
Date: Sun Mar 30 21:26:06 2008
New Revision: 642871

URL: http://svn.apache.org/viewvc?rev=642871&view=rev
Log:
Some refactoring

Added:
    incubator/tuscany/java/sca/vtest/java-api/annotations/
    incubator/tuscany/java/sca/vtest/java-api/annotations/pom.xml   (with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/reference/
    incubator/tuscany/java/sca/vtest/java-api/annotations/reference/pom.xml   
(with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/
    incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
   (with props)
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java
   (with props)
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
   (with props)
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/BServiceImpl.java
   (with props)
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/resources/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/resources/ab.composite
   (with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/
    
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
   (with props)
Modified:
    incubator/tuscany/java/sca/vtest/java-api/pom.xml

Added: 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=642871&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/pom.xml (added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/pom.xml Sun Mar 30 
21:26:06 2008
@@ -0,0 +1,60 @@
+<?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>vtest-java-api</artifactId>
+        <version>2.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>java-api-annotations</artifactId>
+    <packaging>pom</packaging>
+
+    <name>Apache Tuscany SCA Java APIs and Annoations Verification Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>default</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <modules>
+                <module>reference</module>
+           </modules>
+        </profile>
+    </profiles>
+</project>

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/reference/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/reference/pom.xml?rev=642871&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/reference/pom.xml 
(added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/reference/pom.xml Sun 
Mar 30 21:26:06 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>annotations-reference</artifactId>
+    <name>Apache Tuscany SCA Java APIs and Annoations Verification Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+    </dependencies>
+</project>

Propchange: 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java?rev=642871&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
 Sun Mar 30 21:26:06 2008
@@ -0,0 +1,40 @@
+/*
+ * 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.reference;
+
+
+/**
+ * Simple Service that uses another Service
+ */
+public interface AService {
+
+    public String getName();
+    public String getB1Name();
+    public String getB2Name();
+    public String getB3Name();
+    public String getB4Name();
+    public String getB5Name();
+    public String getB6Name();
+    public String getB7Name();
+    public String getB8Name();
+    public String getB9Name();
+
+    public boolean isB7SetterCalled();
+    
+}

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

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

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java?rev=642871&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java
 Sun Mar 30 21:26:06 2008
@@ -0,0 +1,29 @@
+/*
+ * 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.reference;
+
+
+/**
+ * Simple Service used by another service
+ */
+public interface BService {
+
+    String getName();
+
+}

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

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

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java?rev=642871&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
 Sun Mar 30 21:26:06 2008
@@ -0,0 +1,123 @@
+/*
+ * 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.reference.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.BService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
[EMAIL PROTECTED](AService.class)
+public class AServiceImpl implements AService {
+
+    @Reference
+    protected BService b1; // field injection
+
+    protected BService b2; // injected via constructor parameter
+
+    protected BService b3; // setter injection
+
+    public BService b4; // field injection (public, un-annotated)
+
+    protected BService b5; // field injection (non-public, un-annotated)
+
+    public BService b6; // setter injection (public, un-annotated)
+
+    @Reference
+    protected BService b7; // setter injection (field and setter annotated)
+
+    @Reference(name="b8", required=false)
+    protected BService bEight; // field injection (different reference and 
field name)
+
+    protected BService bNine; // setter injection (different reference and 
field name)
+
+    protected boolean b7SetterCalled;
+
+    public AServiceImpl(@Reference(name = "b2")
+    BService b2) {
+        super();
+        this.b2 = b2;
+        b7SetterCalled = false;
+    }
+
+    @Reference
+    public void setB3(BService b3) {
+        this.b3 = b3;
+    }
+
+    public void setB6(BService b6) {
+        this.b6 = b6;
+    }
+
+    @Reference
+    public void setB7(BService b7) {
+        b7SetterCalled = true;
+        this.b7 = b7;
+    }
+
+    @Reference(name="b9", required=false)
+    public void setB9(BService bNine) {
+        this.bNine = bNine;
+    }
+    
+    public String getName() {
+        return "AService";
+    }
+
+    public String getB1Name() {
+        return b1.getName();
+    }
+
+    public String getB2Name() {
+        return b2.getName();
+    }
+
+    public String getB3Name() {
+        return b3.getName();
+    }
+
+    public String getB4Name() {
+        return b4.getName();
+    }
+
+    public String getB5Name() {
+        return b5.getName();
+    }
+
+    public String getB6Name() {
+        return b6.getName();
+    }
+
+    public String getB7Name() {
+        return b7.getName();
+    }
+
+    public String getB8Name() {
+        return bEight.getName();
+    }
+    
+    public String getB9Name() {
+        return bNine.getName();
+    }
+    
+    public boolean isB7SetterCalled() {
+        return b7SetterCalled;
+    }
+}

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

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

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/BServiceImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/BServiceImpl.java?rev=642871&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/BServiceImpl.java
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/BServiceImpl.java
 Sun Mar 30 21:26:06 2008
@@ -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.reference.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.BService;
+import org.osoa.sca.annotations.Service;
+
[EMAIL PROTECTED](BService.class)
+public class BServiceImpl implements BService {
+
+    public String getName() {
+        return "BService";
+    }
+
+}

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

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

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/resources/ab.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/resources/ab.composite?rev=642871&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/resources/ab.composite
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/resources/ab.composite
 Sun Mar 30 21:26:06 2008
@@ -0,0 +1,41 @@
+<?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="AB-Composite">
+             
+    <component name="AComponent">
+           <implementation.java 
class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AServiceImpl"/>
+        <reference name="b1" target="BComponent"/>             
+        <reference name="b2" target="BComponent"/>             
+        <reference name="b3" target="BComponent"/>
+        <reference name="b4" target="BComponent"/>
+        <reference name="b5" target="BComponent"/>
+        <reference name="b6" target="BComponent"/>
+        <reference name="b7" target="BComponent"/>
+        <reference name="b8" target="BComponent"/>
+        <reference name="b9" target="BComponent"/>
+     </component>   
+    
+    <component name="BComponent">
+        <implementation.java 
class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.BServiceImpl"/>
+    </component>     
+    
+</composite>

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

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

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

Added: 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java?rev=642871&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
 (added)
+++ 
incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
 Sun Mar 30 21:26:06 2008
@@ -0,0 +1,162 @@
+/*
+ * 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.reference;
+
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test class tests the "@Reference" annotation described in section
+ * 1.8.1.4
+ */
+public class ReferenceAnnotationTestCase {
+
+    protected static SCADomain domain;
+    protected static String compositeName = "ab.composite";
+    protected static AService a;
+
+    @BeforeClass
+    public static void init() throws Exception {
+        try {
+            System.out.println("Setting up");
+            domain = SCADomain.newInstance(compositeName);
+            a = 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();
+
+    }
+
+    /**
+     * Temporary test unrelated to spec test effort. Remove after resolution of
+     */
+    @Test
+    @Ignore
+    // JIRA T-2145
+    public void bogusComponentName() throws Exception {
+        SCADomain tempDomain = SCADomain.newInstance(compositeName);
+        try {
+            AService a = tempDomain.getService(AService.class, 
"AReallyBogusComponentName");
+            if (a == null)
+                fail("Should have thrown an exception rather than return 
null");
+            else
+                fail("Should have thrown an exception rather than return a 
proxy");
+        } finally {
+            if (tempDomain != null)
+                tempDomain.close();
+        }
+
+    }
+
+    /**
+     * Lines 1404, 1405, 1406 <br>
+     * The "@Reference" annotation type is used to annotate a Java class field
+     * or a setter method that is used to inject a service that resolves the
+     * reference. The interface of the service injected is defined by the type
+     * of the Java class field or the type of the setter method input argument.
+     * <p>
+     * This tests the use of the three usages of the "@Reference" 
annotation<br>
+     * B1 is injected via field injection <br>
+     * B2 is injected via constructor parameter <br>
+     * B3 is injected via setter method
+     */
+    @Test
+    public void atReference1() throws Exception {
+
+        Assert.assertEquals("BService", a.getB1Name());
+        Assert.assertEquals("BService", a.getB2Name());
+        Assert.assertEquals("BService", a.getB3Name());
+
+    }
+
+    /**
+     * Lines 1407, 1408, 1409, 1410 <br>
+     * References may also be injected via public setter methods even when the
+     * "@Reference" annotation is not present. However, the "@Reference"
+     * annotation must be used in order to inject a reference onto a non public
+     * field. In the case where there is no "@Reference" annotation, the name 
of
+     * the reference is the same as the name of the field or setter.
+     * <p>
+     * B4 is injected via field injection. Public, Non-annotated <br>
+     * B5 is expected to fail field injection. Non-Public, Non-Annotated <br>
+     * B6 is injected via setter injection. Public, Non-Annotated
+     */
+    @Test
+    @Ignore
+    // (Jira Tuscany-2165)
+    public void atReference2() throws Exception {
+
+        Assert.assertEquals("BService", a.getB4Name());
+        try {
+            a.getB5Name();
+            fail("getB5Name expected to fail with NPE");
+        } catch (NullPointerException e) {
+        }
+        Assert.assertEquals("BService", a.getB6Name());
+
+    }
+
+    /**
+     * Lines 1411 <br>
+     * Where there is both a setter method and a field for a reference, the
+     * setter method is used.
+     * <p>
+     * B7 has both field and setter annotated. The setter must be called
+     */
+    @Test
+    public void atReference3() throws Exception {
+        Assert.assertTrue(a.isB7SetterCalled());
+    }
+
+    /**
+     * Lines 1413, 1414, 1415 <br>
+     * The "@Reference" annotation has the following attributes: <br> • name
+     * (optional) – the name of the reference, defaults to the name of the 
field
+     * of the Java class <br>
+     * required (optional) – whether injection of service or services is
+     * required. Defaults to true.
+     * <p>
+     * Reference and field have different names<br>
+     * B8 is field injected<br>
+     * B9 is setter injected
+     * 
+     * @TODO - Would be best to explicitly test "required" attribute
+     */
+    @Test
+    public void atReference4() throws Exception {
+        Assert.assertEquals("BService", a.getB8Name());
+        Assert.assertEquals("BService", a.getB9Name());
+    }
+}

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

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

Modified: incubator/tuscany/java/sca/vtest/java-api/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/pom.xml?rev=642871&r1=642870&r2=642871&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/pom.xml (original)
+++ incubator/tuscany/java/sca/vtest/java-api/pom.xml Sun Mar 30 21:26:06 2008
@@ -26,6 +26,7 @@
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>vtest-java-api</artifactId>
+    <packaging>pom</packaging>
     <name>Apache Tuscany SCA Java APIs and Annoations Verification Tests</name>
 
     <dependencies>
@@ -43,4 +44,18 @@
         </dependency>
         
     </dependencies>
+
+
+    <profiles>
+        <profile>
+            <id>default</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <modules>
+                <module>annotations</module>
+           </modules>
+        </profile>
+    </profiles>
+
 </project>



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

Reply via email to