geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r1002995 - /geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java
Date Thu, 30 Sep 2010 10:31:50 GMT
Author: rickmcguire
Date: Thu Sep 30 10:31:49 2010
New Revision: 1002995

URL: http://svn.apache.org/viewvc?rev=1002995&view=rev
Log:
add @Resource injection checking to the test

Modified:
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java?rev=1002995&r1=1002994&r2=1002995&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java
(original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java
Thu Sep 30 10:31:49 2010
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Set;
 
+import javax.annotation.Resource;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.servlet.RequestDispatcher;
@@ -41,6 +42,10 @@ import org.apache.geronimo.sample.Regist
 @WebServlet(name = "submitInfo", urlPatterns = {"/submitInfo"})
 public class submitInfo extends HttpServlet {
 
+    // we'll also test that these get injected properly, as well as the jndi lookup version

+    @Resource ValidatorFactory injectedValidatorFactory; 
+    @Resource Validator injectedValidator; 
+    
     /** 
      * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
methods.
      * @param request servlet request
@@ -82,6 +87,15 @@ public class submitInfo extends HttpServ
         ValidatorFactory vf = null; 
         Validator validator = null; 
         
+        if (injectedValidatorFactory == null) {
+            message += "<b>Unable to ValidatorFactory injected as @Resource<br>";
+            violationSize += 1; 
+        }
+        if (injectedValidator == null) {
+            message += "<b>Unable to Validator injected as @Resource<br>";
+            violationSize += 1; 
+        }
+        
         // obtain the validator factory and validator instance from JNDI 
         try {
             InitialContext ctx = new InitialContext();



Mime
View raw message