vmassol 01/08/19 09:24:53
Modified: cactus/src/framework/share/org/apache/commons/cactus/client
AbstractHttpClient.java
AssertionFailedErrorWrapper.java
AutoReadHttpURLConnection.java
ClientConfigurationChecker.java
HttpClientHelper.java JspHttpClient.java
ServletExceptionWrapper.java ServletHttpClient.java
Log:
align with coding conventions
Revision Changes Path
1.4 +5 -2
jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/AbstractHttpClient.java
Index: AbstractHttpClient.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/AbstractHttpClient.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractHttpClient.java 2001/04/28 14:03:21 1.3
+++ AbstractHttpClient.java 2001/08/19 16:24:53 1.4
@@ -67,7 +67,9 @@
* configuration checks to verify if the runtime configuration is right (see
* the <code>ClientConfigurationChecker</code> class for details).
*
- * @version @version@
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
+ *
+ * @version $Id: AbstractHttpClient.java,v 1.4 2001/08/19 16:24:53 vmassol Exp $
*/
public abstract class AbstractHttpClient
{
@@ -102,6 +104,7 @@
* @exception Throwable if an error occured in the test method or in the
* redirector servlet.
*/
- public abstract HttpURLConnection doTest(ServletTestRequest theRequest) throws
Throwable;
+ public abstract HttpURLConnection doTest(ServletTestRequest theRequest)
+ throws Throwable;
}
1.2 +15 -12
jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/AssertionFailedErrorWrapper.java
Index: AssertionFailedErrorWrapper.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/AssertionFailedErrorWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AssertionFailedErrorWrapper.java 2001/04/09 11:52:37 1.1
+++ AssertionFailedErrorWrapper.java 2001/08/19 16:24:53 1.2
@@ -62,7 +62,9 @@
* extends JUnit <code>AssertionFailedError</code> so that JUnit will
* print a different message in it's runner console.
*
- * @version @version@
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
+ *
+ * @version $Id: AssertionFailedErrorWrapper.java,v 1.2 2001/08/19 16:24:53 vmassol
Exp $
*/
public class AssertionFailedErrorWrapper extends AssertionFailedError
{
@@ -70,12 +72,12 @@
* The stack trace that was sent back from the servlet redirector as a
* string.
*/
- private String m_StackTrace;
+ private String stackTrace;
/**
* The class name of the exception that was raised on the server side.
*/
- private String m_ClassName;
+ private String className;
/**
* Standard throwable constructor.
@@ -102,11 +104,12 @@
* @param theClassName the server exception class name
* @param theStackTrace the server exception stack trace
*/
- public AssertionFailedErrorWrapper(String theMessage, String theClassName,
String theStackTrace)
+ public AssertionFailedErrorWrapper(String theMessage, String theClassName,
+ String theStackTrace)
{
super(theMessage);
- m_ClassName = theClassName;
- m_StackTrace = theStackTrace;
+ this.className = theClassName;
+ this.stackTrace = theStackTrace;
}
/**
@@ -116,10 +119,10 @@
*/
public void printStackTrace(PrintStream thePs)
{
- if (m_StackTrace == null) {
+ if (this.stackTrace == null) {
thePs.print(getMessage());
} else {
- thePs.print(m_StackTrace);
+ thePs.print(this.stackTrace);
}
}
@@ -130,10 +133,10 @@
*/
public void printStackTrace(PrintWriter thePw)
{
- if (m_StackTrace == null) {
+ if (this.stackTrace == null) {
thePw.print(getMessage());
} else {
- thePw.print(m_StackTrace);
+ thePw.print(this.stackTrace);
}
}
@@ -146,11 +149,11 @@
*/
public boolean instanceOf(Class theClass)
{
- if (m_ClassName == null) {
+ if (this.className == null) {
return false;
}
- return theClass.getName().equals(m_ClassName);
+ return theClass.getName().equals(this.className);
}
}
1.2 +76 -47
jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/AutoReadHttpURLConnection.java
Index: AutoReadHttpURLConnection.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/AutoReadHttpURLConnection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AutoReadHttpURLConnection.java 2001/06/17 13:38:32 1.1
+++ AutoReadHttpURLConnection.java 2001/08/19 16:24:53 1.2
@@ -57,6 +57,8 @@
import java.net.*;
import java.security.*;
+import org.apache.commons.cactus.util.log.*;
+
/**
* Wrapper class for the real <code>HttpURLConnection</code> to the test servlet
* that reads the complete input stream into an internal buffer on
@@ -68,12 +70,22 @@
* <p>
* This class is final so we don't have to provide access to protected instance
* variables and methods of the wrapped connection.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Bob Davison</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
*
- * @version @version@
+ * @version $Id: AutoReadHttpURLConnection.java,v 1.2 2001/08/19 16:24:53 vmassol
Exp $
*/
final class AutoReadHttpURLConnection extends HttpURLConnection
{
/**
+ * The logger
+ */
+ private static Log logger =
+ LogService.getInstance().
+ getLog(AutoReadHttpURLConnection.class.getName());
+
+ /**
* Default size of array for copying data, not sure what a good size is.
*/
static final int DEFAULT_CHUNK_SIZE = 16384;
@@ -101,10 +113,10 @@
*/
InputStream streamBuffer;
- AutoReadHttpURLConnection(HttpURLConnection conn)
+ AutoReadHttpURLConnection(HttpURLConnection theConnection)
{
super(null);
- delegate = conn;
+ this.delegate = theConnection;
}
/**
@@ -115,15 +127,24 @@
*/
public synchronized InputStream getInputStream() throws IOException
{
+ this.logger.entry("getInputStream()");
+
+ this.logger.debug("Original connection = " + this.delegate);
+
if (streamBuffer == null) {
- streamBuffer = bufferInputStream(delegate.getInputStream());
+ InputStream is = this.delegate.getInputStream();
+ streamBuffer = bufferInputStream(is);
}
+
+ this.logger.exit("getInputStream");
return streamBuffer;
}
InputStream bufferInputStream(InputStream is) throws IOException
{
- ByteArrayOutputStream os = new ByteArrayOutputStream(chunkSize);
+ this.logger.entry("bufferInputStream(...)");
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream(this.chunkSize);
copy(is, os);
ByteArrayInputStream bais = null;
@@ -135,220 +156,228 @@
byte[] buffer = os.toByteArray();
boolean foundMagic = true;
for (int i = 1; i < MAGIC_KEYWORD.length - 1; i++) {
- if (buffer[buffer.length - i] != MAGIC_KEYWORD[MAGIC_KEYWORD.length -
i]) {
+ if (buffer[buffer.length - i] !=
+ MAGIC_KEYWORD[MAGIC_KEYWORD.length - i]) {
+
foundMagic = false;
break;
}
}
if (foundMagic) {
- bais = new ByteArrayInputStream(buffer, 0, buffer.length -
MAGIC_KEYWORD.length);
+ bais = new ByteArrayInputStream(buffer, 0,
+ buffer.length - MAGIC_KEYWORD.length);
} else {
bais = new ByteArrayInputStream(buffer);
}
- return bais;
+ this.logger.exit("bufferInputStream");
+ return bais;
}
void copy(InputStream is, OutputStream os) throws IOException
{
- byte[] buf = new byte[chunkSize];
+ this.logger.entry("copy(...)");
+
+ byte[] buf = new byte[this.chunkSize];
int count;
while( -1 != (count = is.read(buf)) ) {
os.write(buf, 0, count);
}
+
+ this.logger.exit("copy");
}
// Delegated methods
public void connect() throws IOException
{
- delegate.connect();
+ this.delegate.connect();
}
public boolean getAllowUserInteraction()
{
- return delegate.getAllowUserInteraction();
+ return this.delegate.getAllowUserInteraction();
}
public Object getContent() throws IOException
{
- return delegate.getContent();
+ return this.delegate.getContent();
}
public String getContentEncoding()
{
- return delegate.getContentEncoding();
+ return this.delegate.getContentEncoding();
}
public int getContentLength()
{
- return delegate.getContentLength();
+ return this.delegate.getContentLength();
}
public String getContentType()
{
- return delegate.getContentType();
+ return this.delegate.getContentType();
}
public long getDate()
{
- return delegate.getDate();
+ return this.delegate.getDate();
}
public boolean getDefaultUseCaches()
{
- return delegate.getDefaultUseCaches();
+ return this.delegate.getDefaultUseCaches();
}
public boolean getDoInput()
{
- return delegate.getDoInput();
+ return this.delegate.getDoInput();
}
public boolean getDoOutput()
{
- return delegate.getDoOutput();
+ return this.delegate.getDoOutput();
}
public long getExpiration()
{
- return delegate.getExpiration();
+ return this.delegate.getExpiration();
}
public String getHeaderField(int a0)
{
- return delegate.getHeaderField(a0);
+ return this.delegate.getHeaderField(a0);
}
public String getHeaderField(String a0)
{
- return delegate.getHeaderField(a0);
+ return this.delegate.getHeaderField(a0);
}
public long getHeaderFieldDate(String a0, long a1)
{
- return delegate.getHeaderFieldDate(a0, a1);
+ return this.delegate.getHeaderFieldDate(a0, a1);
}
public int getHeaderFieldInt(String a0, int a1)
{
- return delegate.getHeaderFieldInt(a0, a1);
+ return this.delegate.getHeaderFieldInt(a0, a1);
}
public String getHeaderFieldKey(int a0)
{
- return delegate.getHeaderFieldKey(a0);
+ return this.delegate.getHeaderFieldKey(a0);
}
public long getIfModifiedSince()
{
- return delegate.getIfModifiedSince();
+ return this.delegate.getIfModifiedSince();
}
public long getLastModified()
{
- return delegate.getLastModified();
+ return this.delegate.getLastModified();
}
public OutputStream getOutputStream() throws IOException
{
- return delegate.getOutputStream();
+ return this.delegate.getOutputStream();
}
public Permission getPermission() throws IOException
{
- return delegate.getPermission();
+ return this.delegate.getPermission();
}
public String getRequestProperty(String a0)
{
- return delegate.getRequestProperty(a0);
+ return this.delegate.getRequestProperty(a0);
}
public URL getURL()
{
- return delegate.getURL();
+ return this.delegate.getURL();
}
public boolean getUseCaches()
{
- return delegate.getUseCaches();
+ return this.delegate.getUseCaches();
}
public void setAllowUserInteraction(boolean a0)
{
- delegate.setAllowUserInteraction(a0);
+ this.delegate.setAllowUserInteraction(a0);
}
public void setDefaultUseCaches(boolean a0)
{
- delegate.setDefaultUseCaches(a0);
+ this.delegate.setDefaultUseCaches(a0);
}
public void setDoInput(boolean a0)
{
- delegate.setDoInput(a0);
+ this.delegate.setDoInput(a0);
}
public void setDoOutput(boolean a0)
{
- delegate.setDoOutput(a0);
+ this.delegate.setDoOutput(a0);
}
public void setIfModifiedSince(long a0)
{
- delegate.setIfModifiedSince(a0);
+ this.delegate.setIfModifiedSince(a0);
}
public void setRequestProperty(String a0, String a1)
{
- delegate.setRequestProperty(a0, a1);
+ this.delegate.setRequestProperty(a0, a1);
}
public void setUseCaches(boolean a0)
{
- delegate.setUseCaches(a0);
+ this.delegate.setUseCaches(a0);
}
public String toString()
{
- return delegate.toString();
+ return this.delegate.toString();
}
public void disconnect()
{
- delegate.disconnect();
+ this.delegate.disconnect();
}
public InputStream getErrorStream()
{
- return delegate.getErrorStream();
+ return this.delegate.getErrorStream();
}
public String getRequestMethod()
{
- return delegate.getRequestMethod();
+ return this.delegate.getRequestMethod();
}
public int getResponseCode() throws IOException
{
- return delegate.getResponseCode();
+ return this.delegate.getResponseCode();
}
public String getResponseMessage() throws IOException
{
- return delegate.getResponseMessage();
+ return this.delegate.getResponseMessage();
}
public void setRequestMethod(String a0) throws ProtocolException
{
- delegate.setRequestMethod(a0);
+ this.delegate.setRequestMethod(a0);
}
public boolean usingProxy()
{
- return delegate.usingProxy();
+ return this.delegate.usingProxy();
}
}
1.2 +7 -5
jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/ClientConfigurationChecker.java
Index: ClientConfigurationChecker.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/ClientConfigurationChecker.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClientConfigurationChecker.java 2001/04/28 14:05:02 1.1
+++ ClientConfigurationChecker.java 2001/08/19 16:24:53 1.2
@@ -63,8 +63,9 @@
* like if the CLASSPATH contains the jar for the Servlet API, if the
* <code>cactus.properties</code> file is in the CLASSPATH, ...
*
- * @version @version@
- * @author Vincent Massol <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
+ *
+ * @version $Id: ClientConfigurationChecker.java,v 1.2 2001/08/19 16:24:53 vmassol
Exp $
*/
public class ClientConfigurationChecker
{
@@ -80,9 +81,10 @@
"/" + AbstractHttpClient.CONFIG_NAME + ".properties");
if (is == null) {
- String msg = "The Cactus '" + AbstractHttpClient.CONFIG_NAME +
".properties' ";
- msg += "configuration file need to be present in the java CLASSPATH";
- msg += "(i.e. the directory that contains it need to be added to the
CLASSPATH).";
+ String msg = "The Cactus '" + AbstractHttpClient.CONFIG_NAME +
+ ".properties' configuration file need to be present in the " +
+ "java CLASSPATH (i.e. the directory that contains it need " +
+ "to be added to the CLASSPATH).";
throw new RuntimeException(msg);
}
1.4 +34 -11
jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/HttpClientHelper.java
Index: HttpClientHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/HttpClientHelper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HttpClientHelper.java 2001/06/27 20:42:49 1.3
+++ HttpClientHelper.java 2001/08/19 16:24:53 1.4
@@ -60,26 +60,39 @@
import junit.framework.*;
import org.apache.commons.cactus.*;
+import org.apache.commons.cactus.util.log.*;
/**
* Helper class to open an HTTP connection to the server redirector and pass
* to it HTTP parameters, Cookies and HTTP headers.
*
- * @version @version@
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
+ *
+ * @version $Id: HttpClientHelper.java,v 1.4 2001/08/19 16:24:53 vmassol Exp $
*/
class HttpClientHelper
{
/**
+ * The logger
+ */
+ private static Log logger =
+ LogService.getInstance().getLog(HttpClientHelper.class.getName());
+
+ /**
* The URL that will be used for the HTTP connection.
*/
- private String m_URL;
+ private String url;
/**
* @param theURL the URL that will be used for the HTTP connection.
*/
public HttpClientHelper(String theURL)
{
- m_URL = theURL;
+ this.logger.entry("HttpClientHelper([" + theURL + "])");
+
+ this.url = theURL;
+
+ this.logger.exit("HttpClientHelper");
}
/**
@@ -90,7 +103,8 @@
* @param theURL the URL used to connect to the server redirector.
* @return the new URL
*/
- private URL addParametersUsingGet(ServletTestRequest theRequest, URL theURL)
throws Throwable
+ private URL addParametersUsingGet(ServletTestRequest theRequest, URL theURL)
+ throws Throwable
{
// If no parameters, then exit
if (!theRequest.getParameterNames().hasMoreElements()) {
@@ -144,7 +158,8 @@
* redirector.
* @param theConnection the HTTP connection
*/
- private void addParametersUsingPost(ServletTestRequest theRequest,
URLConnection theConnection) throws Throwable
+ private void addParametersUsingPost(ServletTestRequest theRequest,
+ URLConnection theConnection) throws Throwable
{
// If no parameters, then exit
if (!theRequest.getParameterNames().hasMoreElements()) {
@@ -157,10 +172,12 @@
} catch (ConnectException e) {
// Cannot connect to server, try to explain why ...
- String reason = "Cannot connect to URL [" + theConnection.getURL() +
"]. Reason : [" + e.getMessage() + "]\r\n";
+ String reason = "Cannot connect to URL [" + theConnection.getURL() +
+ "]. Reason : [" + e.getMessage() + "]\r\n";
reason += "Possible reasons :\r\n";
reason += "\t- The server is not running,\r\n";
- reason += "\t- The server redirector is not correctly mapped in
web.xml,\r\n";
+ reason += "\t- The server redirector is not correctly mapped in " +
+ "web.xml,\r\n";
reason += "\t- Something else ... !";
throw new Exception(reason);
@@ -206,7 +223,8 @@
* redirector.
* @param theConnection the HTTP connection
*/
- private void addCookies(ServletTestRequest theRequest, URLConnection
theConnection)
+ private void addCookies(ServletTestRequest theRequest,
+ URLConnection theConnection)
{
// If no Cookies, then exit
if (!theRequest.getCookieNames().hasMoreElements()) {
@@ -253,7 +271,8 @@
* redirector.
* @param theConnection the HTTP connection
*/
- private void addHeaders(ServletTestRequest theRequest, URLConnection
theConnection)
+ private void addHeaders(ServletTestRequest theRequest,
+ URLConnection theConnection)
{
Enumeration keys = theRequest.getHeaderNames();
@@ -285,9 +304,12 @@
*
* @exception Throwable if an unexpected error occured
*/
- public HttpURLConnection connect(ServletTestRequest theRequest) throws Throwable
+ public HttpURLConnection connect(ServletTestRequest theRequest)
+ throws Throwable
{
- URL url = new URL(m_URL);
+ this.logger.entry("connect(" + theRequest + ")");
+
+ URL url = new URL(this.url);
// If the method is GET, add the parameters to the URL
if (theRequest.getMethod().equals(theRequest.GET_METHOD)) {
@@ -321,6 +343,7 @@
// Open the connection and get the result
connection.connect();
+ this.logger.exit("connect");
return connection;
}
1.5 +23 -5
jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/JspHttpClient.java
Index: JspHttpClient.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/JspHttpClient.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JspHttpClient.java 2001/04/28 14:04:21 1.4
+++ JspHttpClient.java 2001/08/19 16:24:53 1.5
@@ -60,6 +60,7 @@
import junit.framework.*;
import org.apache.commons.cactus.*;
+import org.apache.commons.cactus.util.log.*;
/**
* Manage the logic for calling a test method (which need access to JSP
@@ -68,11 +69,19 @@
* by opening a second HTTP connection but to the Servlet redirector (the tests
* were saved in the application context scope).
*
- * @version @version@
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
+ *
+ * @version $Id: JspHttpClient.java,v 1.5 2001/08/19 16:24:53 vmassol Exp $
*/
public class JspHttpClient extends AbstractHttpClient
{
/**
+ * The logger
+ */
+ private static Log logger =
+ LogService.getInstance().getLog(JspHttpClient.class.getName());
+
+ /**
* Default URL to call the <code>jspRedirector</code> JSP.
*/
protected final static String JSP_REDIRECTOR_URL =
@@ -98,9 +107,12 @@
* @exception Throwable if an error occured in the test method or in the
* redirector servlet.
*/
- public HttpURLConnection doTest(ServletTestRequest theRequest) throws Throwable
+ public HttpURLConnection doTest(ServletTestRequest theRequest)
+ throws Throwable
{
- ServletTestResult result = null;
+ this.logger.entry("doTest(" + theRequest + ")");
+
+ WebTestResult result = null;
HttpURLConnection connection = null;
// Open the first connection to the redirector JSP
@@ -111,6 +123,10 @@
ServiceEnumeration.CALL_TEST_SERVICE.toString());
connection = helper1.connect(theRequest);
+ // Wrap the connection to ensure that all servlet output is read
+ // before we ask for results
+ connection = new AutoReadHttpURLConnection(connection);
+
// Note: We need to get the input stream here to trigger the actual
// call to the servlet ... Don't know why exactly ... :(
connection.getInputStream();
@@ -124,8 +140,9 @@
HttpURLConnection resultConnection = helper2.connect(resultsRequest);
// Read the results as a serialized object
- ObjectInputStream ois = new
ObjectInputStream(resultConnection.getInputStream());
- result = (ServletTestResult)ois.readObject();
+ ObjectInputStream ois =
+ new ObjectInputStream(resultConnection.getInputStream());
+ result = (WebTestResult)ois.readObject();
ois.close();
@@ -147,6 +164,7 @@
result.getExceptionStackTrace());
}
+ this.logger.exit("doTest");
return connection;
}
1.2 +15 -12
jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/ServletExceptionWrapper.java
Index: ServletExceptionWrapper.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/ServletExceptionWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServletExceptionWrapper.java 2001/04/09 11:52:37 1.1
+++ ServletExceptionWrapper.java 2001/08/19 16:24:53 1.2
@@ -67,7 +67,9 @@
* and overloading the <code>printStackTrace()</code> methods to print a
* text stack trace.
*
- * @version @version@
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
+ *
+ * @version $Id: ServletExceptionWrapper.java,v 1.2 2001/08/19 16:24:53 vmassol Exp
$
*/
public class ServletExceptionWrapper extends Throwable
{
@@ -75,12 +77,12 @@
* The stack trace that was sent back from the servlet redirector as a
* string.
*/
- private String m_StackTrace;
+ private String stackTrace;
/**
* The class name of the exception that was raised on the server side.
*/
- private String m_ClassName;
+ private String className;
/**
* Standard throwable constructor.
@@ -107,11 +109,12 @@
* @param theClassName the server exception class name
* @param theStackTrace the server exception stack trace
*/
- public ServletExceptionWrapper(String theMessage, String theClassName, String
theStackTrace)
+ public ServletExceptionWrapper(String theMessage, String theClassName,
+ String theStackTrace)
{
super(theMessage);
- m_ClassName = theClassName;
- m_StackTrace = theStackTrace;
+ this.className = theClassName;
+ this.stackTrace = theStackTrace;
}
/**
@@ -121,10 +124,10 @@
*/
public void printStackTrace(PrintStream thePs)
{
- if (m_StackTrace == null) {
+ if (this.stackTrace == null) {
thePs.print(getMessage());
} else {
- thePs.print(m_StackTrace);
+ thePs.print(this.stackTrace);
}
}
@@ -135,10 +138,10 @@
*/
public void printStackTrace(PrintWriter thePw)
{
- if (m_StackTrace == null) {
+ if (this.stackTrace == null) {
thePw.print(getMessage());
} else {
- thePw.print(m_StackTrace);
+ thePw.print(this.stackTrace);
}
}
@@ -151,11 +154,11 @@
*/
public boolean instanceOf(Class theClass)
{
- if (m_ClassName == null) {
+ if (this.className == null) {
return false;
}
- return theClass.getName().equals(m_ClassName);
+ return theClass.getName().equals(this.className);
}
}
1.5 +25 -8
jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/ServletHttpClient.java
Index: ServletHttpClient.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/framework/share/org/apache/commons/cactus/client/ServletHttpClient.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ServletHttpClient.java 2001/06/17 13:38:32 1.4
+++ ServletHttpClient.java 2001/08/19 16:24:53 1.5
@@ -60,6 +60,7 @@
import junit.framework.*;
import org.apache.commons.cactus.*;
+import org.apache.commons.cactus.util.log.*;
/**
* Manage the logic for calling a test method (which need access to Servlet
@@ -68,11 +69,19 @@
* by opening a second HTTP connection but to the redirector servlet (the tests
* were saved in the application context scope).
*
- * @version @version@
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
+ *
+ * @version $Id: ServletHttpClient.java,v 1.5 2001/08/19 16:24:53 vmassol Exp $
*/
public class ServletHttpClient extends AbstractHttpClient
{
/**
+ * The logger
+ */
+ private static Log logger =
+ LogService.getInstance().getLog(ServletHttpClient.class.getName());
+
+ /**
* Default URL to call the <code>ServletRedirector</code> servlet.
*/
protected final static String SERVLET_REDIRECTOR_URL =
@@ -91,9 +100,12 @@
* @exception Throwable if an error occured in the test method or in the
* redirector servlet.
*/
- public HttpURLConnection doTest(ServletTestRequest theRequest) throws Throwable
+ public HttpURLConnection doTest(ServletTestRequest theRequest)
+ throws Throwable
{
- ServletTestResult result = null;
+ this.logger.entry("doTest(" + theRequest + ")");
+
+ WebTestResult result = null;
HttpURLConnection connection = null;
// Open the first connection to the redirector servlet
@@ -120,8 +132,9 @@
HttpURLConnection resultConnection = helper2.connect(resultsRequest);
// Read the results as a serialized object
- ObjectInputStream ois = new
ObjectInputStream(resultConnection.getInputStream());
- result = (ServletTestResult)ois.readObject();
+ ObjectInputStream ois =
+ new ObjectInputStream(resultConnection.getInputStream());
+ result = (WebTestResult)ois.readObject();
ois.close();
@@ -142,22 +155,26 @@
// it's runner console). Otherwise we use an instance of
// ServletExceptionWrapper.
- if
(result.getExceptionClassName().equals("junit.framework.AssertionFailedError")) {
+ if (result.getExceptionClassName().
+ equals("junit.framework.AssertionFailedError")) {
throw new AssertionFailedErrorWrapper(
- result.getExceptionMessage(), result.getExceptionClassName(),
+ result.getExceptionMessage(),
+ result.getExceptionClassName(),
result.getExceptionStackTrace());
} else {
throw new ServletExceptionWrapper(
- result.getExceptionMessage(), result.getExceptionClassName(),
+ result.getExceptionMessage(),
+ result.getExceptionClassName(),
result.getExceptionStackTrace());
}
}
+ this.logger.exit("doTest");
return connection;
}