You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2002/07/04 16:06:33 UTC
cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/validators BaseConditionalValidator.java
dion 2002/07/04 07:06:33
Modified: latka/src/java/org/apache/commons/latka/event
LatkaEventInfo.java LatkaEventListener.java
LatkaEventPublisher.java ReportMessageEvent.java
RequestEvent.java
latka/src/java/org/apache/commons/latka/http
Credentials.java Parameters.java Proxy.java
Request.java RequestHeaders.java RequestImpl.java
Response.java ResponseImpl.java Session.java
SessionImpl.java
latka/src/java/org/apache/commons/latka/jelly HttpTag.java
LatkaTag.java SessionTag.java SuiteTag.java
latka/src/java/org/apache/commons/latka/junit
JUnitEventReporter.java JUnitTestAdapter.java
latka/src/java/org/apache/commons/latka/servlet
ViewResponseServlet.java ViewSuiteServlet.java
latka/src/java/org/apache/commons/latka/util URLParser.java
latka/src/java/org/apache/commons/latka/util/xml
BasicDelegateHandler.java DelegateHandler.java
DelegateHandlerImpl.java
latka/src/java/org/apache/commons/latka/validators
BaseConditionalValidator.java
Log:
Style violations
Revision Changes Path
1.10 +5 -5 jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventInfo.java
Index: LatkaEventInfo.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventInfo.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- LatkaEventInfo.java 11 Apr 2002 13:33:35 -0000 1.9
+++ LatkaEventInfo.java 4 Jul 2002 14:06:32 -0000 1.10
@@ -85,7 +85,7 @@
* failure
* @return true if request succeeded
*/
- public boolean didRequestSucceed(Request request);
+ boolean didRequestSucceed(Request request);
/**
* Check to see if a particular Session succeeded or failed.
@@ -96,14 +96,14 @@
* failure
* @return true if all requests in the session succeeded
*/
- public boolean didSessionSucceed(Session session);
+ boolean didSessionSucceed(Session session);
/**
* Returns true if all Requests in the suite succeed.
*
* @return true if all Requests have succeeded
*/
- public boolean didSuiteSucceed();
+ boolean didSuiteSucceed();
/**
* Returns a List of all responses that failed
@@ -111,5 +111,5 @@
*
* @return List of failed Responses
*/
- public List getFailedResponses();
+ List getFailedResponses();
}
1.12 +16 -12 jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventListener.java
Index: LatkaEventListener.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventListener.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- LatkaEventListener.java 29 Apr 2002 18:20:21 -0000 1.11
+++ LatkaEventListener.java 4 Jul 2002 14:06:32 -0000 1.12
@@ -1,9 +1,13 @@
/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -63,7 +67,8 @@
* @author Rodney Waldhoff
* @author Morgan Delagrange
* @author dIon Gillard
- * @version $Id$
+ * @version
+ * $Id$
*/
public interface LatkaEventListener {
@@ -72,7 +77,7 @@
*
* @param event a successful request event
*/
- public void requestSucceeded(RequestEvent event);
+ void requestSucceeded(RequestEvent event);
/**
* Invoked if the request failed. A request "failure" is
@@ -81,20 +86,19 @@
* validation (threw a ValidationException).
*
* @param event a "failed" request event. This request should still
- * have a response, although the response was not
- * expected by the test.
+ * have a response, although the response was not expected by the test.
*/
- public void requestFailed(RequestEvent event);
+ void requestFailed(RequestEvent event);
/**
* A skipped request. Most Latka suites will skip
* any further requests inside a session
* upon the first failed request.
*
- * @param event a "skipped" request. Skipped requests have no valid
- * response.
+ * @param event a "skipped" request. Skipped requests have no valid
+ * response.
*/
- public void requestSkipped(RequestEvent event);
+ void requestSkipped(RequestEvent event);
/**
* Invoked if a request error occurs. A request "error"
@@ -105,7 +109,7 @@
* @param event a request "error" event. This request has no valid
* response.
*/
- public void requestError(RequestEvent event);
+ void requestError(RequestEvent event);
/**
* Invoked if a Latka suite wants to send a message to the
@@ -114,13 +118,13 @@
*
* @param event Event containing the report message
*/
- public void reportMessage(ReportMessageEvent event);
+ void reportMessage(ReportMessageEvent event);
/**
* Invoke when all requests completed.
*
* @param event suite event
*/
- public void suiteCompleted(SuiteEvent event);
+ void suiteCompleted(SuiteEvent event);
}
1.10 +11 -2 jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventPublisher.java
Index: LatkaEventPublisher.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventPublisher.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- LatkaEventPublisher.java 29 Apr 2002 18:20:21 -0000 1.9
+++ LatkaEventPublisher.java 4 Jul 2002 14:06:32 -0000 1.10
@@ -1,9 +1,13 @@
/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,7 +71,8 @@
*
* @author Morgan Delagrange
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
- * @version $Id$
+ * @version
+ * $Id$
*/
public class LatkaEventPublisher implements LatkaEventListener {
@@ -147,6 +152,10 @@
broadcastEvent(event);
}
+ /**
+ * send the supplied event to all listeners
+ * @param event a message event to be broadcast
+ */
public void reportMessage(ReportMessageEvent event) {
broadcastEvent(event);
}
1.2 +24 -1 jakarta-commons/latka/src/java/org/apache/commons/latka/event/ReportMessageEvent.java
Index: ReportMessageEvent.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/event/ReportMessageEvent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReportMessageEvent.java 29 Apr 2002 18:20:21 -0000 1.1
+++ ReportMessageEvent.java 4 Jul 2002 14:06:32 -0000 1.2
@@ -1,9 +1,13 @@
/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,16 +58,35 @@
* <http://www.apache.org/>.
*
*/
+
package org.apache.commons.latka.event;
+/**
+ * An event detailing a report message
+ *
+ * @author Morgan Delagrange
+ * @author dIon Gillard
+ * @version $Id$
+ */
public class ReportMessageEvent implements LatkaEvent {
+ /** the message text */
private String _message = null;
+ /**
+ * Create a new instance of the class with the supplied message
+ *
+ * @param message the message text
+ */
public ReportMessageEvent(String message) {
_message = message;
}
+ /**
+ * The message text of the event
+ *
+ * @return the text of the message for the event
+ */
public String getMessage() {
return _message;
}
1.8 +4 -4 jakarta-commons/latka/src/java/org/apache/commons/latka/event/RequestEvent.java
Index: RequestEvent.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/event/RequestEvent.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- RequestEvent.java 11 Apr 2002 13:33:35 -0000 1.7
+++ RequestEvent.java 4 Jul 2002 14:06:32 -0000 1.8
@@ -77,15 +77,15 @@
/** the request the event is about
* @return the request the event relates to
*/
- public abstract Request getRequest();
+ Request getRequest();
/** the response associated with the event's request
* @return the response for the event's request
*/
- public abstract Response getResponse();
+ Response getResponse();
/** the session the event took place within
* @return the session the event took within
*/
- public abstract Session getSession();
+ Session getSession();
}
1.6 +10 -5 jakarta-commons/latka/src/java/org/apache/commons/latka/http/Credentials.java
Index: Credentials.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/Credentials.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Credentials.java 11 Apr 2002 13:40:47 -0000 1.5
+++ Credentials.java 4 Jul 2002 14:06:32 -0000 1.6
@@ -63,19 +63,24 @@
/**
* Used for authentication
+ *
* @author Morgan Delagrange
* @version $Id$
*/
public interface Credentials {
- /** return the user's name
+ /**
+ * return the user's name
+ *
* @return the user's name
*/
- public String getUserName();
+ String getUserName();
- /** return the user's password
+ /**
+ * return the user's password
+ *
* @return the user's password
*/
- public String getPassword();
+ String getPassword();
}
1.5 +3 -3 jakarta-commons/latka/src/java/org/apache/commons/latka/http/Parameters.java
Index: Parameters.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/Parameters.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Parameters.java 11 Apr 2002 13:40:47 -0000 1.4
+++ Parameters.java 4 Jul 2002 14:06:32 -0000 1.5
@@ -78,7 +78,7 @@
* @param paramName parameter name
* @param paramValue parameter value, or null for an empty value
*/
- public void addParameter(String paramName, String paramValue);
+ void addParameter(String paramName, String paramValue);
/**
* Returns a list of all the parameters for the request.
@@ -88,6 +88,6 @@
*
* @return all parameters for the request
*/
- public List getParameters();
+ List getParameters();
}
1.3 +7 -7 jakarta-commons/latka/src/java/org/apache/commons/latka/http/Proxy.java
Index: Proxy.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/Proxy.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Proxy.java 30 Jun 2002 05:32:14 -0000 1.2
+++ Proxy.java 4 Jul 2002 14:06:32 -0000 1.3
@@ -72,9 +72,9 @@
public class Proxy {
/** the host to use as a proxy */
- private String host;
+ private String _host;
/** the port to send proxied requests on */
- private int port;
+ private int _port;
/** the port number that represents port is unassigned */
public static final int PORT_UNSPECIFIED = -1;
@@ -102,7 +102,7 @@
* @return the host name of the proxy to be used.
*/
public String getHost() {
- return host;
+ return _host;
}
/**
@@ -111,7 +111,7 @@
* @param host the host name of the proxy to be used.
*/
public void setHost(String host) {
- this.host = host;
+ _host = host;
}
/**
@@ -120,7 +120,7 @@
* @return the port to send proxied requests on.
*/
public int getPort() {
- return port;
+ return _port;
}
/**
@@ -129,7 +129,7 @@
* @param port the port to send proxied requests on.
*/
public void setPort(int port) {
- this.port = port;
+ _port = port;
}
}
1.14 +14 -14 jakarta-commons/latka/src/java/org/apache/commons/latka/http/Request.java
Index: Request.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/Request.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Request.java 11 Apr 2002 13:40:47 -0000 1.13
+++ Request.java 4 Jul 2002 14:06:32 -0000 1.14
@@ -87,7 +87,7 @@
*
* @throws IOException if the remote server could not be reached
*/
- public Response execute() throws IOException;
+ Response execute() throws IOException;
/**
* Assigns a text label to this request. This label
@@ -96,7 +96,7 @@
*
* @return the label associated with this request
*/
- public String getLabel();
+ String getLabel();
/**
* Gets the URL that Latka will attempt to contact. Note:
@@ -105,7 +105,7 @@
*
* @return the URL associated with this HTTP request
*/
- public URL getURL();
+ URL getURL();
/**
* Associate a parameter with this request.
@@ -114,7 +114,7 @@
* @param value the value of the parameter
*
*/
- public void addParameter(String name, String value);
+ void addParameter(String name, String value);
/**
* Set all the parameters for the request. Overrides
@@ -123,7 +123,7 @@
* @param parameters
* all parameters for this request
*/
- public void setParameters(Parameters parameters);
+ void setParameters(Parameters parameters);
/**
* Get the parameters for the request, so that they can
@@ -131,7 +131,7 @@
*
* @return parameters for this request
*/
- public Parameters getParameters();
+ Parameters getParameters();
/**
* Sets a request header.
@@ -139,7 +139,7 @@
* @param headerName header name
* @param headerValue header value or null for a null header
*/
- public void addHeader(String headerName, String headerValue);
+ void addHeader(String headerName, String headerValue);
/**
* Set all the headers for the request. Overrides
@@ -148,7 +148,7 @@
* @param requestHeaders
* all headers for this request
*/
- public void setHeaders(RequestHeaders requestHeaders);
+ void setHeaders(RequestHeaders requestHeaders);
/**
* Get the headers for the request, so that they can
@@ -156,7 +156,7 @@
*
* @return headers for this request
*/
- public RequestHeaders getHeaders();
+ RequestHeaders getHeaders();
// getHeader method purposely ommitted. HttpClient does not retain
// header information after the request is submitted.
@@ -166,7 +166,7 @@
*
* @return a <code>Session</code> object
*/
- public Session getSession();
+ Session getSession();
/**
* The amount of time it took to execute the
@@ -175,7 +175,7 @@
*
* @return time it took to execute the request in millis
*/
- public int getRequestTiming();
+ int getRequestTiming();
/**
* Sets the basic authentication credentials for this request,
@@ -183,7 +183,7 @@
*
* @param credentials user's identification
*/
- public void setCredentials(Credentials credentials);
+ void setCredentials(Credentials credentials);
/**
* Whether or not this request will instruct HttpClient
@@ -191,7 +191,7 @@
*
* @return true if HttpClient will redirect a 301 or 302 response
*/
- public boolean followRedirects();
+ boolean followRedirects();
/**
* Return the constant representing the HTTP method
@@ -199,6 +199,6 @@
*
* @return HTTP method for this request
*/
- public int getMethod();
+ int getMethod();
}
1.5 +3 -3 jakarta-commons/latka/src/java/org/apache/commons/latka/http/RequestHeaders.java
Index: RequestHeaders.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/RequestHeaders.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RequestHeaders.java 11 Apr 2002 13:40:47 -0000 1.4
+++ RequestHeaders.java 4 Jul 2002 14:06:32 -0000 1.5
@@ -77,7 +77,7 @@
* @param headerName header name
* @param headerValue header value, or null for an empty value
*/
- public void addHeader(String headerName, String headerValue);
+ void addHeader(String headerName, String headerValue);
/**
* Return a list of all the headers for the request.
@@ -86,6 +86,6 @@
* as the second (can be null).
* @return all headers for the request
*/
- public List getHeaders();
+ List getHeaders();
}
1.22 +2 -2 jakarta-commons/latka/src/java/org/apache/commons/latka/http/RequestImpl.java
Index: RequestImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/RequestImpl.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- RequestImpl.java 29 Jun 2002 10:30:21 -0000 1.21
+++ RequestImpl.java 4 Jul 2002 14:06:32 -0000 1.22
@@ -493,7 +493,7 @@
}
/** Setter for property proxy.
- * @param _proxy New value of property proxy.
+ * @param proxy New value of property proxy.
*/
public void setProxy(Proxy proxy) {
_proxy = proxy;
1.13 +13 -9 jakarta-commons/latka/src/java/org/apache/commons/latka/http/Response.java
Index: Response.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/Response.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Response.java 3 May 2002 23:03:47 -0000 1.12
+++ Response.java 4 Jul 2002 14:06:32 -0000 1.13
@@ -1,9 +1,13 @@
/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -70,12 +74,12 @@
/**
* @return the integer status code provided by the HTTP server.
*/
- public int getStatusCode();
+ int getStatusCode();
/**
- * Return the status text (or "reason phrase") associated with the response.
+ * @return the status text (or "reason phrase") associated with the response.
*/
- public String getStatusText();
+ String getStatusText();
/**
* Returns the resource, in string form,
@@ -84,7 +88,7 @@
* @return the contents of the HTTP response body has a String,
* or null if there was no response body
*/
- public String getResource();
+ String getResource();
/**
* Get the actual bytes returned by the web server
@@ -92,7 +96,7 @@
* @return InputStream containing the HTTP response, or null
* if the response contains no body
*/
- public InputStream getStream();
+ InputStream getStream();
/**
* Returns the length of the Response stream (as bytes),
@@ -100,13 +104,13 @@
*
* @return Byte length of the response stream
*/
- public int getByteLength();
+ int getByteLength();
/**
* Getter for request property
* @return the request that generated this response
*/
- public Request getRequest();
+ Request getRequest();
/**
* Check a response header. If more than one header
@@ -117,5 +121,5 @@
* @return the value of the header(s), or null if the header does not
* exist
*/
- public String getHeader(String headerName);
+ String getHeader(String headerName);
}
1.19 +40 -9 jakarta-commons/latka/src/java/org/apache/commons/latka/http/ResponseImpl.java
Index: ResponseImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/ResponseImpl.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ResponseImpl.java 3 May 2002 19:36:11 -0000 1.18
+++ ResponseImpl.java 4 Jul 2002 14:06:32 -0000 1.19
@@ -1,9 +1,13 @@
/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -102,23 +106,40 @@
// Response Interface Methods //
////////////////////////////////
-
- // defined in interface
+ /**
+ * @return the integer status code provided by the HTTP server.
+ */
public int getStatusCode() {
return _httpMethod.getStatusCode();
}
- // defined in interface
+ /**
+ * @return the status text (or "reason phrase") associated with the response
+ */
public String getStatusText() {
return _httpMethod.getStatusText();
}
- // defined in interface
+ /**
+ * Returns the resource, in string form,
+ * provided by the HTTP server
+ *
+ * @return the contents of the HTTP response body has a String,
+ * or null if there was no response body
+ */
public String getResource() {
return _httpMethod.getResponseBodyAsString();
}
- // defined in interface
+ /**
+ * Check a response header. If more than one header
+ * of the same name is encountered, they are collapsed
+ * into one comma-separated String.
+ *
+ * @param headerName The name of the header to find in the Reponse
+ * @return the value of the header(s), or null if the header does not
+ * exist
+ */
public String getHeader(String headerName) {
Header header = _httpMethod.getResponseHeader(headerName);
if (header != null) {
@@ -127,7 +148,12 @@
return null;
}
- // defined in interface
+ /**
+ * Returns the length of the Response stream (as bytes),
+ * or -1 if no stream is available
+ *
+ * @return Byte length of the response stream
+ */
public int getByteLength() {
byte[] responseBytes = _httpMethod.getResponseBody();
if (responseBytes == null) {
@@ -137,7 +163,12 @@
return _httpMethod.getResponseBody().length;
}
- // defined in interface
+ /**
+ * Get the actual bytes returned by the web server
+ *
+ * @return InputStream containing the HTTP response, or null
+ * if the response contains no body
+ */
public InputStream getStream() {
InputStream stream;
1.10 +35 -34 jakarta-commons/latka/src/java/org/apache/commons/latka/http/Session.java
Index: Session.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/Session.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Session.java 29 Jun 2002 10:30:21 -0000 1.9
+++ Session.java 4 Jul 2002 14:06:32 -0000 1.10
@@ -79,13 +79,13 @@
*
* @param url The URL to request of the HTTP server.
* @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
- * used to communicate with server.
- * @return a new {@link Request} object representing the <code>url</code> and
- * <code>httpMethod</code>
+ * used to communicate with server.
+ * @return a new {@link Request} object representing the <code>url</code>
+ * and <code>httpMethod</code>
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
*/
- public Request createRequest(URL url, int httpMethod);
+ Request createRequest(URL url, int httpMethod);
/** Create a request with the given label, to access the given URL via the
* given HTTP method, and follow redirects as specified.
@@ -93,31 +93,31 @@
* @param label a name used to identify the request
* @param url The URL to request of the HTTP server.
* @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
- * used to communicate with server.
+ * used to communicate with server.
* @param followRedirects whether to follow HTTP redirection responses
- * @return a new {@link Request} object representing the <code>url</code> and
- * <code>httpMethod</code>
+ * @return a new {@link Request} object representing the <code>url</code>
+ * and <code>httpMethod</code>
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
*/
- public Request createRequest(String label, URL url, int httpMethod,
+ Request createRequest(String label, URL url, int httpMethod,
boolean followRedirects);
/**
* Creates a request object with the specified URL and HTTP Method to be
* accessed via the provided proxy
*
- * @param url The URL to request of the HTTP server.
+ * @param url The URL to request of the HTTP server.
* @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
- * used to communicate with server.
- * @return a new {@link Request} object representing the <code>url</code> and
- * <code>httpMethod</code>
+ * used to communicate with server.
* @param proxy a proxy to use during the request
+ * @return a new {@link Request} object representing the <code>url</code>
+ * and <code>httpMethod</code>.
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
* @see org.apache.commons.latka.http.Proxy
*/
- public Request createRequest(URL url, int httpMethod, Proxy proxy);
+ Request createRequest(URL url, int httpMethod, Proxy proxy);
/** Create a request with the given label, to access the given URL via the
* given HTTP method, and follow redirects as specified, using the given
@@ -129,33 +129,34 @@
* used to communicate with server.
* @param followRedirects whether to follow HTTP redirection responses
* @param proxy a proxy to use during the request
- * @return a new {@link Request} object representing the <code>url</code> and
- * <code>httpMethod</code>
+ * @return a new {@link Request} object representing the <code>url</code>
+ * and <code>httpMethod</code>
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
* @see org.apache.commons.latka.http.Proxy
*/
- public Request createRequest(String label, URL url, int httpMethod,
+ Request createRequest(String label, URL url, int httpMethod,
boolean followRedirects, Proxy proxy);
- /**
- * Adds a cookie to all HTTP requests whose domain and path match (according to RFC2109).
- *
- * @param domain the domain to which the cookie should apply
- * @param path the path to which the cookie should apply
- * @param name the name of the cookie
- * @param value the value of the cookie
- */
- public void addCookie(String domain, String path,
+ /**
+ * Adds a cookie to all HTTP requests whose domain and path match
+ * (according to RFC2109).
+ *
+ * @param domain the domain to which the cookie should apply
+ * @param path the path to which the cookie should apply
+ * @param name the name of the cookie
+ * @param value the value of the cookie
+ */
+ void addCookie(String domain, String path,
String name, String value);
- /**
- * Returns the value of cookie <code>name</code>.
- *
- * @param name the name of the cookie
- *
- * @return the value of the cookie, or null if the cookie isn't set
- */
- public String getCookieValue(String name);
+ /**
+ * Returns the value of cookie <code>name</code>.
+ *
+ * @param name the name of the cookie
+ *
+ * @return the value of the cookie, or null if the cookie isn't set
+ */
+ String getCookieValue(String name);
}
1.13 +30 -22 jakarta-commons/latka/src/java/org/apache/commons/latka/http/SessionImpl.java
Index: SessionImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/http/SessionImpl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SessionImpl.java 29 Jun 2002 10:30:21 -0000 1.12
+++ SessionImpl.java 4 Jul 2002 14:06:32 -0000 1.13
@@ -66,10 +66,10 @@
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.Cookie;
-import org.apache.commons.latka.http.Proxy;
/**
- * An implementation of a Latka Session interface based on the Jakarta Commons HttpClient package.
+ * An implementation of a Latka Session interface based on the Jakarta Commons
+ * HttpClient package.
*
* @todo accept proxy details on create request
* @todo fix interface to match proxy details
@@ -88,9 +88,11 @@
*/
protected LinkedList _urls = new LinkedList();
- // this state object 'belongs' to HttpClient
- // we maintain a reference in SessionImpl for
- // simplicity
+ /**
+ * this state object 'belongs' to HttpClient
+ * we maintain a reference in SessionImpl for
+ * simplicity
+ */
protected HttpState _state = new HttpState();
///////////////////////////////
@@ -101,8 +103,10 @@
* Creates a request object with the specified URL and HTTP Method.
*
* @param url The URL to request of the HTTP server.
- * @param httpMethod An integer representing the HTTP method (e.g. GET, PUT) used to communicate with server.
- * @return a new <code>Request</code> object representing the <code>url</code> and <code>httpMethod</code>
+ * @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
+ * used to communicate with server.
+ * @return a new <code>Request</code> object representing the <code>url</code>
+ * and <code>httpMethod</code>
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
*/
@@ -117,13 +121,16 @@
*
* @param label Name of the request
* @param url The URL to request of the HTTP server.
- * @param httpMethod An integer representing the HTTP method (e.g. GET, PUT) used to communicate with server.
- * @return a new <code>Request</code> object representing the <code>url</code> and <code>httpMethod</code>
+ * @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
+ * used to communicate with server.
+ * @param followRedirects whether HTTP redirects should be processed
+ * @return a new <code>Request</code> object representing the <code>url</code>
+ * and <code>httpMethod</code>
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
*/
- public Request createRequest(String label, URL url,
- int httpMethod, boolean followRedirects) {
+ public Request createRequest(String label, URL url, int httpMethod,
+ boolean followRedirects) {
// default proxy to null
return createRequest(label, url, httpMethod, followRedirects, null);
}
@@ -134,9 +141,9 @@
*
* @param url The URL to request of the HTTP server.
* @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
- * used to communicate with server.
- * @return a new {@link Request} object representing the <code>url</code> and
- * <code>httpMethod</code>
+ * used to communicate with server.
+ * @return a new {@link Request} object representing the <code>url</code>
+ * and <code>httpMethod</code>
* @param proxy a proxy to use during the request
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
@@ -154,11 +161,11 @@
* @param label a name used to identify the request
* @param url The URL to request of the HTTP server.
* @param httpMethod An integer representing the HTTP method (e.g. GET, PUT)
- * used to communicate with server.
+ * used to communicate with server.
* @param followRedirects whether to follow HTTP redirection responses
* @param proxy a proxy to use during the request
- * @return a new {@link Request} object representing the <code>url</code> and
- * <code>httpMethod</code>
+ * @return a new {@link Request} object representing the <code>url</code>
+ * and <code>httpMethod</code>.
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_GET
* @see org.apache.commons.latka.http.Request#HTTP_METHOD_POST
* @see org.apache.commons.latka.http.Proxy
@@ -166,8 +173,8 @@
public Request createRequest(String label, URL url, int httpMethod,
boolean followRedirects, Proxy proxy) {
- RequestImpl request =
- new RequestImpl(label,url, httpMethod, _state, this, followRedirects);
+ RequestImpl request = new RequestImpl(label, url, httpMethod, _state,
+ this, followRedirects);
request.setProxy(proxy);
URL referer = getReferer();
@@ -201,14 +208,15 @@
*/
protected URL getReferer() {
if (_urls.size() > 0) {
- return (URL)_urls.getLast();
+ return (URL) _urls.getLast();
}
return null;
}
/**
- * Adds a cookie to all HTTP requests whose domain and path match (according to RFC2109).
+ * Adds a cookie to all HTTP requests whose domain and path match (according
+ * to RFC2109).
*
* @param domain the domain to which the cookie should apply
* @param path the path to which the cookie should apply
1.2 +21 -11 jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/HttpTag.java
Index: HttpTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/HttpTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HttpTag.java 4 Jul 2002 07:14:01 -0000 1.1
+++ HttpTag.java 4 Jul 2002 14:06:32 -0000 1.2
@@ -61,13 +61,15 @@
package org.apache.commons.latka.jelly;
+import org.apache.commons.httpclient.HttpUrlMethod;
+
/**
* The base tag for all http requests
*
* @author dion
* @version $Id$
*/
-public class HttpTag extends LatkaTag {
+public abstract class HttpTag extends LatkaTag {
/**
* the path to be tested relative to the host/port specifed on the parent
@@ -75,14 +77,14 @@
* Either this property and the suite's host
* must be provided, or the {@link #getUrl() url} property must be specifed
*/
- private String path;
+ private String _path;
/**
* The complete url to be processed
* Either this property or the {@link #getPath() path} and the suite's host
* must be provided.
*/
- private String url;
+ private String _url;
/**
* Creates a new instance of HttpTag
@@ -90,6 +92,14 @@
public HttpTag() {
}
+ /**
+ * A method that must be implemented by subclasses to provide the
+ * {@link HttpUrlMethod url method} implementation
+ *
+ * @return a HttpUrlMethod implementation
+ */
+ protected abstract HttpUrlMethod getHttpUrlMethod();
+
//--------------------------------------------------------------------------
// Property accessors/mutators
//--------------------------------------------------------------------------
@@ -100,7 +110,7 @@
* @return Value of property path.
*/
public String getPath() {
- return path;
+ return _path;
}
/**
@@ -109,7 +119,7 @@
* @param path New value of property path.
*/
public void setPath(String path) {
- this.path = path;
+ _path = path;
}
/**
@@ -118,7 +128,7 @@
* @return Value of property url.
*/
public String getUrl() {
- return url;
+ return _url;
}
/**
@@ -127,7 +137,7 @@
* @param url New value of property url.
*/
public void setUrl(String url) {
- this.url = url;
+ _url = url;
}
}
1.2 +10 -11 jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/LatkaTag.java
Index: LatkaTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/LatkaTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LatkaTag.java 30 Jun 2002 05:36:19 -0000 1.1
+++ LatkaTag.java 4 Jul 2002 14:06:32 -0000 1.2
@@ -62,7 +62,6 @@
package org.apache.commons.latka.jelly;
import org.apache.commons.jelly.TagSupport;
-import org.apache.commons.jelly.XMLOutput;
/**
* The base of tags in Latka. Provides the following:
@@ -77,9 +76,9 @@
public abstract class LatkaTag extends TagSupport {
/** unique identifier of the tag */
- private String id;
+ private String _id;
/** a descriptive label for the tag */
- private String label;
+ private String _label;
/**
* Getter for property id.
@@ -87,7 +86,7 @@
* @return Value of property id.
*/
public String getId() {
- return id;
+ return _id;
}
/**
@@ -96,7 +95,7 @@
* @param id New value of property id.
*/
public void setId(String id) {
- this.id = id;
+ _id = id;
}
/**
@@ -105,7 +104,7 @@
* @return Value of property label.
*/
public String getLabel() {
- return label;
+ return _label;
}
/**
@@ -114,7 +113,7 @@
* @param label New value of property label.
*/
public void setLabel(String label) {
- this.label = label;
+ _label = label;
}
}
1.3 +6 -6 jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SessionTag.java
Index: SessionTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SessionTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SessionTag.java 30 Jun 2002 16:23:42 -0000 1.2
+++ SessionTag.java 4 Jul 2002 14:06:32 -0000 1.3
@@ -73,7 +73,7 @@
public class SessionTag extends LatkaTag {
/** http client used to store state and execute requests */
- private HttpMultiClient httpClient = new HttpMultiClient();
+ private HttpMultiClient _httpClient = new HttpMultiClient();
/**
* Creates a new instance of SessionTag
@@ -97,7 +97,7 @@
* @return Value of property httpClient.
*/
public HttpMultiClient getHttpClient() {
- return httpClient;
+ return _httpClient;
}
/**
@@ -106,7 +106,7 @@
* @param httpClient New value of property httpClient.
*/
public void setHttpClient(HttpMultiClient httpClient) {
- this.httpClient = httpClient;
+ _httpClient = httpClient;
}
}
1.4 +22 -17 jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SuiteTag.java
Index: SuiteTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SuiteTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SuiteTag.java 30 Jun 2002 16:23:42 -0000 1.3
+++ SuiteTag.java 4 Jul 2002 14:06:32 -0000 1.4
@@ -66,9 +66,11 @@
/**
* A tag representing a Latka Suite
- * - attributes: host, port, proxyHost, proxyPort, proxyUser, proxyPassword, label, id
+ * - attributes: host, port, proxyHost, proxyPort, proxyUser, proxyPassword,
+ * label, id
* - holds sessions, requests and messages, proxyCredentials?
- * - what does it do? Execute's the children? Sets them up somehow? Creates credentials and proxy if needed?
+ * - what does it do? Execute's the children? Sets them up somehow?
+ * Creates credentials and proxy if needed?
*
* @author dion
* @version $Id$
@@ -76,11 +78,11 @@
public class SuiteTag extends LatkaTag {
/** default host for requests */
- private String host;
+ private String _host;
/** default port for requests */
- private String port;
+ private String _port;
/** Proxy details for requests */
- private Proxy proxy = new Proxy();
+ private Proxy _proxy = new Proxy();
/**
* Creates a new instance of SuiteTag
@@ -91,6 +93,9 @@
/**
* Perform the tag functionality. In this case, simply evaluate the body
* after creating credentials, proxy etc from the properties
+ *
+ * @param xmlOutput where to send output
+ * @throws Exception when an error occurs
*/
public void doTag(XMLOutput xmlOutput) throws Exception {
xmlOutput.write(getBodyText());
@@ -122,7 +127,7 @@
/**
* Helper method for proxy <code>host</code> property
*
- * @param the {@link #getProxy() proxy's} host property
+ * @param host the {@link #getProxy() proxy's} host property
*/
public void setProxyHost(String host) {
getProxy().setHost(host);
@@ -140,7 +145,7 @@
/**
* Helper method for proxy <code>port</code> property
*
- * @param the {@link #getProxy() proxy's} port property
+ * @param port the {@link #getProxy() proxy's} port property
*/
public void setProxyPort(int port) {
getProxy().setPort(port);
@@ -152,7 +157,7 @@
* @return Value of property host.
*/
public String getHost() {
- return host;
+ return _host;
}
/**
@@ -161,21 +166,21 @@
* @param host New value of property host.
*/
public void setHost(String host) {
- this.host = host;
+ _host = host;
}
/** Getter for property port.
* @return Value of property port.
*/
public String getPort() {
- return port;
+ return _port;
}
/** Setter for property port.
* @param port New value of property port.
*/
public void setPort(String port) {
- this.port = port;
+ _port = port;
}
/**
@@ -184,7 +189,7 @@
* @return Value of property proxy.
*/
public Proxy getProxy() {
- return proxy;
+ return _proxy;
}
/**
@@ -193,7 +198,7 @@
* @param proxy New value of property proxy.
*/
public void setProxy(Proxy proxy) {
- this.proxy = proxy;
+ _proxy = proxy;
}
}
1.8 +24 -10 jakarta-commons/latka/src/java/org/apache/commons/latka/junit/JUnitEventReporter.java
Index: JUnitEventReporter.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/junit/JUnitEventReporter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JUnitEventReporter.java 29 Apr 2002 18:20:21 -0000 1.7
+++ JUnitEventReporter.java 4 Jul 2002 14:06:32 -0000 1.8
@@ -1,9 +1,13 @@
/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -83,8 +87,11 @@
* @version $Id$
*/
public class JUnitEventReporter extends AbstractReporter {
- private static final Category _log = Category.getInstance(JUnitEventReporter.class);
+ /** log4j category for log output */
+ private static final Category _log = Category.getInstance(
+ JUnitEventReporter.class);
+ /** the result from running the tests */
private TestResult _testResult = null;
/**
@@ -96,8 +103,13 @@
_testResult = result;
}
+ /**
+ * A {@link Test JUnit Test} that knows how to be a Latka reporter
+ */
private class EventTestAdapter implements Test {
+ /** the JUnit assertion error */
private AssertionFailedError _failed = null;
+ /** the error that occurred */
private Throwable _error = null;
/**
@@ -121,11 +133,12 @@
}
/**
- * Create an instance with a JUnit {@link java.lang.Throwable Throble} that
- * can be added to the results in the
+ * Create an instance with a JUnit {@link java.lang.Throwable Throwable}
+ * that can be added to the results in the
* {@link #run(junit.framework.TestResult) run} method
*
- * @param t The Throwable that will be stored for later addition to results
+ * @param t The Throwable that will be stored for later addition to
+ * results
*/
public EventTestAdapter(Throwable t) {
_error = t;
@@ -142,7 +155,7 @@
/**
* Run this test.
- * Since Latka has already executed the request we simply check if there
+ * Since Latka has already executed the request we simply check if there
* has been a failure or error stored and add it to the test results
*
* @param result The {@link junit.framework.TestResult TestResult} to
@@ -166,7 +179,7 @@
public void requestError(RequestEvent event) {
_log.debug("Received latka RequestErrorEvent");
super.requestError(event);
- Throwable error = ((RequestErrorEvent)event).getError();
+ Throwable error = ((RequestErrorEvent) event).getError();
Test test = new EventTestAdapter(error);
test.run(_testResult);
}
@@ -178,8 +191,9 @@
public void requestFailed(RequestEvent event) {
_log.debug("Received latka RequestFailedEvent");
super.requestFailed(event);
- RequestFailedEvent fe = (RequestFailedEvent)event;
- ValidationException ve = (ValidationException)fe.getValidationException();
+ RequestFailedEvent fe = (RequestFailedEvent) event;
+ ValidationException ve = (ValidationException)
+ fe.getValidationException();
String requestUrl = event.getRequest().getURL().toString();
String requestLabel = event.getRequest().getLabel();
String message = requestUrl + " -- " + requestLabel + ": " +
1.13 +22 -11 jakarta-commons/latka/src/java/org/apache/commons/latka/junit/JUnitTestAdapter.java
Index: JUnitTestAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/junit/JUnitTestAdapter.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- JUnitTestAdapter.java 29 Apr 2002 18:20:21 -0000 1.12
+++ JUnitTestAdapter.java 4 Jul 2002 14:06:32 -0000 1.13
@@ -1,9 +1,13 @@
/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -93,7 +97,8 @@
*/
public class JUnitTestAdapter implements Test {
/** log4j category that output is logged to */
- private static final Category _log = Category.getInstance(JUnitTestAdapter.class);
+ private static final Category _log = Category.getInstance(
+ JUnitTestAdapter.class);
/** The latka {@link org.apache.commons.latka.Suite Suite} to be run*/
private Suite _latkaSuite = null;
@@ -147,9 +152,10 @@
/**
* Create a Test from a resource accessible via
* the {@link java.lang.ClassLoader#getResource(String) class loader}
- * @param resourceName A resource accessible by the class loader in Latka's XML format
+ * @param resourceName A resource accessible by the class loader in Latka's
+ * XML format
* @return a JUnit Test, ready to run, or null if the resource can't be
- * resolved
+ * resolved
*/
public static Test createTestFromResource(String resourceName) {
Test result = null;
@@ -203,12 +209,14 @@
* @param xml The inputsource to parse
* @throws IOException When an IO occurs reading the document
* @throws SAXException When the document is invalid XML
- * @throws FactoryConfigurationError When the SAX Parser factory can't be configured correctly
- * @throws ParserConfigurationException When the SAX Parser can't be configured correctly
+ * @throws FactoryConfigurationError When the SAX Parser factory can't be
+ * configured correctly
+ * @throws ParserConfigurationException When the SAX Parser can't be
+ * configured correctly
* @return the number of tests in the Latka suite
*/
- protected static int parse(InputSource xml) throws IOException, SAXException,
- FactoryConfigurationError, ParserConfigurationException {
+ protected static int parse(InputSource xml) throws IOException, SAXException
+ , FactoryConfigurationError, ParserConfigurationException {
int result = 0;
XMLReader reader = null;
SAXParserFactory factory = SAXParserFactory.newInstance();
@@ -227,7 +235,8 @@
*
* @author Chuck Burdick
* @author dIon Gillard
- * @version $Id$
+ * @version
+ * $Id$
*/
private static class TestCounter extends DefaultHandler {
/** number of requests (ie junit tests) */
@@ -273,7 +282,9 @@
}
/**
- * Run the test, adding results to the provided {@link junit.framework.TestResult TestResult}
+ * Run the test, adding results to the provided
+ * {@link junit.framework.TestResult TestResult}
+ *
* @param r TestResult to accumulate
*/
public void run(TestResult r) {
1.4 +34 -9 jakarta-commons/latka/src/java/org/apache/commons/latka/servlet/ViewResponseServlet.java
Index: ViewResponseServlet.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/servlet/ViewResponseServlet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ViewResponseServlet.java 29 Jun 2002 13:25:22 -0000 1.3
+++ ViewResponseServlet.java 4 Jul 2002 14:06:33 -0000 1.4
@@ -85,15 +85,29 @@
* @version $Id$
*/
public class ViewResponseServlet extends HttpServlet {
-
+ /** log4 category for output */
public static final Category _log = Category.getInstance(
ViewResponseServlet.class);
+ /**
+ * Perform a post request
+ *
+ * @param req the http request
+ * @param res the http response
+ * @throws IOException when an error occurs writing the response
+ */
public void doPost(HttpServletRequest req, HttpServletResponse res) throws
IOException {
- doGet(req,res);
+ doGet(req, res);
}
+ /**
+ * Perform a get request
+ *
+ * @param req the http request
+ * @param res the http response
+ * @throws IOException when an error occurs writing the response
+ */
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
HttpSession session = req.getSession();
@@ -102,8 +116,9 @@
String responseHash = req.getParameter("responseId");
- Collections.sort(list,new ToStringComparator());
- int i = Collections.binarySearch(list,responseHash,new ToStringComparator());
+ Collections.sort(list, new ToStringComparator());
+ int i = Collections.binarySearch(list, responseHash,
+ new ToStringComparator());
Response response = (Response) list.get(i);
@@ -111,7 +126,7 @@
String contentType = response.getHeader("Content-type");
_log.debug("Content type = " + contentType);
if (contentType != null) {
- res.setHeader("Content-type",contentType);
+ res.setHeader("Content-type", contentType);
}
InputStream responseStream = response.getStream();
@@ -131,7 +146,17 @@
_log.debug("end doGet(HttpServletRequest,HttpServletResponse)");
}
+ /**
+ * A comparator that converts the objects to strings before comparing
+ */
private class ToStringComparator implements Comparator {
+ /**
+ * compare the two objects
+ *
+ * @param o1 the object being compared with
+ * @param o2 the object being compared to
+ * @return 0 if equal, -1 if o1 < o2, 1 if o1 > o2
+ */
public int compare(Object o1, Object o2) {
return o1.toString().compareTo(o2.toString());
}
1.3 +99 -21 jakarta-commons/latka/src/java/org/apache/commons/latka/servlet/ViewSuiteServlet.java
Index: ViewSuiteServlet.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/servlet/ViewSuiteServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ViewSuiteServlet.java 16 May 2002 08:04:40 -0000 1.2
+++ ViewSuiteServlet.java 4 Jul 2002 14:06:33 -0000 1.3
@@ -1,3 +1,64 @@
+/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
package org.apache.commons.latka.servlet;
import java.io.IOException;
@@ -12,29 +73,46 @@
import org.apache.commons.latka.Suite;
import org.apache.commons.latka.xml.XMLPreprocessor;
+/**
+ * A servlet to view the Latka Suite
+ *
+ * @author Morgan Delagrange
+ * @version $Id$
+ */
public class ViewSuiteServlet extends HttpServlet {
- public void doPost(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- doGet(req,res);
- }
-
- public void doGet(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
-
- String suiteUrl = req.getParameter("url");
-
- res.setHeader("Content-type","text/xml");
-
- Suite suite = new Suite(new URL(suiteUrl));
-
- XMLPreprocessor processor = XMLPreprocessor.instance();
-
- PrintWriter writer = res.getWriter();
-
- // do an identity transform to resolve any external entities
- String xml = processor.identityTransform(suite);
- writer.print(xml);
+ /**
+ * perform a get request
+ *
+ * @param req the http request
+ * @param res the http response
+ * @throws IOException when an error occurs writing the response
+ */
+ public void doPost(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ doGet(req, res);
+ }
+
+ /**
+ * Perform a get request
+ *
+ * @param req the http request
+ * @param res the http response
+ * @throws IOException when an error occurs writing the response
+ */
+ public void doGet(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+
+ res.setHeader("Content-type", "text/xml");
+
+ String suiteUrl = req.getParameter("url");
+ Suite suite = new Suite(new URL(suiteUrl));
+
+ PrintWriter writer = res.getWriter();
+ // do an identity transform to resolve any external entities
+ XMLPreprocessor processor = XMLPreprocessor.instance();
+ String xml = processor.identityTransform(suite);
+ writer.print(xml);
}
}
1.8 +97 -39 jakarta-commons/latka/src/java/org/apache/commons/latka/util/URLParser.java
Index: URLParser.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/util/URLParser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- URLParser.java 11 Apr 2002 13:43:39 -0000 1.7
+++ URLParser.java 4 Jul 2002 14:06:33 -0000 1.8
@@ -119,39 +119,64 @@
// Parse Patterns //
- /** Extracts the URL from the <code>HREF</code> attribute of the HTML <code>A</code> element. */
+ /**
+ * Extracts the URL from the <code>HREF</code> attribute of the HTML
+ * <code>A</code> element.
+ */
public static final String ANCHOR_PATTERN =
"<A\\s+[^>]*?HREF\\s*=\\s*([\"\']?)([^#\'\">\\s]+)[^\'\">\\s]*\\1[^>]*>";
- /** Extracts the URL from the <code>SRC</code> attribute of the HTML <code>FRAME</code> element. */
+ /**
+ * Extracts the URL from the <code>SRC</code> attribute of the HTML
+ * <code>FRAME</code> element.
+ */
public static final String FRAME_PATTERN =
"<FRAME\\s+[^>]*?SRC\\s*=\\s*([\"\']?)([^\'\">\\s]*)\\1[^>]*>";
- /** Extracts the URL from the <code>SRC</code> attribute of the HTML <code>IMG</code> element. */
+ /**
+ * Extracts the URL from the <code>SRC</code> attribute of the HTML
+ * <code>IMG</code> element.
+ */
public static final String IMAGE_PATTERN =
"<IMG\\s+[^>]*?SRC\\s*=\\s*([\"\']?)([^\'\">\\s]*)\\1[^>]*>";
- /** Extracts the URL from the <code>SRC</code> attribute of the HTML <code>LAYER</code> element. */
+ /**
+ * Extracts the URL from the <code>SRC</code> attribute of the HTML
+ * <code>LAYER</code> element.
+ */
public static final String LAYER_PATTERN =
"<LAYER\\s+[^>]*?SRC\\s*=\\s*([\"\']?)([^\'\">\\s]*)\\1[^>]*>";
- /** Extracts the URL from the <code>HREF</code> attribute of the HTML <code>LINK</code> element. */
+ /**
+ * Extracts the URL from the <code>HREF</code> attribute of the HTML
+ * <code>LINK</code> element.
+ */
public static final String LINK_PATTERN =
"<LINK\\s+[^>]*?HREF\\s*=\\s*([\"\']?)([^\'\">\\s]*)\\1[^>]*>";
- /** Extracts the URL from the <code>SRC</code> attribute of the HTML <code>OBJECT</code> element. */
+ /**
+ * Extracts the URL from the <code>SRC</code> attribute of the HTML
+ * <code>OBJECT</code> element.
+ */
public static final String OBJECT_PATTERN =
"<OBJECT\\s+[^>]*?SRC\\s*=\\s*([\"\']?)([^\'\">\\s]*)\\1[^>]*>";
- /** Extracts the URL from the <code>SRC</code> attribute of the HTML <code>SCRIPT</code> element. */
+ /**
+ * Extracts the URL from the <code>SRC</code> attribute of the HTML
+ * <code>SCRIPT</code> element.
+ */
public static final String SCRIPT_PATTERN =
"<SCRIPT\\s+[^>]*?SRC\\s*=\\s*([\"\']?)([^\'\">\\s]*)\\1[^>]*>";
// pattern and program containers
+ /** the map of pattern number to pattern */
protected static Map _patterns;
+ /** the compiled regular expressions keyed on pattern */
protected static Map _programs;
+ /** the number of patterns available */
protected static int _numPatterns = 7;
+ /** the default load factor for hash tables */
protected static float _loadFactor = 0.75f;
///////////////////////
@@ -159,9 +184,12 @@
///////////////////////
static {
- // ensure that '_patterns' capacity doesn't have to increase on class initialization
- _patterns = new Hashtable((int)(_numPatterns/_loadFactor) + 1, _loadFactor);
- _programs = new Hashtable((int)(_numPatterns/_loadFactor) + 1, _loadFactor);
+ // ensure that '_patterns' capacity doesn't have to increase on class
+ // initialization
+ _patterns = new Hashtable((int) (_numPatterns / _loadFactor) + 1,
+ _loadFactor);
+ _programs = new Hashtable((int) (_numPatterns / _loadFactor) + 1,
+ _loadFactor);
_patterns.put(new Integer(PARSE_ANCHORS), ANCHOR_PATTERN);
_patterns.put(new Integer(PARSE_FRAMES), FRAME_PATTERN);
@@ -176,12 +204,18 @@
// INSTANCE VARIABLES //
////////////////////////
+ /** the regular expression compiler */
protected RECompiler _compiler;
+ /** the regular expression processor */
protected RE _engine;
+ /** what sort of parsing is being done. An 'or' of flags above */
protected int _parseFlag;
+ /** the url others are relative to */
protected URL _baseURL;
+ /** whether to keep malformed urls or not */
protected boolean _includeMalformedURLs;
+ /** the malformed urls collected during parsing */
protected Collection _malformedURLs;
//////////////////
@@ -200,6 +234,8 @@
* Creates a URLParser instance that includes malformed URL's,
* parses <code>parseFlag</code> element types,
* and does not resolve relative URL's.
+ *
+ * @param parseFlag the elements to parse
*/
public URLParser(int parseFlag) {
this(parseFlag, null, false);
@@ -210,6 +246,9 @@
* according to <code>includeMalformedURLs</code>,
* parses all element types, and resolves relative URL's
* according to <code>baseURL</code>.
+ *
+ * @param baseURL the url that elements are relative to
+ * @param includeMalformedURLs whether to include malformed URLs
*/
public URLParser(URL baseURL, boolean includeMalformedURLs) {
this(URLParser.PARSE_ALL, baseURL, includeMalformedURLs);
@@ -220,6 +259,10 @@
* according to <code>includeMalformedURLs</code>,
* parses element types according to <code>parseFlag</code>,
* and resolves relative URL's according to <code>baseURL</code>.
+ *
+ * @param parseFlag the elements to parse
+ * @param baseURL the url that elements are relative to
+ * @param includeMalformedURLs whether to include malformed URLs
*/
public URLParser(int parseFlag, URL baseURL, boolean includeMalformedURLs) {
_parseFlag = parseFlag;
@@ -280,11 +323,10 @@
}
/**
- * Set a base URL to use when resolving relative URL's. URLParser cannot check
+ * Set a base URL to use when resolving relative URL's. URLParser cannot check
* for malformed URL's unless a base URL is set.
*
* @param baseURL the base URL used to resolve relative URL's
- *
*/
public void setBaseURL(URL baseURL) {
_baseURL = baseURL;
@@ -305,8 +347,8 @@
* Malformed URL's from the last parsing are always available via
* {@link #getMalformedURLs}
*
- * @param includeMalformedURL a boolean determining parsing
- * behavior with respect to malformed URL's
+ * @param includeMalformedURLs a boolean determining parsing
+ * behavior with respect to malformed URL's
*/
public void setIncludeMalformedURLs(boolean includeMalformedURLs) {
_includeMalformedURLs = includeMalformedURLs;
@@ -324,7 +366,8 @@
/**
* Returns a Collection of malformed URL's from the previous parsing.
*
- * @return a collection of malformed URL's or null if no parsing has been done yet.
+ * @return a collection of malformed URL's or null if no parsing has been done
+ * yet.
*/
public Collection getMalformedURLs() {
return _malformedURLs;
@@ -392,6 +435,13 @@
return urls;
}
+ /**
+ * Parse the provided input with the given pattern
+ *
+ * @param input an iterator of characters
+ * @param pattern the pattern to parse with
+ * @return a list of URLs
+ */
protected Collection parse(CharacterIterator input, String pattern) {
Collection urls = new Vector();
@@ -410,8 +460,7 @@
try {
url = resolveURL(url);
urls.add(url);
- }
- catch (MalformedURLException e) {
+ } catch (MalformedURLException e) {
if (_includeMalformedURLs) {
urls.add(url);
}
@@ -422,6 +471,13 @@
return urls;
}
+ /**
+ * Resolve a URL against the current baseURL
+ *
+ * @param url the url to resolve
+ * @return the resolved url in its external form
+ * @throws MalformedURLException if the url isn't applicable to _baseURL
+ */
protected String resolveURL(String url)
throws MalformedURLException {
@@ -430,14 +486,19 @@
// if a base URL has been provided to resolve against
if (_baseURL != null) {
resolvedURL = new URL(_baseURL, url).toExternalForm();
- }
- else {
+ } else {
resolvedURL = url;
}
return resolvedURL;
}
+ /**
+ * Get a compiled version of the regular expression passed
+ *
+ * @param pattern the expression to compile
+ * @return a compiled regular expression
+ */
protected REProgram getProgram(String pattern) {
REProgram program = (REProgram) _programs.get(pattern);
@@ -446,11 +507,9 @@
try {
program = _compiler.compile(pattern);
_programs.put(pattern, program);
- }
- catch (RESyntaxException x) {
- throw new RuntimeException(
- "The Regular Expression Compiler could not compile the following regular expression: "
- + pattern);
+ } catch (RESyntaxException x) {
+ throw new RuntimeException("The Regular Expression Compiler could not"
+ + " compile the following regular expression: " + pattern);
}
}
@@ -463,7 +522,7 @@
/**
* Parse a file, extracting all URL's to standard output.
- * Usage: java com.britannica.util.URLParser <filename> [<base URL>]
+ * Usage: java org.apache.commons.latka.util.URLParser <filename> [<base URL>]
*
* If a base URL is specified, malformed URL's will be output to
* standard error.
@@ -473,12 +532,15 @@
* 1 - bad usage
* 2 - bad filename
* 3 - bad base url
+ *
+ * @param args the command line arguments
*/
public static void main(String[] args) {
- final String USAGE_MSG = "Usage: java com.britannica.util.URLParser <filename> [<base URL>]";
- final String FILE_MSG = "File not found: ";
- final String URL_MSG = "Malformed Base URL: ";
+ final String usageMsg = "Usage: java org.apache.commons.latka.util." +
+ "URLParser <filename> [<base URL>]";
+ final String fileMsg = "File not found: ";
+ final String urlMsg = "Malformed Base URL: ";
URLParser parser;
Collection urls;
@@ -487,8 +549,7 @@
try {
if (args.length > 1) {
parser = new URLParser(new URL(args[1]), false);
- }
- else {
+ } else {
parser = new URLParser();
}
@@ -507,17 +568,14 @@
System.err.println((String) iter.next());
}
}
- }
- catch (ArrayIndexOutOfBoundsException e) {
- System.err.println(USAGE_MSG);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ System.err.println(usageMsg);
System.exit(1);
- }
- catch (FileNotFoundException e) {
- System.err.println(FILE_MSG + args[0]);
+ } catch (FileNotFoundException e) {
+ System.err.println(fileMsg + args[0]);
System.exit(2);
- }
- catch (MalformedURLException e) {
- System.err.println(URL_MSG + args[1]);
+ } catch (MalformedURLException e) {
+ System.err.println(urlMsg + args[1]);
System.exit(3);
}
1.11 +60 -20 jakarta-commons/latka/src/java/org/apache/commons/latka/util/xml/BasicDelegateHandler.java
Index: BasicDelegateHandler.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/util/xml/BasicDelegateHandler.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BasicDelegateHandler.java 11 Apr 2002 13:43:39 -0000 1.10
+++ BasicDelegateHandler.java 4 Jul 2002 14:06:33 -0000 1.11
@@ -75,18 +75,26 @@
* this one. BasicDelegateHandler
* is a good base class for delegate handlers produced by factories and/or
* reflection.
+ *
+ * @author Morgan Delagrange
+ * @version $Id$
*/
public abstract class BasicDelegateHandler extends DefaultHandler
-implements DelegateHandler {
+ implements DelegateHandler {
+ /** handler to process xml content */
protected ContentHandler _handler = null;
+ /** source of xml data */
protected XMLReader _reader = null;
-
//debug
+ /** class doing delegation */
private String _delegatorClassName = null;
+ /** class to delete to */
private String _delegateClassName = null;
- protected static final Category log = Category.getInstance(BasicDelegateHandler.class);
+ /** log4j category to send output to */
+ protected static final Category _log = Category.getInstance(
+ BasicDelegateHandler.class);
/**
* Create a DelegateHandler that releases to the
@@ -95,7 +103,7 @@
* @param reader XMLReader that will do the parsing
*/
protected void init(XMLReader reader) {
- init(reader,reader.getContentHandler());
+ init(reader, reader.getContentHandler());
}
/**
@@ -112,6 +120,15 @@
_handler = handler;
}
+ /**
+ * Delegate xml processing
+ *
+ * @param namespaceURI the name space of the element
+ * @param localName the name space relative element name
+ * @param rawName the raw name of the element
+ * @param atts the attributes of the element
+ * @throws SAXException when an error occurs
+ */
public void delegate(String namespaceURI, String localName,
String rawName, Attributes atts)
throws SAXException {
@@ -121,43 +138,66 @@
delegate();
//log.info("broadcasting first event to delegate: " + _handler);
- startElement(namespaceURI,localName,rawName,atts);
+ startElement(namespaceURI, localName, rawName, atts);
}
-
+
+ /**
+ * delegate from the previous handler to this class
+ */
protected void delegate() {
//debug
- if (log.isDebugEnabled()) {
+ if (_log.isDebugEnabled()) {
_delegatorClassName = _handler.getClass().getName();
_delegateClassName = this.getClass().getName();
- log.debug("beginning delegation");
- log.debug("delegating from " + _delegatorClassName + " to " + _delegateClassName);
+ _log.debug("beginning delegation");
+ _log.debug("delegating from " + _delegatorClassName + " to " +
+ _delegateClassName);
}
_reader.setContentHandler(this);
}
+ /**
+ * finish handling the request
+ */
public void release() {
- if (log.isDebugEnabled()) {
- log.debug("releasing from " + _delegateClassName + " to " + _delegatorClassName);
+ if (_log.isDebugEnabled()) {
+ _log.debug("releasing from " + _delegateClassName + " to " +
+ _delegatorClassName);
}
_reader.setContentHandler(_handler);
}
- protected void release(String namespaceURI, String localName,
- String rawName, Attributes atts)
- throws SAXException {
- log.debug("begin tag release");
+ /**
+ * finish handling the request
+ *
+ * @param namespaceURI the name space of the element
+ * @param localName the name space relative element name
+ * @param rawName the raw name of the element
+ * @param atts the attributes of the element
+ * @throws SAXException when an error occurs
+ */
+ protected void release(String namespaceURI, String localName, String rawName,
+ Attributes atts) throws SAXException {
+ _log.debug("begin tag release");
release();
- _handler.startElement(namespaceURI,localName,rawName,atts);
+ _handler.startElement(namespaceURI, localName, rawName, atts);
}
- protected void release(String namespaceURI, String localName,
- String rawName)
- throws SAXException {
+ /**
+ * finish handling the request
+ *
+ * @param namespaceURI the name space of the element
+ * @param localName the name space relative element name
+ * @param rawName the raw name of the element
+ * @throws SAXException when an error occurs
+ */
+ protected void release(String namespaceURI, String localName, String rawName)
+ throws SAXException {
//log.debug("end tag release");
release();
- _handler.endElement(namespaceURI,localName,rawName);
+ _handler.endElement(namespaceURI, localName, rawName);
}
}
1.6 +19 -3 jakarta-commons/latka/src/java/org/apache/commons/latka/util/xml/DelegateHandler.java
Index: DelegateHandler.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/util/xml/DelegateHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DelegateHandler.java 11 Apr 2002 13:43:39 -0000 1.5
+++ DelegateHandler.java 4 Jul 2002 14:06:33 -0000 1.6
@@ -65,12 +65,28 @@
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
+/**
+ * An interface for delegation of xml processing
+ *
+ * @author Morgan Delagrange
+ * @version $Id$
+ */
public interface DelegateHandler extends ContentHandler {
- public void delegate(String namespaceURI, String localName,
+ /**
+ * Delegate xml processing
+ *
+ * @param namespaceURI the name space of the element
+ * @param localName the name space relative element name
+ * @param rawName the raw name of the element
+ * @param atts the attributes of the element
+ * @throws SAXException when an error occurs
+ */
+ void delegate(String namespaceURI, String localName,
String rawName, Attributes atts)
- throws SAXException;
+ throws SAXException;
- public void release();
+ /** finish processing */
+ void release();
}
1.6 +5 -3 jakarta-commons/latka/src/java/org/apache/commons/latka/util/xml/DelegateHandlerImpl.java
Index: DelegateHandlerImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/util/xml/DelegateHandlerImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DelegateHandlerImpl.java 11 Apr 2002 13:43:39 -0000 1.5
+++ DelegateHandlerImpl.java 4 Jul 2002 14:06:33 -0000 1.6
@@ -70,9 +70,11 @@
* the best base class for most delegate handlers. BasicDelegateHandler
* is a good base class for delegate handlers produced by factories and/or
* reflection.
+ *
+ * @author Morgan Delagrange
+ * @version $Id$
*/
-public abstract class DelegateHandlerImpl extends BasicDelegateHandler
-{
+public abstract class DelegateHandlerImpl extends BasicDelegateHandler {
/**
* Create a DelegateHandler that releases to the
@@ -94,7 +96,7 @@
* called
*/
public DelegateHandlerImpl(XMLReader reader, ContentHandler handler) {
- init(reader,handler);
+ init(reader, handler);
}
}
1.2 +17 -10 jakarta-commons/latka/src/java/org/apache/commons/latka/validators/BaseConditionalValidator.java
Index: BaseConditionalValidator.java
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/validators/BaseConditionalValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseConditionalValidator.java 2 May 2002 22:25:44 -0000 1.1
+++ BaseConditionalValidator.java 4 Jul 2002 14:06:33 -0000 1.2
@@ -1,9 +1,13 @@
/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -57,9 +61,7 @@
package org.apache.commons.latka.validators;
-import org.apache.commons.latka.Validator;
import org.apache.commons.latka.ValidationException;
-
import org.apache.commons.latka.http.Response;
import org.apache.log4j.Category;
@@ -73,12 +75,16 @@
* and generateBareExceptionMessage().
*
* @author MorganDelagrange
- * @version $Id$
+ * @version
+ * $Id$
*/
public abstract class BaseConditionalValidator extends BaseValidator {
- // ------------------------------------------------------- Instance Variables
+ // ------------------------------------------------------ Instance Variables
- protected final Category _log = Category.getInstance(BaseConditionalValidator.class);
+ /** log4j category for output */
+ protected final Category _log = Category.getInstance(
+ BaseConditionalValidator.class);
+ /** condition to test against */
protected boolean _condition = true;
// ----------------------------------------------------------- Constructors
@@ -89,7 +95,7 @@
* @param condition Whether the test should evaluate to true or false
*/
public BaseConditionalValidator(boolean condition) {
- this(null,condition);
+ this(null, condition);
}
/**
@@ -129,7 +135,7 @@
* in generateBareExceptionMessage()
*
* @param response Response from the HTTP server
- * @exception ValidationException
+ * @throws ValidationException when a validation fails
*/
public final void validate(Response response) throws ValidationException {
boolean assertion = assertTrue(response);
@@ -155,9 +161,10 @@
*
* @param response HTTP response
* @return true if the test conditions were met, false otherwise
- * @exception ValidationException
+ * @throws ValidationException when a validation fails
*/
- public abstract boolean assertTrue(Response response) throws ValidationException;
+ public abstract boolean assertTrue(Response response) throws
+ ValidationException;
/**
* The BASE exception message for a subclass of
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>