geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r600682 - in /geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main: java/org/apache/geronimo/test/ webapp/WEB-INF/
Date Mon, 03 Dec 2007 20:52:12 GMT
Author: gawor
Date: Mon Dec  3 12:52:11 2007
New Revision: 600682

URL: http://svn.apache.org/viewvc?rev=600682&view=rev
Log:
added tests for jndi lookup servlet listeners. looks like both tomcat and jetty do not set
the right jndi context in a few callbacks

Added:
    geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/ContextListener.java
  (with props)
    geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/RequestListener.java
  (with props)
    geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestFilter.java
  (with props)
Modified:
    geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestServlet.java
    geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/webapp/WEB-INF/web.xml

Added: geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/ContextListener.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/ContextListener.java?rev=600682&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/ContextListener.java
(added)
+++ geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/ContextListener.java
Mon Dec  3 12:52:11 2007
@@ -0,0 +1,33 @@
+/**
+ * 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.test;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public class ContextListener implements ServletContextListener {
+        
+    public void contextDestroyed(ServletContextEvent event) {
+        //TestServlet.testLookup("contextDestroyed");
+    }
+
+    public void contextInitialized(ServletContextEvent event) {
+        TestServlet.testLookup("contextInitialized");
+    }
+    
+}

Propchange: geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/ContextListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/RequestListener.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/RequestListener.java?rev=600682&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/RequestListener.java
(added)
+++ geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/RequestListener.java
Mon Dec  3 12:52:11 2007
@@ -0,0 +1,33 @@
+/**
+ * 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.test;
+
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletRequestListener;
+
+public class RequestListener implements ServletRequestListener {
+        
+    public void requestDestroyed(ServletRequestEvent event) {
+        //TestServlet.testLookup("requestDestroyed");
+    }
+
+    public void requestInitialized(ServletRequestEvent event) {
+        TestServlet.testLookup("requestInitialized");
+    }
+    
+}

Propchange: geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/RequestListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestFilter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestFilter.java?rev=600682&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestFilter.java
(added)
+++ geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestFilter.java
Mon Dec  3 12:52:11 2007
@@ -0,0 +1,44 @@
+/**
+ * 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.test;
+
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+public class TestFilter implements Filter {
+        
+    public void init(FilterConfig filterConfig) {
+        //TestServlet.testLookup("initFilter");
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response,
+                         FilterChain chain) throws IOException, ServletException {
+        TestServlet.testLookup("doFilter");
+        chain.doFilter(request, response);
+    }
+
+    public void destroy() {  
+        //TestServlet.testLookup("destroyFilter");
+    }
+
+}

Propchange: geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestServlet.java?rev=600682&r1=600681&r2=600682&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestServlet.java
(original)
+++ geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/java/org/apache/geronimo/test/TestServlet.java
Mon Dec  3 12:52:11 2007
@@ -29,6 +29,8 @@
 
 public class TestServlet extends HttpServlet {
         
+    private static Integer expectedValue = new Integer(20);
+
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
         String mode = request.getParameter("mode");
 
@@ -54,6 +56,23 @@
         } catch (Exception e) {
             e.printStackTrace();
             return null;
+        }
+    }
+
+    public static void testLookup(String name) {
+        System.out.println(name);
+
+        Integer value;
+        try {
+            Context ctx = new InitialContext();
+            value = (Integer)ctx.lookup("java:comp/env/value");
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException(name, e);
+        }
+        
+        if (!expectedValue.equals(value)) {
+            throw new RuntimeException("Values do not match: " + expectedValue + " " + value);
         }
     }
     

Modified: geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/webapp/WEB-INF/web.xml?rev=600682&r1=600681&r2=600682&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/webapp/WEB-INF/web.xml
(original)
+++ geronimo/server/trunk/testsuite/web-testsuite/test-web-forward/web-forward-war-2/src/main/webapp/WEB-INF/web.xml
Mon Dec  3 12:52:11 2007
@@ -25,6 +25,24 @@
 
    <display-name>TestServlet</display-name>
 
+   <listener>
+       <listener-class>org.apache.geronimo.test.RequestListener</listener-class>
+   </listener>
+
+   <listener>
+       <listener-class>org.apache.geronimo.test.ContextListener</listener-class>
+   </listener>
+
+   <filter>
+       <filter-name>TestFilter</filter-name>
+       <filter-class>org.apache.geronimo.test.TestFilter</filter-class>
+   </filter>
+
+   <filter-mapping>
+       <filter-name>TestFilter</filter-name>
+       <servlet-name>TestServlet</servlet-name>
+   </filter-mapping>
+
    <servlet>
        <description></description>
        <display-name>TestServlet</display-name>



Mime
View raw message