You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2008/04/17 14:29:50 UTC

svn commit: r649063 - in /incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src: main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/ main/resourc...

Author: antelder
Date: Thu Apr 17 05:29:46 2008
New Revision: 649063

URL: http://svn.apache.org/viewvc?rev=649063&view=rev
Log:
TUSCANY-2165: apply patch from Vamsavardhana Reddy for Java runtime should inject service references to field with common name in absence of @Reference

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

Modified: 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=649063&r1=649062&r2=649063&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java Thu Apr 17 05:29:46 2008
@@ -18,10 +18,12 @@
  */
 package org.apache.tuscany.sca.vtest.javaapi.annotations.reference;
 
+import org.osoa.sca.annotations.Remotable;
 
 /**
  * Simple Service used by another service
  */
+@Remotable
 public interface BService {
 
     String getName();

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.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/AnotherAServiceImpl.java?rev=649063&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.java Thu Apr 17 05:29:46 2008
@@ -0,0 +1,121 @@
+/*
+ * 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.Service;
+
+@Service(AService.class)
+public class AnotherAServiceImpl implements AService {
+
+    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)
+
+    public AnotherAServiceImpl() {
+    }
+
+    public String getName() {
+        return "AService";
+    }
+
+    public String getB4Name() {
+        return b4.getName();
+    }
+
+    public String getB5Name() {
+        return b5.getName();
+    }
+
+    public void setB6(BService b6) {
+        this.b6 = b6;
+    }
+
+    public String getB6Name() {
+        return b6.getName();
+    }
+
+    public String getB1Name() {
+        return null;
+    }
+
+    public String getB2Name() {
+        return null;
+    }
+
+    public String getB3Name() {
+        return null;
+    }
+
+    public String getB7Name() {
+        return null;
+    }
+
+    public String getB8Name() {
+        return null;
+    }
+
+    public String getB9Name() {
+        return null;
+    }
+
+    public boolean isB7SetterCalled() {
+        return false;
+    }
+
+    public String getB10Name() {
+        return null;
+    }
+
+    public String getB11Name() {
+        return null;
+    }
+
+    public String getB12Name() {
+        return null;
+    }
+
+    public String getB13Name(int i) {
+        return null;
+    }
+
+    public int getB13Size() {
+        return 0;
+    }
+
+    public String getB14Name(int i) {
+        return null;
+    }
+
+    public int getB14Size() {
+        return 0;
+    }
+
+    public String getB15Name(int i) {
+        return null;
+    }
+
+    public int getB15Size() {
+        return 0;
+    }
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.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/AnotherAServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 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=649063&r1=649062&r2=649063&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/resources/ab.composite (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/main/resources/ab.composite Thu Apr 17 05:29:46 2008
@@ -40,6 +40,13 @@
         <reference name="b15" multiplicity="1..n" target="BComponent BComponent"/>
     </component>   
     
+    <component name="AnotherAComponent">
+        <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AnotherAServiceImpl"/>
+        <reference name="b4" target="BComponent"/>
+        <reference name="b5" target="BComponent"/>
+        <reference name="b6" target="BComponent"/>
+     </component>   
+
     <component name="BComponent">
         <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.BServiceImpl"/>
     </component>     

Modified: 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=649063&r1=649062&r2=649063&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java Thu Apr 17 05:29:46 2008
@@ -114,17 +114,15 @@
      * B6 is injected via setter injection. Public, Non-Annotated
      */
     @Test
-    @Ignore
-    // (Jira Tuscany-2165)
     public void atReference2() throws Exception {
-
-        Assert.assertEquals("BService", a.getB4Name());
+        AService anotherA = domain.getService(AService.class, "AnotherAComponent");
+        Assert.assertEquals("BService", anotherA.getB4Name());
         try {
-            a.getB5Name();
+            anotherA.getB5Name();
             fail("getB5Name expected to fail with NPE");
         } catch (NullPointerException e) {
         }
-        Assert.assertEquals("BService", a.getB6Name());
+        Assert.assertEquals("BService", anotherA.getB6Name());
 
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org