You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/02/02 18:54:38 UTC
cvs commit: jakarta-cactus/src/test/share/org/apache/cactus/mock MockHttpURLConnection.java
vmassol 02/02/02 09:54:38
Modified: src/framework/servlet23/org/apache/cactus
FilterTestCase.java
src/framework/servlet23/org/apache/cactus/server
FilterConfigWrapper.java FilterImplicitObjects.java
FilterTestCaller.java FilterTestController.java
FilterTestRedirector.java
HttpServletRequestWrapper.java
PageContextWrapper.java
RequestDispatcherWrapper.java
ServletConfigWrapper.java
ServletContextWrapper.java
src/framework/share/org/apache/cactus/client
AutoReadHttpURLConnection.java
ClientConfiguration.java
src/sample/servlet23/org/apache/cactus TestAll.java
src/sample/servlet23/org/apache/cactus/sample
SampleFilter.java TestSampleFilter.java
src/sample/servlet23/org/apache/cactus/sample/unit
TestServletTestCaseSpecific.java
src/sample/servlet23/org/apache/cactus/sample/util
FilterServletOutputStream.java
GenericResponseWrapper.java
src/sample/share/org/apache/cactus/sample SampleBodyTag.java
SampleServlet.java SampleServletConfig.java
SampleTag.java TestSampleBodyTag.java
TestSampleServlet.java TestSampleServletConfig.java
TestSampleTag.java
src/sample/share/org/apache/cactus/sample/unit
TestJspTestCase.java TestServletTestCase1.java
TestServletTestCase1_ExceptionSerializable.java
TestServletTestCase1_InterceptorServletTestCase.java
TestServletTestCase2.java TestServletTestCase3.java
TestServletTestCase4.java TestServletTestCase5.java
TestServletTestCase5_InterceptorServletTestCase.java
TestServletTestCase_Authentication.java
TestServletTestCase_OverrideRedirector.java
TestServletTestCase_TestResult.java
src/test/share/org/apache/cactus TestAbstractTestCase.java
TestAbstractTestCase_InterceptorTestCase.java
TestAll.java TestServletURL.java
TestServletUtil.java
src/test/share/org/apache/cactus/mock
MockHttpURLConnection.java
Log:
more reformatting
Revision Changes Path
1.5 +5 -9 jakarta-cactus/src/framework/servlet23/org/apache/cactus/FilterTestCase.java
Index: FilterTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/FilterTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FilterTestCase.java 13 Jan 2002 15:01:57 -0000 1.4
+++ FilterTestCase.java 2 Feb 2002 17:54:36 -0000 1.5
@@ -53,15 +53,11 @@
*/
package org.apache.cactus;
-import java.lang.reflect.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
+import javax.servlet.FilterChain;
+import javax.servlet.http.HttpServletResponse;
-import junit.framework.*;
-
-import org.apache.cactus.client.*;
-import org.apache.cactus.server.*;
+import org.apache.cactus.client.FilterHttpClient;
+import org.apache.cactus.server.FilterConfigWrapper;
/**
* Test classes that need access to valid Filter implicit objects (such as the
@@ -70,7 +66,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: FilterTestCase.java,v 1.4 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: FilterTestCase.java,v 1.5 2002/02/02 17:54:36 vmassol Exp $
*/
public class FilterTestCase extends AbstractTestCase
{
1.5 +9 -11 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterConfigWrapper.java
Index: FilterConfigWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterConfigWrapper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FilterConfigWrapper.java 13 Jan 2002 15:01:57 -0000 1.4
+++ FilterConfigWrapper.java 2 Feb 2002 17:54:36 -0000 1.5
@@ -53,13 +53,11 @@
*/
package org.apache.cactus.server;
-import java.util.*;
-import java.io.*;
-import java.security.*;
-import java.net.*;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
/**
* Wrapper around <code>FilterConfig</code> which overrides the
@@ -68,7 +66,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: FilterConfigWrapper.java,v 1.4 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: FilterConfigWrapper.java,v 1.5 2002/02/02 17:54:36 vmassol Exp $
* @see ServletContext
*/
public class FilterConfigWrapper implements FilterConfig
@@ -158,14 +156,14 @@
// Add parameters that were added using setInitParameter()
Enumeration enum = this.initParameters.keys();
while (enum.hasMoreElements()) {
- String value = (String)enum.nextElement();
+ String value = (String) enum.nextElement();
names.add(value);
}
// Add parameters from web.xml
enum = this.originalConfig.getInitParameterNames();
while (enum.hasMoreElements()) {
- String value = (String)enum.nextElement();
+ String value = (String) enum.nextElement();
if (!names.contains(value)) {
names.add(value);
}
@@ -184,7 +182,7 @@
{
// Look first in the list of parameters set using the
// setInitParameter() method.
- String value = (String)this.initParameters.get(theName);
+ String value = (String) this.initParameters.get(theName);
if (value == null) {
value = this.originalConfig.getInitParameter(theName);
}
1.4 +3 -3 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterImplicitObjects.java
Index: FilterImplicitObjects.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterImplicitObjects.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FilterImplicitObjects.java 13 Jan 2002 15:01:57 -0000 1.3
+++ FilterImplicitObjects.java 2 Feb 2002 17:54:36 -0000 1.4
@@ -53,8 +53,8 @@
*/
package org.apache.cactus.server;
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
/**
* Holder class that contains the instances of the implicit objects that will
@@ -63,7 +63,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: FilterImplicitObjects.java,v 1.3 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: FilterImplicitObjects.java,v 1.4 2002/02/02 17:54:36 vmassol Exp $
*/
public class FilterImplicitObjects extends WebImplicitObjects
{
1.6 +10 -12 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterTestCaller.java
Index: FilterTestCaller.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterTestCaller.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FilterTestCaller.java 13 Jan 2002 15:01:57 -0000 1.5
+++ FilterTestCaller.java 2 Feb 2002 17:54:36 -0000 1.6
@@ -53,16 +53,14 @@
*/
package org.apache.cactus.server;
-import java.io.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
+import java.lang.reflect.Field;
+import javax.servlet.http.HttpServletRequest;
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-import org.apache.cactus.*;
-import org.apache.cactus.util.log.*;
+import org.apache.cactus.AbstractTestCase;
+import org.apache.cactus.FilterTestCase;
+import org.apache.cactus.ServletURL;
+import org.apache.cactus.util.log.Log;
+import org.apache.cactus.util.log.LogService;
/**
* Responsible for instanciating the <code>TestCase</code> class on the server
@@ -70,7 +68,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: FilterTestCaller.java,v 1.5 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: FilterTestCaller.java,v 1.6 2002/02/02 17:54:36 vmassol Exp $
*/
public class FilterTestCaller extends AbstractTestCaller
{
@@ -95,9 +93,9 @@
protected void setTestCaseFields(AbstractTestCase theTestInstance)
throws Exception
{
- FilterTestCase filterInstance = (FilterTestCase)theTestInstance;
+ FilterTestCase filterInstance = (FilterTestCase) theTestInstance;
FilterImplicitObjects filterImplicitObjects =
- (FilterImplicitObjects)this.webImplicitObjects;
+ (FilterImplicitObjects) this.webImplicitObjects;
// Sets the request field of the test case class
// ---------------------------------------------
1.4 +3 -14 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterTestController.java
Index: FilterTestController.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterTestController.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FilterTestController.java 13 Jan 2002 15:01:57 -0000 1.3
+++ FilterTestController.java 2 Feb 2002 17:54:36 -0000 1.4
@@ -53,17 +53,6 @@
*/
package org.apache.cactus.server;
-import java.io.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-import org.apache.cactus.*;
-import org.apache.cactus.util.log.*;
-
/**
* Filter Controller that extracts the requested service from the
* HTTP request and executes the request by calling a
@@ -72,7 +61,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: FilterTestController.java,v 1.3 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: FilterTestController.java,v 1.4 2002/02/02 17:54:36 vmassol Exp $
*/
public class FilterTestController extends AbstractTestController
{
@@ -80,9 +69,9 @@
* @return the test caller that will be used to execute the test
*/
protected AbstractTestCaller getTestCaller(
- WebImplicitObjects theObjects)
+ WebImplicitObjects theObjects)
{
- return new FilterTestCaller((FilterImplicitObjects)theObjects);
+ return new FilterTestCaller((FilterImplicitObjects) theObjects);
}
}
1.7 +16 -10 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterTestRedirector.java
Index: FilterTestRedirector.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/FilterTestRedirector.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FilterTestRedirector.java 13 Jan 2002 15:01:57 -0000 1.6
+++ FilterTestRedirector.java 2 Feb 2002 17:54:36 -0000 1.7
@@ -53,20 +53,25 @@
*/
package org.apache.cactus.server;
-import java.io.*;
+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;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-import org.apache.cactus.*;
-import org.apache.cactus.util.log.*;
+import org.apache.cactus.util.log.Log;
+import org.apache.cactus.util.log.LogService;
/**
* Generic Filter redirector that calls a test method on the server side.
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: FilterTestRedirector.java,v 1.6 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: FilterTestRedirector.java,v 1.7 2002/02/02 17:54:36 vmassol Exp $
* @see FilterTestCaller
*/
public class FilterTestRedirector implements Filter
@@ -76,7 +81,8 @@
* details from the correct properties file. Initialization is done here
* as this servlet is the first point of entry to the server code.
*/
- static {
+ static
+ {
LogService.getInstance().init("/log_server.properties");
}
@@ -110,8 +116,8 @@
// Create implicit object holder
FilterImplicitObjects objects = new FilterImplicitObjects();
- objects.setHttpServletRequest((HttpServletRequest)theRequest);
- objects.setHttpServletResponse((HttpServletResponse)theResponse);
+ objects.setHttpServletRequest((HttpServletRequest) theRequest);
+ objects.setHttpServletResponse((HttpServletResponse) theResponse);
objects.setFilterConfig(this.config);
objects.setServletContext(this.config.getServletContext());
objects.setFilterChain(theFilterChain);
1.11 +5 -10 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/HttpServletRequestWrapper.java
Index: HttpServletRequestWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/HttpServletRequestWrapper.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- HttpServletRequestWrapper.java 13 Jan 2002 15:01:57 -0000 1.10
+++ HttpServletRequestWrapper.java 2 Feb 2002 17:54:36 -0000 1.11
@@ -53,16 +53,11 @@
*/
package org.apache.cactus.server;
-import java.util.*;
-import java.io.*;
-import java.security.*;
-import java.net.*;
+import java.io.UnsupportedEncodingException;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-import org.apache.cactus.*;
-import org.apache.cactus.util.log.*;
+import org.apache.cactus.ServletURL;
/**
* Encapsulation class for the Servlet 2.3 API <code>HttpServletRequest</code>.
@@ -76,7 +71,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: HttpServletRequestWrapper.java,v 1.10 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: HttpServletRequestWrapper.java,v 1.11 2002/02/02 17:54:36 vmassol Exp $
*/
public class HttpServletRequestWrapper extends AbstractHttpServletRequestWrapper
{
1.4 +5 -5 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/PageContextWrapper.java
Index: PageContextWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/PageContextWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PageContextWrapper.java 13 Jan 2002 15:01:57 -0000 1.3
+++ PageContextWrapper.java 2 Feb 2002 17:54:36 -0000 1.4
@@ -53,11 +53,11 @@
*/
package org.apache.cactus.server;
-import java.io.*;
-import javax.servlet.jsp.*;
-import javax.servlet.*;
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.jsp.PageContext;
-import org.apache.cactus.*;
+import org.apache.cactus.ServletURL;
/**
* Wrapper around <code>PageContext</code> so that get methods that would
@@ -66,7 +66,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: PageContextWrapper.java,v 1.3 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: PageContextWrapper.java,v 1.4 2002/02/02 17:54:36 vmassol Exp $
*/
public class PageContextWrapper extends AbstractPageContextWrapper
{
1.7 +9 -8 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/RequestDispatcherWrapper.java
Index: RequestDispatcherWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/RequestDispatcherWrapper.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RequestDispatcherWrapper.java 13 Jan 2002 15:01:57 -0000 1.6
+++ RequestDispatcherWrapper.java 2 Feb 2002 17:54:36 -0000 1.7
@@ -53,10 +53,11 @@
*/
package org.apache.cactus.server;
-import java.io.*;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
+import java.io.IOException;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
/**
* Wrapper around <code>RequestDispatcher</code> which overrides the
@@ -65,14 +66,14 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: RequestDispatcherWrapper.java,v 1.6 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: RequestDispatcherWrapper.java,v 1.7 2002/02/02 17:54:36 vmassol Exp $
*/
public class RequestDispatcherWrapper implements RequestDispatcher
{
/**
* The original request dispatcher object
*/
- private RequestDispatcher originalDispatcher;
+ private RequestDispatcher originalDispatcher;
/**
* @param theOriginalDispatcher the original request dispatcher object
@@ -94,7 +95,7 @@
throws IOException, ServletException
{
HttpServletRequestWrapper request =
- (HttpServletRequestWrapper)theRequest;
+ (HttpServletRequestWrapper) theRequest;
this.originalDispatcher.forward(request.getOriginalRequest(),
theResponse);
}
@@ -111,7 +112,7 @@
throws IOException, ServletException
{
HttpServletRequestWrapper request =
- (HttpServletRequestWrapper)theRequest;
+ (HttpServletRequestWrapper) theRequest;
this.originalDispatcher.include(request.getOriginalRequest(),
theResponse);
}
1.7 +9 -11 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/ServletConfigWrapper.java
Index: ServletConfigWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/ServletConfigWrapper.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ServletConfigWrapper.java 13 Jan 2002 15:01:57 -0000 1.6
+++ ServletConfigWrapper.java 2 Feb 2002 17:54:36 -0000 1.7
@@ -53,13 +53,11 @@
*/
package org.apache.cactus.server;
-import java.util.*;
-import java.io.*;
-import java.security.*;
-import java.net.*;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
/**
* Wrapper around <code>ServletConfig</code> which overrides the
@@ -68,7 +66,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: ServletConfigWrapper.java,v 1.6 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: ServletConfigWrapper.java,v 1.7 2002/02/02 17:54:36 vmassol Exp $
* @see ServletContext
*/
public class ServletConfigWrapper implements ServletConfig
@@ -158,14 +156,14 @@
// Add parameters that were added using setInitParameter()
Enumeration enum = this.initParameters.keys();
while (enum.hasMoreElements()) {
- String value = (String)enum.nextElement();
+ String value = (String) enum.nextElement();
names.add(value);
}
// Add parameters from web.xml
enum = this.originalConfig.getInitParameterNames();
while (enum.hasMoreElements()) {
- String value = (String)enum.nextElement();
+ String value = (String) enum.nextElement();
if (!names.contains(value)) {
names.add(value);
}
@@ -184,7 +182,7 @@
{
// Look first in the list of parameters set using the
// setInitParameter() method.
- String value = (String)this.initParameters.get(theName);
+ String value = (String) this.initParameters.get(theName);
if (value == null) {
value = this.originalConfig.getInitParameter(theName);
}
1.8 +8 -13 jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/ServletContextWrapper.java
Index: ServletContextWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/servlet23/org/apache/cactus/server/ServletContextWrapper.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ServletContextWrapper.java 13 Jan 2002 15:01:57 -0000 1.7
+++ ServletContextWrapper.java 2 Feb 2002 17:54:36 -0000 1.8
@@ -53,14 +53,9 @@
*/
package org.apache.cactus.server;
-import java.util.*;
-import java.io.*;
-import java.security.*;
-import java.net.*;
-import java.lang.reflect.*;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
+import java.lang.reflect.Method;
+import java.util.Set;
+import javax.servlet.ServletContext;
/**
* Wrapper around Servlet 2.3 <code>ServletContext</code>. This wrapper
@@ -69,7 +64,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: ServletContextWrapper.java,v 1.7 2002/01/13 15:01:57 vmassol Exp $
+ * @version $Id: ServletContextWrapper.java,v 1.8 2002/02/02 17:54:36 vmassol Exp $
* @see RequestDispatcherWrapper
*/
public class ServletContextWrapper extends AbstractServletContextWrapper
@@ -101,7 +96,7 @@
getMethod("getResourcePaths", null);
if (method != null) {
- returnSet = (Set)method.invoke(this.originalContext, null);
+ returnSet = (Set) method.invoke(this.originalContext, null);
} else {
throw new RuntimeException("Method ServletContext." +
"getResourcePaths() no longer supported by your servlet " +
@@ -130,11 +125,11 @@
// upgraded yet)
try {
Method method = this.originalContext.getClass().
- getMethod("getResourcePaths", new Class[] { String.class });
+ getMethod("getResourcePaths", new Class[]{String.class});
if (method != null) {
- returnSet = (Set)method.invoke(this.originalContext,
- new Object[] { thePath });
+ returnSet = (Set) method.invoke(this.originalContext,
+ new Object[]{thePath});
} else {
throw new RuntimeException("Method ServletContext." +
"getResourcePaths(String path) not supported yet by your " +
1.15 +6 -6 jakarta-cactus/src/framework/share/org/apache/cactus/client/AutoReadHttpURLConnection.java
Index: AutoReadHttpURLConnection.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/share/org/apache/cactus/client/AutoReadHttpURLConnection.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- AutoReadHttpURLConnection.java 27 Jan 2002 20:00:38 -0000 1.14
+++ AutoReadHttpURLConnection.java 2 Feb 2002 17:54:37 -0000 1.15
@@ -83,14 +83,14 @@
* @author <a href="mailto:Bob.Davison@reuters.com">Bob Davison</a>
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: AutoReadHttpURLConnection.java,v 1.14 2002/01/27 20:00:38 vmassol Exp $
+ * @version $Id: AutoReadHttpURLConnection.java,v 1.15 2002/02/02 17:54:37 vmassol Exp $
*/
final class AutoReadHttpURLConnection extends HttpURLConnection
{
/**
* The logger
*/
- private static final Log logger =
+ private static final Log LOGGER =
LogService.getInstance().
getLog(AutoReadHttpURLConnection.class.getName());
@@ -126,7 +126,7 @@
// Catch IOException to log the content of the error stream
try {
if (this.streamBuffer == null) {
- logger.debug("Original connection = " + this.delegate);
+ LOGGER.debug("Original connection = " + this.delegate);
InputStream is = this.delegate.getInputStream();
this.streamBuffer = bufferInputStream(is);
}
@@ -146,7 +146,7 @@
new InputStreamReader(theErrorStream));
String buffer;
while ((buffer = errorStream.readLine()) != null) {
- logger.debug("ErrorStream [" + buffer + "]");
+ LOGGER.debug("ErrorStream [" + buffer + "]");
}
}
}
@@ -172,7 +172,7 @@
// that all servers that return no content-length header also do
// not block on read() operations !
- logger.debug("Content-Length : [" +
+ LOGGER.debug("Content-Length : [" +
this.delegate.getContentLength() + "]");
if (this.delegate.getContentLength() != 0) {
@@ -228,7 +228,7 @@
prefix.append(" ...] [... ");
}
- logger.debug("Read [" + theCount + "]: [" + prefix + suffix + "]");
+ LOGGER.debug("Read [" + theCount + "]: [" + prefix + suffix + "]");
}
// Delegated methods
1.7 +6 -14 jakarta-cactus/src/framework/share/org/apache/cactus/client/ClientConfiguration.java
Index: ClientConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/framework/share/org/apache/cactus/client/ClientConfiguration.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ClientConfiguration.java 2 Feb 2002 17:26:55 -0000 1.6
+++ ClientConfiguration.java 2 Feb 2002 17:54:37 -0000 1.7
@@ -59,25 +59,17 @@
import java.util.ResourceBundle;
import org.apache.cactus.util.ChainedRuntimeException;
-import org.apache.cactus.util.log.Log;
-import org.apache.cactus.util.log.LogService;
/**
* Provides acces to the client side Cactus configuration.
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: ClientConfiguration.java,v 1.6 2002/02/02 17:26:55 vmassol Exp $
+ * @version $Id: ClientConfiguration.java,v 1.7 2002/02/02 17:54:37 vmassol Exp $
*/
public class ClientConfiguration
{
/**
- * The logger
- */
- private static final Log logger =
- LogService.getInstance().getLog(ClientConfiguration.class.getName());
-
- /**
* Name of the Cactus configuration file if cactus is to look for it in
* the classpath.
*/
@@ -93,7 +85,7 @@
/**
* Properties file holding configuration data for Cactus.
*/
- private static ResourceBundle CONFIG = null;
+ private static ResourceBundle config = null;
/**
* Tries to read the cactus configuration from the java property defined
@@ -104,24 +96,24 @@
*/
private static final ResourceBundle getConfiguration()
{
- if (CONFIG == null) {
+ if (config == null) {
// Has the user passed the location of the cactus configuration file
// as a java property
String configOverride = System.getProperty(CONFIG_PROPERTY);
if (configOverride == null) {
// Try to read the default cactus configuration file from the
// classpath
- CONFIG = PropertyResourceBundle.getBundle(CONFIG_DEFAULT_NAME);
+ config = PropertyResourceBundle.getBundle(CONFIG_DEFAULT_NAME);
} else {
try {
- CONFIG = new PropertyResourceBundle(new FileInputStream(configOverride));
+ config = new PropertyResourceBundle(new FileInputStream(configOverride));
} catch (IOException e) {
throw new ChainedRuntimeException("Cannot read cactus configuration file [" +
configOverride + "]", e);
}
}
}
- return CONFIG;
+ return config;
}
/**
1.7 +5 -3 jakarta-cactus/src/sample/servlet23/org/apache/cactus/TestAll.java
Index: TestAll.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/servlet23/org/apache/cactus/TestAll.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestAll.java 13 Jan 2002 21:21:17 -0000 1.6
+++ TestAll.java 2 Feb 2002 17:54:37 -0000 1.7
@@ -53,7 +53,9 @@
*/
package org.apache.cactus;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
/**
* Run all the sample tests of Cactus for Servlet API 2.3 that do need a
@@ -61,7 +63,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestAll.java,v 1.6 2002/01/13 21:21:17 vmassol Exp $
+ * @version $Id: TestAll.java,v 1.7 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestAll extends TestCase
{
@@ -82,7 +84,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {TestAll.class.getName()});
+ junit.ui.TestRunner.main(new String[]{TestAll.class.getName()});
}
/**
1.4 +12 -6 jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/SampleFilter.java
Index: SampleFilter.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/SampleFilter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SampleFilter.java 13 Jan 2002 15:30:20 -0000 1.3
+++ SampleFilter.java 2 Feb 2002 17:54:37 -0000 1.4
@@ -53,11 +53,17 @@
*/
package org.apache.cactus.sample;
-import java.io.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
+import java.io.IOException;
+import java.io.OutputStream;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
-import org.apache.cactus.sample.util.*;
+import org.apache.cactus.sample.util.GenericResponseWrapper;
/**
* Sample filter that implements some very simple business logic. The goal is
@@ -66,7 +72,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: SampleFilter.java,v 1.3 2002/01/13 15:30:20 vmassol Exp $
+ * @version $Id: SampleFilter.java,v 1.4 2002/02/02 17:54:37 vmassol Exp $
*/
public class SampleFilter implements Filter
{
@@ -109,7 +115,7 @@
// get an error saying that the response has already been
// committed.
GenericResponseWrapper wrapper =
- new GenericResponseWrapper((HttpServletResponse)theResponse);
+ new GenericResponseWrapper((HttpServletResponse) theResponse);
theChain.doFilter(theRequest, wrapper);
1.5 +18 -12 jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/TestSampleFilter.java
Index: TestSampleFilter.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/TestSampleFilter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestSampleFilter.java 13 Jan 2002 15:30:20 -0000 1.4
+++ TestSampleFilter.java 2 Feb 2002 17:54:37 -0000 1.5
@@ -53,24 +53,27 @@
*/
package org.apache.cactus.sample;
-import java.util.*;
-import java.text.*;
-import java.net.*;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
-import javax.servlet.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-import junit.framework.*;
-
-import org.apache.cactus.*;
-import org.apache.cactus.util.*;
+import org.apache.cactus.FilterTestCase;
+import org.apache.cactus.WebResponse;
/**
* Tests of the <code>SampleFilter</code> filter class.
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestSampleFilter.java,v 1.4 2002/01/13 15:30:20 vmassol Exp $
+ * @version $Id: TestSampleFilter.java,v 1.5 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestSampleFilter extends FilterTestCase
{
@@ -91,7 +94,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestSampleFilter.class.getName()});
}
@@ -190,7 +193,8 @@
config.setInitParameter("footer", "<h1>footer</h1>");
filter.init(config);
- FilterChain mockFilterChain = new FilterChain() {
+ FilterChain mockFilterChain = new FilterChain()
+ {
public void doFilter(ServletRequest theRequest,
ServletResponse theResponse) throws IOException, ServletException
{
@@ -198,9 +202,11 @@
writer.print("<p>some content</p>");
writer.close();
}
+
public void init(FilterConfig theConfig)
{
}
+
public void destroy()
{
}
1.6 +5 -11 jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/unit/TestServletTestCaseSpecific.java
Index: TestServletTestCaseSpecific.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/unit/TestServletTestCaseSpecific.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestServletTestCaseSpecific.java 13 Jan 2002 15:30:20 -0000 1.5
+++ TestServletTestCaseSpecific.java 2 Feb 2002 17:54:37 -0000 1.6
@@ -53,16 +53,10 @@
*/
package org.apache.cactus.sample.unit;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
-import java.io.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-import junit.framework.*;
-
-import org.apache.cactus.*;
+import org.apache.cactus.ServletTestCase;
/**
* Cactus unit tests for testing <code>ServletTestCase</code>. These tests
@@ -76,7 +70,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCaseSpecific.java,v 1.5 2002/01/13 15:30:20 vmassol Exp $
+ * @version $Id: TestServletTestCaseSpecific.java,v 1.6 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestServletTestCaseSpecific extends ServletTestCase
{
@@ -97,7 +91,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestServletTestCaseSpecific.class.getName()});
}
1.4 +5 -3 jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/util/FilterServletOutputStream.java
Index: FilterServletOutputStream.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/util/FilterServletOutputStream.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FilterServletOutputStream.java 13 Jan 2002 15:30:20 -0000 1.3
+++ FilterServletOutputStream.java 2 Feb 2002 17:54:37 -0000 1.4
@@ -53,8 +53,10 @@
*/
package org.apache.cactus.sample.util;
-import javax.servlet.*;
-import java.io.*;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import javax.servlet.ServletOutputStream;
/**
* Helper class to help write filters that manipulates the output stream. This
@@ -67,7 +69,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: FilterServletOutputStream.java,v 1.3 2002/01/13 15:30:20 vmassol Exp $
+ * @version $Id: FilterServletOutputStream.java,v 1.4 2002/02/02 17:54:37 vmassol Exp $
*
* @see GenericResponseWrapper
*/
1.4 +6 -4 jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/util/GenericResponseWrapper.java
Index: GenericResponseWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/servlet23/org/apache/cactus/sample/util/GenericResponseWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- GenericResponseWrapper.java 13 Jan 2002 15:30:20 -0000 1.3
+++ GenericResponseWrapper.java 2 Feb 2002 17:54:37 -0000 1.4
@@ -53,9 +53,11 @@
*/
package org.apache.cactus.sample.util;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
/**
* Wrapper around a <code>HttpServletResponse</code> that we use to easily
@@ -71,7 +73,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: GenericResponseWrapper.java,v 1.3 2002/01/13 15:30:20 vmassol Exp $
+ * @version $Id: GenericResponseWrapper.java,v 1.4 2002/02/02 17:54:37 vmassol Exp $
*
* @see FilterServletOutputStream
*/
1.3 +23 -23 jakarta-cactus/src/sample/share/org/apache/cactus/sample/SampleBodyTag.java
Index: SampleBodyTag.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/SampleBodyTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SampleBodyTag.java 13 Jan 2002 15:31:39 -0000 1.2
+++ SampleBodyTag.java 2 Feb 2002 17:54:37 -0000 1.3
@@ -53,10 +53,10 @@
*/
package org.apache.cactus.sample;
-import java.util.*;
-import javax.servlet.jsp.*;
-import javax.servlet.jsp.tagext.*;
-import java.io.*;
+import java.io.IOException;
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.BodyTagSupport;
/**
* Sample tag that interacts with its body. The tag acts as a filter for its
@@ -65,21 +65,21 @@
*
* @author <a href="mailto:nick@eblox.com">Nicholas Lesiecki</a>
*
- * @version $Id: SampleBodyTag.java,v 1.2 2002/01/13 15:31:39 vmassol Exp $
+ * @version $Id: SampleBodyTag.java,v 1.3 2002/02/02 17:54:37 vmassol Exp $
*/
public class SampleBodyTag extends BodyTagSupport
{
/**
* The substring to be replaced in the body.
*/
- private String target;
+ private String target;
/**
* The substring that will replace the target in the body.
*/
private String replacement;
- /**
+ /**
* Sets the substring to be replaced in the body.
*
* @param theTarget the substring to be replaced in the body
@@ -88,48 +88,48 @@
{
this.target = theTarget;
}
-
- /**
+
+ /**
* Sets the substring that will replace the target in the body.
*/
- public void setReplacement(String theReplacement)
+ public void setReplacement(String theReplacement)
{
this.replacement = theReplacement;
}
-
+
/**
* Performs the replacement.
- */
+ */
public int doAfterBody() throws JspTagException
{
String contentString = this.bodyContent.getString();
StringBuffer contentBuffer = new StringBuffer(contentString);
-
+
int beginIndex = -1;
int targetLength = this.target.length();
-
+
// while instances of target still exist
- while ((beginIndex = contentString.indexOf(this.target)) > -1){
-
+ while ((beginIndex = contentString.indexOf(this.target)) > -1) {
+
int endIndex = beginIndex + targetLength;
contentBuffer.replace(beginIndex, endIndex, this.replacement);
-
+
contentString = contentBuffer.toString();
}
-
+
// write out the changed body
JspWriter pageWriter = this.bodyContent.getEnclosingWriter();
try {
-
+
pageWriter.write(contentString);
-
- } catch (IOException e){
+
+ } catch (IOException e) {
throw new JspTagException(e.getMessage());
}
-
+
return SKIP_BODY;
}
-
+
public void release()
{
this.target = null;
1.9 +14 -7 jakarta-cactus/src/sample/share/org/apache/cactus/sample/SampleServlet.java
Index: SampleServlet.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/SampleServlet.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SampleServlet.java 13 Jan 2002 15:31:39 -0000 1.8
+++ SampleServlet.java 2 Feb 2002 17:54:37 -0000 1.9
@@ -53,10 +53,17 @@
*/
package org.apache.cactus.sample;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.io.*;
-import java.util.*;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
/**
* Sample servlet that implement some very simple business logic. The goal is
@@ -66,7 +73,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: SampleServlet.java,v 1.8 2002/01/13 15:31:39 vmassol Exp $
+ * @version $Id: SampleServlet.java,v 1.9 2002/02/02 17:54:37 vmassol Exp $
*/
public class SampleServlet extends HttpServlet
{
@@ -193,8 +200,8 @@
*
* @param theResponse the HTTP response
*/
- public void setResponseCookie(HttpServletResponse theResponse)
- {
+ public void setResponseCookie(HttpServletResponse theResponse)
+ {
Cookie cookie = new Cookie("responsecookie",
"this is a response cookie");
cookie.setDomain("jakarta.apache.org");
1.6 +2 -5 jakarta-cactus/src/sample/share/org/apache/cactus/sample/SampleServletConfig.java
Index: SampleServletConfig.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/SampleServletConfig.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SampleServletConfig.java 13 Jan 2002 15:31:39 -0000 1.5
+++ SampleServletConfig.java 2 Feb 2002 17:54:37 -0000 1.6
@@ -53,10 +53,7 @@
*/
package org.apache.cactus.sample;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.io.*;
-import java.util.*;
+import javax.servlet.http.HttpServlet;
/**
* Sample servlet to show how to unit test a servlet that makes calls to
@@ -66,7 +63,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: SampleServletConfig.java,v 1.5 2002/01/13 15:31:39 vmassol Exp $
+ * @version $Id: SampleServletConfig.java,v 1.6 2002/02/02 17:54:37 vmassol Exp $
*/
public class SampleServletConfig extends HttpServlet
{
1.3 +31 -29 jakarta-cactus/src/sample/share/org/apache/cactus/sample/SampleTag.java
Index: SampleTag.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/SampleTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SampleTag.java 13 Jan 2002 15:31:39 -0000 1.2
+++ SampleTag.java 2 Feb 2002 17:54:37 -0000 1.3
@@ -53,17 +53,20 @@
*/
package org.apache.cactus.sample;
-import java.util.*;
-import javax.servlet.jsp.*;
-import javax.servlet.jsp.tagext.*;
-import java.io.*;
+import java.io.IOException;
+import java.util.Enumeration;
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.Tag;
+import javax.servlet.jsp.tagext.TagSupport;
/**
* Sample tag that implements simple tag logic.
*
* @author <a href="mailto:nick@eblox.com">Nicholas Lesiecki</a>
*
- * @version $Id: SampleTag.java,v 1.2 2002/01/13 15:31:39 vmassol Exp $
+ * @version $Id: SampleTag.java,v 1.3 2002/02/02 17:54:37 vmassol Exp $
*/
public class SampleTag extends TagSupport
{
@@ -71,12 +74,12 @@
* Determines whether the tag's body should be shown.
*/
private boolean showBody;
-
+
/**
* Determines whether page should continue after the tag.
*/
private boolean stopPage;
-
+
/** Determines whether the tag's body should be shown.
* @param showBody a String equaling 'true' will be taken as
* <code>true</code>. Anything else will be
@@ -87,7 +90,7 @@
showBody = showBody.toLowerCase();
this.showBody = "true".equals(showBody);
}
-
+
/** Determines whether page should stop after the tag.
* @param showBody a String equaling 'true' will be taken as
* <code>true</code>. Anything else will be
@@ -97,7 +100,7 @@
{
this.stopPage = "true".equals(stopPage);
}
-
+
/**
* Prints the names and values of everything in page scope to the response,
* along with the body (if showBody is set to <code>true</code>).
@@ -105,35 +108,34 @@
public int doStartTag() throws JspTagException
{
Enumeration names =
- pageContext.getAttributeNamesInScope(PageContext.PAGE_SCOPE);
-
+ pageContext.getAttributeNamesInScope(PageContext.PAGE_SCOPE);
+
JspWriter out = pageContext.getOut();
-
+
try {
-
+
out.println("The following attributes exist in page scope: <BR>");
-
+
while (names.hasMoreElements()) {
- String name = (String)names.nextElement();
+ String name = (String) names.nextElement();
Object attribute = pageContext.getAttribute(name);
-
+
out.println(name + " = " + attribute + " <BR>");
}
-
-
+
if (this.showBody) {
-
+
out.println("Body Content Follows: <BR>");
return EVAL_BODY_INCLUDE;
}
-
+
} catch (IOException e) {
throw new JspTagException(e.getMessage());
}
-
+
return SKIP_BODY;
}
-
+
/**
* Does two things:
* <ul>
@@ -145,23 +147,23 @@
{
//get the parent if any
Tag parent = this.getParent();
-
+
if (parent != null) {
try {
JspWriter out = this.pageContext.getOut();
out.println("This tag has a parent. <BR>");
-
+
} catch (IOException e) {
throw new JspTagException(e.getMessage());
}
}
-
- if (this.stopPage){
-
+
+ if (this.stopPage) {
+
return Tag.SKIP_PAGE;
}
-
+
return Tag.EVAL_PAGE;
}
-
+
}
1.4 +22 -21 jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleBodyTag.java
Index: TestSampleBodyTag.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleBodyTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestSampleBodyTag.java 13 Jan 2002 15:31:39 -0000 1.3
+++ TestSampleBodyTag.java 2 Feb 2002 17:54:37 -0000 1.4
@@ -53,21 +53,21 @@
*/
package org.apache.cactus.sample;
-import java.util.*;
-import java.io.*;
-import javax.servlet.jsp.*;
-import javax.servlet.jsp.tagext.*;
-import junit.framework.*;
+import javax.servlet.jsp.tagext.BodyContent;
+import javax.servlet.jsp.tagext.BodyTag;
-import org.apache.cactus.*;
-import org.apache.cactus.util.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.cactus.JspTestCase;
+import org.apache.cactus.WebResponse;
/**
* Tests of the <code>SampleBodyTag</code> class.
*
* @author <a href="mailto:nick@eblox.com">Nciholas Lesiecki</a>
*
- * @version $Id: TestSampleBodyTag.java,v 1.3 2002/01/13 15:31:39 vmassol Exp $
+ * @version $Id: TestSampleBodyTag.java,v 1.4 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestSampleBodyTag extends JspTestCase
{
@@ -88,7 +88,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestSampleBodyTag.class.getName()});
}
@@ -105,8 +105,9 @@
//-------------------------------------------------------------------------
private SampleBodyTag tag;
+
private BodyContent tagContent;
-
+
/**
* In addition to creating the tag instance and adding the pageContext to
* it, this method creates a BodyContent object and passes it to the tag.
@@ -115,7 +116,7 @@
{
this.tag = new SampleBodyTag();
this.tag.setPageContext(this.pageContext);
-
+
//create the BodyContent object and call the setter on the tag instance
this.tagContent = this.pageContext.pushBody();
this.tag.setBodyContent(this.tagContent);
@@ -132,38 +133,38 @@
//set the target and the String to replace it with
this.tag.setTarget("@target@");
this.tag.setReplacement("replacement");
-
+
//add the tag's body by writing to the BodyContent object created in
//setUp()
this.tagContent.println("@target@ is now @target@");
this.tagContent.println("@target@_@target@");
-
- //none of the other life cycle methods need to be implemented, so they
+
+ //none of the other life cycle methods need to be implemented, so they
//do not need to be called.
int result = this.tag.doAfterBody();
assertEquals(BodyTag.SKIP_BODY, result);
-
+
}
-
+
public void tearDown()
- {
+ {
//necessary for tag to output anything on most servlet engines.
this.pageContext.popBody();
}
-
+
/**
- * Verifies that the target String has indeed been replaced in the tag's
+ * Verifies that the target String has indeed been replaced in the tag's
* body.
*/
public void endReplacement(WebResponse theResponse)
{
String content = theResponse.getText();
-
+
assert("Response should have contained the [" +
"replacement is now replacement] string",
content.indexOf("replacement is now replacement") > -1);
assert("Response should have contained the [" +
"replacement_replacement] string", content.indexOf("replacement") > -1);
}
-
+
}
1.15 +18 -16 jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleServlet.java
Index: TestSampleServlet.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleServlet.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TestSampleServlet.java 13 Jan 2002 15:31:39 -0000 1.14
+++ TestSampleServlet.java 2 Feb 2002 17:54:37 -0000 1.15
@@ -53,22 +53,24 @@
*/
package org.apache.cactus.sample;
-import java.util.*;
-import java.text.*;
-import java.net.*;
-import java.io.*;
-
-import junit.framework.*;
-
-import org.apache.cactus.*;
-import org.apache.cactus.util.*;
+import java.io.IOException;
+import java.net.URLDecoder;
+import java.util.Hashtable;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.cactus.Cookie;
+import org.apache.cactus.ServletTestCase;
+import org.apache.cactus.WebRequest;
+import org.apache.cactus.WebResponse;
/**
* Tests of the <code>SampleServlet</code> servlet class.
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestSampleServlet.java,v 1.14 2002/01/13 15:31:39 vmassol Exp $
+ * @version $Id: TestSampleServlet.java,v 1.15 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestSampleServlet extends ServletTestCase
{
@@ -89,7 +91,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestSampleServlet.class.getName()});
}
@@ -270,7 +272,7 @@
Hashtable cookies = servlet.getRequestCookies(request);
assert("Cannot find [testcookie] cookie in request",
- cookies.get("testcookie") != null);
+ cookies.get("testcookie") != null);
assertEquals("thisisacookie", cookies.get("testcookie"));
}
@@ -387,7 +389,7 @@
/**
* Verify that we can use a <code>RequestDispatcher</code> in the class to
- * test to forward to another page and compare the result sent to the
+ * test to forward to another page and compare the result sent to the
* output stream on the client side.
*/
public void testRequestDispatcherForward() throws Exception
@@ -398,7 +400,7 @@
/**
* Verify that we can use a <code>RequestDispatcher</code> in the class to
- * test to forward to another page and compare the result sent to the
+ * test to forward to another page and compare the result sent to the
* output stream on the client side.
*
* @param theResponse the response from the server side.
@@ -418,7 +420,7 @@
/**
* Verify that we can use a <code>RequestDispatcher</code> in the class to
- * test to include another page and compare the result sent to the
+ * test to include another page and compare the result sent to the
* output stream on the client side.
*/
public void testRequestDispatcherInclude() throws Exception
@@ -429,7 +431,7 @@
/**
* Verify that we can use a <code>RequestDispatcher</code> in the class to
- * test to include another page and compare the result sent to the
+ * test to include another page and compare the result sent to the
* output stream on the client side.
*
* @param theResponse the response from the server side.
1.7 +6 -11 jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleServletConfig.java
Index: TestSampleServletConfig.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleServletConfig.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestSampleServletConfig.java 13 Jan 2002 15:31:39 -0000 1.6
+++ TestSampleServletConfig.java 2 Feb 2002 17:54:37 -0000 1.7
@@ -53,17 +53,12 @@
*/
package org.apache.cactus.sample;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
-import java.io.*;
+import javax.servlet.ServletException;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-import org.apache.cactus.*;
-import org.apache.cactus.util.*;
+import org.apache.cactus.ServletTestCase;
/**
* Tests of the <code>SampleServletConfig</code> servlet class. This to show
@@ -74,7 +69,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestSampleServletConfig.java,v 1.6 2002/01/13 15:31:39 vmassol Exp $
+ * @version $Id: TestSampleServletConfig.java,v 1.7 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestSampleServletConfig extends ServletTestCase
{
@@ -95,7 +90,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestSampleServletConfig.class.getName()});
}
1.3 +31 -28 jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleTag.java
Index: TestSampleTag.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestSampleTag.java 13 Jan 2002 15:31:39 -0000 1.2
+++ TestSampleTag.java 2 Feb 2002 17:54:37 -0000 1.3
@@ -53,17 +53,20 @@
*/
package org.apache.cactus.sample;
-import javax.servlet.jsp.tagext.*;
-import junit.framework.*;
+import javax.servlet.jsp.tagext.Tag;
-import org.apache.cactus.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.cactus.JspTestCase;
+import org.apache.cactus.WebResponse;
/**
* Tests of the <code>SampleTag</code> class.
*
* @author <a href="mailto:nick@eblox.com">Nicholas Lesiecki</a>
*
- * @version $Id: TestSampleTag.java,v 1.2 2002/01/13 15:31:39 vmassol Exp $
+ * @version $Id: TestSampleTag.java,v 1.3 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestSampleTag extends JspTestCase
{
@@ -84,7 +87,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestSampleTag.class.getName()});
}
@@ -101,17 +104,17 @@
//-------------------------------------------------------------------------
private SampleTag tag;
-
+
public void setUp()
{
this.tag = new SampleTag();
this.tag.setPageContext(this.pageContext);
}
-
+
//-------------------------------------------------------------------------
/**
- * Tests whether doStartTag() will skip the body if the corresponding tag
+ * Tests whether doStartTag() will skip the body if the corresponding tag
* attribute is set. Also tests whether an attribute put into page scope
* before the tag executes will be output to the response.
*/
@@ -119,28 +122,28 @@
{
//put something in page scope to see if it shows up in the response...
this.pageContext.setAttribute("test-key", "test-value");
-
+
this.tag.setShowBody("false");
int result = this.tag.doStartTag();
-
+
//body should not show up
assertEquals(Tag.SKIP_BODY, result);
}
-
+
/**
* Verifies that the output includes the output from doStartTag (a message
* from the tag and the attribute set into page scope).
*/
public void endDoStartTag(WebResponse theResponse)
{
- // check that two of the lines output by the tag showed up in
+ // check that two of the lines output by the tag showed up in
// the response
assertContains(theResponse,
- "The following attributes exist in page scope: <BR>");
-
+ "The following attributes exist in page scope: <BR>");
+
assertContains(theResponse, "test-key = test-value <BR>");
}
-
+
//-------------------------------------------------------------------------
/**
@@ -150,9 +153,9 @@
public void testDoStartTagInclude() throws Exception
{
this.tag.setShowBody("true");
-
+
int result = this.tag.doStartTag();
-
+
//body should show up
assertEquals(Tag.EVAL_BODY_INCLUDE, result);
}
@@ -166,7 +169,7 @@
// check that the pre-body message printed by the tag shows up
assertContains(theResponse, "Body Content Follows: <BR>");
}
-
+
//-------------------------------------------------------------------------
/**
@@ -177,11 +180,11 @@
{
this.tag.setParent(new SampleTag());
this.tag.setStopPage("false");
-
+
int result = this.tag.doEndTag();
assertEquals(Tag.EVAL_PAGE, result);
}
-
+
/**
* Checks whether the tag has printed a message indicating that it has a
* parent tag.
@@ -190,22 +193,22 @@
{
assertContains(theResponse, "This tag has a parent. <BR>");
}
-
+
//-------------------------------------------------------------------------
/**
- * Checks if the tag will signal that page processing should stop if
+ * Checks if the tag will signal that page processing should stop if
* stopPage is set to "true"
*/
public void testDoEndTagStop() throws Exception
{
//no parent set
this.tag.setStopPage("true");
-
+
int result = this.tag.doEndTag();
assertEquals(Tag.SKIP_PAGE, result);
}
-
+
/**
* Checks whether the tag has printed a message indicating that it has a
* parent tag. (In this case it should not.)
@@ -216,9 +219,9 @@
boolean containsMessage = target.indexOf("This tag has a parent. <BR>") > 0;
assert(!containsMessage);
}
-
+
//--------------------------------------------------------------------------
-
+
/**
* Convenience function that asserts that a substring can be found in a
* target String.
@@ -226,8 +229,8 @@
public void assertContains(WebResponse theResponse, String theSubstring)
{
String target = theResponse.getText();
-
- if (target.indexOf(theSubstring) < 0){
+
+ if (target.indexOf(theSubstring) < 0) {
fail("Response did not contain the substring: [" +
theSubstring + "]");
}
1.7 +10 -11 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestJspTestCase.java
Index: TestJspTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestJspTestCase.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestJspTestCase.java 13 Jan 2002 15:31:40 -0000 1.6
+++ TestJspTestCase.java 2 Feb 2002 17:54:37 -0000 1.7
@@ -53,16 +53,15 @@
*/
package org.apache.cactus.sample.unit;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-import org.apache.cactus.*;
+import org.apache.cactus.JspTestCase;
+import org.apache.cactus.WebResponse;
/**
* Cactus unit tests for testing <code>JspTestCase</code>.
@@ -75,7 +74,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestJspTestCase.java,v 1.6 2002/01/13 15:31:40 vmassol Exp $
+ * @version $Id: TestJspTestCase.java,v 1.7 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestJspTestCase extends JspTestCase
{
@@ -96,7 +95,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestJspTestCase.class.getName()});
}
@@ -134,7 +133,7 @@
while (null != ((str = input.readLine()))) {
sb.append(str);
}
- input.close ();
+ input.close();
assertEquals("some text sent back using out", sb.toString());
}
1.7 +5 -12 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase1.java
Index: TestServletTestCase1.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase1.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestServletTestCase1.java 13 Jan 2002 15:31:40 -0000 1.6
+++ TestServletTestCase1.java 2 Feb 2002 17:54:37 -0000 1.7
@@ -53,16 +53,9 @@
*/
package org.apache.cactus.sample.unit;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
-import java.io.*;
-
-import junit.framework.*;
-
-import org.apache.cactus.*;
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+import junit.framework.TestSuite;
/**
* Cactus unit tests for testing exception handling of
@@ -82,7 +75,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase1.java,v 1.6 2002/01/13 15:31:40 vmassol Exp $
+ * @version $Id: TestServletTestCase1.java,v 1.7 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestServletTestCase1
extends TestServletTestCase1_InterceptorServletTestCase
@@ -104,7 +97,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestServletTestCase1.class.getName()});
}
1.6 +2 -2 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase1_ExceptionSerializable.java
Index: TestServletTestCase1_ExceptionSerializable.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase1_ExceptionSerializable.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestServletTestCase1_ExceptionSerializable.java 13 Jan 2002 15:31:40 -0000 1.5
+++ TestServletTestCase1_ExceptionSerializable.java 2 Feb 2002 17:54:37 -0000 1.6
@@ -53,7 +53,7 @@
*/
package org.apache.cactus.sample.unit;
-import java.io.*;
+import java.io.Serializable;
/**
* Used by <code>TestServletTestCase1</code> to test the case where
@@ -61,7 +61,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase1_ExceptionSerializable.java,v 1.5 2002/01/13 15:31:40 vmassol Exp $
+ * @version $Id: TestServletTestCase1_ExceptionSerializable.java,v 1.6 2002/02/02 17:54:37 vmassol Exp $
* @see TestServletTestCase1
*/
public class TestServletTestCase1_ExceptionSerializable
1.10 +8 -7 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase1_InterceptorServletTestCase.java
Index: TestServletTestCase1_InterceptorServletTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase1_InterceptorServletTestCase.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestServletTestCase1_InterceptorServletTestCase.java 27 Jan 2002 17:23:18 -0000 1.9
+++ TestServletTestCase1_InterceptorServletTestCase.java 2 Feb 2002 17:54:37 -0000 1.10
@@ -53,10 +53,11 @@
*/
package org.apache.cactus.sample.unit;
-import junit.framework.*;
+import junit.framework.AssertionFailedError;
-import org.apache.cactus.client.*;
-import org.apache.cactus.*;
+import org.apache.cactus.ServletTestCase;
+import org.apache.cactus.client.AssertionFailedErrorWrapper;
+import org.apache.cactus.client.ServletExceptionWrapper;
/**
* Helper class for the <code>TestServletTestCase1</code> tests. It is used to
@@ -66,7 +67,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase1_InterceptorServletTestCase.java,v 1.9 2002/01/27 17:23:18 vmassol Exp $
+ * @version $Id: TestServletTestCase1_InterceptorServletTestCase.java,v 1.10 2002/02/02 17:54:37 vmassol Exp $
* @see TestServletTestCase1
*/
public class TestServletTestCase1_InterceptorServletTestCase
@@ -85,8 +86,8 @@
/**
* Intercepts running test cases to check for normal exceptions.
*/
- protected void runTest() throws Throwable
- {
+ protected void runTest() throws Throwable
+ {
try {
super.runTest();
} catch (AssertionFailedErrorWrapper e) {
@@ -133,5 +134,5 @@
throw e;
}
- }
+ }
}
1.24 +26 -17 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase2.java
Index: TestServletTestCase2.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase2.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- TestServletTestCase2.java 13 Jan 2002 15:31:40 -0000 1.23
+++ TestServletTestCase2.java 2 Feb 2002 17:54:37 -0000 1.24
@@ -53,18 +53,27 @@
*/
package org.apache.cactus.sample.unit;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
-import java.io.*;
-
-import junit.framework.*;
-
-import org.apache.cactus.*;
-import org.apache.cactus.server.*;
-import org.apache.cactus.util.*;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Enumeration;
+import java.util.Vector;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.cactus.ServletTestCase;
+import org.apache.cactus.WebRequest;
+import org.apache.cactus.WebResponse;
+import org.apache.cactus.server.ServletContextWrapper;
/**
* Some Cactus unit tests for testing <code>ServletTestCase</code>.
@@ -77,7 +86,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase2.java,v 1.23 2002/01/13 15:31:40 vmassol Exp $
+ * @version $Id: TestServletTestCase2.java,v 1.24 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestServletTestCase2 extends ServletTestCase
{
@@ -98,7 +107,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestServletTestCase2.class.getName()});
}
@@ -205,8 +214,8 @@
boolean found = false;
Enumeration enum = config.getInitParameterNames();
- while(enum.hasMoreElements()) {
- String name = (String)enum.nextElement();
+ while (enum.hasMoreElements()) {
+ String name = (String) enum.nextElement();
if (name.equals("testparam")) {
found = true;
break;
@@ -486,7 +495,7 @@
context.log(message);
- Vector logs = ((ServletContextWrapper)context).getLogs();
+ Vector logs = ((ServletContextWrapper) context).getLogs();
assertEquals("Found more than one log message", logs.size(), 1);
assert("Cannot find expected log message : [" + message + "]",
logs.contains("some test log"));
1.8 +7 -12 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase3.java
Index: TestServletTestCase3.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase3.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestServletTestCase3.java 13 Jan 2002 15:31:40 -0000 1.7
+++ TestServletTestCase3.java 2 Feb 2002 17:54:37 -0000 1.8
@@ -53,16 +53,11 @@
*/
package org.apache.cactus.sample.unit;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
-import java.io.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-import junit.framework.*;
-
-import org.apache.cactus.*;
+import org.apache.cactus.ServletTestCase;
+import org.apache.cactus.WebResponse;
/**
* Cactus unit tests for verifying that <code>setUp()</code> and
@@ -77,7 +72,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase3.java,v 1.7 2002/01/13 15:31:40 vmassol Exp $
+ * @version $Id: TestServletTestCase3.java,v 1.8 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestServletTestCase3 extends ServletTestCase
{
@@ -98,7 +93,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestServletTestCase3.class.getName()});
}
@@ -129,7 +124,7 @@
*/
public void testSetUp()
{
- assertEquals("a setUp test flag", session.getValue("setUpFlag"));
+ assertEquals("a setUp test flag", session.getValue("setUpFlag"));
}
//-------------------------------------------------------------------------
1.9 +9 -13 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase4.java
Index: TestServletTestCase4.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase4.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TestServletTestCase4.java 13 Jan 2002 15:31:40 -0000 1.8
+++ TestServletTestCase4.java 2 Feb 2002 17:54:37 -0000 1.9
@@ -53,15 +53,11 @@
*/
package org.apache.cactus.sample.unit;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-import junit.framework.*;
-
-import org.apache.cactus.*;
+import org.apache.cactus.ServletTestCase;
+import org.apache.cactus.WebRequest;
/**
* Cactus unit tests for testing simulation URL for
@@ -75,7 +71,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase4.java,v 1.8 2002/01/13 15:31:40 vmassol Exp $
+ * @version $Id: TestServletTestCase4.java,v 1.9 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestServletTestCase4 extends ServletTestCase
{
@@ -96,7 +92,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestServletTestCase4.class.getName()});
}
@@ -253,7 +249,7 @@
//-------------------------------------------------------------------------
/**
- * Verify that we can simulate different parts of the URL. Also verify
+ * Verify that we can simulate different parts of the URL. Also verify
* that HTTP parameters put in the simulation URL will be
* available on the server side as real HTTP parameters.
*
@@ -262,12 +258,12 @@
*/
public void beginSimulatedURL5(WebRequest theRequest)
{
- theRequest.setURL("jakarta.apache.org", "/catalog",
+ theRequest.setURL("jakarta.apache.org", "/catalog",
"/help/feedback.jsp", null, "PARAM1=param1&PARAM2=&PARAM3=param3");
}
/**
- * Verify that we can simulate different parts of the URL. Also verify
+ * Verify that we can simulate different parts of the URL. Also verify
* that HTTP parameters put in the simulation URL will be
* available on the server side as real HTTP parameters.
*/
1.7 +5 -12 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase5.java
Index: TestServletTestCase5.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase5.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestServletTestCase5.java 13 Jan 2002 15:31:40 -0000 1.6
+++ TestServletTestCase5.java 2 Feb 2002 17:54:37 -0000 1.7
@@ -53,16 +53,9 @@
*/
package org.apache.cactus.sample.unit;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
-import java.io.*;
-
-import junit.framework.*;
-
-import org.apache.cactus.*;
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+import junit.framework.TestSuite;
/**
* Cactus unit tests for testing exception handling of
@@ -82,7 +75,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase5.java,v 1.6 2002/01/13 15:31:40 vmassol Exp $
+ * @version $Id: TestServletTestCase5.java,v 1.7 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestServletTestCase5
extends TestServletTestCase5_InterceptorServletTestCase
@@ -104,7 +97,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestServletTestCase5.class.getName()});
}
1.6 +5 -8 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase5_InterceptorServletTestCase.java
Index: TestServletTestCase5_InterceptorServletTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase5_InterceptorServletTestCase.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestServletTestCase5_InterceptorServletTestCase.java 13 Jan 2002 15:31:40 -0000 1.5
+++ TestServletTestCase5_InterceptorServletTestCase.java 2 Feb 2002 17:54:37 -0000 1.6
@@ -53,10 +53,7 @@
*/
package org.apache.cactus.sample.unit;
-import junit.framework.*;
-
-import org.apache.cactus.client.*;
-import org.apache.cactus.*;
+import org.apache.cactus.ServletTestCase;
/**
* Helper class for the <code>TestServletTestCase5</code> tests. It is used to
@@ -66,7 +63,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase5_InterceptorServletTestCase.java,v 1.5 2002/01/13 15:31:40 vmassol Exp $
+ * @version $Id: TestServletTestCase5_InterceptorServletTestCase.java,v 1.6 2002/02/02 17:54:37 vmassol Exp $
* @see TestServletTestCase1
*/
public class TestServletTestCase5_InterceptorServletTestCase
@@ -85,8 +82,8 @@
/**
* Intercepts running test cases to check for normal exceptions.
*/
- protected void runTest() throws Throwable
- {
+ protected void runTest() throws Throwable
+ {
try {
super.runTest();
} catch (Throwable e) {
@@ -95,5 +92,5 @@
}
- }
+ }
}
1.2 +2 -2 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase_Authentication.java
Index: TestServletTestCase_Authentication.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase_Authentication.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestServletTestCase_Authentication.java 13 Jan 2002 21:21:17 -0000 1.1
+++ TestServletTestCase_Authentication.java 2 Feb 2002 17:54:37 -0000 1.2
@@ -71,7 +71,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase_Authentication.java,v 1.1 2002/01/13 21:21:17 vmassol Exp $
+ * @version $Id: TestServletTestCase_Authentication.java,v 1.2 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestServletTestCase_Authentication extends ServletTestCase
{
@@ -92,7 +92,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestServletTestCase_Authentication.class.getName()});
}
1.2 +6 -12 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase_OverrideRedirector.java
Index: TestServletTestCase_OverrideRedirector.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase_OverrideRedirector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestServletTestCase_OverrideRedirector.java 13 Jan 2002 21:21:17 -0000 1.1
+++ TestServletTestCase_OverrideRedirector.java 2 Feb 2002 17:54:37 -0000 1.2
@@ -53,17 +53,11 @@
*/
package org.apache.cactus.sample.unit;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
-import java.io.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-import junit.framework.*;
-
-import org.apache.cactus.*;
-import org.apache.cactus.client.ClientConfiguration;
+import org.apache.cactus.ServletTestCase;
+import org.apache.cactus.WebRequest;
/**
* Cactus unit tests for testing that it is possible to override a servlet
@@ -79,7 +73,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase_OverrideRedirector.java,v 1.1 2002/01/13 21:21:17 vmassol Exp $
+ * @version $Id: TestServletTestCase_OverrideRedirector.java,v 1.2 2002/02/02 17:54:37 vmassol Exp $
*/
public class TestServletTestCase_OverrideRedirector extends ServletTestCase
{
@@ -100,7 +94,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestServletTestCase_OverrideRedirector.class.getName()});
}
1.6 +9 -14 jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase_TestResult.java
Index: TestServletTestCase_TestResult.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/unit/TestServletTestCase_TestResult.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestServletTestCase_TestResult.java 13 Jan 2002 15:31:40 -0000 1.5
+++ TestServletTestCase_TestResult.java 2 Feb 2002 17:54:38 -0000 1.6
@@ -53,21 +53,16 @@
*/
package org.apache.cactus.sample.unit;
-import java.io.*;
-import java.util.*;
-import java.text.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.net.*;
+import javax.servlet.ServletOutputStream;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-import org.apache.cactus.*;
-import org.apache.cactus.util.*;
+import org.apache.cactus.ServletTestCase;
/**
* Verify that the Cactus client side only read the test result *after* the
- * test is finished (i.e. after the test result has been saved in the
+ * test is finished (i.e. after the test result has been saved in the
* application scope). This JUnit test need to be the first one to be run.
* Otherwise, the test result might be that of the previous test and not the
* current test one, thus proving nothing !!
@@ -80,7 +75,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase_TestResult.java,v 1.5 2002/01/13 15:31:40 vmassol Exp $
+ * @version $Id: TestServletTestCase_TestResult.java,v 1.6 2002/02/02 17:54:38 vmassol Exp $
*/
public class TestServletTestCase_TestResult extends ServletTestCase
{
@@ -101,7 +96,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {
+ junit.ui.TestRunner.main(new String[]{
TestServletTestCase_TestResult.class.getName()});
}
@@ -128,7 +123,7 @@
ServletOutputStream os = response.getOutputStream();
os.print("<html><head><Long Process></head><body>");
os.flush();
-
+
// do some processing that takes a while ...
Thread.sleep(3000);
os.println("Some data</body></html>");
@@ -145,7 +140,7 @@
ServletOutputStream os = response.getOutputStream();
os.println("<html><head>Lots of Data</head><body>");
os.flush();
- for (int i = 0 ; i < 5000 ; i++) {
+ for (int i = 0; i < 5000; i++) {
os.println("<p>Lots and lots of data here");
}
os.println("</body></html>");
1.7 +8 -8 jakarta-cactus/src/test/share/org/apache/cactus/TestAbstractTestCase.java
Index: TestAbstractTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/test/share/org/apache/cactus/TestAbstractTestCase.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestAbstractTestCase.java 13 Jan 2002 15:33:54 -0000 1.6
+++ TestAbstractTestCase.java 2 Feb 2002 17:54:38 -0000 1.7
@@ -53,26 +53,26 @@
*/
package org.apache.cactus;
-import java.util.*;
-import java.net.*;
+import java.net.HttpURLConnection;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-import org.apache.cactus.*;
-import org.apache.cactus.util.log.*;
+import org.apache.cactus.util.log.LogService;
/**
* Unit tests of the <code>AbstractTestCase</code> class.
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestAbstractTestCase.java,v 1.6 2002/01/13 15:33:54 vmassol Exp $
+ * @version $Id: TestAbstractTestCase.java,v 1.7 2002/02/02 17:54:38 vmassol Exp $
*/
public class TestAbstractTestCase extends
TestAbstractTestCase_InterceptorTestCase
{
// Initialize logging system first
- static {
+ static
+ {
LogService.getInstance().init(null);
}
@@ -94,7 +94,7 @@
public static void main(String[] theArgs)
{
junit.ui.TestRunner.main(
- new String[] {TestAbstractTestCase.class.getName()});
+ new String[]{TestAbstractTestCase.class.getName()});
}
/**
1.13 +8 -9 jakarta-cactus/src/test/share/org/apache/cactus/TestAbstractTestCase_InterceptorTestCase.java
Index: TestAbstractTestCase_InterceptorTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/test/share/org/apache/cactus/TestAbstractTestCase_InterceptorTestCase.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TestAbstractTestCase_InterceptorTestCase.java 27 Jan 2002 17:23:18 -0000 1.12
+++ TestAbstractTestCase_InterceptorTestCase.java 2 Feb 2002 17:54:38 -0000 1.13
@@ -53,13 +53,12 @@
*/
package org.apache.cactus;
-import java.net.*;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.net.URL;
-import junit.framework.*;
+import junit.framework.AssertionFailedError;
-import org.apache.cactus.*;
-import org.apache.cactus.mock.*;
+import org.apache.cactus.mock.MockHttpURLConnection;
/**
* Test <code>TestCase</code> class that intercepts all exceptions (and assert
@@ -68,7 +67,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestAbstractTestCase_InterceptorTestCase.java,v 1.12 2002/01/27 17:23:18 vmassol Exp $
+ * @version $Id: TestAbstractTestCase_InterceptorTestCase.java,v 1.13 2002/02/02 17:54:38 vmassol Exp $
*/
public class TestAbstractTestCase_InterceptorTestCase
extends AbstractTestCase
@@ -95,8 +94,8 @@
/**
* Intercepts running test cases to check for normal exceptions.
*/
- protected void runTest() throws Throwable
- {
+ protected void runTest() throws Throwable
+ {
try {
// Call the begin method
WebRequest request = new WebRequest();
@@ -240,5 +239,5 @@
}
- }
+ }
}
1.10 +5 -3 jakarta-cactus/src/test/share/org/apache/cactus/TestAll.java
Index: TestAll.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/test/share/org/apache/cactus/TestAll.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestAll.java 13 Jan 2002 15:33:54 -0000 1.9
+++ TestAll.java 2 Feb 2002 17:54:38 -0000 1.10
@@ -53,7 +53,9 @@
*/
package org.apache.cactus;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
/**
* Run all the unit tests of Cactus that do not need a servlet
@@ -62,7 +64,7 @@
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestAll.java,v 1.9 2002/01/13 15:33:54 vmassol Exp $
+ * @version $Id: TestAll.java,v 1.10 2002/02/02 17:54:38 vmassol Exp $
*/
public class TestAll extends TestCase
{
@@ -83,7 +85,7 @@
*/
public static void main(String[] theArgs)
{
- junit.ui.TestRunner.main(new String[] {TestAll.class.getName()});
+ junit.ui.TestRunner.main(new String[]{TestAll.class.getName()});
}
/**
1.3 +8 -5 jakarta-cactus/src/test/share/org/apache/cactus/TestServletURL.java
Index: TestServletURL.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/test/share/org/apache/cactus/TestServletURL.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestServletURL.java 13 Jan 2002 15:33:54 -0000 1.2
+++ TestServletURL.java 2 Feb 2002 17:54:38 -0000 1.3
@@ -53,21 +53,24 @@
*/
package org.apache.cactus;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
-import org.apache.cactus.util.log.*;
+import org.apache.cactus.util.log.LogService;
/**
* Unit tests of the <code>ServletURL</code> class.
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletURL.java,v 1.2 2002/01/13 15:33:54 vmassol Exp $
+ * @version $Id: TestServletURL.java,v 1.3 2002/02/02 17:54:38 vmassol Exp $
*/
public class TestServletURL extends TestCase
{
// Initialize logging system first
- static {
+ static
+ {
LogService.getInstance().init(null);
}
@@ -89,7 +92,7 @@
public static void main(String[] theArgs)
{
junit.ui.TestRunner.main(
- new String[] {TestServletURL.class.getName()});
+ new String[]{TestServletURL.class.getName()});
}
/**
1.3 +8 -5 jakarta-cactus/src/test/share/org/apache/cactus/TestServletUtil.java
Index: TestServletUtil.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/test/share/org/apache/cactus/TestServletUtil.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestServletUtil.java 13 Jan 2002 15:33:54 -0000 1.2
+++ TestServletUtil.java 2 Feb 2002 17:54:38 -0000 1.3
@@ -53,22 +53,25 @@
*/
package org.apache.cactus;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
-import org.apache.cactus.util.log.*;
import org.apache.cactus.server.ServletUtil;
+import org.apache.cactus.util.log.LogService;
/**
* Unit tests of the <code>ServletUtil</code> class.
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: TestServletUtil.java,v 1.2 2002/01/13 15:33:54 vmassol Exp $
+ * @version $Id: TestServletUtil.java,v 1.3 2002/02/02 17:54:38 vmassol Exp $
*/
public class TestServletUtil extends TestCase
{
// Initialize logging system first
- static {
+ static
+ {
LogService.getInstance().init(null);
}
@@ -90,7 +93,7 @@
public static void main(String[] theArgs)
{
junit.ui.TestRunner.main(
- new String[] {TestServletUtil.class.getName()});
+ new String[]{TestServletUtil.class.getName()});
}
/**
1.7 +4 -4 jakarta-cactus/src/test/share/org/apache/cactus/mock/MockHttpURLConnection.java
Index: MockHttpURLConnection.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/src/test/share/org/apache/cactus/mock/MockHttpURLConnection.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- MockHttpURLConnection.java 13 Jan 2002 15:33:55 -0000 1.6
+++ MockHttpURLConnection.java 2 Feb 2002 17:54:38 -0000 1.7
@@ -53,16 +53,16 @@
*/
package org.apache.cactus.mock;
-import java.net.*;
-import java.io.*;
-import java.util.*;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
/**
* Mock implementation of <code>HttpURLConnection</code>.
*
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: MockHttpURLConnection.java,v 1.6 2002/01/13 15:33:55 vmassol Exp $
+ * @version $Id: MockHttpURLConnection.java,v 1.7 2002/02/02 17:54:38 vmassol Exp $
*/
public class MockHttpURLConnection extends HttpURLConnection
{
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>