httpunit-commit Mailing List for httpunit (Page 75)
Brought to you by:
russgold
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(31) |
Oct
(39) |
Nov
(18) |
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(8) |
Feb
(5) |
Mar
(8) |
Apr
(25) |
May
(20) |
Jun
(23) |
Jul
(28) |
Aug
(10) |
Sep
(3) |
Oct
(32) |
Nov
(61) |
Dec
(24) |
| 2002 |
Jan
(50) |
Feb
(34) |
Mar
(35) |
Apr
(3) |
May
(25) |
Jun
(25) |
Jul
(30) |
Aug
(146) |
Sep
(49) |
Oct
(156) |
Nov
(121) |
Dec
(54) |
| 2003 |
Jan
(12) |
Feb
(79) |
Mar
(88) |
Apr
(26) |
May
(67) |
Jun
(29) |
Jul
(8) |
Aug
(16) |
Sep
(20) |
Oct
(17) |
Nov
|
Dec
(5) |
| 2004 |
Jan
|
Feb
(40) |
Mar
(30) |
Apr
(5) |
May
|
Jun
(83) |
Jul
(34) |
Aug
(20) |
Sep
(44) |
Oct
(46) |
Nov
|
Dec
(14) |
| 2005 |
Jan
(4) |
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(1) |
| 2006 |
Jan
|
Feb
|
Mar
(26) |
Apr
(8) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(36) |
May
(38) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(4) |
Oct
|
Nov
(18) |
Dec
(4) |
| 2009 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(35) |
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(9) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(21) |
Oct
(18) |
Nov
(1) |
Dec
|
|
From: Russell G. <rus...@us...> - 2001-05-22 22:18:58
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv20200/test/com/meterware/httpunit
Modified Files:
WebPageTest.java
Log Message:
Added support for the <meta> tag to set character set
Index: WebPageTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- WebPageTest.java 2001/04/02 19:03:54 1.9
+++ WebPageTest.java 2001/05/22 22:18:55 1.10
@@ -155,6 +155,24 @@
}
+ public void testMetaEncoding() throws Exception {
+ String hebrewTitle = "\u05d0\u05d1\u05d2\u05d3";
+ String page = "<html><head><title>" + hebrewTitle + "</title>" +
+ "<meta Http_equiv=content-type content=\"text/html; charset=iso-8859-8\"></head>\n" +
+ "<body>This has no data\n" +
+ "</body></html>\n";
+ defineResource( "SimplePage.html", page );
+ setResourceCharSet( "SimplePage.html", "iso-8859-8", false );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" );
+ WebResponse simplePage = wc.getResponse( request );
+
+ assertEquals( "Character set", "iso-8859-8", simplePage.getCharacterSet() );
+ assertEquals( "Title", hebrewTitle, simplePage.getTitle() );
+ }
+
+
public void testHebrewForm() throws Exception {
String hebrewName = "\u05d0\u05d1\u05d2\u05d3";
defineResource( "HebrewForm.html",
|
|
From: Russell G. <rus...@us...> - 2001-05-22 22:18:58
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv20200/src/com/meterware/httpunit Modified Files: HttpWebResponse.java Log Message: Added support for the <meta> tag to set character set Index: HttpWebResponse.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpWebResponse.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- HttpWebResponse.java 2001/04/13 21:23:46 1.7 +++ HttpWebResponse.java 2001/05/22 22:18:55 1.8 @@ -20,10 +20,7 @@ * *******************************************************************************************************************/ -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.InputStreamReader; -import java.io.IOException; +import java.io.*; import java.net.HttpURLConnection; import java.net.URL; @@ -48,8 +45,6 @@ HttpWebResponse( String target, URL url, URLConnection connection ) throws IOException { super( target, url ); readHeaders( connection ); - - if (_responseCode == HttpURLConnection.HTTP_OK) loadResponseText( url, connection ); } @@ -82,8 +77,8 @@ //-------------------------------------------- private members ------------------------------------------------ - final private static String endOfLine = System.getProperty( "line.separator" ); - final private static String _fileEncoding = System.getProperty( "file.encoding" ); + final private static String END_OF_LINE = System.getProperty( "line.separator" ); + final private static String FILE_ENCODING = System.getProperty( "file.encoding" ); private int _responseCode = HttpURLConnection.HTTP_OK; @@ -95,14 +90,19 @@ private void loadResponseText( URL url, URLConnection connection ) throws FileNotFoundException { StringBuffer sb = new StringBuffer(); try { - BufferedReader input = new BufferedReader( new InputStreamReader( connection.getInputStream(), getCharacterSet() ) ); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BufferedInputStream inputStream = new BufferedInputStream( connection.getInputStream() ); + byte[] buffer = new byte[8 * 1024]; + int count = 0; + do { + outputStream.write( buffer, 0, count ); + count = inputStream.read( buffer, 0, buffer.length ); + } while (count != -1); - String str; - while (null != ((str = input.readLine()))) { - sb.append( str ).append( endOfLine ); - } - input.close(); - _responseText = sb.toString(); + inputStream.close(); + + readMetaTags( outputStream.toByteArray() ); + _responseText = new String( outputStream.toByteArray(), getCharacterSet() ); } catch (FileNotFoundException e) { if (connection instanceof HttpURLConnection) { _responseCode = HttpURLConnection.HTTP_NOT_FOUND; @@ -119,17 +119,43 @@ private int getResponseCode( String statusHeader ) { StringTokenizer st = new StringTokenizer( statusHeader ); - st.nextToken(); - if (!st.hasMoreTokens()) { - return HttpURLConnection.HTTP_OK; - } else try { - return Integer.parseInt( st.nextToken() ); - } catch (NumberFormatException e) { - return HttpURLConnection.HTTP_INTERNAL_ERROR; - } + st.nextToken(); + if (!st.hasMoreTokens()) { + return HttpURLConnection.HTTP_OK; + } else try { + return Integer.parseInt( st.nextToken() ); + } catch (NumberFormatException e) { + return HttpURLConnection.HTTP_INTERNAL_ERROR; + } + } + + + private void readMetaTags( byte[] rawMessage ) throws UnsupportedEncodingException { + ByteTagParser parser = new ByteTagParser( rawMessage ); + ByteTag tag = parser.getNextTag(); + while (tag != null && !tag.getName().equalsIgnoreCase( "body" )) { + if (tag.getName().equalsIgnoreCase( "meta" )) processMetaTag( tag ); + tag = parser.getNextTag(); + } + } + + + private void processMetaTag( ByteTag tag ) { + if (tag.getAttribute( "http_equiv" ) != null && + tag.getAttribute( "http_equiv" ).equalsIgnoreCase( "content-type" )) { + inferContentType( tag.getAttribute( "content" ) ); + } } + private void inferContentType( String contentTypeHeader ) { + String originalHeader = (String) _headers.get( "Content-type".toUpperCase() ); + if (originalHeader == null || originalHeader.indexOf( "charset" ) < 0) { + _headers.put( "Content-type".toUpperCase(), contentTypeHeader ); + } + } + + private void readHeaders( URLConnection connection ) { loadHeaders( connection ); if (connection instanceof HttpURLConnection) { @@ -137,7 +163,7 @@ } else { _responseCode = HttpURLConnection.HTTP_OK; if (getContentType().startsWith( "text" )) { - _headers.put( "Content-type".toUpperCase(), getContentType() + "; charset=" + _fileEncoding ); + _headers.put( "Content-type".toUpperCase(), getContentType() + "; charset=" + FILE_ENCODING ); } } } @@ -171,7 +197,92 @@ } } +} + +//======================================================================================= + +class ByteTag { + + ByteTag( byte[] buffer, int start, int length ) throws UnsupportedEncodingException { + _buffer = new String( buffer, start, length, "iso-8859-1" ).toCharArray(); + _name = nextToken(); + + String attribute = ""; + String token = nextToken(); + while (token.length() != 0) { + if (token.equals( "=" ) && attribute.length() != 0) { + _attributes.put( attribute.toLowerCase(), nextToken() ); + attribute = ""; + } else { + if (attribute.length() > 0) _attributes.put( attribute.toLowerCase(), "" ); + attribute = token; + } + token = nextToken(); + } + } + + + public String getName() { + return _name; + } + + public String getAttribute( String attributeName ) { + return (String) _attributes.get( attributeName ); + } + + public String toString() { + return "ByteTag[ name=" + _name + ";attributes = " + _attributes + ']'; + } + + private String _name = ""; + private Hashtable _attributes = new Hashtable(); + + + private char[] _buffer; + private int _start; + private int _end = -1; + + + private String nextToken() { + _start = _end+1; + while (_start < _buffer.length && Character.isWhitespace( _buffer[ _start ] )) _start++; + if (_start >= _buffer.length) { + return ""; + } else if (_buffer[ _start ] == '"') { + for (_end = _start+1; _end < _buffer.length && _buffer[ _end ] != '"'; _end++); + return new String( _buffer, _start+1, _end-_start-1 ); + } else if (_buffer[ _start ] == '=') { + _end = _start; + return "="; + } else { + for (_end = _start+1; _end < _buffer.length && _buffer[ _end ] != '=' && !Character.isWhitespace( _buffer[ _end ] ); _end++); + return new String( _buffer, _start, (_end--)-_start ); + } + } +} + +//======================================================================================= + + +class ByteTagParser { + + ByteTagParser( byte[] buffer ) { + _buffer = buffer; + } + + + ByteTag getNextTag() throws UnsupportedEncodingException { + _start = _end+1; + while (_start < _buffer.length && _buffer[ _start ] != '<') _start++; + for (_end =_start+1; _end < _buffer.length && _buffer[ _end ] != '>'; _end++); + if (_end >= _buffer.length || _end < _start) return null; + return new ByteTag( _buffer, _start+1, _end-_start-1 ); + } + + private int _start = 0; + private int _end = -1; + private byte[] _buffer; } |
|
From: Russell G. <rus...@us...> - 2001-05-22 22:18:58
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv20200/doc
Modified Files:
release_notes.txt
Log Message:
Added support for the <meta> tag to set character set
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- release_notes.txt 2001/05/21 21:04:29 1.31
+++ release_notes.txt 2001/05/22 22:18:55 1.32
@@ -11,6 +11,10 @@
Revision History:
+22-May-01
+Additions:
+ 1. Reading the character set from a <meta> tag is now supported.
+
21-May-01
Additions:
1. selectFile now infers file content for zip extension
|
|
From: Russell G. <rus...@us...> - 2001-05-21 21:04:31
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv16881/doc Modified Files: plans.txt release_notes.txt todo.txt Log Message: Support <button> tag Index: plans.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/plans.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- plans.txt 2001/05/18 21:02:01 1.3 +++ plans.txt 2001/05/21 21:04:29 1.4 @@ -1,19 +1,7 @@ -<button> tag ------------- -These have an optional type attribute with possible values: reset, submit (default), and button. - -reset - currently ignored -button - to trigger JavaScript; currently ignored - -only the submit value is relevant. Such elements should be treated identically with -<input type="submit"> -except that it might be useful to allow getButtonWith to search for internal text... - - - <META tags> ------------ -<META HTTP_EQUIV="refresh" content="5"> +<META HTTP_EQUIV="refresh" content="5; URL=http://www.cnn.com/"> fairly strightforward to find this, but action not clear: 2. define 'refreshRequest' property which is normally null, refreshInterval property +<META http-equiv="Content-Type" content="text/html; charset=EUC-JP"> Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- release_notes.txt 2001/05/16 21:05:30 1.30 +++ release_notes.txt 2001/05/21 21:04:29 1.31 @@ -11,6 +11,12 @@ Revision History: +21-May-01 +Additions: + 1. selectFile now infers file content for zip extension + 2. <button> tags are now recognized as submit buttons if their type is "submit" + or not specified. + 16-May-01 Additions: 1. selectFile now can infer file content type for the most common file extensions: Index: todo.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/todo.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- todo.txt 2001/05/18 21:02:01 1.7 +++ todo.txt 2001/05/21 21:04:29 1.8 @@ -1,5 +1,4 @@ o Integrate PUT method (written by Marcos Tarruella, et. al.) -o Support <button> tags o Support <META HTTP_EQUIV=REFRESH tags> o Add support for POST/PUT to contain user-specified data and content-type taken either from file or a string |
|
From: Russell G. <rus...@us...> - 2001-05-21 21:04:31
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv16881/test/com/meterware/httpunit
Modified Files:
FormSubmitTest.java
Log Message:
Support <button> tag
Index: FormSubmitTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FormSubmitTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FormSubmitTest.java 2001/03/20 23:35:43 1.7
+++ FormSubmitTest.java 2001/05/21 21:04:29 1.8
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
-* Copyright (c) 2000, Russell Gold
+* Copyright (c) 2000-2001, Russell Gold
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -110,6 +110,19 @@
"<Input type=text name=age value=12>" +
"<Input type=submit name=update>" +
"<Input type=submit name=recalculate>" +
+ "</form>" );
+ WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" );
+ WebForm form = page.getForms()[0];
+ SubmitButton[] buttons = form.getSubmitButtons();
+ assertEquals( "num detected submit buttons", 2, buttons.length );
+ }
+
+
+ public void testButtonTagDetection() throws Exception {
+ defineWebPage( "Default", "<form method=GET action = \"/ask\">" +
+ "<Input type=text name=age value=12>" +
+ "<Button type=submit name=update></button>" +
+ "<button name=recalculate></button>" +
"</form>" );
WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" );
WebForm form = page.getForms()[0];
|
|
From: Russell G. <rus...@us...> - 2001-05-21 21:04:31
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv16881/src/com/meterware/httpunit
Modified Files:
WebForm.java WebResponse.java
Log Message:
Support <button> tag
Index: WebForm.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- WebForm.java 2001/04/18 03:18:35 1.21
+++ WebForm.java 2001/05/21 21:04:29 1.22
@@ -117,10 +117,19 @@
private Vector getSubmitButtonVector() {
if (_buttonVector == null) {
_buttonVector = new Vector();
+
NodeList nl = ((Element) _node).getElementsByTagName( "input" );
for (int i = 0; i < nl.getLength(); i++) {
if (NodeUtils.getNodeAttribute( nl.item(i), "type" ).equalsIgnoreCase( "submit" )
|| NodeUtils.getNodeAttribute( nl.item(i), "type" ).equalsIgnoreCase( "image" )) {
+ _buttonVector.addElement( new SubmitButton( nl.item(i) ) );
+ }
+ }
+
+ nl = ((Element) _node).getElementsByTagName( "button" );
+ for (int i = 0; i < nl.getLength(); i++) {
+ if (NodeUtils.getNodeAttribute( nl.item(i), "type" ).equalsIgnoreCase( "submit" )
+ || NodeUtils.getNodeAttribute( nl.item(i), "type" ).equalsIgnoreCase( "" )) {
_buttonVector.addElement( new SubmitButton( nl.item(i) ) );
}
}
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- WebResponse.java 2001/04/18 03:18:35 1.32
+++ WebResponse.java 2001/05/21 21:04:29 1.33
@@ -308,8 +308,8 @@
/**
* Constructs a response object.
+ * @param target the name of the frame to hold the response
* @param url the url from which the response was received
- * @param inputStream the input stream from which the response can be read
**/
protected WebResponse( String target, URL url ) {
_url = url;
|
|
From: Russell G. <rus...@us...> - 2001-05-18 21:02:03
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv8098/src/com/meterware/httpunit
Modified Files:
WebRequest.java
Log Message:
Update file types and docs
Index: WebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- WebRequest.java 2001/05/16 21:05:30 1.19
+++ WebRequest.java 2001/05/18 21:02:01 1.20
@@ -334,11 +334,12 @@
private String _contentType = "text/plain";
private static String[][] CONTENT_EXTENSIONS = {
- { "text/plain", "txt", "text" },
- { "text/html", "htm", "html" },
- { "image/gif", "gif" },
- { "image/jpeg", "jpg", "jpeg" },
- { "image/png", "png" }
+ { "text/plain", "txt", "text" },
+ { "text/html", "htm", "html" },
+ { "image/gif", "gif" },
+ { "image/jpeg", "jpg", "jpeg" },
+ { "image/png", "png" },
+ { "application/octet-stream", "zip" }
};
|
|
From: Russell G. <rus...@us...> - 2001-05-18 21:02:03
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv8098/doc Modified Files: plans.txt todo.txt Log Message: Update file types and docs Index: plans.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/plans.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- plans.txt 2000/10/04 15:45:46 1.2 +++ plans.txt 2001/05/18 21:02:01 1.3 @@ -1,50 +1,19 @@ -Implementing frames -------------------- +<button> tag +------------ +These have an optional type attribute with possible values: reset, submit (default), and button. -Without frames, browser behavior is simply in at least one aspect: each response replaces the previous one. As a result, -it makes sense to test web site behavior by simply retrieving one response after another, and (usually) ignoring any -previous ones. Frames change that rather drastically, requiring a concept to correspond to the browser window contents, -only part of which may be updated by any particular server request. The most obvious object to hold this information is the -WebConversation, which will need to have added to it a 'current window' property. In addition, every request will need to -have encoded in it somewhere the target information, so that the appropriate section of the window will receive the update. +reset - currently ignored +button - to trigger JavaScript; currently ignored -This could be done either by: -1. making the target an attribute of the WebRequest, or -2. specifying the target in the getResponse call. +only the submit value is relevant. Such elements should be treated identically with +<input type="submit"> +except that it might be useful to allow getButtonWith to search for internal text... -The question is, how would we use such features? -Imagine: (assuming option 1) - - response1 = conversation.getResponse( initial frame request ); - request1 = response1.getLink( within a frame ) // the link is found in frame "details" and has no target attribute - response2 = conversation.getResponse( request1 ); // this updates the nested frame only - frame = conversation.getFrameContents( "details" ); - -frame and response2 should be the same object - -To do this, each response must have encoded its current frame (default is "_top") -and each request must as well. "target" is an attribute of both <A> and <FORM> tags. - - -Additional properties: - -WebRequest.target -- the target for the request -WebResponse.target -- the name of the window in which the response is displayed -WebConversation.frameNames[] -- the names of the current active frames -WebResponse.allFrameNames[] -- the names of the frames in or below this response -WebResponse.frameNames[] -- the names of the frames in this response - -Potential validations: - -validate whether a response is targeted to an active frame. What happens in the real world if it is not? - - -Other Consequences: - -will probably want to support history on the web conversation object. Support "back, forward, mayGoBack, mayGoForward" - - - - +<META tags> +------------ +<META HTTP_EQUIV="refresh" content="5"> + fairly strightforward to find this, but action not clear: + 2. define 'refreshRequest' property which is normally null, refreshInterval property + Index: todo.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/todo.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- todo.txt 2001/04/18 03:21:06 1.6 +++ todo.txt 2001/05/18 21:02:01 1.7 @@ -1,6 +1,8 @@ o Integrate PUT method (written by Marcos Tarruella, et. al.) o Support <button> tags o Support <META HTTP_EQUIV=REFRESH tags> +o Add support for POST/PUT to contain user-specified data and content-type + taken either from file or a string o Documentation, Documentation Possibles: |
|
From: Russell G. <rus...@us...> - 2001-05-17 00:35:34
|
Update of /cvsroot/httpunit/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv29639
Modified Files:
build.xml
Log Message:
Use ant 1.3
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- build.xml 2001/05/16 21:04:32 1.26
+++ build.xml 2001/05/17 00:35:31 1.27
@@ -129,24 +129,22 @@
<!-- =================================================================== -->
<target name="dist" depends="jar,javadocs">
<mkdir dir="${dist.dir}" />
- <mkdir dir="${dist.dir}/lib" />
- <mkdir dir="${dist.dir}/doc" />
- <mkdir dir="${dist.dir}/doc/api" />
- <mkdir dir="${dist.dir}/src" />
- <mkdir dir="${dist.dir}/test" />
- <mkdir dir="${dist.dir}/examples" />
- <copydir src="${src.dir}" dest="${dist.dir}/src" />
- <copydir src="${tstsrc.dir}" dest="${dist.dir}/test" includes="**/httpunit/*" />
- <copydir src="${examples.dir}" dest="${dist.dir}/examples" />
- <copydir src="${lib.dir}" dest="${dist.dir}/lib" />
- <copydir src="${jars.dir}" dest="${dist.dir}/lib" includes="Tidy.jar" />
- <copyfile src="build.xml" dest="${dist.dir}/build.xml" />
- <copydir src="${docs.dir}" dest="${dist.dir}/doc" />
- <copyfile src="readme.txt" dest="${dist.dir}/readme.txt" />
- <copyfile src="index.html" dest="${dist.dir}/index.html" />
+ <copy todir="${dist.dir}" >
+ <fileset dir="." >
+ <include name="build.xml" />
+ <include name="readme.txt" />
+ <include name="index.html" />
+ <include name="src/**" />
+ <include name="test/**" />
+ <include name="examples/**" />
+ <include name="lib/*.*" />
+ <include name="doc/**/*.*" />
+ </fileset>
+ </copy>
+ <copy todir="${dist.dir}/lib" file="${jars.dir}/Tidy.jar" />
<replace file="${dist.dir}/index.html" token="var:dist " value="var:dist>" />
<replace file="${dist.dir}/index.html" token="var:publish>" value="var:publish " />
- </target>
+</target>
<!-- =================================================================== -->
@@ -162,7 +160,9 @@
<!-- =================================================================== -->
<target name="publish" depends="dist-zip">
<mkdir dir="${web.dir}" />
- <copydir src="." dest="${web.dir}" includes="*.zip,index.html,doc/**"/>
+ <copy todir="${web.dir}" >
+ <fileset dir="." includes="*.zip,index.html,doc/**"/>
+ </copy>
<replace file="${web.dir}/index.html" token="var:dist>" value="var:dist " />
<replace file="${web.dir}/index.html" token="var:publish " value="var:publish>" />
<replace file="${web.dir}/index.html" token="<version>" value="${zip_version}" />
@@ -191,8 +191,7 @@
<!-- Total cleanup -->
<!-- =================================================================== -->
<target name="total-clean" depends="clean">
- <delete file="${name}_${zip_version}.zip" />
- <delete file="${name}_website_${zip_version}.zip" />
+ <delete file="${name}_*.zip" quiet="true" />
<delete dir="${docs.dir}/api" />
<delete dir="${lib.dir}" />
</target>
|
|
From: Russell G. <rus...@us...> - 2001-05-16 21:05:32
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv7044/doc
Modified Files:
release_notes.txt
Log Message:
Added support for file upload context type
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- release_notes.txt 2001/05/04 22:43:00 1.29
+++ release_notes.txt 2001/05/16 21:05:30 1.30
@@ -11,6 +11,18 @@
Revision History:
+16-May-01
+Additions:
+ 1. selectFile now can infer file content type for the most common file extensions:
+ text, txt, gif, jpg, jpeg, png, html, and htm.
+ 2. A new version of selectFile allows explicit specification of file content type
+ which will override any inferred type.
+
+Configuration changes:
+ 1. The build.xml file has been changed to use a specified directory of dependant jars
+ rather than the system classpath. This requires at least ant 1.3. It is no longer
+ necessary to specify the classpath parameter when running the unit tests.
+
5-May-01 1.2.4
Acknowledgements:
Thanks to Jim Kimball for finding and fixing the redirection of subframes
|
|
From: Russell G. <rus...@us...> - 2001-05-16 21:05:32
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv7044/test/com/meterware/httpunit
Modified Files:
FileUploadTest.java
Log Message:
Added support for file upload context type
Index: FileUploadTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FileUploadTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FileUploadTest.java 2001/04/18 03:21:06 1.4
+++ FileUploadTest.java 2001/05/16 21:05:30 1.5
@@ -158,10 +158,54 @@
WebRequest formSubmit = simplePage.getForms()[0].getRequest();
formSubmit.selectFile( "message", file );
WebResponse encoding = wc.getResponse( formSubmit );
- assertEquals( "update=age&message.name=temp.txt&message.lines=2", encoding.getText().trim() );
+ assertEquals( "update=age&text/plain:message.name=temp.txt&message.lines=2", encoding.getText().trim() );
file.delete();
}
+
+
+ public void testFileContentType() throws Exception {
+ File file = new File( "temp.gif" );
+ FileOutputStream fos = new FileOutputStream( file );
+ fos.write( new byte[] { 1, 2, 3, 4, 0x7f, 0x23 }, 0, 6 );
+ fos.close();
+
+ defineResource( "ListParams", new MimeEcho() );
+ defineWebPage( "Default", "<form method=POST action = \"ListParams\" enctype=\"multipart/form-data\"> " +
+ "<Input type=file name=message>" +
+ "</form>" );
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/Default.html" );
+ WebResponse simplePage = wc.getResponse( request );
+ WebRequest formSubmit = simplePage.getForms()[0].getRequest();
+ formSubmit.selectFile( "message", file );
+ WebResponse encoding = wc.getResponse( formSubmit );
+ assertEquals( "image/gif:message.name=temp.gif&message.lines=1", encoding.getText().trim() );
+
+ file.delete();
+ }
+
+
+ public void testSpecifiedFileContentType() throws Exception {
+ File file = new File( "temp.new" );
+ FileOutputStream fos = new FileOutputStream( file );
+ fos.write( new byte[] { 1, 2, 3, 4, 0x7f, 0x23 }, 0, 6 );
+ fos.close();
+
+ defineResource( "ListParams", new MimeEcho() );
+ defineWebPage( "Default", "<form method=POST action = \"ListParams\" enctype=\"multipart/form-data\"> " +
+ "<Input type=file name=message>" +
+ "</form>" );
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/Default.html" );
+ WebResponse simplePage = wc.getResponse( request );
+ WebRequest formSubmit = simplePage.getForms()[0].getRequest();
+ formSubmit.selectFile( "message", file, "x-application/new" );
+ WebResponse encoding = wc.getResponse( formSubmit );
+ assertEquals( "x-application/new:message.name=temp.new&message.lines=1", encoding.getText().trim() );
+
+ file.delete();
+ }
}
@@ -229,6 +273,7 @@
if (mbp.getFileName() == null) {
appendFieldValue( name, sb, mbp );
} else {
+ sb.append( mbp.getContentType() ).append( ':' );
appendFileSpecs( name, sb, mbp );
}
}
|
|
From: Russell G. <rus...@us...> - 2001-05-16 21:05:32
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv7044/src/com/meterware/httpunit
Modified Files:
MimeEncodedMessageBody.java PostMethodWebRequest.java
WebRequest.java
Log Message:
Added support for file upload context type
Index: MimeEncodedMessageBody.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/MimeEncodedMessageBody.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MimeEncodedMessageBody.java 2001/04/18 03:21:06 1.4
+++ MimeEncodedMessageBody.java 2001/05/16 21:05:30 1.5
@@ -69,8 +69,8 @@
String name = (String) e.nextElement();
WebRequest.UploadFileSpec spec = (WebRequest.UploadFileSpec) files.get( name );
writeLn( outputStream, "--" + BOUNDARY );
- writeLn( outputStream, "Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + spec.getFile().getAbsolutePath() + '"' ); // XXX need to handle non-ascii names here
-// writeLn( outputStream, "Content-Type: application/octet-stream" ); // XXX want to support real content types
+ writeLn( outputStream, "Content-Disposition: form-data; name=\"" + encode( name ) + "\"; filename=\"" + encode( spec.getFile().getAbsolutePath() ) + '"' ); // XXX need to handle non-ascii names here
+ writeLn( outputStream, "Content-Type: " + spec.getContentType() );
writeLn( outputStream, "" );
FileInputStream in = new FileInputStream( spec.getFile() );
@@ -90,6 +90,20 @@
private final static String BOUNDARY = "--HttpUnit-part0-aSgQ2M";
private final static byte[] CRLF = { 0x0d, 0x0A };
+
+
+ private String encode( String string ) {
+ StringBuffer sb = new StringBuffer();
+ char[] chars = string.toCharArray();
+ for (int i = 0; i < chars.length; i++ ) {
+ if (chars[i] == '\\') {
+ sb.append( "\\\\" ); // accomodate MS-DOS file paths XXX is this safe??
+ } else {
+ sb.append( chars[i] );
+ }
+ }
+ return sb.toString();
+ }
private void writeLn( OutputStream os, String value, String encoding ) throws IOException {
Index: PostMethodWebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/PostMethodWebRequest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- PostMethodWebRequest.java 2001/04/18 03:16:07 1.11
+++ PostMethodWebRequest.java 2001/05/16 21:05:30 1.12
@@ -73,6 +73,16 @@
}
+ /**
+ * Sets the file for a parameter upload in a web request.
+ **/
+ public void selectFile( String parameterName, File file, String contentType ) {
+ super.selectFile( parameterName, file, contentType );
+
+ _files.put( parameterName, new UploadFileSpec( file, contentType ) );
+ }
+
+
//---------------------------------- WebRequest methods --------------------------------
Index: WebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- WebRequest.java 2001/04/05 22:16:07 1.18
+++ WebRequest.java 2001/05/16 21:05:30 1.19
@@ -1,4 +1,24 @@
package com.meterware.httpunit;
+/********************************************************************************************************************
+* $Id$
+*
+* Copyright (c) 2000-2001, Russell Gold
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in all copies or substantial portions
+* of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*
+*******************************************************************************************************************/
import java.io.*;
import java.net.*;
@@ -44,6 +64,17 @@
/**
+ * Sets the file for a parameter upload in a web request.
+ **/
+ public void selectFile( String parameterName, File file, String contentType ) {
+ if (_sourceForm == null || !_sourceForm.isFileParameter( parameterName )) {
+ throw new IllegalNonFileParameterException( parameterName );
+ }
+ if (!isMimeEncoded()) throw new MultipartFormRequiredException();
+ }
+
+
+ /**
* Returns an enumeration of all parameters in this web request.
**/
public Enumeration getParameterNames() {
@@ -279,6 +310,7 @@
static class UploadFileSpec {
UploadFileSpec( File file ) {
_file = file;
+ guessContentType();
}
@@ -299,7 +331,32 @@
private File _file;
- private String _contentType;
+ private String _contentType = "text/plain";
+
+ private static String[][] CONTENT_EXTENSIONS = {
+ { "text/plain", "txt", "text" },
+ { "text/html", "htm", "html" },
+ { "image/gif", "gif" },
+ { "image/jpeg", "jpg", "jpeg" },
+ { "image/png", "png" }
+ };
+
+
+ private void guessContentType() {
+ String extension = getExtension( _file.getName() );
+ for (int i = 0; i < CONTENT_EXTENSIONS.length; i++) {
+ for (int j=1; j < CONTENT_EXTENSIONS[i].length; j++) {
+ if (extension.equalsIgnoreCase( CONTENT_EXTENSIONS[i][j] )) {
+ _contentType = CONTENT_EXTENSIONS[i][0];
+ return;
+ }
+ }
+ }
+ }
+
+ private String getExtension( String fileName ) {
+ return fileName.substring( fileName.lastIndexOf( '.' ) + 1 );
+ }
}
|
|
From: Russell G. <rus...@us...> - 2001-05-16 21:04:35
|
Update of /cvsroot/httpunit/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv6843
Modified Files:
build.xml
Log Message:
Use jars directory instead of system classpath
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- build.xml 2001/05/04 22:43:00 1.25
+++ build.xml 2001/05/16 21:04:32 1.26
@@ -6,31 +6,47 @@
<property name="name" value="httpunit" />
<property name="Name" value="HttpUnit" />
<property name="version" value="1.2.4" />
- <property name="zip_version" value="1_2_4" />
+ <property name="zip_version" value="1_2_4" />
+
<property name="src.dir" value="src" />
<property name="tstsrc.dir" value="test" />
<property name="examples.dir" value="examples" />
<property name="lib.dir" value="lib" />
- <property name="jars.dir" value="" />
+ <property name="jars.dir" value="jars" />
+
<property name="docs.dir" value="doc" />
<property name="build.dir" value="build" />
<property name="build.classes" value="${build.dir}/classes" />
- <property name="javadoc.dir" value="${docs.dir}/api" />
+ <property name="test.classes" value="${build.dir}/testclasses" />
+ <property name="javadoc.dir" value="${docs.dir}/api" />
+
<property name="dist.dir" value="dist" />
<property name="classpath" value="" />
<property name="web.dir" value="web" />
<property name="packages" value="com.meterware.*" />
<property name="build.compiler" value="classic" />
- <property name="test.class" value="com.meterware.httpunit.HttpUnitSuite" />
+ <property name="test.class" value="com.meterware.httpunit.HttpUnitSuite" />
+<!-- =================================================================== -->
+<!-- Defines the classpath used for compilation and test. -->
+<!-- =================================================================== -->
+<path id="base.classpath">
+ <fileset dir="${jars.dir}">
+ <include name="*.jar"/>
+ </fileset>
+</path>
+
<!-- =================================================================== -->
<!-- Check to see what optional dependencies are available -->
<!-- =================================================================== -->
<target name="check_for_optional_packages">
- <available property="jsdk.present" classname="javax.servlet.http.HttpServlet" />
- <available property="javamail.present" classname="javax.mail.internet.MimeMultipart" />
- <available property="xerces.present" classname="org.apache.xerces.parsers.DOMParser" />
+ <available property="jsdk.present" classname="javax.servlet.http.HttpServlet"
+ classpathref="base.classpath" />
+ <available property="javamail.present" classname="javax.mail.internet.MimeMultipart"
+ classpathref="base.classpath" />
+ <available property="xerces.present" classname="org.apache.xerces.parsers.DOMParser"
+ classpathref="base.classpath" />
</target>
@@ -47,8 +63,9 @@
<!-- =================================================================== -->
<target name="compile" depends="prepare,check_for_optional_packages">
<mkdir dir="${build.classes}" />
- <javac srcdir="${src.dir}" destdir="${build.classes}" classpath="${classpath}"
+ <javac srcdir="${src.dir}" destdir="${build.classes}"
debug="off" deprecation="on" optimize="off">
+ <classpath refid="base.classpath" />
<exclude name="**/servletunit/*" unless="jsdk.present" />
</javac>
</target>
@@ -58,8 +75,13 @@
<!-- Compiles the test code -->
<!-- =================================================================== -->
<target name="testcompile" depends="compile,check_for_optional_packages">
- <javac srcdir="${tstsrc.dir}" destdir="${build.classes}" classpath="${classpath}"
+ <mkdir dir="${test.classes}" />
+ <javac srcdir="${tstsrc.dir}" destdir="${test.classes}"
debug="off" deprecation="on" optimize="off">
+ <classpath>
+ <path refid="base.classpath" />
+ <pathelement location="${build.classes}" />
+ </classpath>
<exclude name="**/servletunit/*" unless="jsdk.present" />
<exclude name="**/FileUploadTest.java" unless="javamail.present" />
<exclude name="**/XMLPageTest.java" unless="xerces.present" />
@@ -69,11 +91,14 @@
<!-- =================================================================== -->
<!-- Runs the test code -->
-<!-- Note: the classpath variable must be set on the command line -->
<!-- =================================================================== -->
<target name="test" depends="testcompile">
- <java classname="${test.class}"
- fork="yes" classpath="${build.classes};${classpath}" >
+ <java classname="${test.class}" fork="yes" >
+ <classpath>
+ <path refid="base.classpath" />
+ <pathelement location="${build.classes}" />
+ <pathelement location="${test.classes}" />
+ </classpath>
</java>
</target>
@@ -156,9 +181,9 @@
<!-- Cleans up generated stuff -->
<!-- =================================================================== -->
<target name="clean">
- <deltree dir="${build.dir}" />
- <deltree dir="${dist.dir}" />
- <deltree dir="${web.dir}" />
+ <delete dir="${build.dir}" />
+ <delete dir="${dist.dir}" />
+ <delete dir="${web.dir}" />
</target>
@@ -168,8 +193,8 @@
<target name="total-clean" depends="clean">
<delete file="${name}_${zip_version}.zip" />
<delete file="${name}_website_${zip_version}.zip" />
- <deltree dir="${docs.dir}/api" />
- <deltree dir="${lib.dir}" />
+ <delete dir="${docs.dir}/api" />
+ <delete dir="${lib.dir}" />
</target>
</project>
|
|
From: Russell G. <rus...@us...> - 2001-05-16 21:03:05
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv6418/test/com/meterware/httpunit
Modified Files:
PseudoServer.java
Log Message:
Set timeout on pseudo-server servlet sockets
Index: PseudoServer.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/PseudoServer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- PseudoServer.java 2001/04/02 19:07:36 1.11
+++ PseudoServer.java 2001/05/16 21:03:00 1.12
@@ -38,6 +38,8 @@
try {
handleConnection();
Thread.sleep( 50 );
+ } catch (InterruptedIOException e) {
+ _active = false;
} catch (IOException e) {
System.out.println( "Error in pseudo server: " + e );
e.printStackTrace();
@@ -359,6 +361,7 @@
private ServerSocket getServerSocket() throws IOException {
synchronized (this) {
if (_serverSocket == null) _serverSocket = new ServerSocket(0);
+ _serverSocket.setSoTimeout( 1000 );
}
return _serverSocket;
}
|
|
From: Russell G. <rus...@us...> - 2001-05-04 22:43:02
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv30865/doc
Modified Files:
release_notes.txt
Log Message:
Update documentation for 1.2.4
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- release_notes.txt 2001/04/18 03:21:05 1.28
+++ release_notes.txt 2001/05/04 22:43:00 1.29
@@ -11,17 +11,7 @@
Revision History:
-13-Apr-01
-Problems corrected:
- 1. Repeated requests to the same URL were not resending requests properly. This caused some problems with validation.
- 2. Now correctly passes the full specification of uploaded files, rather than just the name.
-
-Additions:
- 1. The GetMethodWebRequest and PostMethodWebRequest constructors which accept a target are now public.
- 2. Added getID to WebForm
- 3. Added getFormWithID to HTMLSegment interface
-
-3-Apr-01
+ 5-May-01 1.2.4
Acknowledgements:
Thanks to Jim Kimball for finding and fixing the redirection of subframes
@@ -30,6 +20,18 @@
2. No longer capitalizes all header names; this was necessary for
compatibility with those servers that do not understand case-insensitive
header names.
+ 3. Repeated requests to the same URL were not resending requests properly.
+ This caused some problems with validation.
+ 4. Now correctly passes the full specification of uploaded files, rather than just the name.
+
+Additions:
+ 1. Transmitted headers as well as received headers are now shown when loggingHttpHeaders
+ is enabled.
+ 2. The GetMethodWebRequest and PostMethodWebRequest constructors which accept a target
+ are now public.
+ 3. Added getID to WebForm
+ 4. Added getFormWithID to HTMLSegment interface
+
2-Apr-01 1.2.3
Acknowledgements:
|
|
From: Russell G. <rus...@us...> - 2001-05-04 22:43:02
|
Update of /cvsroot/httpunit/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv30865
Modified Files:
build.xml
Log Message:
Update documentation for 1.2.4
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- build.xml 2001/04/02 19:38:30 1.24
+++ build.xml 2001/05/04 22:43:00 1.25
@@ -5,8 +5,8 @@
<project name="httpunit" default="jar" basedir=".">
<property name="name" value="httpunit" />
<property name="Name" value="HttpUnit" />
- <property name="version" value="1.2.2" />
- <property name="zip_version" value="1_2_2" />
+ <property name="version" value="1.2.4" />
+ <property name="zip_version" value="1_2_4" />
<property name="src.dir" value="src" />
<property name="tstsrc.dir" value="test" />
<property name="examples.dir" value="examples" />
@@ -48,7 +48,7 @@
<target name="compile" depends="prepare,check_for_optional_packages">
<mkdir dir="${build.classes}" />
<javac srcdir="${src.dir}" destdir="${build.classes}" classpath="${classpath}"
- debug="on" deprecation="on" optimize="off">
+ debug="off" deprecation="on" optimize="off">
<exclude name="**/servletunit/*" unless="jsdk.present" />
</javac>
</target>
@@ -59,7 +59,7 @@
<!-- =================================================================== -->
<target name="testcompile" depends="compile,check_for_optional_packages">
<javac srcdir="${tstsrc.dir}" destdir="${build.classes}" classpath="${classpath}"
- debug="on" deprecation="on" optimize="off">
+ debug="off" deprecation="on" optimize="off">
<exclude name="**/servletunit/*" unless="jsdk.present" />
<exclude name="**/FileUploadTest.java" unless="javamail.present" />
<exclude name="**/XMLPageTest.java" unless="xerces.present" />
|
|
From: Russell G. <rus...@us...> - 2001-05-04 21:07:10
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv14122/doc Modified Files: faq.html Log Message: Note FAQ regarding IllegalAccessException Index: faq.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/faq.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- faq.html 2001/02/21 19:01:07 1.6 +++ faq.html 2001/05/04 21:07:07 1.7 @@ -14,6 +14,7 @@ <LI><A HREF="#charset">Why isn't HttpUnit handling my non-English pages?</A></LI> <LI><A HREF="#utf8">HttpUnit fails with an IllegalArgumentException: sun.io.CharToByteUTF-8, what do I do?</A></LI> <LI><A HREF="#buttons">HttpUnit is not finding the buttons in my forms. What is wrong?</A></LI> +<LI><A HREF="#reload">Why do I get java.lang.IllegalAccessError when calling getResponse()?</A></LI> </OL> @@ -82,6 +83,21 @@ will reject any that are not. JTidy can display error messages to tell you what is wrong. To see them, call <code>HttpUnitOptions.setParserWarningsEnabled( true )</code> before retrieving your HTML page. Once you have corrected any errors, HttpUnit should see your form buttons. + +<A NAME="#reload"><H2>Why do I get java.lang.IllegalAccessError when calling getResponse()?</H2></A> +This happens when you use HttpUnit and JTidy with one of the JUnit graphical test runners, which reloads +classes every time to run a test. Unfortunately, this places different versions of the JTidy +classes in different class loaders, so you get this error. To avoid it, +you can do any of the following:<ul><li>Use only the text test runner</li> +<li>Disable all class reloading in JUnit by adding "loading=false" to <tt>junit.properties</tt> in your current directory</li> +<li>Disable reloading of HttpUnit and JTidy by adding the following lines to <tt>excluded.properties</tt> in junit.jar<blockquote><code> +excluded.10=com.meterware.httpunit.*<br> +excluded.11=org.w3c.tidy.* +</code></blockquote> +This will require extracting the file, modifying it and then putting it back <em>in the same directory</em>, but it should allow your +tests to reload safely.</ul> + + </BODY></HTML> |
|
From: Russell G. <rus...@us...> - 2001-04-18 03:21:08
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv17081/test/com/meterware/httpunit
Modified Files:
FileUploadTest.java
Log Message:
Pass full pathname of uploaded files
Index: FileUploadTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FileUploadTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FileUploadTest.java 2001/04/02 19:07:36 1.3
+++ FileUploadTest.java 2001/04/18 03:21:06 1.4
@@ -241,6 +241,7 @@
private void appendFileSpecs( String parameterName, StringBuffer sb, MimeBodyPart mbp ) throws IOException, MessagingException {
String filename = mbp.getFileName();
+ filename = filename.substring( filename.lastIndexOf( File.separator )+1 );
BufferedReader br = new BufferedReader( new StringReader( mbp.getContent().toString() ) );
int numLines = 0;
while (br.readLine() != null) numLines++;
|
|
From: Russell G. <rus...@us...> - 2001-04-18 03:21:08
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv17081/src/com/meterware/httpunit
Modified Files:
MimeEncodedMessageBody.java
Log Message:
Pass full pathname of uploaded files
Index: MimeEncodedMessageBody.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/MimeEncodedMessageBody.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MimeEncodedMessageBody.java 2001/04/02 19:54:29 1.3
+++ MimeEncodedMessageBody.java 2001/04/18 03:21:06 1.4
@@ -69,7 +69,7 @@
String name = (String) e.nextElement();
WebRequest.UploadFileSpec spec = (WebRequest.UploadFileSpec) files.get( name );
writeLn( outputStream, "--" + BOUNDARY );
- writeLn( outputStream, "Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + spec.getFile().getName() + '"' ); // XXX need to handle non-ascii names here
+ writeLn( outputStream, "Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + spec.getFile().getAbsolutePath() + '"' ); // XXX need to handle non-ascii names here
// writeLn( outputStream, "Content-Type: application/octet-stream" ); // XXX want to support real content types
writeLn( outputStream, "" );
|
|
From: Russell G. <rus...@us...> - 2001-04-18 03:21:08
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv17081/doc
Modified Files:
release_notes.txt todo.txt
Log Message:
Pass full pathname of uploaded files
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- release_notes.txt 2001/04/13 21:23:46 1.27
+++ release_notes.txt 2001/04/18 03:21:05 1.28
@@ -14,6 +14,12 @@
13-Apr-01
Problems corrected:
1. Repeated requests to the same URL were not resending requests properly. This caused some problems with validation.
+ 2. Now correctly passes the full specification of uploaded files, rather than just the name.
+
+Additions:
+ 1. The GetMethodWebRequest and PostMethodWebRequest constructors which accept a target are now public.
+ 2. Added getID to WebForm
+ 3. Added getFormWithID to HTMLSegment interface
3-Apr-01
Acknowledgements:
Index: todo.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/todo.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- todo.txt 2001/01/10 15:12:48 1.5
+++ todo.txt 2001/04/18 03:21:06 1.6
@@ -1,3 +1,6 @@
+o Integrate PUT method (written by Marcos Tarruella, et. al.)
+o Support <button> tags
+o Support <META HTTP_EQUIV=REFRESH tags>
o Documentation, Documentation
Possibles:
|
|
From: Russell G. <rus...@us...> - 2001-04-18 03:18:37
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv16408/test/com/meterware/httpunit
Modified Files:
WebFormTest.java
Log Message:
Added ID attribute for forms
Index: WebFormTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFormTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- WebFormTest.java 2000/11/21 20:44:59 1.9
+++ WebFormTest.java 2001/04/18 03:18:35 1.10
@@ -1,5 +1,24 @@
package com.meterware.httpunit;
-
+/********************************************************************************************************************
+* $Id$
+*
+* Copyright (c) 2000-2001, Russell Gold
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in all copies or substantial portions
+* of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*
+*******************************************************************************************************************/
import java.net.URL;
import junit.framework.Test;
@@ -72,6 +91,20 @@
WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" );
assertNull( "Found nonexistent form", page.getFormWithName( "nobody" ) );
assertNotNull( "Did not find named form", page.getFormWithName( "oneform" ) );
+ }
+
+
+ public void testFindFormByID() throws Exception {
+ defineWebPage( "Default", "<form id=oneForm method=POST action = \"/servlet/Login\">" +
+ "<Input name=\"secret\" type=\"hidden\" value=\"surprise\">" +
+ "<br><Input name=typeless value=nothing>" +
+ "<B>Enter the name 'master': <Input type=TEXT Name=name></B>" +
+ "<br><Input type=submit value = \"Log in\">" +
+ "</form>" );
+
+ WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" );
+ assertNull( "Found nonexistent form", page.getFormWithID( "nobody" ) );
+ assertNotNull( "Did not find specified form", page.getFormWithID( "oneform" ) );
}
|
|
From: Russell G. <rus...@us...> - 2001-04-18 03:18:37
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv16408/src/com/meterware/httpunit
Modified Files:
HTMLSegment.java ParsedHTML.java WebForm.java WebResponse.java
Log Message:
Added ID attribute for forms
Index: HTMLSegment.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLSegment.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HTMLSegment.java 2001/04/02 01:53:21 1.1
+++ HTMLSegment.java 2001/04/18 03:18:35 1.2
@@ -36,6 +36,13 @@
/**
+ * Returns the form found in this HTML segment with the specified ID.
+ * @exception SAXException thrown if there is an error parsing the segment.
+ **/
+ public WebForm getFormWithID( String ID ) throws SAXException;
+
+
+ /**
* Returns the form found in this HTML segment with the specified name.
* @exception SAXException thrown if there is an error parsing the segment.
**/
Index: ParsedHTML.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ParsedHTML.java 2001/04/02 01:53:21 1.14
+++ ParsedHTML.java 2001/04/18 03:18:35 1.15
@@ -51,6 +51,19 @@
/**
+ * Returns the form found in the page with the specified ID.
+ * @exception SAXException thrown if there is an error parsing the response.
+ **/
+ public WebForm getFormWithID( String ID ) {
+ WebForm[] forms = getForms();
+ for (int i = 0; i < forms.length; i++) {
+ if (forms[i].getID().equalsIgnoreCase( ID )) return forms[i];
+ }
+ return null;
+ }
+
+
+ /**
* Returns the form found in the page with the specified name.
* @exception SAXException thrown if there is an error parsing the response.
**/
Index: WebForm.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- WebForm.java 2001/03/23 20:50:41 1.20
+++ WebForm.java 2001/04/18 03:18:35 1.21
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
-* Copyright (c) 2000, Russell Gold
+* Copyright (c) 2000-2001, Russell Gold
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -53,11 +53,19 @@
}
- /**
+ /**
* Returns the name of the form.
**/
public String getName() {
return emptyIfNull( getValue( _node.getAttributes().getNamedItem( "name" ) ) );
+ }
+
+
+ /**
+ * Returns the ID associated with the form.
+ **/
+ public String getID() {
+ return emptyIfNull( getValue( _node.getAttributes().getNamedItem( "id" ) ) );
}
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- WebResponse.java 2001/04/02 01:53:21 1.31
+++ WebResponse.java 2001/04/18 03:18:35 1.32
@@ -188,6 +188,15 @@
/**
+ * Returns the form found in the page with the specified ID.
+ * @exception SAXException thrown if there is an error parsing the response.
+ **/
+ public WebForm getFormWithID( String ID ) throws SAXException {
+ return getReceivedPage().getFormWithID( ID );
+ }
+
+
+ /**
* Returns the links found in the page in the order in which they appear.
* @exception SAXException thrown if there is an error parsing the response.
**/
|
|
From: Russell G. <rus...@us...> - 2001-04-18 03:16:10
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv16158/src/com/meterware/httpunit
Modified Files:
GetMethodWebRequest.java PostMethodWebRequest.java
Log Message:
Made target constructors public
Index: GetMethodWebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/GetMethodWebRequest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- GetMethodWebRequest.java 2000/11/21 20:44:58 1.7
+++ GetMethodWebRequest.java 2001/04/18 03:16:07 1.8
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
-* Copyright (c) 2000, Russell Gold
+* Copyright (c) 2000-2001, Russell Gold
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -45,6 +45,14 @@
/**
+ * Constructs a web request with a specific target.
+ **/
+ public GetMethodWebRequest( URL urlBase, String urlString, String target ) {
+ super( urlBase, urlString, target );
+ }
+
+
+ /**
* Returns the HTTP method defined for this request.
**/
public String getMethod() {
@@ -53,14 +61,6 @@
//--------------------------------------- package members ---------------------------------------------
-
-
- /**
- * Constructs a web request with a specific target.
- **/
- GetMethodWebRequest( URL urlBase, String urlString, String target ) {
- super( urlBase, urlString, target );
- }
/**
Index: PostMethodWebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/PostMethodWebRequest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PostMethodWebRequest.java 2001/04/02 19:07:36 1.10
+++ PostMethodWebRequest.java 2001/04/18 03:16:07 1.11
@@ -48,6 +48,14 @@
/**
+ * Constructs a web request with a specific target.
+ **/
+ public PostMethodWebRequest( URL urlBase, String urlString, String target ) {
+ super( urlBase, urlString, target );
+ }
+
+
+ /**
* Returns the HTTP method defined for this request.
**/
public String getMethod() {
|
|
From: Russell G. <rus...@us...> - 2001-04-13 21:23:49
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv11952/src/com/meterware/httpunit
Modified Files:
HttpWebResponse.java WebConversation.java
Log Message:
Removed superfluous url socket disconnection
Index: HttpWebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpWebResponse.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- HttpWebResponse.java 2001/03/20 23:35:42 1.6
+++ HttpWebResponse.java 2001/04/13 21:23:46 1.7
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
-* Copyright (c) 2000, Russell Gold
+* Copyright (c) 2000-2001, Russell Gold
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -51,7 +51,6 @@
if (_responseCode == HttpURLConnection.HTTP_OK) loadResponseText( url, connection );
- if (connection instanceof HttpURLConnection) ((HttpURLConnection) connection).disconnect();
}
Index: WebConversation.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebConversation.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- WebConversation.java 2001/04/05 22:16:07 1.20
+++ WebConversation.java 2001/04/13 21:23:46 1.21
@@ -56,6 +56,12 @@
protected WebResponse newResponse( WebRequest request ) throws MalformedURLException, IOException {
URLConnection connection = openConnection( request.getURL() );
sendHeaders( connection, request.getHeaders() );
+ if (HttpUnitOptions.isLoggingHttpHeaders()) {
+ for (Enumeration e = getHeaderFields().keys(); e.hasMoreElements(); ) {
+ String key = (String) e.nextElement();
+ System.out.println( "Sending:: " + key + ": " + connection.getRequestProperty( key ) );
+ }
+ }
request.completeRequest( connection );
return new HttpWebResponse( request.getTarget(), request.getURL(), connection );
}
|
|
From: Russell G. <rus...@us...> - 2001-04-13 21:23:49
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv11952/doc
Modified Files:
release_notes.txt
Log Message:
Removed superfluous url socket disconnection
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- release_notes.txt 2001/04/05 22:16:06 1.26
+++ release_notes.txt 2001/04/13 21:23:46 1.27
@@ -11,6 +11,10 @@
Revision History:
+13-Apr-01
+Problems corrected:
+ 1. Repeated requests to the same URL were not resending requests properly. This caused some problems with validation.
+
3-Apr-01
Acknowledgements:
Thanks to Jim Kimball for finding and fixing the redirection of subframes
|