httpunit-commit Mailing List for httpunit (Page 41)
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...> - 2002-11-27 01:28:38
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv24371/src/com/meterware/httpunit
Modified Files:
FormParameter.java
Log Message:
Handle arrays of form parameters even if they are not checkboxes
Index: FormParameter.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormParameter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FormParameter.java 13 Oct 2002 23:53:48 -0000 1.2
+++ FormParameter.java 27 Nov 2002 01:28:34 -0000 1.3
@@ -66,9 +66,7 @@
ArrayList list = new ArrayList();
for (int i = 0; i < _controls.length; i++) {
FormControl control = _controls[i];
- if (control instanceof CheckboxFormControl) {
- list.add( control.getScriptableObject() );
- }
+ list.add( control.getScriptableObject() );
}
return list.toArray( new ScriptableDelegate[ list.size() ] );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-27 01:28:38
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv24371/doc
Modified Files:
release_notes.txt
Log Message:
Handle arrays of form parameters even if they are not checkboxes
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -r1.227 -r1.228
--- release_notes.txt 26 Nov 2002 11:55:56 -0000 1.227
+++ release_notes.txt 27 Nov 2002 01:28:34 -0000 1.228
@@ -13,6 +13,8 @@
26-Nov-2002
Problems fixed:
1. Bug #641687: when neither NekoHTML.jar or Tidy.jar is in the classpath, an explanatory exception is now thrown
+ 2. Javascript: multiple form parameters with the same name were only being treated as an array if they were checkboxes;
+ otherwise, they were being ignored - this would result in a "undefined value has no properties" error message.
25-Nov-2002
Acknowledgements:
|
|
From: Russell G. <rus...@us...> - 2002-11-26 13:01:00
|
Update of /cvsroot/httpunit/httpunit/doc/manual In directory sc8-pr-cvs1:/tmp/cvs-serv10758/doc/manual Added Files: installing.html introduction.html manual.css Log Message: Begin new user documentation --- NEW FILE --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>HttpUnit Manual - Installing HttpUnit</title> <LINK REL="stylesheet" HREF="manual.css" TYPE="text/css"> </head> <body> <h1>Installing HttpUnit</h1> <h2><a name="getting">Getting HttpUnit</a></h2> <h3>Releases</h3> <p>The latest release of HttpUnit is available from the <a href="http://sourceforge.net/project/showfiles.php?group_id=6550">HttpUnit project download page</a>. <br>From time to time, pre-release versions are made available from <a href="http://www.httpunit.org/prerelease">the web site prerelease directory</a>. Because HttpUnit is build test-first, these should usually be as stable as the releases; however, they are not tracked as closely and formally, and typically are only available for a relatively short time. Either form of distribution includes all source code and jars required to build the project.</p> <h3>cvs access</h3> <p>If you prefer to see the very latest code, you can always obtain directly it from the cvs archive at <code>:pserver:ano...@cv...:/cvsroot/httpunit</code>. Be sure to check out the <code>httpunit</code> module.</p> You can also access the <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/httpunit/">cvs repository online</a>. See <a href="#building"><i>Building HttpUnit</i></a> for instructions on building HttpUnit from the source code.</p> <h2><a name="sysrequirements">System Requirements</a></h2> HttpUnit should run on any system that supports Java JDK 1.3 or higher. <h2><a name="distribution">Examining the Distribution</a></h2> <p>When you unpack the HttpUnit distribution, you should find the following directory layout: <pre> httpunit +--- jars // contains jars required to build, test, and run HttpUnit | +--- lib // contains the HttpUnit jar | +--- doc // contains documentation | | | +--- tutorial // a brief tutorial in test-first development of a servlet-based web site | | | +--- api // the javadoc | | | +--- manual // this user manual | +--- examples // some example programs written with HttpUnit | +--- src // the HttpUnit source code | +--- test // unit tests for HttpUnit - a good source for more examples </pre> Only the <code>lib</code> and <code>jars</code> directories are required to run HttpUnit. You must have at least the HttpUnit jar in your classpath. Many of the other jars are optional. See the sext section, <a href="#dependencies"><i>Understanding HttpUnit's dependencies</i></a> for more information. <h2><a name="dependencies">Understanding HttpUnit's dependencies</a></h2> <p>HttpUnit supports a number of optional capabilities. If you don't need them, you don't need the corresponding libraries in your classpath. At the minimum you must have an HTML parser (both JTidy and NekoHTML are supported) and a jaxp-compliant parser (xerces 2.2 is included in the distribution).</p> <table border="1" cellpadding="2" cellspacing="0"> <tr> <th>Jar Name</td> <th>Needed For</td> <th>Documented at</td> </tr> <tr> <td>nekohtml.jar</td> <td>HTML parsing. Very tolerant of sloppy HTML. Requires xerces-j 2.2 or higher</td> <td><a target="_top" href="http://www.apache.org/~andyc/neko/doc/html/index.html"> www.apache.org/~andyc/neko/doc/html/index.html</a>.</td> </tr> <tr> <td>tidy.jar</td> <td>HTML parsing. Very picky. Works with any jaxp-compliant parser.</td> <td><a href="http://lempinen.net/sami/jtidy/" target="_top">lempinen.net/sami/jtidy/</a></td> </tr> <tr> <td>xmlParserAPIs.jar</td> <td>the generic parser APIs supported by xerces-j</td> <td><a href="http://xml.apache.org" target="_top">xml.apache.org</a></td> </tr> <tr> <td>xercesImpl.jar</td> <td>the xerces-j 2.2 implementation</td> <td><a href="http://xml.apache.org" target="_top">xml.apache.org</a></td> </tr> <tr> <td>js.jar</td> <td>javascript support</td> <td><a href="http://www.mozilla.org/rhino/" target="_top">www.mozilla.org/rhino</a></td> </tr> <tr> <td>servlet.jar</td> <td>required for ServletUnit - unit testing of servlets</td> <td><a href="http://java.sun.com/" target="_top">java.sun.com</a></td> </tr> <tr> <td>junit.jar</td> <td>running the unit tests.</td> <td><a href="http://www.junit.org/" target="_top">www.junit.org</a></td> </tr> <tr> <td>mail.jar</td> <td>Testing the file upload capabilities - not used to run HttpUnit itself</td> <td><a href="http://java.sun.com/products/javamail/" target="_top">java.sun.com/products/javamail/</a></td> </tr> <tr> <td>activation.jar</td> <td>Testing the file upload capabilities - not used to run HttpUnit itself</td> <td><a href="http://java.sun.com/products/javabeans/glasgow/jaf.html" target="_top">java.sun.com/products/javabeans/glasgow/jaf.html</a></td> </tr> </table> <h2><a name="#building">Building HttpUnit</a></h2> <p>By far the easiest way to build HttpUnit is by using <code>ant</code>. If you choose to build with less than the full set of jars, some classes will not compile. The included <code>ant</code> script handles this automatically for you, selecting only those that are appropriate. If you have <code>ant</code> installed, simply go to the main httpunit installation directory and type:<blockquote><code>ant jar</code></blockquote> to build the httpunit jar using any classes available in the jars directory. You can then verify your installation by running one of the examples. The command<blockquote><code>ant run-example</code></blockquote> will compile the examples and run the simplest of them, going to the <a href="http://www.meterware.com">Meterware</a> web site and following a link to the main HttpUnit site. If all is working properly, it should print out a message telling you the number of links it found there. <hr> <p align="center">Copyright © 2000-2002 Russell Gold. All rights Reserved.</p> </body> </html> --- NEW FILE --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>HttpUnit Manual - Introduction</title> <LINK REL="stylesheet" HREF="manual.css" TYPE="text/css"> </head> <body> <h1>Introduction</h2> <p>Automated unit testing is a great way to ensure that code being maintained works and continues to work. The <A HREF="http://www.XProgramming.com/">Extreme Programming</A> (XP) methodology relies heavily on it, and practitioners have available to them a range of <A HREF="http://www.xprogramming.com/software.htm">unit testing frameworks</A>, which work by making direct calls to the code being tested. But what if you want to test a web application? HttpUnit is a library which makes this possible.</p> <p>HttpUnit works by emulating a browser, handling frames, cookies, redirects, and so on. It lets you view pages as plain text, an XML DOM, or as an aggregation of collection of links, frames, images, and so on. It lets you select an element which should lead to a new page and follow it, so that you can easily handle a chain of web pages.</p> <h2>Test Design and Abstraction</h2> <p>Unlike most commercial tools, HttpUnit does not rely on record and playback. Its API lets you define what you want to see or change, even before the web site is built. This is essential for test-first development. Since the primary use of HttpUnit is to write functional tests, it helps you abstract those elements which are most likely to change. For example, a page might start by providing a small number of options, using a set of radio buttons:</p> <form class="sample"> Select the desired color: <input type="radio" name="color" value="red">Red <input type="radio" name="color" value="green" checked>Green <input type="radio" name="color" value="blue">Blue </form> <p>As the site evolves, the number of options might grow until the UI designer feels that a pull-down menu would be easier to use to send the same values:</p> <form class="sample"> Select the desired color: <select name="color"> <option value="red">Red <option value="green" selected>Green <option value="blue">Blue <option value="yellow">Yellow <option value="magenta">Magenta </select> </form> <p>Further expansion could lead to a free-form textual input:</p> <form class="sample"> Enter the desired color: <input type="text" name="color" value="green"> </form> <p>A tool which focuses on the type of control actually on the page would force the testers to rewrite their tests with each change, even though the functionality of the site is unchanged. HttpUnit focuses on the intent of the entry, and allows tests to be defined in terms of the values to be transmitted. It is aware of the controls being used and ensures that only values which a user could supply will be sent; however, the tester need only focus on the desired value for each test.</p> <hr> <p align="center">Copyright © 2000-2002 Russell Gold. All rights Reserved.</p> </body></html> --- NEW FILE --- FORM.sample { margin-left: 2%; margin-right: 2%; padding-top: .5em; padding-bottom: .5em; padding-right: .5em; padding-left: .5em; background-color: #cccccc; border-color: #0000cc; border-width: 2; border-style: solid } H2 { padding-left: .5em; padding-top: .5em; padding-bottom: .5 em; margin-bottom: 1em; background-color: #e3e3e3; border-color: #000000; border-width: 2; border-style: solid } |
|
From: Russell G. <rus...@us...> - 2002-11-26 11:56:00
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv21694/src/com/meterware/httpunit
Modified Files:
HttpUnitOptions.java
Log Message:
Some cleanup to tolerate missing jars
Index: HttpUnitOptions.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- HttpUnitOptions.java 6 Nov 2002 13:10:41 -0000 1.33
+++ HttpUnitOptions.java 26 Nov 2002 11:55:57 -0000 1.34
@@ -62,7 +62,13 @@
public static HTMLParser getHTMLParser() {
- return _htmlParser;
+ if (_nekoParser != null) {
+ return _nekoParser;
+ } else if (_jtidyParser != null) {
+ return _jtidyParser;
+ } else {
+ throw new RuntimeException( "No HTML parser found. Make sure that either nekoHTML.jar or Tidy.jar is in the in classpath" );
+ }
}
@@ -511,8 +517,6 @@
private static boolean _exceptionsThrownOnScriptError = true;
- private static HTMLParser _htmlParser;
-
private static HTMLParser _jtidyParser;
private static HTMLParser _nekoParser;
@@ -536,7 +540,5 @@
} catch (IllegalAccessException e) {
} catch (ClassNotFoundException e) {
}
-
- _htmlParser = (_nekoParser == null) ? _jtidyParser : _nekoParser;
}
}
|
|
From: Russell G. <rus...@us...> - 2002-11-26 11:56:00
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv21694/doc
Modified Files:
release_notes.txt
Log Message:
Some cleanup to tolerate missing jars
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -r1.226 -r1.227
--- release_notes.txt 25 Nov 2002 22:41:06 -0000 1.226
+++ release_notes.txt 26 Nov 2002 11:55:56 -0000 1.227
@@ -10,9 +10,13 @@
Revision History:
+26-Nov-2002
+Problems fixed:
+ 1. Bug #641687: when neither NekoHTML.jar or Tidy.jar is in the classpath, an explanatory exception is now thrown
+
25-Nov-2002
Acknowledgements:
- Thanks to Larry Hamel for supplying an ant target to run the first example
+ Thanks to Larry Hamel for supplying an ant target to run Example.java
Additions:
1. There is now an ant target to run the Example program.
|
|
From: Russell G. <rus...@us...> - 2002-11-26 11:56:00
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv21694/test/com/meterware/httpunit
Modified Files:
HttpUnitSuite.java
Added Files:
ConditionalTestSuite.java
Log Message:
Some cleanup to tolerate missing jars
***** Error reading new file[Errno 2] No such file or directory: 'ConditionalTestSuite.java'
Index: HttpUnitSuite.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HttpUnitSuite.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- HttpUnitSuite.java 22 Nov 2002 17:19:35 -0000 1.27
+++ HttpUnitSuite.java 26 Nov 2002 11:55:57 -0000 1.28
@@ -33,10 +33,7 @@
/**
* Tests for the package.
**/
-public class HttpUnitSuite {
-
- private static Class[] NO_PARAMETERS = new Class[ 0 ];
-
+public class HttpUnitSuite extends ConditionalTestSuite {
public static void main( String[] args ) {
junit.textui.TestRunner.run( suite() );
@@ -68,26 +65,6 @@
addOptionalTestCase( result, "com.meterware.servletunit.ServletUnitSuite" );
return result;
}
-
-
- private static void addOptionalTestCase( TestSuite testSuite, String testCaseName ) {
- try {
- final Class testClass = Class.forName( testCaseName );
- Method suiteMethod = testClass.getMethod( "suite", NO_PARAMETERS );
- if (suiteMethod != null && Modifier.isStatic( suiteMethod.getModifiers() )) {
- testSuite.addTest( (TestSuite) suiteMethod.invoke( null, NO_PARAMETERS ) );
- } else if (TestCase.class.isAssignableFrom( testClass )) {
- testSuite.addTest( new TestSuite( testClass ) );
- } else {
- System.out.println( "Note: test suite " + testCaseName + " not a TestClass and has no suite() method" );
- }
- } catch (ClassNotFoundException e) {
- System.out.println( "Note: skipping optional test suite " + testCaseName + " since it was not build." );
- } catch (Exception e) {
- System.out.println( "Note: unable to add " + testCaseName + ": " + e );
- }
- }
-
}
|
|
From: Russell G. <rus...@us...> - 2002-11-26 11:56:00
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/servletunit
In directory sc8-pr-cvs1:/tmp/cvs-serv21694/test/com/meterware/servletunit
Modified Files:
ServletUnitSuite.java
Log Message:
Some cleanup to tolerate missing jars
Index: ServletUnitSuite.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/ServletUnitSuite.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ServletUnitSuite.java 3 Dec 2001 19:14:59 -0000 1.4
+++ ServletUnitSuite.java 26 Nov 2002 11:55:57 -0000 1.5
@@ -20,6 +20,8 @@
*
*******************************************************************************************************************/
+import com.meterware.httpunit.ConditionalTestSuite;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -27,7 +29,7 @@
/**
* Tests for the package.
**/
-public class ServletUnitSuite {
+public class ServletUnitSuite extends ConditionalTestSuite {
public static void main(String args[]) {
junit.textui.TestRunner.run( suite() );
@@ -44,7 +46,7 @@
suite.addTest( NavigationTest.suite() );
suite.addTest( ConfigTest.suite() );
suite.addTest( WebXMLTest.suite() );
- suite.addTest( JUnitServletTest.suite() );
+ addOptionalTestCase( suite, "com.meterware.servletunit.JUnitServletTest" );
return suite;
}
|
|
From: Russell G. <rus...@us...> - 2002-11-26 11:55:59
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv21694
Modified Files:
build.xml
Log Message:
Some cleanup to tolerate missing jars
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- build.xml 25 Nov 2002 13:52:45 -0000 1.57
+++ build.xml 26 Nov 2002 11:55:56 -0000 1.58
@@ -59,6 +59,8 @@
classpathref="base.classpath" />
<available property="nekoHTML.present" classname="org.cyberneko.html.HTMLConfiguration"
classpathref="base.classpath" />
+ <available property="junit.present" classname="junit.framework.Test"
+ classpathref="base.classpath" />
</target>
@@ -78,12 +80,13 @@
<mkdir dir="${build.classes}" />
<javac srcdir="${src.dir}" destdir="${build.classes}"
debug="${debug}" deprecation="${deprecation}" optimize="${optimize}">
- <classpath refid="base.classpath" />
- <exclude name="**/JTidyHTMLParser.java" unless="jtidy.present" />
- <exclude name="**/ScriptFilter.java" unless="nekoHTML.present" />
- <exclude name="**/NekoHTMLParser.java" unless="nekoHTML.present" />
- <exclude name="**/servletunit/*" unless="jsdk.present" />
- <exclude name="**/javascript/*" unless="rhino.present" />
+ <classpath refid="base.classpath" />
+ <exclude name="**/JTidyHTMLParser.java" unless="jtidy.present" />
+ <exclude name="**/ScriptFilter.java" unless="nekoHTML.present" />
+ <exclude name="**/NekoHTMLParser.java" unless="nekoHTML.present" />
+ <exclude name="**/servletunit/*" unless="jsdk.present" />
+ <exclude name="**/JUnitServlet.java" unless="junit.present" />
+ <exclude name="**/javascript/*" unless="rhino.present" />
</javac>
</target>
@@ -124,14 +127,15 @@
<mkdir dir="${test.classes}" />
<javac srcdir="${tstsrc.dir}" destdir="${test.classes}"
debug="on" deprecation="off" 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="jaxp.present" />
- <exclude name="**/javascript/*" unless="rhino.present" />
+ <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="jaxp.present" />
+ <exclude name="**/javascript/*" unless="rhino.present" />
+ <exclude name="**/JUnitServletTest.java" unless="junit.present" />
</javac>
</target>
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv14937/src/com/meterware/httpunit
Modified Files:
HTMLPage.java JTidyHTMLParser.java NekoHTMLParser.java
ParsedHTML.java WebRequest.java WebResponse.java
Log Message:
Process base tag before parsing HTML
Index: HTMLPage.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLPage.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- HTMLPage.java 17 Nov 2002 16:43:40 -0000 1.16
+++ HTMLPage.java 25 Nov 2002 22:41:06 -0000 1.17
@@ -28,7 +28,6 @@
import org.xml.sax.SAXException;
import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Vector;
@@ -45,8 +44,8 @@
private Scriptable _scriptable;
- HTMLPage( WebResponse response, URL url, String parentTarget, String characterSet ) throws IOException, SAXException {
- super( response, url, parentTarget, null, characterSet );
+ HTMLPage( WebResponse response, URL baseURL, String baseTarget, String characterSet ) throws IOException, SAXException {
+ super( response, baseURL, baseTarget, null, characterSet );
}
@@ -250,34 +249,8 @@
- public void parse( String text ) throws SAXException, IOException {
- HttpUnitOptions.getHTMLParser().parse( this, getBaseURL(), text );
- setBaseAttributes();
- }
-
-
-//---------------------------------- private members --------------------------------
-
-
- private void setBaseAttributes() {
- NodeList nl = ((Document) getOriginalDOM()).getElementsByTagName( "base" );
- if (nl.getLength() == 0) return;
- try {
- applyBaseAttributes( NodeUtils.getNodeAttribute( nl.item(0), "href" ),
- NodeUtils.getNodeAttribute( nl.item(0), "target" ) );
- } catch (MalformedURLException e) {
- throw new RuntimeException( "Unable to set document base: " + e );
- }
- }
-
-
- private void applyBaseAttributes( String baseURLString, String baseTarget ) throws MalformedURLException {
- if (baseURLString.length() > 0) {
- this.setBaseURL( new URL( baseURLString ) );
- }
- if (baseTarget.length() > 0) {
- this.setBaseTarget( baseTarget );
- }
+ public void parse( String text, URL pageURL ) throws SAXException, IOException {
+ HttpUnitOptions.getHTMLParser().parse( this, pageURL, text );
}
Index: JTidyHTMLParser.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/JTidyHTMLParser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JTidyHTMLParser.java 24 Oct 2002 13:28:53 -0000 1.2
+++ JTidyHTMLParser.java 25 Nov 2002 22:41:07 -0000 1.3
@@ -36,9 +36,9 @@
class JTidyHTMLParser implements HTMLParser {
- public void parse( HTMLPage page, URL baseURL, String pageText ) throws IOException, SAXException {
+ public void parse( HTMLPage page, URL pageURL, String pageText ) throws IOException, SAXException {
try {
- page.setRootNode( getParser( baseURL ).parseDOM( new ByteArrayInputStream( pageText.getBytes( UTF_ENCODING ) ), null ) );
+ page.setRootNode( getParser( pageURL ).parseDOM( new ByteArrayInputStream( pageText.getBytes( UTF_ENCODING ) ), null ) );
} catch (UnsupportedEncodingException e) {
throw new RuntimeException( "UTF-8 encoding failed" );
}
Index: NekoHTMLParser.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/NekoHTMLParser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NekoHTMLParser.java 24 Oct 2002 13:28:53 -0000 1.2
+++ NekoHTMLParser.java 25 Nov 2002 22:41:07 -0000 1.3
@@ -43,7 +43,7 @@
class NekoHTMLParser implements HTMLParser {
- public void parse( HTMLPage page, URL baseURL, String pageText ) throws IOException, SAXException {
+ public void parse( HTMLPage page, URL pageURL, String pageText ) throws IOException, SAXException {
try {
DOMParser parser = DOMParser.newParser(page);
parser.parse( new InputSource( new StringReader( pageText ) ) );
Index: ParsedHTML.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- ParsedHTML.java 12 Nov 2002 13:41:54 -0000 1.34
+++ ParsedHTML.java 25 Nov 2002 22:41:07 -0000 1.35
@@ -331,32 +331,6 @@
}
-//---------------------------------- protected members ------------------------------
-
-
- /**
- * Overrides the base URL for this HTML segment.
- **/
- protected void setBaseURL( URL baseURL ) {
- _baseURL = baseURL;
- }
-
-
- /**
- * Overrides the base target for this HTML segment.
- **/
- protected void setBaseTarget( String baseTarget ) {
- _baseTarget = baseTarget;
- }
-
-
-
- protected Node getRootNode() {
- if (_rootNode == null) throw new IllegalStateException( "The root node has not been specified" );
- return _rootNode;
- }
-
-
//---------------------------------- package members --------------------------------
@@ -396,6 +370,14 @@
//---------------------------------- private members --------------------------------
+
+
+ private Node getRootNode() {
+ if (_rootNode == null) throw new IllegalStateException( "The root node has not been specified" );
+ return _rootNode;
+ }
+
+
/**
* Returns true if the node is a link anchor node.
Index: WebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- WebRequest.java 10 Oct 2002 21:10:19 -0000 1.51
+++ WebRequest.java 25 Nov 2002 22:41:07 -0000 1.52
@@ -252,7 +252,7 @@
public String toString() {
- return getMethod() + " request for " + getURLString();
+ return getMethod() + " request for (" + getURLBase() + ") " + getURLString();
}
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- WebResponse.java 19 Nov 2002 04:57:17 -0000 1.102
+++ WebResponse.java 25 Nov 2002 22:41:07 -0000 1.103
@@ -28,6 +28,7 @@
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
+import java.net.MalformedURLException;
import java.util.Hashtable;
import java.util.Vector;
import java.util.zip.GZIPInputStream;
@@ -48,8 +49,11 @@
**/
abstract
public class WebResponse implements HTMLSegment, CookieSource {
- private String _refreshHeader;
+
+ private String _refreshHeader;
private boolean _hasSubframes;
+ private URL _baseURL;
+ private String _baseTarget;
/**
@@ -73,7 +77,7 @@
* Returns the URL which invoked this response.
**/
public URL getURL() {
- return _url;
+ return _pageURL;
}
@@ -655,12 +659,12 @@
public void setLocation( String relativeURL ) throws IOException, SAXException {
- getWindow().getResponse( new GetMethodWebRequest( _url, relativeURL, _frameName ) );
+ getWindow().getResponse( new GetMethodWebRequest( _pageURL, relativeURL, _frameName ) );
}
public URL getURL() {
- return WebResponse.this._url;
+ return WebResponse.this._pageURL;
}
}
@@ -681,8 +685,8 @@
**/
protected WebResponse( WebClient client, String frameName, URL url ) {
_client = client;
- _url = url;
- _frameName = frameName;
+ _baseURL = _pageURL = url;
+ _baseTarget = _frameName = frameName;
}
@@ -800,7 +804,7 @@
// the following variables are essentially final; however, the JDK 1.1 compiler does not handle blank final variables properly with
// multiple constructors that call each other, so the final qualifiers have been removed.
- private URL _url;
+ private URL _pageURL;
private String _frameName;
@@ -838,17 +842,24 @@
}
- private void readTags( byte[] rawMessage ) throws UnsupportedEncodingException {
+ private void readTags( byte[] rawMessage ) throws UnsupportedEncodingException, MalformedURLException {
ByteTagParser parser = new ByteTagParser( rawMessage );
ByteTag tag = parser.getNextTag();
while (tag != null && !tag.getName().equalsIgnoreCase( "body" )) {
if (tag.getName().equalsIgnoreCase( "meta" )) processMetaTag( tag );
+ if (tag.getName().equalsIgnoreCase( "base" )) processBaseTag( tag );
if (tag.getName().equalsIgnoreCase( "frameset" )) _hasSubframes = true;
tag = parser.getNextTag();
}
}
+ private void processBaseTag( ByteTag tag ) throws MalformedURLException {
+ if (tag.getAttribute( "href" ) != null) _baseURL = new URL( tag.getAttribute( "href" ) );
+ if (tag.getAttribute( "target" ) != null) _baseTarget = tag.getAttribute( "target" );
+ }
+
+
private void processMetaTag( ByteTag tag ) {
if (isHttpEquivMetaTag( tag, "content-type" )) {
inferContentType( tag.getAttribute( "content" ) );
@@ -883,7 +894,7 @@
if (splitIndex < 0) splitIndex = 0;
try {
_refreshDelay = Integer.parseInt( refreshHeader.substring( 0, splitIndex ) );
- _refreshRequest = new GetMethodWebRequest( _url, getRefreshURL( refreshHeader.substring( splitIndex+1 ) ), _frameName );
+ _refreshRequest = new GetMethodWebRequest( _pageURL, getRefreshURL( refreshHeader.substring( splitIndex+1 ) ), _frameName );
} catch (NumberFormatException e) {
_refreshDelay = 0;
System.out.println( "Unable to interpret refresh tag: \"" + refreshHeader + '"' );
@@ -958,8 +969,8 @@
if (_page == null) {
try {
if (!isHTML()) throw new NotHTMLException( getContentType() );
- _page = new HTMLPage( this, _url, _frameName, getCharacterSet() );
- _page.parse( getText() );
+ _page = new HTMLPage( this, _baseURL, _baseTarget, getCharacterSet() );
+ _page.parse( getText(), _pageURL );
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException( e.toString() );
|
|
From: Russell G. <rus...@us...> - 2002-11-25 22:41:11
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv14937/test/com/meterware/httpunit/javascript
Modified Files:
ScriptingTest.java
Log Message:
Process base tag before parsing HTML
Index: ScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- ScriptingTest.java 19 Nov 2002 04:57:17 -0000 1.45
+++ ScriptingTest.java 25 Nov 2002 22:41:07 -0000 1.46
@@ -233,6 +233,17 @@
}
+ public void testIncludedFunctionWithBaseTag() throws Exception {
+ defineResource( "scripts/saycheese.js", "function sayCheese() { alert( \"Cheese!\" ); }" );
+ defineResource( "OnCommand.html", "<html><head><base href='" + getHostPath() + "/scripts/OnCommand.html'><script language='JavaScript' src='saycheese.js'>" +
+ "</script></head>" +
+ "<body onLoad='sayCheese()'></body>" );
+ WebConversation wc = new WebConversation();
+ wc.getResponse( getHostPath() + "/OnCommand.html" );
+ assertEquals( "Alert message", "Cheese!", wc.popNextAlert() );
+ }
+
+
public void testWindowOpen() throws Exception {
defineResource( "Target.html", "You made it!" );
defineResource( "OnCommand.html", "<html><head><title>Amazing!</title></head>" +
|
|
From: Russell G. <rus...@us...> - 2002-11-25 22:41:11
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv14937/test/com/meterware/httpunit
Modified Files:
HttpUnitTest.java
Log Message:
Process base tag before parsing HTML
Index: HttpUnitTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HttpUnitTest.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- HttpUnitTest.java 15 Nov 2002 01:22:37 -0000 1.23
+++ HttpUnitTest.java 25 Nov 2002 22:41:07 -0000 1.24
@@ -21,34 +21,32 @@
*******************************************************************************************************************/
import com.meterware.pseudoserver.HttpUserAgentTest;
-import java.net.URL;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import java.util.Enumeration;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-
/**
* a base class for HttpUnit regression tests.
*
- * @author <a href="mailto:rus...@ac...">Russell Gold</a>
+ * @author <a href="mailto:rus...@ht...">Russell Gold</a>
**/
abstract
public class HttpUnitTest extends HttpUserAgentTest {
+ private boolean _showTestName;
+
public HttpUnitTest( String name ) {
super( name );
}
+ public HttpUnitTest( String name, boolean showTestName ) {
+ super( name );
+ _showTestName = showTestName;
+ }
+
+
public void setUp() throws Exception {
super.setUp();
HttpUnitOptions.reset();
+ if (_showTestName) System.out.println( "----------------------- " + getName() + " ------------------------");
}
static {
|
|
From: Russell G. <rus...@us...> - 2002-11-25 22:41:11
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv14937/doc
Modified Files:
release_notes.txt
Log Message:
Process base tag before parsing HTML
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -r1.225 -r1.226
--- release_notes.txt 25 Nov 2002 17:02:20 -0000 1.225
+++ release_notes.txt 25 Nov 2002 22:41:06 -0000 1.226
@@ -20,6 +20,7 @@
Problems fixed:
1. Table <th> elements were being handled *after* <td> elements in the same row
+ 2. The <base> tag was not being used to find included scripts
22-Nov-2002
Notes:
|
|
From: Russell G. <rus...@us...> - 2002-11-25 17:02:24
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv20411/test/com/meterware/httpunit
Modified Files:
HtmlTablesTest.java
Log Message:
Corrected handling of <th> tags
Index: HtmlTablesTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HtmlTablesTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HtmlTablesTest.java 25 Oct 2001 17:30:03 -0000 1.12
+++ HtmlTablesTest.java 25 Nov 2002 17:02:21 -0000 1.13
@@ -55,11 +55,11 @@
defineWebPage( "OneTable", "<h2>Interesting data</h2>" +
"<table summary=\"tough luck\">" +
- "<tr><td>One</td><td> </td><td>1</td></tr>" +
+ "<tr><th>One</th><td> </td><td>1</td></tr>" +
"<tr><td colspan=3><IMG SRC=\"/images/spacer.gif\" ALT=\"\" WIDTH=1 HEIGHT=1></td></tr>" +
- "<tr><td>Two</td><td> </td><td>2</td></tr>" +
+ "<tr><th>Two</th><td> </td><td>2</td></tr>" +
"<tr><td colspan=3><IMG SRC=\"/images/spacer.gif\" ALT=\"\" WIDTH=1 HEIGHT=1></td></tr>" +
- "<tr><td>Three</td><td> </td><td>3</td></tr>" +
+ "<tr><th>Three</th><td> </td><td>3</td></tr>" +
"</table>" );
defineWebPage( "SpanTable", "<h2>Interesting data</h2>" +
"<table summary=\"tough luck\">" +
|
|
From: Russell G. <rus...@us...> - 2002-11-25 17:02:24
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv20411/doc
Modified Files:
release_notes.txt
Log Message:
Corrected handling of <th> tags
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -r1.224 -r1.225
--- release_notes.txt 25 Nov 2002 13:52:45 -0000 1.224
+++ release_notes.txt 25 Nov 2002 17:02:20 -0000 1.225
@@ -16,6 +16,10 @@
Additions:
1. There is now an ant target to run the Example program.
+ 2. The Rhino jar now includes a patch to improve error-reporting for unsupported DOM elements
+
+Problems fixed:
+ 1. Table <th> elements were being handled *after* <td> elements in the same row
22-Nov-2002
Notes:
|
|
From: Russell G. <rus...@us...> - 2002-11-25 17:02:24
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv20411/src/com/meterware/httpunit
Modified Files:
WebTable.java
Log Message:
Corrected handling of <th> tags
Index: WebTable.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebTable.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- WebTable.java 4 Oct 2002 02:16:00 -0000 1.19
+++ WebTable.java 25 Nov 2002 17:02:21 -0000 1.20
@@ -356,10 +356,13 @@
private TableRow[] getRows() {
final Vector rows = new Vector();
- processChildren( _dom, "tr", "table", new ElementHandler() {
+ processChildren( _dom, "table", new ElementHandler() {
public void handleElement( Element element ) {
rows.addElement( new TableRow( element ) );
}
+ public boolean shouldHandleElement( String tagName ) {
+ return tagName.equalsIgnoreCase( "tr" );
+ }
} );
TableRow[] result = new TableRow[ rows.size() ];
@@ -374,22 +377,20 @@
}
TableCell[] getCells() {
- Vector cells = new Vector();
- collectChildren( "td", cells );
- collectChildren( "th", cells );
-
- TableCell[] result = new TableCell[ cells.size() ];
- cells.copyInto( result );
- return result;
- }
-
+ final Vector cells = new Vector();
- private void collectChildren( String childTag, final Vector children ) {
- processChildren( _element, childTag, "table", new ElementHandler() {
+ processChildren( _element, "table", new ElementHandler() {
public void handleElement( Element element ) {
- children.addElement( new TableCell( _response, element, _url, _parentTarget, _characterSet ) );
+ cells.addElement( new TableCell( _response, element, _url, _parentTarget, _characterSet ) );
+ }
+ public boolean shouldHandleElement( String tagName ) {
+ return tagName.equalsIgnoreCase( "th" ) || tagName.equalsIgnoreCase( "td" );
}
} );
+
+ TableCell[] result = new TableCell[ cells.size() ];
+ cells.copyInto( result );
+ return result;
}
@@ -400,21 +401,20 @@
}
-
-
interface ElementHandler {
public void handleElement( Element element );
+ public boolean shouldHandleElement( String tagName );
}
- static void processChildren( Element root, String childTag, String avoidingParentTag, ElementHandler handler ) {
+ static void processChildren( Element root, String avoidingParentTag, ElementHandler handler ) {
for (Node child = root.getFirstChild(); child != null; child = child.getNextSibling()) {
if (child instanceof Element) {
Element element = (Element) child;
String name = child.getNodeName();
- if (name.equalsIgnoreCase( childTag )) handler.handleElement( element );
- if (!name.equalsIgnoreCase( avoidingParentTag )) processChildren( element, childTag, avoidingParentTag, handler );
+ if (handler.shouldHandleElement( name )) handler.handleElement( element );
+ if (!name.equalsIgnoreCase( avoidingParentTag )) processChildren( element, avoidingParentTag, handler );
}
}
}
|
|
From: Russell G. <rus...@us...> - 2002-11-25 14:17:50
|
Update of /cvsroot/httpunit/httpunit/jars In directory sc8-pr-cvs1:/tmp/cvs-serv14159/jars Modified Files: jars.txt js.jar Log Message: Include patched Rhino jar for better error messages Index: jars.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/jars/jars.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- jars.txt 14 Oct 2002 04:19:05 -0000 1.6 +++ jars.txt 25 Nov 2002 14:17:46 -0000 1.7 @@ -5,8 +5,8 @@ servlet 2.3 xerces 2.2 jtidy 04aug2000r7 -rhino 1.5R3 -NekoHTML 0.6.8 +rhino 1.5preR4 (patched) +NekoHTML 0.6.8 (patched) (for testing HttpUnit only) mail (javamail 1.2) Index: js.jar =================================================================== RCS file: /cvsroot/httpunit/httpunit/jars/js.jar,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 Binary files /tmp/cvscb5nmx and /tmp/cvsCoCtWX differ |
|
From: Russell G. <rus...@us...> - 2002-11-25 14:17:48
|
Update of /cvsroot/httpunit/httpunit/doc/manual In directory sc8-pr-cvs1:/tmp/cvs-serv14159/doc/manual Added Files: notes.txt Log Message: Include patched Rhino jar for better error messages --- NEW FILE --- get page for URL (see text) parsing XML find links in page following links find tables in a page reading data from a table reading form data submitting a form working with text parameters working with discrete parameters verifying cookies examining headers setting headers uploading files downloading files working with framesets opening new windows handling JavaScript problems interactive JavaScript |
|
From: Russell G. <rus...@us...> - 2002-11-25 14:17:48
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv14159
Added Files:
project.xml
Log Message:
Include patched Rhino jar for better error messages
--- NEW FILE ---
<?xml version="1.0"?>
<project>
<pomVersion>3</pomVersion>
<name>httpunit</name>
<id>httpunit</id>
<currentVersion>1.5.0-dev</currentVersion>
<organization>
<name>Meterware</name>
<url>http://www.meterware.com/</url>
</organization>
<inceptionYear>2000</inceptionYear>
<package>com.meterware.httpunit</package>
<shortDescription>Web Functional Testing Library</shortDescription>
<!-- Gump integration -->
<gumpRepositoryId></gumpRepositoryId>
<description>
HttpUnit simplifies the job of writing automated functional tests for web site.
It emulates the relevant portions of browser behavior, including
form submission, <a href="doc/Javascript-support.html">JavaScript</a>,
basic <A HREF="ftp://ftp.isi.edu/in-notes/rfc2617.txt">http authentication</A>,
cookies and automatic page redirection, and allows
Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links..
</description>
<url>http://www.httpunit.org/</url>
<issueTrackingUrl>http://sourceforge.net/tracker/?group_id=6550&atid=106550</issueTrackingUrl>
<siteAddress>httpunit.sourceforge.net</siteAddress>
<siteDirectory>/home/groups/h/ht/httpunit/htdocs/</siteDirectory>
<distributionDirectory>/home/groups/h/ht/httpunit/htdocs/prerelease</distributionDirectory>
<repository>
<connection>
scm:cvs:pserver:ano...@cv...:/cvsroot/httpunit
</connection>
<url>
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/httpunit/
</url>
</repository>
<versions>
<version>
<id>1.5</id>
<name>1.5</name>
<tag>httpunit_1_5</tag>
</version>
</versions>
<mailingLists>
<mailingList>
<name>HttpUnit user/Developer List</name>
<subscribe>
http://lists.sourceforge.net/lists/listinfo/httpunit-develop
</subscribe>
<archive>
http://sourceforge.net/mailarchive/forum.php?forum=httpunit-develop
</archive>
</mailingList>
</mailingLists>
<developers>
<developer>
<name>Russell Gold</name>
<id>russgold</id>
<email>rus...@ht...</email>
<organization></organization>
</developer>
</developers>
<dependencies>
<dependency>
<id>nekohtml</id>
<version>0.68</version>
<url>http://www.apache.org/~andyc/neko/doc/html/index.html</url>
</dependency>
<dependency>
<id>xerces</id>
<version>2.2</version>
<url>http://xml.apache.org/xerces2-j/index.html</url>
</dependency>
</dependencies>
<build>
<nagEmailAddress></nagEmailAddress>
<sourceDirectory>src</sourceDirectory>
<unitTestSourceDirectory>test</unitTestSourceDirectory>
<integrationUnitTestSourceDirectory/>
<aspectSourceDirectory/>
<!-- Unit test cases -->
<unitTest>
<includes>
<include>**/*.java</include>
</includes>
</unitTest>
<!-- J A R R E S O U R C E S -->
<!-- Resources that are packaged up inside the JAR file -->
<resources>
</resources>
<!-- Integration unit test cases -->
<integrationUnitTest/>
<jars></jars>
</build>
</project>
|
|
From: Russell G. <rus...@us...> - 2002-11-25 13:52:48
|
Update of /cvsroot/httpunit/httpunit/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv30205/examples
Modified Files:
Example.java
Log Message:
Updated Example.java to point to always-on page
Index: Example.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/examples/Example.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Example.java 28 Jan 2002 05:05:30 -0000 1.2
+++ Example.java 25 Nov 2002 13:52:45 -0000 1.3
@@ -1 +1 @@
-import com.meterware.httpunit.*;
import java.io.IOException;
import java.net.MalformedURLException;
import org.xml.sax.*;
public class Example {
public static void main( String[] params ) {
try {
WebRequest request;
WebResponse response;
WebConversation conversation = new WebConversation();
request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" );
response = conversation.getResponse( request );
System.out.println( response );
WebForm loginForm = response.getForms()[0];
request = loginForm.getRequest();
request.setParameter( "name", "master" );
response = conversation.getResponse( request );
System.out.println( response.getText() );
} catch (Exception e) {
System.err.println( "Exception: " + e );
}
}
}
\ No newline at end of file
+import com.meterware.httpunit.*;
/** This is a simple example of using HttpUnit to read and understand web pages. **/
public class Example {
public static void main( String[] params ) {
try {
// create the conversation object which will maintain state for us
WebConversation wc = new WebConversation();
// Obtain the main page on the meterware web site
WebRequest request = new GetMethodWebRequest( "http://www.meterware.com" );
WebResponse response = wc.getResponse( request );
// find the link which contains the string "HttpUnit" and click it
WebLink httpunitLink = response.getFirstMatchingLink( WebLink.MATCH_CONTAINED_TEXT, "HttpUnit" );
response = httpunitLink.click();
// print out the number of links on the HttpUnit main page
System.out.println( "The HttpUnit main page contains " + response.getLinks().length + " links" );
} catch (Exception e) {
System.err.println( "Exception: " + e );
}
}
}
\ No newline at end of file
|
|
From: Russell G. <rus...@us...> - 2002-11-25 13:52:48
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv30205/doc
Modified Files:
release_notes.txt
Log Message:
Updated Example.java to point to always-on page
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.223
retrieving revision 1.224
diff -u -r1.223 -r1.224
--- release_notes.txt 22 Nov 2002 17:19:32 -0000 1.223
+++ release_notes.txt 25 Nov 2002 13:52:45 -0000 1.224
@@ -10,6 +10,13 @@
Revision History:
+25-Nov-2002
+Acknowledgements:
+ Thanks to Larry Hamel for supplying an ant target to run the first example
+
+Additions:
+ 1. There is now an ant target to run the Example program.
+
22-Nov-2002
Notes:
1. The nekohtml.jar included has a patch supplied by the author (Andy Clark) to support applet parameter tags
|
|
From: Russell G. <rus...@us...> - 2002-11-25 13:52:48
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv30205
Modified Files:
build.xml
Log Message:
Updated Example.java to point to always-on page
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- build.xml 13 Nov 2002 14:01:22 -0000 1.56
+++ build.xml 25 Nov 2002 13:52:45 -0000 1.57
@@ -24,8 +24,6 @@
<property name="example.classes" value="${build.dir}/examples" />
<property name="javadoc.dir" value="${docs.dir}/api" />
- <property name="use.jtidy" value="" />
-
<property name="dist.dir" value="dist" />
<property name="archive.dir" value="${dist.dir}/${name}-${version}" />
<property name="classpath" value="" />
@@ -59,7 +57,7 @@
classpathref="base.classpath" />
<available property="jtidy.present" classname="org.w3c.tidy.Tidy"
classpathref="base.classpath" />
- <available property="nekoHTML.present" classname="org.cyberneko.html.parsers.DOMParser"
+ <available property="nekoHTML.present" classname="org.cyberneko.html.HTMLConfiguration"
classpathref="base.classpath" />
</target>
@@ -102,6 +100,20 @@
<pathelement location="${build.classes}" />
</classpath>
</javac>
+</target>
+
+
+<!-- =================================================================== -->
+<!-- Runs the main example -->
+<!-- =================================================================== -->
+<target name="run-example" depends="compile-examples">
+ <java fork="true" classname="Example" dir="${basedir}">
+ <classpath>
+ <path refid="base.classpath"/>
+ <pathelement location="${example.classes}"/>
+ <pathelement location="${build.classes}"/>
+ </classpath>
+ </java>
</target>
|
|
From: Russell G. <rus...@us...> - 2002-11-25 01:40:11
|
Update of /cvsroot/httpunit/httpunit/doc/manual In directory sc8-pr-cvs1:/tmp/cvs-serv4295/manual Log Message: Directory /cvsroot/httpunit/httpunit/doc/manual added to the repository |
|
From: Russell G. <rus...@us...> - 2002-11-22 17:19:43
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/applet
In directory sc8-pr-cvs1:/tmp/cvs-serv22673/test/com/meterware/httpunit/applet
Modified Files:
AppletTest.java
Log Message:
Added support for applet parameters and archives
Index: AppletTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/applet/AppletTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AppletTest.java 15 Nov 2002 00:07:33 -0000 1.2
+++ AppletTest.java 22 Nov 2002 17:19:36 -0000 1.3
@@ -27,6 +27,10 @@
import java.applet.Applet;
import java.util.Enumeration;
import java.net.URL;
+import java.lang.reflect.Method;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
import junit.textui.TestRunner;
import junit.framework.TestSuite;
@@ -74,8 +78,8 @@
WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
WebApplet applet1 = response.getApplets()[0];
WebApplet applet2 = response.getApplets()[1];
- assertEquals( "Applet 1 codebase", getHostPath() + "/classes", applet1.getCodeBase().toExternalForm() );
- assertEquals( "Applet 2 codebase", getHostPath() + "/", applet2.getCodeBase().toExternalForm() );
+ assertEquals( "Applet 1 codebase", getHostPath() + "/classes/", applet1.getCodeBaseURL().toExternalForm() );
+ assertEquals( "Applet 2 codebase", getHostPath() + "/", applet2.getCodeBaseURL().toExternalForm() );
assertEquals( "Applet 1 name", "first", applet1.getName() );
assertEquals( "Applet 1 width", 150, applet1.getWidth() );
@@ -83,6 +87,21 @@
}
+ public void testReadAppletParameters() throws Exception {
+ defineWebPage( "start", "<applet code='DoIt'>" +
+ " <param name='color' value='ffff00'>" +
+ " <param name='age' value='12'>" +
+ "</applet>" );
+
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
+ WebApplet applet = response.getApplets()[0];
+ assertNotNull( "Parameter names return null", applet.getParameterNames() );
+ assertEquals( "Number of parameters", 2, applet.getParameterNames().length );
+ assertMatchingSet( "Parameter names", new String[]{"color", "age"}, applet.getParameterNames() );
+ }
+
+
public void testAppletClassName() throws Exception {
defineWebPage( "start", "<applet code='com/something/FirstApplet.class' width=150 height=100></applet>" +
"<applet code='org\\nothing\\SecondApplet' width=150 height=100></applet>" +
@@ -108,6 +127,37 @@
}
+ public void testAppletArchive() throws Exception {
+ defineWebPage( "start", "<applet archive='/lib/xercesImpl.jar,/lib/xmlParserAPIs.jar'" +
+ " code='" + XMLApplet.class.getName() + ".class'" +
+ " codebase=/classes width=100 height=100></applet>");
+ mapToClasspath( "/classes" );
+ mapToClasspath( "/lib" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
+ Applet applet = response.getApplets()[0].getApplet();
+ Method testMethod = applet.getClass().getMethod( "getDocumentBuilder", new Class[0] );
+ Object result = testMethod.invoke( applet, new Object[0] );
+ assertEquals( "Superclass name", DocumentBuilder.class.getName(), result.getClass().getSuperclass().getName() );
+ }
+
+
+ public void testAppletParameterAccess() throws Exception {
+ defineWebPage( "start", "<applet code='" + SimpleApplet.class.getName() +
+ ".class' codebase=/classes width=100 height=100>" +
+ " <param name='color' value='ffff00'>" +
+ " <param name='age' value='12'>" +
+ "</applet>");
+ mapToClasspath( "/classes" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
+ Applet applet = response.getApplets()[0].getApplet();
+ assertNull( "Applet parameter 'hue' should be null", applet.getParameter( "hue" ) );
+ assertEquals( "Applet parameter 'color'", "ffff00", applet.getParameter( "color" ) );
+ assertEquals( "Applet parameter 'age'", "12", applet.getParameter( "age" ) );
+ }
+
+
public void testAppletFindFromApplet() throws Exception {
defineWebPage( "start", "<applet name=first code='" + SimpleApplet.class.getName() +
".class' codebase=/classes width=100 height=100></applet>" +
@@ -148,7 +198,14 @@
public static class SimpleApplet extends Applet {
}
- public static class SecondApplet extends Applet {
+ public static class SecondApplet extends SimpleApplet {
+ }
+
+ public static class XMLApplet extends Applet {
+ public DocumentBuilder getDocumentBuilder() throws Exception {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ return factory.newDocumentBuilder();
+ }
}
}
|
|
From: Russell G. <rus...@us...> - 2002-11-22 17:19:42
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver
In directory sc8-pr-cvs1:/tmp/cvs-serv22673/src/com/meterware/pseudoserver
Modified Files:
PseudoServer.java
Log Message:
Added support for applet parameters and archives
Index: PseudoServer.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/PseudoServer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PseudoServer.java 15 Nov 2002 00:07:33 -0000 1.4
+++ PseudoServer.java 22 Nov 2002 17:19:35 -0000 1.5
@@ -236,7 +236,7 @@
return (WebResource) resource;
} else if (resource instanceof PseudoServlet) {
return getResource( (PseudoServlet) resource, request );
- } else {
+ } else if (request.getURI().endsWith( ".class" )) {
for (Iterator iterator = _classpathDirs.iterator(); iterator.hasNext();) {
String directory = (String) iterator.next();
if (request.getURI().startsWith( directory )) {
@@ -244,6 +244,25 @@
return new WebResource( getClass().getClassLoader().getResourceAsStream( resourceName ), "application/class", 200 );
}
}
+ return null;
+ } else if (request.getURI().endsWith( ".zip" ) || request.getURI().endsWith( ".jar" )) {
+ for (Iterator iterator = _classpathDirs.iterator(); iterator.hasNext();) {
+ String directory = (String) iterator.next();
+ if (request.getURI().startsWith( directory )) {
+ String resourceName = request.getURI().substring( directory.length()+1 );
+ String classPath = System.getProperty( "java.class.path" );
+ StringTokenizer st = new StringTokenizer( classPath, ":;," );
+ while (st.hasMoreTokens()) {
+ String file = st.nextToken();
+ if (file.endsWith( resourceName )) {
+ File f = new File( file );
+ return new WebResource( new FileInputStream( f ), "application/zip", 200 );
+ }
+ }
+ }
+ }
+ return null;
+ } else {
return null;
}
}
|
|
From: Russell G. <rus...@us...> - 2002-11-22 17:19:42
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv22673/test/com/meterware/httpunit
Modified Files:
HttpUnitSuite.java
Log Message:
Added support for applet parameters and archives
Index: HttpUnitSuite.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HttpUnitSuite.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- HttpUnitSuite.java 6 Nov 2002 13:10:41 -0000 1.26
+++ HttpUnitSuite.java 22 Nov 2002 17:19:35 -0000 1.27
@@ -25,9 +25,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.lang.reflect.InvocationTargetException;
-import junit.framework.Test;
import junit.framework.TestSuite;
import junit.framework.TestCase;
@@ -45,7 +43,7 @@
}
- public static Test suite() {
+ public static TestSuite suite() {
TestSuite result = new TestSuite();
result.addTest( WebPageTest.suite() );
result.addTest( WebLinkTest.suite() );
@@ -77,7 +75,7 @@
final Class testClass = Class.forName( testCaseName );
Method suiteMethod = testClass.getMethod( "suite", NO_PARAMETERS );
if (suiteMethod != null && Modifier.isStatic( suiteMethod.getModifiers() )) {
- testSuite.addTest( (Test) suiteMethod.invoke( null, NO_PARAMETERS ) );
+ testSuite.addTest( (TestSuite) suiteMethod.invoke( null, NO_PARAMETERS ) );
} else if (TestCase.class.isAssignableFrom( testClass )) {
testSuite.addTest( new TestSuite( testClass ) );
} else {
|