cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gkossakow...@apache.org
Subject svn commit: r611596 - /cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/ServletServiceContextTestCase.java
Date Sun, 13 Jan 2008 17:04:03 GMT
Author: gkossakowski
Date: Sun Jan 13 09:04:01 2008
New Revision: 611596

URL: http://svn.apache.org/viewvc?rev=611596&view=rev
Log:
Done some clean up and added additional checks if response is being committed and how it is
handled by ServletServiceContext class.

Modified:
    cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/ServletServiceContextTestCase.java

Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/ServletServiceContextTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/ServletServiceContextTestCase.java?rev=611596&r1=611595&r2=611596&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/ServletServiceContextTestCase.java
(original)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/ServletServiceContextTestCase.java
Sun Jan 13 09:04:01 2008
@@ -76,6 +76,7 @@
 
             protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
                 response.setStatus(HttpServletResponse.SC_OK);
+                response.flushBuffer();
             }
         };
         servletAContext.setServlet(servletA);
@@ -86,6 +87,7 @@
         dispatcher.forward(request, response);
 
         assertEquals(HttpServletResponse.SC_OK, response.getStatus());
+        assertTrue("Check if response has been committed", response.isCommitted());
     }
 
     /**
@@ -119,6 +121,7 @@
                 assertEquals(servletAContext, CallStackHelper.getBaseServletContext());
                 assertEquals(servletBContext, CallStackHelper.getCurrentServletContext());
                 response.setStatus(HttpServletResponse.SC_OK);
+                response.flushBuffer();
             }
         };
 
@@ -132,6 +135,7 @@
         RequestDispatcher dispatcher = mainContext.getNamedDispatcher("servletA");
         dispatcher.forward(request, response);
         assertEquals(HttpServletResponse.SC_OK, response.getStatus());
+        assertTrue("Check if response has been committed", response.isCommitted());
     }
 
     /**
@@ -175,7 +179,8 @@
                 super.service(req, response);
                 assertEquals(servletCContext, CallStackHelper.getBaseServletContext());
                 assertEquals(servletCContext, CallStackHelper.getCurrentServletContext());
-                res.setStatus(200);
+                res.setStatus(HttpServletResponse.SC_OK);
+                res.flushBuffer();
             }
         };
         servletAContext.setServlet(servletA);
@@ -189,7 +194,8 @@
 
         RequestDispatcher dispatcher = mainContext.getNamedDispatcher("servletA");
         dispatcher.forward(request, response);
-        assertEquals(200, response.getStatus());
+        assertEquals(HttpServletResponse.SC_OK, response.getStatus());
+        assertTrue("Check if response has been committed", response.isCommitted());
     }
 
     /**
@@ -212,7 +218,9 @@
 
             protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
                 super.service(request, response);
-                response.setStatus(500);
+                response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+                //FIXME: Uncomment this line in order to see the same error as reported in
COCOON-2150 issue
+                //response.flushBuffer();
             }
 
         };
@@ -234,7 +242,8 @@
                 super.service(req, response);
                 assertEquals(servletCContext, CallStackHelper.getBaseServletContext());
                 assertEquals(servletCContext, CallStackHelper.getCurrentServletContext());
-                res.setStatus(200);
+                res.setStatus(HttpServletResponse.SC_OK);
+                res.flushBuffer();
             }
         };
         servletAContext.setServlet(servletA);
@@ -248,7 +257,8 @@
 
         RequestDispatcher dispatcher = mainContext.getNamedDispatcher("servletA");
         dispatcher.forward(request, response);
-        assertEquals(200, response.getStatus());
+        assertEquals(HttpServletResponse.SC_OK, response.getStatus());
+        assertTrue("Check if response has been committed", response.isCommitted());
     }
 
     /**
@@ -273,7 +283,9 @@
 
             protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
                 super.service(request, response);
-                response.setStatus(500);
+                response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+                //FIXME: Uncomment this line in order to see the same error as reported in
COCOON-2150 issue
+                //response.flushBuffer();
             }
 
         };
@@ -283,7 +295,9 @@
 
             protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
             	super.service(request, response);
-                response.setStatus(500);
+                response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+                //FIXME: Uncomment this line in order to see the same error as reported in
COCOON-2150 issue
+                //response.flushBuffer();
             }
         };
 
@@ -294,7 +308,8 @@
                 super.service(req, response);
                 assertEquals(servletAContext, CallStackHelper.getBaseServletContext());
                 assertEquals(servletCContext, CallStackHelper.getCurrentServletContext());
-                res.setStatus(200);
+                res.setStatus(HttpServletResponse.SC_OK);
+                res.flushBuffer();
             }
         };
         servletAContext.setServlet(servletA);
@@ -308,7 +323,8 @@
 
         RequestDispatcher dispatcher = mainContext.getNamedDispatcher("servletA");
         dispatcher.forward(request, response);
-        assertEquals(200, response.getStatus());
+        assertEquals(HttpServletResponse.SC_OK, response.getStatus());
+        assertTrue("Check if response has been committed", response.isCommitted());
     }
 
     //-----------------------------------------------------------------------------------------



Mime
View raw message