geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1002004 - in /geronimo/server/trunk/testsuite/javaee6-testsuite: ./ managedbean1.0-test/ managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/ managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ manage...
Date Tue, 28 Sep 2010 03:54:08 GMT
Author: gawor
Date: Tue Sep 28 03:54:08 2010
New Revision: 1002004

URL: http://svn.apache.org/viewvc?rev=1002004&view=rev
Log:
GERONIMO-5520: @Resource injection of Managed Beans should be working now

Added:
    geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedInterface.java
  (with props)
Modified:
    geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/pom.xml
    geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedBean.java
    geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanJNDIServlet.java
    geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanResourceServlet.java
    geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/test/java/org/apache/geronimo/sample/managedbean/test/ManagedbeanTest.java
    geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/pom.xml?rev=1002004&r1=1002003&r2=1002004&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/pom.xml (original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/pom.xml Tue Sep
28 03:54:08 2010
@@ -35,7 +35,6 @@
     <packaging>war</packaging>
 
     <dependencies>
-
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-servlet_3.0_spec</artifactId>
@@ -44,10 +43,10 @@
           <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-annotation_1.1_spec</artifactId>
-            <version>1.0</version>
             <scope>provided</scope>
         </dependency>         
     </dependencies> 
+
     <profiles>
         <profile>
             <id>it</id>
@@ -92,12 +91,12 @@
 		        <groupId>org.apache.maven.plugins</groupId>
 		        <artifactId>maven-failsafe-plugin</artifactId>
 		        <configuration>
-		           <suiteXmlFiles>
+		            <suiteXmlFiles>
 			        <suiteXmlFile>${project.build.testOutputDirectory}/testng.xml</suiteXmlFile>
-		          </suiteXmlFiles>
-                        <systemPropertyVariables>
-                             <appContext>${project.artifactId}</appContext>
-                        </systemPropertyVariables>
+		            </suiteXmlFiles>
+                            <systemPropertyVariables>
+                                <appContext>${project.artifactId}</appContext>
+                            </systemPropertyVariables>
 		        </configuration>
 		   </plugin>
                 </plugins>

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedBean.java?rev=1002004&r1=1002003&r2=1002004&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedBean.java
(original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedBean.java
Tue Sep 28 03:54:08 2010
@@ -23,17 +23,20 @@ import javax.annotation.ManagedBean;
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 
-@ManagedBean(value="mybean")
-public class MyManagedBean {
-   @PostConstruct
-   public void setResources(){
-	   System.out.println("Setting resources");
-   }
-   @PreDestroy
-   public void cleanResources(){
-	   System.out.println("Collecting resources");
-   }
-   public String saySomeThing(String word){
-	   return word;
-   }
+@ManagedBean(value = "mybean")
+public class MyManagedBean implements MyManagedInterface {
+    
+    @PostConstruct
+    public void setResources() {
+        System.out.println("Setting resources");
+    }
+
+    @PreDestroy
+    public void cleanResources() {
+        System.out.println("Collecting resources");
+    }
+
+    public String saySomeThing(String word) {
+        return word;
+    }
 }

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedInterface.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedInterface.java?rev=1002004&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedInterface.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedInterface.java
Tue Sep 28 03:54:08 2010
@@ -0,0 +1,26 @@
+/**
+ *  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.geronimo.sample.managedbean;
+
+public interface MyManagedInterface {
+    
+    String saySomeThing(String word);
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedInterface.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/managedbean/MyManagedInterface.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanJNDIServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanJNDIServlet.java?rev=1002004&r1=1002003&r2=1002004&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanJNDIServlet.java
(original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanJNDIServlet.java
Tue Sep 28 03:54:08 2010
@@ -21,6 +21,8 @@ package org.apache.geronimo.sample.servl
 
 import java.io.IOException;
 import java.io.PrintWriter;
+
+import javax.annotation.Resource;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.servlet.ServletException;
@@ -29,46 +31,38 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.geronimo.sample.managedbean.MyManagedBean;
+import org.apache.geronimo.sample.managedbean.MyManagedInterface;
 
 /**
  * Servlet implementation class ManagedBeanServlet
  */
 public class ManagedBeanJNDIServlet extends HttpServlet {
-	private static final long serialVersionUID = 1L;
-       
+    
+    private static final long serialVersionUID = 1L;
+    
+    @Resource(lookup = "java:module/mybean")
+    private MyManagedInterface myManagedBean; // inject by interface
+    
     /**
-     * @see HttpServlet#HttpServlet()
+     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
+     *      response)
      */
-    public ManagedBeanJNDIServlet() {
-        super();
-        // TODO Auto-generated constructor stub
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        doPost(request, response);
     }
 
-	/**
-	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
-	 */
-	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
-		doPost(request,response);
-	}
-
-	/**
-	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
-	 */
-	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
-		   MyManagedBean myManagedBean=null;
-		   try {
-				InitialContext ctx=new InitialContext();
-				myManagedBean=(MyManagedBean) ctx.lookup("java:module/mybean");
-			} catch (NamingException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-	        
-		    PrintWriter out = response.getWriter();
-	        out.println("<html><head><title>Common Annotation ManagedBean</title></head></html>");
-	        out.println("<body>");
-            out.println(myManagedBean.saySomeThing("Hello,I am a ManagedBean!"));
-            out.println("</body></html>");
-	}
+    /**
+     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
+     *      response)
+     */
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        PrintWriter out = response.getWriter();
+        out.println("<html><head><title>Common Annotation ManagedBean</title></head></html>");
+        out.println("<body>");
+        out.println(myManagedBean.saySomeThing("Hello,I am a ManagedBean!"));
+        out.println("</body></html>");
+    }
 
 }

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanResourceServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanResourceServlet.java?rev=1002004&r1=1002003&r2=1002004&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanResourceServlet.java
(original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/main/java/org/apache/geronimo/sample/servlet/ManagedBeanResourceServlet.java
Tue Sep 28 03:54:08 2010
@@ -23,9 +23,6 @@ import java.io.IOException;
 import java.io.PrintWriter;
 
 import javax.annotation.Resource;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
@@ -37,34 +34,32 @@ import org.apache.geronimo.sample.manage
  * Servlet implementation class ManagedBeanServlet
  */
 public class ManagedBeanResourceServlet extends HttpServlet {
-	 @Resource
-	 MyManagedBean myManagedBean1;
-	private static final long serialVersionUID = 1L;
-       
+
+    private static final long serialVersionUID = 1L;
+    
+    @Resource
+    private MyManagedBean myManagedBean; // inject by bean class
+
     /**
-     * @see HttpServlet#HttpServlet()
+     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
+     *      response)
      */
-    public ManagedBeanResourceServlet() {
-        super();
-        // TODO Auto-generated constructor stub
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        doPost(request, response);
     }
 
-	/**
-	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
-	 */
-	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
-		doPost(request,response);
-	}
-
-	/**
-	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
-	 */
-	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
-		    PrintWriter out = response.getWriter();
-	        out.println("<html><head><title>Common Annotation ManagedBean</title></head></html>");
-	        out.println("<body>");
-            out.println(myManagedBean1.saySomeThing("Hello,I am a ManagedBean!"));
-            out.println("</body></html>");
-	}
+    /**
+     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
+     *      response)
+     */
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        PrintWriter out = response.getWriter();
+        out.println("<html><head><title>Common Annotation ManagedBean</title></head></html>");
+        out.println("<body>");
+        out.println(myManagedBean.saySomeThing("Hello,I am a ManagedBean!"));
+        out.println("</body></html>");
+    }
 
 }

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/test/java/org/apache/geronimo/sample/managedbean/test/ManagedbeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/test/java/org/apache/geronimo/sample/managedbean/test/ManagedbeanTest.java?rev=1002004&r1=1002003&r2=1002004&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/test/java/org/apache/geronimo/sample/managedbean/test/ManagedbeanTest.java
(original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/managedbean1.0-test/src/test/java/org/apache/geronimo/sample/managedbean/test/ManagedbeanTest.java
Tue Sep 28 03:54:08 2010
@@ -25,21 +25,21 @@ import org.apache.geronimo.testsupport.S
 
 public class ManagedbeanTest extends SeleniumTestSupport {
 
+    @Test
+    public void testManagedBeanResource() {
+        String appContextStr = System.getProperty("appContext");
+        selenium.open(appContextStr);
+        selenium.click("link=ManagedBeanResource");
+        selenium.waitForPageToLoad("30000");
+        Assert.assertEquals(selenium.getBodyText(), "Hello,I am a ManagedBean!");
+    }
 
-	@Test
-	public void testManagedBeanResource() {
-		String appContextStr = System.getProperty("appContext");
-		selenium.open(appContextStr);
-		selenium.click("link=ManagedBeanResource");
-		selenium.waitForPageToLoad("30000");
-		Assert.assertEquals(selenium.getBodyText(),"Hello,I am a ManagedBean!");
-	}
-	@Test
-	public void testManagedBeanJNDI() {
-		String appContextStr = System.getProperty("appContext");
-		selenium.open(appContextStr);
-		selenium.click("link=ManagedBeanJNDI");
-		selenium.waitForPageToLoad("30000");
-		Assert.assertEquals(selenium.getBodyText(),"Hello,I am a ManagedBean!");
-	}
+    @Test
+    public void testManagedBeanJNDI() {
+        String appContextStr = System.getProperty("appContext");
+        selenium.open(appContextStr);
+        selenium.click("link=ManagedBeanJNDI");
+        selenium.waitForPageToLoad("30000");
+        Assert.assertEquals(selenium.getBodyText(), "Hello,I am a ManagedBean!");
+    }
 }

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml?rev=1002004&r1=1002003&r2=1002004&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml (original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml Tue Sep 28 03:54:08 2010
@@ -54,12 +54,13 @@
     <modules>
         <module>beanvalidation-test</module>
         <module>ejb3.1lite-test</module>
+        <module>managedbean1.0-test</module>
+
 <!--
         <module>servlet3.0-test</module>
         <module>servlet3.0-security-test</module>
         <module>el2.2-test</module>
         <module>jsp2.2-test</module>
-        <module>managedbean1.0-test</module>
         <module>di1.0-test</module>
         <module>interceptors1.1-test</module>
         <module>webbean1.0-test</module>



Mime
View raw message