geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r743576 - in /geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src: main/java/com/test/servlet/AddressServlet.java main/webapp/WEB-INF/web.xml test/java/org/apache/geronimo/testsuite/servlets/TestServlets.java
Date Thu, 12 Feb 2009 00:00:36 GMT
Author: djencks
Date: Thu Feb 12 00:00:36 2009
New Revision: 743576

URL: http://svn.apache.org/viewvc?rev=743576&view=rev
Log:
add a simple test to check getRemoteAddr is working

Added:
    geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/java/com/test/servlet/AddressServlet.java
      - copied, changed from r743429, geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/java/com/test/servlet/SampleServlet.java
Modified:
    geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/webapp/WEB-INF/web.xml
    geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/test/java/org/apache/geronimo/testsuite/servlets/TestServlets.java

Copied: geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/java/com/test/servlet/AddressServlet.java
(from r743429, geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/java/com/test/servlet/SampleServlet.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/java/com/test/servlet/AddressServlet.java?p2=geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/java/com/test/servlet/AddressServlet.java&p1=geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/java/com/test/servlet/SampleServlet.java&r1=743429&r2=743576&rev=743576&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/java/com/test/servlet/SampleServlet.java
(original)
+++ geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/java/com/test/servlet/AddressServlet.java
Thu Feb 12 00:00:36 2009
@@ -27,27 +27,19 @@
  * Servlet implementation class for Servlet: SampleServlet
  *
  * @web.servlet
- *   name="SampleServlet"
- *   display-name="SampleServlet"
+ *   name="AddressServlet"
+ *   display-name="AddressServlet"
  *
  * @web.servlet-mapping
- *   url-pattern="/SampleServlet"
+ *   url-pattern="/AddressServlet"
  *
  */
- public class  SampleServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet
{
-    /* (non-Java-doc)
-	 * @see javax.servlet.http.HttpServlet#HttpServlet()
-	 */
-	public  SampleServlet() {
-		super();
-
-	}
+ public class  AddressServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet
{
 
 	/* (non-Java-doc)
 	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
response)
 	 */
 	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
-		// TODO Auto-generated method stub
 	   doPost(request,response);
 	}
 
@@ -55,13 +47,12 @@
 	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
response)
 	 */
 	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
-		// TODO Auto-generated method stub
 
 		PrintWriter out = response.getWriter();
 		out.println("<html><head><title>Sample application with Servlets 2.5</title></head></html>");
 		out.println("<body>");
-		out.println("<font align=Center face=\"Garamond\">Welcome to Servlets 2.5 samples.</font>");
-		out.println("<font align=Center face=\"Garamond\">Sample Servlet!</font>");
+		out.println("<font align=Center face=\"Garamond\">Address Test</font>");
+		out.println("<font align=Center face=\"Garamond\">Remote Address:" + request.getRemoteAddr()
+ "</font>");
 		out.println("</body></html>");
 
 	}

Modified: geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/webapp/WEB-INF/web.xml?rev=743576&r1=743575&r2=743576&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/webapp/WEB-INF/web.xml
(original)
+++ geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/main/webapp/WEB-INF/web.xml
Thu Feb 12 00:00:36 2009
@@ -34,6 +34,12 @@
 		<servlet-name>SampleServlet2</servlet-name>
 		<servlet-class>com.test.servlet.SampleServlet2</servlet-class>
 	</servlet>
+	<servlet>
+		<description></description>
+		<display-name>AddressServlet</display-name>
+		<servlet-name>AddressServlet</servlet-name>
+		<servlet-class>com.test.servlet.AddressServlet</servlet-class>
+	</servlet>
 	<servlet-mapping>
 		<servlet-name>SampleServlet</servlet-name>
 		<url-pattern>/SampleServlet</url-pattern>
@@ -44,6 +50,11 @@
 		<url-pattern>/SampleServlet2</url-pattern>
 		<url-pattern>/SampleServlet2/*</url-pattern>
 	</servlet-mapping>
+    <servlet-mapping>
+            <servlet-name>AddressServlet</servlet-name>
+            <url-pattern>/AddressServlet</url-pattern>
+            <url-pattern>/AddressServlet/*</url-pattern>
+    </servlet-mapping>
 	<filter-mapping>
 	   <filter-name>Sample Filter</filter-name>
            <url-pattern>/*</url-pattern>

Modified: geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/test/java/org/apache/geronimo/testsuite/servlets/TestServlets.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/test/java/org/apache/geronimo/testsuite/servlets/TestServlets.java?rev=743576&r1=743575&r2=743576&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/test/java/org/apache/geronimo/testsuite/servlets/TestServlets.java
(original)
+++ geronimo/server/trunk/testsuite/web-testsuite/test-2.5-servlets/src/test/java/org/apache/geronimo/testsuite/servlets/TestServlets.java
Thu Feb 12 00:00:36 2009
@@ -42,4 +42,12 @@
         assertEquals("Welcome to Servlets 2.5 samples. Another Sample Servlet!", selenium.getText("xpath=/html/body"));
 
     }
+    @Test
+    public void testAddress() throws Exception {
+        selenium.open("/servlet25/AddressServlet");
+        waitForPageLoad();
+        assertEquals("Sample application with Servlets 2.5", selenium.getTitle());
+        String actual = selenium.getText("xpath=/html/body");
+        assertEquals(actual, "Address Test Remote Address:127.0.0.1", actual);
+    }
 }
\ No newline at end of file



Mime
View raw message