httpunit-commit Mailing List for httpunit (Page 7)
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: <wol...@us...> - 2008-05-13 10:24:00
|
Revision: 963 http://httpunit.svn.sourceforge.net/httpunit/?rev=963&view=rev Author: wolfgang_fahl Date: 2008-05-13 03:23:58 -0700 (Tue, 13 May 2008) Log Message: ----------- not for release notes - missing html file added Added Paths: ----------- trunk/httpunit/test/com/meterware/httpunit/html/ trunk/httpunit/test/com/meterware/httpunit/html/testArgumentsProperty.html Added: trunk/httpunit/test/com/meterware/httpunit/html/testArgumentsProperty.html =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/html/testArgumentsProperty.html (rev 0) +++ trunk/httpunit/test/com/meterware/httpunit/html/testArgumentsProperty.html 2008-05-13 10:23:58 UTC (rev 963) @@ -0,0 +1,26 @@ +<!-- + $Header$ + Test for bug report [ 1286018 ] EcmaError in seemingly valid function + by Stephane Mikaty +--> +<html> +<body onload="dumpargs('a','b')"> +<script language='JavaScript'> + <!-- + function dumpargs() { + var args=dumpargs.arguments; + var argdump=args.length; + for (i=0; i<args.length; i+=1) { + argdump+='+'; + argdump+=args[i]; + } + document.getElementById('actual').innerHTML=argdump; + } + // --> +</script> + +<div id="expected">2+a+b</div> +<div id="actual"/> + +</body> +</html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 10:22:47
|
Revision: 962 http://httpunit.svn.sourceforge.net/httpunit/?rev=962&view=rev Author: wolfgang_fahl Date: 2008-05-13 03:22:45 -0700 (Tue, 13 May 2008) Log Message: ----------- not for release notes jars rebuilt Modified Paths: -------------- trunk/httpunit/lib/httpunit.jar trunk/httpunit/lib/httpunit_uncompressed.jar Modified: trunk/httpunit/lib/httpunit.jar =================================================================== (Binary files differ) Modified: trunk/httpunit/lib/httpunit_uncompressed.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 10:02:41
|
Revision: 961 http://httpunit.svn.sourceforge.net/httpunit/?rev=961&view=rev Author: wolfgang_fahl Date: 2008-05-13 03:02:39 -0700 (Tue, 13 May 2008) Log Message: ----------- Test for bug report [ 1286018 ] EcmaError in seemingly valid function by Stephane Mikaty Modified Paths: -------------- trunk/httpunit/build.xml trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-05-13 09:33:27 UTC (rev 960) +++ trunk/httpunit/build.xml 2008-05-13 10:02:39 UTC (rev 961) @@ -213,6 +213,11 @@ <exclude name="**/javascript/*" unless="rhino.present" /> <exclude name="**/JUnitServletTest.java" unless="junit.present" /> </javac> + <copy todir="${test.classes}"> + <fileset dir="${tstsrc.dir}"> + <include name="**/*.html"/> + </fileset> + </copy> </target> Modified: trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java 2008-05-13 09:33:27 UTC (rev 960) +++ trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java 2008-05-13 10:02:39 UTC (rev 961) @@ -21,12 +21,20 @@ *******************************************************************************************************************/ import com.meterware.httpunit.*; +import junit.framework.Assert; import junit.framework.TestSuite; import junit.textui.TestRunner; +import java.net.URL; +import java.net.URLConnection; import java.util.ArrayList; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + + /** * @author <a href="mailto:rus...@ht...">Russell Gold</a> * @author Wolfgang Fahl - for compiling patches from the Source Forge web site 2008-03 @@ -1386,6 +1394,76 @@ HttpUnitOptions.reset(); } // for optimizationLevel } + /** + * bug report [ 1286018 ] EcmaError in seemingly valid function + * by Stephane Mikaty + * @throws Exception + */ + public void testArgumentsProperty() throws Exception { + if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { + warnDisabled("testArgumentsProperty","not fixed for old javascript engine"); + return; + } + new ScriptingTestHelper("../html/testArgumentsProperty.html").run(); + } + + /** + * Helper class to define a whole scripting test in a single html file. + * This avoids the need to create a large Java escaped string, which + * obfuscates the purpose of the test. + * + * The test if given the name of an HTML resource at construction time. + * The resource is expected to be in the same package as {@link ScriptingTest}. + * Inside the HTML resource, two div elements are required: + * <ol> + * <li>a div with id "expected" + * <li>a div with id "actual" + * <ol> + * The test is expected to have run by the time the document is loaded, and + * passes if the actual div and the expected div have the same content. + * + * The simplest to achieve this is to ensure that the HTML resource contains + * an onload instruction that exercises the functionality under test. + */ + public class ScriptingTestHelper extends Assert { + + /** + * Name of the HTML resource containing the test in this package. + */ + private final String htmlResource; + + /** + * constructor for this helper test + * @param anHtmlResource + */ + ScriptingTestHelper(String anHtmlResource) { + this.htmlResource = anHtmlResource; + } + + /** + * run this Assertion + * @throws Exception + */ + void run() throws Exception { + URL url = getClass().getResource(htmlResource); + URLConnection conn = url.openConnection(); + String contentType = conn.getContentType(); + byte[] data = new byte[conn.getContentLength()]; + conn.getInputStream().read(data); + defineResource( "OnCommand.html", data, contentType ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + Document doc=response.getDOM(); + Node expected=doc.getElementById("expected").getFirstChild(); + Node actual =doc.getElementById("actual").getFirstChild(); + assertNotNull("node expected should not be null",expected); + assertNotNull("node actual should not be null",actual); + String expectedText = expected.getNodeValue(); + String actualText = actual.getNodeValue(); + assertEquals(expectedText, actualText); + } + + } + - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 09:33:30
|
Revision: 960 http://httpunit.svn.sourceforge.net/httpunit/?rev=960&view=rev Author: wolfgang_fahl Date: 2008-05-13 02:33:27 -0700 (Tue, 13 May 2008) Log Message: ----------- Feature Request [1956293 ] Add getClient to WebResponse by Matthew O. Smith Modified Paths: -------------- trunk/httpunit/lib/httpunit.jar trunk/httpunit/lib/httpunit_uncompressed.jar trunk/httpunit/src/com/meterware/httpunit/FormParameter.java trunk/httpunit/src/com/meterware/httpunit/WebResponse.java Modified: trunk/httpunit/lib/httpunit.jar =================================================================== (Binary files differ) Modified: trunk/httpunit/lib/httpunit_uncompressed.jar =================================================================== (Binary files differ) Modified: trunk/httpunit/src/com/meterware/httpunit/FormParameter.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-05-13 09:28:41 UTC (rev 959) +++ trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-05-13 09:33:27 UTC (rev 960) @@ -56,7 +56,7 @@ /** * get the controls for this form Parameter - * @return + * @return the controls */ public FormControl[] getControls() { if (_controls == null) _controls = (FormControl[]) _controlList.toArray( new FormControl[ _controlList.size() ] ); @@ -66,7 +66,7 @@ /** * get the control for this form Parameter (assuming it * has only one as for a text control - * @return + * @return the controls */ public FormControl getControl() { FormControl[] controls=getControls(); Modified: trunk/httpunit/src/com/meterware/httpunit/WebResponse.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebResponse.java 2008-05-13 09:28:41 UTC (rev 959) +++ trunk/httpunit/src/com/meterware/httpunit/WebResponse.java 2008-05-13 09:33:27 UTC (rev 960) @@ -1061,6 +1061,14 @@ private final URL _pageURL; private final WebClient _client; + /** + * getter for the WebClient + * @since 1.7 + * @return the web client for this WebResponse (if any) + */ + public WebClient getClient() { + return _client; + } private ScriptingHandler _scriptingHandler; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 09:28:45
|
Revision: 959 http://httpunit.svn.sourceforge.net/httpunit/?rev=959&view=rev Author: wolfgang_fahl Date: 2008-05-13 02:28:41 -0700 (Tue, 13 May 2008) Log Message: ----------- not for release notes - finalized previous change Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/HeaderOnlyWebRequest.java Modified: trunk/httpunit/src/com/meterware/httpunit/HeaderOnlyWebRequest.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HeaderOnlyWebRequest.java 2008-05-13 09:25:29 UTC (rev 958) +++ trunk/httpunit/src/com/meterware/httpunit/HeaderOnlyWebRequest.java 2008-05-13 09:28:41 UTC (rev 959) @@ -32,7 +32,7 @@ * * @author <a href="mailto:rus...@ht...">Russell Gold</a> **/ -public abstract class HeaderOnlyWebRequest extends WebRequest { +public class HeaderOnlyWebRequest extends WebRequest { /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 09:25:32
|
Revision: 958 http://httpunit.svn.sourceforge.net/httpunit/?rev=958&view=rev Author: wolfgang_fahl Date: 2008-05-13 02:25:29 -0700 (Tue, 13 May 2008) Log Message: ----------- Feature request [1956241 ] Need Delete/OptionsMethodWebRequest by Dave Copeland Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/HeadMethodWebRequest.java trunk/httpunit/src/com/meterware/httpunit/HeaderOnlyWebRequest.java trunk/httpunit/src/com/meterware/httpunit/WebRequest.java Modified: trunk/httpunit/src/com/meterware/httpunit/HeadMethodWebRequest.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HeadMethodWebRequest.java 2008-05-13 09:06:21 UTC (rev 957) +++ trunk/httpunit/src/com/meterware/httpunit/HeadMethodWebRequest.java 2008-05-13 09:25:29 UTC (rev 958) @@ -5,7 +5,7 @@ /******************************************************************************************************************** * $Id$ * - * Copyright (c) 2002, Russell Gold + * Copyright (c) 2002-2008, 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 @@ -37,6 +37,7 @@ */ public HeadMethodWebRequest( String urlString ) { super( urlString ); + this.setMethod("HEAD"); } @@ -47,10 +48,7 @@ */ public HeadMethodWebRequest( URL urlBase, String urlString ) { super( urlBase, urlString ); + this.setMethod("HEAD"); } - - public String getMethod() { - return "HEAD"; - } } Modified: trunk/httpunit/src/com/meterware/httpunit/HeaderOnlyWebRequest.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HeaderOnlyWebRequest.java 2008-05-13 09:06:21 UTC (rev 957) +++ trunk/httpunit/src/com/meterware/httpunit/HeaderOnlyWebRequest.java 2008-05-13 09:25:29 UTC (rev 958) @@ -48,6 +48,13 @@ throw new RuntimeException( "Programming error: " + e ); // should never happen } } + + /** + * @param method the method to set + */ + public void setMethod(String method) { + this.method = method; + } //-------------------------------- protected members --------------------------- Modified: trunk/httpunit/src/com/meterware/httpunit/WebRequest.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebRequest.java 2008-05-13 09:06:21 UTC (rev 957) +++ trunk/httpunit/src/com/meterware/httpunit/WebRequest.java 2008-05-13 09:25:29 UTC (rev 958) @@ -184,12 +184,19 @@ /** - * Returns the HTTP method defined for this request. - **/ - abstract - public String getMethod(); + * the HTTP method defined for this request e.g. DELETE,OPTIONS,HEAD + */ + protected String method; + + /** + * @return the method + */ + public String getMethod() { + return method; + } + /** * Returns the query string defined for this request. The query string is sent to the HTTP server as part of * the request header. This default implementation returns an empty string. @@ -569,6 +576,7 @@ } return null; } + } //======================================== class JavaScriptURLStreamHandler ============================================ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 09:06:23
|
Revision: 957 http://httpunit.svn.sourceforge.net/httpunit/?rev=957&view=rev Author: wolfgang_fahl Date: 2008-05-13 02:06:21 -0700 (Tue, 13 May 2008) Log Message: ----------- not for release notes: jar rebuild and release notes update Modified Paths: -------------- trunk/httpunit/doc/release_notes.html trunk/httpunit/lib/httpunit.jar trunk/httpunit/lib/httpunit_uncompressed.jar Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-05-13 08:58:23 UTC (rev 956) +++ trunk/httpunit/doc/release_notes.html 2008-05-13 09:06:21 UTC (rev 957) @@ -116,6 +116,9 @@ The following list of changes has been extracted from this subversion log with patch and subversion repository links being inserted. <ol> + <li>bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1954311&group_id=6550&atid=106550">1954311</a> ] WebForm.setParameter throws NullPointerException on textarea by Matthew O. Smith fixed + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=956">r956</a>) + </li> <li>patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=884146&group_id=6550&atid=306550">884146</a> + refactoring around handling events (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=839">r839</a>) </li> Modified: trunk/httpunit/lib/httpunit.jar =================================================================== (Binary files differ) Modified: trunk/httpunit/lib/httpunit_uncompressed.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 08:58:30
|
Revision: 956 http://httpunit.svn.sourceforge.net/httpunit/?rev=956&view=rev Author: wolfgang_fahl Date: 2008-05-13 01:58:23 -0700 (Tue, 13 May 2008) Log Message: ----------- bug report [ 1954311 ] WebForm.setParameter throws NullPointerException on textarea by Matthew O. Smith fixed Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/FormControl.java trunk/httpunit/test/com/meterware/httpunit/WebFormTest.java Modified: trunk/httpunit/src/com/meterware/httpunit/FormControl.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-05-12 17:15:05 UTC (rev 955) +++ trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-05-13 08:58:23 UTC (rev 956) @@ -760,7 +760,10 @@ setValue( (String) values.get(0) ); values.remove(0); } - if (!(oldValue.equals( getValue() ))) sendOnChangeEvent(); + boolean same=oldValue==null && getValue()==null; + if (oldValue!=null) + same=oldValue.equals( getValue()); + if (!same) sendOnChangeEvent(); } Modified: trunk/httpunit/test/com/meterware/httpunit/WebFormTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebFormTest.java 2008-05-12 17:15:05 UTC (rev 955) +++ trunk/httpunit/test/com/meterware/httpunit/WebFormTest.java 2008-05-13 08:58:23 UTC (rev 956) @@ -302,7 +302,36 @@ assertEquals( "", request.getParameter( "typeless" ) ); } + /** + * [ httpunit-Bugs-1954311 ] Set the value of a text area. Currently fails + * if the textarea is empty to begin with. + * by m0smith + * + * @throws Exception on failure + */ + public void testTextArea() throws Exception { + String fieldName = "comments"; + String comment = "My what a lovely dress that is"; + // Setting defaultValue to something other than an empty string makes + // this test case pass. + String defaultValue = ""; + defineWebPage("Default", "<form method=POST action = \"/servlet/Login\">" + "<textarea name='" + fieldName + + "' row='10' cols='20'>" + defaultValue + "</textarea>" + + "<br><Input type=submit value = \"Submit\">" + + "</form>"); + + WebResponse page = _wc.getResponse(getHostPath() +"/Default.html"); + WebForm form = page.getForms()[0]; + form.setParameter(fieldName, comment); // THIS LINE FAILS + + assertEquals(1, form.getParameterNames().length); + + WebRequest request = form.getRequest(); + assertEquals(comment, request.getParameter(fieldName)); + + } + public void testTableForm() throws Exception { defineWebPage( "Default", "<form method=POST action = \"/servlet/Login\">" + "<table summary=\"\"><tr><td>" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2008-05-12 17:18:21
|
Revision: 955 http://httpunit.svn.sourceforge.net/httpunit/?rev=955&view=rev Author: russgold Date: 2008-05-12 10:15:05 -0700 (Mon, 12 May 2008) Log Message: ----------- more release note cleanup Modified Paths: -------------- trunk/httpunit/doc/release_notes.html Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-05-06 07:24:17 UTC (rev 954) +++ trunk/httpunit/doc/release_notes.html 2008-05-12 17:15:05 UTC (rev 955) @@ -25,7 +25,12 @@ Thanks to Stefan H\xFCbner for supplying a patch for URL-decoding of parameters in ServletUnit Thanks to Archimedes Trajano for supplying code to support non-JSSE SSL providers Thanks to Bobby Abraham for adding the capability of deleting a cookie manually -Thanks for Rafal Krzewski for adding special handling for form actions containing a parameter named "action." +Thanks to Rafal Krzewski for adding special handling for form actions containing a parameter named "action." +Thanks to Michael Rudolf for adding support for connection and read timeouts. +Thanks to Richard Lee for supporting xy parameter submission for unnamed image buttons. +Thanks to Laurent Wozniak for address the handling of expired cookies +Thanks to Matthew O. Smith for adding more sophisticated logging to ServletUnit +Thanks to Mattias Jiderhamn for adding Javascript support for arbitrary attributes <h4>Notes:</h4> <ol> @@ -64,7 +69,9 @@ <li>bug #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1705925&group_id=6550&atid=106550">1705925</a> URL-encoded parameter values were not decoded properly if HttpUnitOptions.setDefaultCharacterSet() is set to something different than ISO-8859-1</li> <li>bug #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1371204&group_id=6550&atid=106550">1371204</a> there was no way to change or delete a server-supplied cookie from a test</li> <li>bug #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1843978&group_id=6550&atid=106550">1843978</a> the value of a SELECT control could not be set if the web page defined a namespace URI</li> + <li>bug #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1277797&group_id=6550&atid=106550">1277797</a> expired cookies are now removed from the client session</li> <li>patch #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155792&group_id=6550&atid=306550">1155792</a> could not set the action for a form if its original action had a parameter named "action" </li> + <li>patch #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1443333&group_id=6550&atid=306550">1443333</a> unnamed image buttons now submit positions as "x" and "y"</li> </ol> <h4>Additions:</h4> <h5> Content and Parsing:</h5> @@ -78,18 +85,25 @@ by a firewall or proxy server</li> <li>Added <a href="api/com/meterware/httpunit/HttpsProtocolSupport.html#useProvider(java.lang.String,%20java.lang.String)">HttpsProtocolSupport.useProvider</a> to override the default selection of the JSSE for SSL support</li> <li>Added <a href="api/com/meterware/httpunit/HttpsProtocolSupport.html#useIBM()">HttpsProtocolSupport.useIBM</a> to select the SSL support provided by IBM WebSphere (which must be in the classpath)</li> - <li></li> + <li>patch #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1531005&group_id=6550&atid=306550">1531005</a> getElementsWithAttribute should now work with most attribute names</li> <li>27-Mar-2006 Created a custom HttpUnit DOM</li> + <li>patch #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1518901&group_id=6550&atid=306550">1518901</a> added methods to control connection and read timeouts.</li> + <li>patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1415415&group_id=6550&atid=306550">1415415</a> added (mime types for tiff and pdf)</li> </ol> +<h5>Javascript support</h5> +<ol> + <li>patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1653410&group_id=6550&atid=306550">1653410</a> added support for arbitrary element attributes</li> + +</ol> <h5>ServletUnit</h5> <ol> <li>ServletUnitHttpRequest.getDateHeader() has been implemented; previously it always returned -1</li> + <li>patch #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1864072&group_id=6550&atid=106550">1864072</a> now log to a user-specified output stream</li> </ol> <h5>Pseudoserver:</h5> <ol> - <li> -31-Mar-2006: Added WebResource.suppressAutomaticContentTypeHeader to permit generation of responses without the - Content-Type header.</li> + <li>Added WebResource.suppressAutomaticContentTypeHeader to permit generation of responses without the Content-Type header.</li> + <li>Improved debugging messages and handle response timeouts.</li> </ol> <h4>Acknowledgements</h4> Thanks to the very many people that have supplied bugfixed and patches from 2005 to 2008 - please follow @@ -102,81 +116,6 @@ The following list of changes has been extracted from this subversion log with patch and subversion repository links being inserted. <ol> - <li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=885326&group_id=6550&atid=206550">885326</a> checked but no go - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=811">r811</a>) - </li> - <li>SR <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1288796&group_id=6550&atid=206550">1288796</a> - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=812">r812</a>) - </li> - <li>test for Patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1838699&group_id=6550&atid=306550">1838699</a>. - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=813">r813</a>) - </li> - <li>Patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1531005&group_id=6550&atid=306550">1531005</a>. - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=814">r814</a>) - </li> - <li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1518901&group_id=6550&atid=306550">patch 1518901</a> - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=815">r815</a>) - </li> - <li>patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1443333&group_id=6550&atid=306550">1443333</a> and some improved javadoc - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=816">r816</a>) - </li> - <li>[ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1333390&group_id=6550&atid=306550">1333390</a> ] patch for bug 1277797 - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=817">r817</a>) - </li> - <li>update website definition to point to subversion repository, list Wolfgang as committer - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=818">r818</a>) - </li> - <li>fix Wolfgang's email address - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=819">r819</a>) - </li> - <li>test proposal for Patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1653410&group_id=6550&atid=306550">1653410</a> - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=820">r820</a>) - </li> - <li>added test for iFrame problem - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=821">r821</a>) - </li> - <li>added stub for testCreateElement - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=823">r823</a>) - </li> - <li>debug of java.net.MalformedURLException problems - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=824">r824</a>) - </li> - <li>improvements by Mark Childerson as mailed in<br />Message-ID: <E1J...@ma...> - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=825">r825</a>) - </li> - <li>PseudoServer enhancements: better debug messages, handle request timeout - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=826">r826</a>) - </li> - <li>isEclipse added - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=827">r827</a>) - </li> - <li>error handling improved - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=828">r828</a>) - </li> - <li>javadoc and error handling - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=829">r829</a>) - </li> - <li>setProxy fix - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=830">r830</a>) - </li> - <li>null handling for openNewWindow - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=832">r832</a>) - </li> - <li>Scriptable interface - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=833">r833</a>) - </li> - <li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1864072&group_id=6550&atid=106550">1864072</a> patch by Matt - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=834">r834</a>) - </li> - <li>patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1653410&group_id=6550&atid=306550">1653410</a> added - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=836">r836</a>) - </li> - <li>event and onchange parts of patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1653410&group_id=6550&atid=306550">1653410</a> - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=837">r837</a>) - </li> - <li>patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1415415&group_id=6550&atid=306550">1415415</a> added (mime types for tiff and pdf) - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=838">r838</a>) - </li> <li>patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=884146&group_id=6550&atid=306550">884146</a> + refactoring around handling events (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=839">r839</a>) </li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-06 07:24:19
|
Revision: 954 http://httpunit.svn.sourceforge.net/httpunit/?rev=954&view=rev Author: wolfgang_fahl Date: 2008-05-06 00:24:17 -0700 (Tue, 06 May 2008) Log Message: ----------- not for release notes: jars rebuilt Modified Paths: -------------- trunk/httpunit/lib/httpunit.jar trunk/httpunit/lib/httpunit_uncompressed.jar Modified: trunk/httpunit/lib/httpunit.jar =================================================================== (Binary files differ) Modified: trunk/httpunit/lib/httpunit_uncompressed.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-06 07:18:36
|
Revision: 953 http://httpunit.svn.sourceforge.net/httpunit/?rev=953&view=rev Author: wolfgang_fahl Date: 2008-05-06 00:18:34 -0700 (Tue, 06 May 2008) Log Message: ----------- improved example to calculate distances by default Modified Paths: -------------- trunk/httpunit/examples/GoogleMapsExample.java Modified: trunk/httpunit/examples/GoogleMapsExample.java =================================================================== --- trunk/httpunit/examples/GoogleMapsExample.java 2008-05-02 16:01:23 UTC (rev 952) +++ trunk/httpunit/examples/GoogleMapsExample.java 2008-05-06 07:18:34 UTC (rev 953) @@ -22,6 +22,7 @@ import java.io.FileWriter; import java.io.StringReader; import java.io.Writer; +import java.text.NumberFormat; import java.util.StringTokenizer; import javax.xml.parsers.DocumentBuilder; @@ -55,7 +56,7 @@ * @param destPoint */ public void getRouteAsGPX(String startPoint,String destPoint, String filename,boolean withDisplay) throws Exception { - String kml=getRouteFromGoogleMaps(startPoint,destPoint,withDisplay); + String kml=getRouteFromGoogleMaps(startPoint,destPoint,withDisplay,false); if (DEBUG) { System.out.println(kml); } @@ -174,30 +175,51 @@ } return gpxdoc; } + /** + * the url to use + */ + public static String url="http://maps.google.com/maps"; + /** + * the directions string to look for + */ + public static String directions="directions"; + + /** + This is how to use the example in germany: + + GoogleMapsExample.url="http://maps.google.de/maps"; + GoogleMapsExample.directions="Route berechnen"; + */ + /** * get a route from google maps with the given start and destination points * @param startPoint * @param destPoint * @param withDisplay + * @param asKML */ - public String getRouteFromGoogleMaps(String startPoint,String destPoint, boolean withDisplay) throws Exception { - // direct call first - String url="http://maps.google.com/maps"; + public String getRouteFromGoogleMaps(String startPoint,String destPoint, boolean withDisplay, boolean asKML) throws Exception { // and now indirectly // 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( url); + WebRequest request = new GetMethodWebRequest(url); request.setParameter("output", "html"); WebResponse response = wc.getResponse( request ); if (withDisplay && DEBUG) BrowserDisplayer.showResponseInBrowser(response); - // find the link which contains the string "HttpUnit" and click it - WebLink httpunitLink = response.getFirstMatchingLink( WebLink.MATCH_CONTAINED_TEXT, "directions" ); - response = httpunitLink.click(); + // find the link which contains the string for directions and click it + WebLink directionsLink = response.getFirstMatchingLink( WebLink.MATCH_CONTAINED_TEXT, directions); + if (directionsLink==null) { + System.err.println("could not find "+directions+" in response"); + if (DEBUG) + BrowserDisplayer.showResponseInBrowser(response); + System.exit(1); + } + response = directionsLink.click(); if (withDisplay && DEBUG) BrowserDisplayer.showResponseInBrowser(response); WebForm lookupForm = response.getFormWithID("d_form"); @@ -207,16 +229,45 @@ response = wc.getResponse( request ); if (withDisplay) BrowserDisplayer.showResponseInBrowser(response); - // request.setParameter("output", "kml"); - FormParameter parameter = lookupForm.getParameter( "output" ); - FormControl outputControl=parameter.getControl(); - outputControl.setAttribute("value", "kml"); - response = wc.getResponse( request ); - if (withDisplay && DEBUG) - BrowserDisplayer.showResponseInBrowser(response); + if (asKML) { + // request.setParameter("output", "kml"); + FormParameter parameter = lookupForm.getParameter( "output" ); + FormControl outputControl=parameter.getControl(); + outputControl.setAttribute("value", "kml"); + response = wc.getResponse( request ); + if (withDisplay && DEBUG) + BrowserDisplayer.showResponseInBrowser(response); + } return (response.getText()); } + /** + * get the distance between to given Zip codes + * @param + */ + public String getDistance(String startPoint, String endPoint, boolean withDisplay) throws Exception { + String route=getRouteFromGoogleMaps(startPoint,endPoint,withDisplay,false); + String [] driveLocale={"Drive:","Fahrt:"}; + String [] unitLocale ={"mi","km"}; + for (int i=0;i<driveLocale.length;i++) { + int drivePos=route.indexOf(driveLocale[i]); + if (drivePos>0) { + String driveString=route.substring(drivePos); + int unitPos=driveString.indexOf(unitLocale[i]); + if (unitPos>0) { + String distanceString=driveString.substring(1, unitPos+unitLocale[i].length()); + int divPos; + while ((divPos=distanceString.indexOf("<div>"))>0) { + distanceString=distanceString.substring(divPos+5); + } + distanceString=distanceString.replace(" "," "); + return distanceString; + } + } + } + return "?"; + } + /** * Start the Route as GPX converter with the given command line parameters * display usage with and example if no parameters are given @@ -225,9 +276,13 @@ public static void main( String[] params ) { try { if (params.length < 3) { - System.out.println( "Usage: java RouteAsGPX [from] [to] [filename] [nodisplay]" ); - System.out.println( ""); - String[] defaultParams={"sfo","94526","sfoexample.gpx"}; + System.out.println( "Usage: java RouteAsGPX [from] [to] ([filename]|'distance') [nodisplay]" ); + System.out.println( " e.g. java RouteAsGPX sfo 94526 sfoexample.gpx"); + System.out.println( " to get the route as a Garmin compatible GPX file"); + System.out.println( " e.g. java RouteAsGPX sfo 94526 distance"); + System.out.println( " to calculate the distance"); + String[] defaultParams={"sfo","94526","distance"}; + // defaultParams={"sfo","94526","sfoexample.gpx"}; params=defaultParams; System.out.println( "will demonstrate usage with the route "+defaultParams[0]+" - "+defaultParams[1]+" and store to "+defaultParams[2]); } @@ -235,8 +290,16 @@ boolean withDisplay=true; if (params.length>=4) withDisplay=false; - routeAsGPX.getRouteAsGPX(params[0], params[1], params[2],withDisplay); - + String startPoint=params[0]; + String endPoint =params[1]; + String filename =params[2]; + if (filename.equals("distance")) { + String distanceS=routeAsGPX.getDistance(startPoint, endPoint, withDisplay); + // String distanceS=NumberFormat.getInstance().format(distance); + System.out.println("The distance between "+startPoint+" and "+endPoint+" is "+distanceS); + } else { + routeAsGPX.getRouteAsGPX(startPoint, endPoint, filename,withDisplay); + } } catch (Exception e) { System.err.println( "Exception: " + e ); e.printStackTrace(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-02 16:01:37
|
Revision: 952 http://httpunit.svn.sourceforge.net/httpunit/?rev=952&view=rev Author: wolfgang_fahl Date: 2008-05-02 09:01:23 -0700 (Fri, 02 May 2008) Log Message: ----------- new Example using GoogleMaps Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/FormControl.java trunk/httpunit/src/com/meterware/httpunit/FormParameter.java trunk/httpunit/src/com/meterware/httpunit/WebForm.java Added Paths: ----------- trunk/httpunit/examples/GoogleMapsExample.java Added: trunk/httpunit/examples/GoogleMapsExample.java =================================================================== --- trunk/httpunit/examples/GoogleMapsExample.java (rev 0) +++ trunk/httpunit/examples/GoogleMapsExample.java 2008-05-02 16:01:23 UTC (rev 952) @@ -0,0 +1,245 @@ +/******************************************************************************************************************** + * $Id: Cookie.java 859 2008-03-31 10:17:30Z wolfgang_fahl $ + * + * Copyright (c) 2008, Wolfgang Fahl, BITPlan GmbH (http://www.bitplan.com) + * + * 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.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.StringReader; +import java.io.Writer; +import java.util.StringTokenizer; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.apache.xml.serialize.DOMSerializer; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.XMLSerializer; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +import com.meterware.httpunit.*; +/** + * get a Route from Google Maps and convert it as a GPX file + * useable by Garmin tracking devices - can be imported in MapSource software then ... + * + */ +public class GoogleMapsExample { + + /** + * shall we show debug information? + */ + private boolean DEBUG=true; + + /** + * get a Route description as a Garmin compatible GPX file + * @param startPoint + * @param destPoint + */ + public void getRouteAsGPX(String startPoint,String destPoint, String filename,boolean withDisplay) throws Exception { + String kml=getRouteFromGoogleMaps(startPoint,destPoint,withDisplay); + if (DEBUG) { + System.out.println(kml); + } + // http://wiki.openstreetmap.org/index.php/JOSM + // here is a so called open source kml to gpx converter + // http://www.fish-track.com/?page_id=3 + Document gpxdoc=convertKMLtoGPX(kml); + // output the result + xmlSerialize(gpxdoc,filename); + } + + /** + * create the xml output for the given document + * @param document + * @param filename + * @throws Exception + */ + public void xmlSerialize(Document document,String filename) throws Exception { + OutputFormat outputOptions = new OutputFormat(); + // outputOptions.setOmitXMLDeclaration(true); + outputOptions.setIndent( 4 ); + outputOptions.setMethod( "xml" ); + //if (System.getProperty("os.name").startsWith("Windows")) { + outputOptions.setEncoding("ISO-8859-1"); + Writer writer = new BufferedWriter(new FileWriter(new File(filename))); + DOMSerializer serializer = new XMLSerializer( writer,outputOptions ); + serializer.serialize( document ); + writer.close(); + } + + /** + * get the subnode with the given tagname + * @param parent + * @param tagName + * @return + */ + public Element getSubNode(Element parent,String tagName, boolean throwException) { + NodeList subNodes=parent.getElementsByTagName(tagName); + if (subNodes.getLength()!=1) { + if (throwException) + throw new RuntimeException("getSubNode failed for "+parent+" expected 1 child with tag name '"+tagName+"' but got "+subNodes.getLength()); + else + return null; + } + return (Element)subNodes.item(0); + } + + /** + * get the latitude and longitude from a route point + * @param kmlRoutePoint + * @return + */ + public String[] extractCoordinates(Element kmlRoutePoint) { + String[] result=new String[2]; + Element point=getSubNode(kmlRoutePoint,"Point",false); + if (point==null) + return null; + Element coordNode=getSubNode(point,"coordinates",true); + String coords=coordNode.getTextContent(); + StringTokenizer coordSplitter=new StringTokenizer(coords,",",false); + if (coordSplitter.countTokens()<=2) { + throw new RuntimeException("extract coordinates failed for "+kmlRoutePoint+" expected at least two coordinates but got "+coordSplitter.countTokens()+" '"+coords+"'"); + } + result[0]=coordSplitter.nextToken(); + result[1]=coordSplitter.nextToken(); + return result; + } + + /** + * convert the given kml file to gpx format + * @param kml - the kml version of the file + * @return + */ + public Document convertKMLtoGPX(String kml) throws Exception { + DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); + DocumentBuilder builder= factory.newDocumentBuilder(); + Document kmldoc = builder.parse(new InputSource(new StringReader(kml)) ); + Document gpxdoc = builder.newDocument(); + String comment="Converted by httpunit GoogleMapsExample"; + gpxdoc.appendChild(gpxdoc.createComment(comment)); + + org.w3c.dom.Element root = gpxdoc.createElement("gpx"); + root.setAttribute("xmlns", "http://www.topografix.com/GPX/1/1"); + root.setAttribute("creator","KML2GPX Example by BITPlan"); + root.setAttribute("version","1.1"); + gpxdoc.appendChild(root); + + org.w3c.dom.Element metadata = gpxdoc.createElement("metadata"); + org.w3c.dom.Element metadatalink = gpxdoc.createElement("link"); + metadatalink.setAttribute("href","http://www.bitplan.com"); + metadata.appendChild(metadatalink); + org.w3c.dom.Element metadatatext = gpxdoc.createElement("text"); + metadatatext.setTextContent("BITPlan GmbH, Willich, Germany"); + metadatalink.appendChild(metadatatext); + root.appendChild(metadata); + + org.w3c.dom.Element route = gpxdoc.createElement("rte"); + root.appendChild(route); + NodeList routePoints=kmldoc.getElementsByTagName("Placemark"); + for (int i=0;i<routePoints.getLength();i++) { + Element kmlRoutePoint=(Element)routePoints.item(i); + String name=getSubNode(kmlRoutePoint,"name",true).getTextContent(); + if (DEBUG) + System.out.println("found route point "+i+": "+name); + + String coords[]=extractCoordinates(kmlRoutePoint); + if (coords!=null) { + org.w3c.dom.Element routePoint = gpxdoc.createElement("rtept"); + routePoint.setAttribute("lon", coords[0] ); + routePoint.setAttribute("lat", coords[1] ); + org.w3c.dom.Element routePointName=gpxdoc.createElement("name"); + routePointName.setTextContent(name); + routePoint.appendChild(routePointName); + route.appendChild(routePoint); + } + } + return gpxdoc; + } + + /** + * get a route from google maps with the given start and destination points + * @param startPoint + * @param destPoint + * @param withDisplay + */ + public String getRouteFromGoogleMaps(String startPoint,String destPoint, boolean withDisplay) throws Exception { + // direct call first + String url="http://maps.google.com/maps"; + // and now indirectly + // 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( url); + request.setParameter("output", "html"); + WebResponse response = wc.getResponse( request ); + if (withDisplay && DEBUG) + BrowserDisplayer.showResponseInBrowser(response); + + // find the link which contains the string "HttpUnit" and click it + WebLink httpunitLink = response.getFirstMatchingLink( WebLink.MATCH_CONTAINED_TEXT, "directions" ); + response = httpunitLink.click(); + if (withDisplay && DEBUG) + BrowserDisplayer.showResponseInBrowser(response); + WebForm lookupForm = response.getFormWithID("d_form"); + request = lookupForm.getRequest(); + request.setParameter( "saddr", startPoint ); + request.setParameter( "daddr", destPoint ); + response = wc.getResponse( request ); + if (withDisplay) + BrowserDisplayer.showResponseInBrowser(response); + // request.setParameter("output", "kml"); + FormParameter parameter = lookupForm.getParameter( "output" ); + FormControl outputControl=parameter.getControl(); + outputControl.setAttribute("value", "kml"); + response = wc.getResponse( request ); + if (withDisplay && DEBUG) + BrowserDisplayer.showResponseInBrowser(response); + return (response.getText()); + } + + /** + * Start the Route as GPX converter with the given command line parameters + * display usage with and example if no parameters are given + * @param params + */ + public static void main( String[] params ) { + try { + if (params.length < 3) { + System.out.println( "Usage: java RouteAsGPX [from] [to] [filename] [nodisplay]" ); + System.out.println( ""); + String[] defaultParams={"sfo","94526","sfoexample.gpx"}; + params=defaultParams; + System.out.println( "will demonstrate usage with the route "+defaultParams[0]+" - "+defaultParams[1]+" and store to "+defaultParams[2]); + } + GoogleMapsExample routeAsGPX=new GoogleMapsExample(); + boolean withDisplay=true; + if (params.length>=4) + withDisplay=false; + routeAsGPX.getRouteAsGPX(params[0], params[1], params[2],withDisplay); + + } catch (Exception e) { + System.err.println( "Exception: " + e ); + e.printStackTrace(); + } + } +} Modified: trunk/httpunit/src/com/meterware/httpunit/FormControl.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-05-02 10:11:40 UTC (rev 951) +++ trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-05-02 16:01:23 UTC (rev 952) @@ -162,7 +162,7 @@ /** * Returns true if this control is hidden. **/ - boolean isHidden() { + public boolean isHidden() { return false; } @@ -365,6 +365,12 @@ } + /** + * return the FormControl for the given parameter node in a form + * @param form - the form in which the parameter is defined + * @param node - the node in which the parameter is defined + * @return the form control + */ static FormControl newFormParameter( WebForm form, Node node ) { if (node.getNodeType() != Node.ELEMENT_NODE) { return null; @@ -834,6 +840,9 @@ } } +/** + * a hidden text field + */ class HiddenFieldFormControl extends TextFieldFormControl { public String getType() { @@ -854,7 +863,7 @@ } - boolean isHidden() { + public boolean isHidden() { return true; } } Modified: trunk/httpunit/src/com/meterware/httpunit/FormParameter.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-05-02 10:11:40 UTC (rev 951) +++ trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-05-02 16:01:23 UTC (rev 952) @@ -33,7 +33,7 @@ * * @author <a href="mailto:rus...@ht...">Russell Gold</a> **/ -class FormParameter { +public class FormParameter { private FormControl[] _controls; @@ -54,10 +54,27 @@ } - private FormControl[] getControls() { + /** + * get the controls for this form Parameter + * @return + */ + public FormControl[] getControls() { if (_controls == null) _controls = (FormControl[]) _controlList.toArray( new FormControl[ _controlList.size() ] ); return _controls; } + + /** + * get the control for this form Parameter (assuming it + * has only one as for a text control + * @return + */ + public FormControl getControl() { + FormControl[] controls=getControls(); + if (controls.length!=1) { + throw new RuntimeException("getControl can only be called if the number of controls is 1 but it is "+controls.length+" you might want to use getControls instead"); + } + return controls[0]; + } Object getScriptableObject() { @@ -225,7 +242,7 @@ return true; } - + public boolean isHiddenParameter() { FormControl[] controls = getControls(); for (int i = 0; i < controls.length; i++) { Modified: trunk/httpunit/src/com/meterware/httpunit/WebForm.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-05-02 10:11:40 UTC (rev 951) +++ trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-05-02 16:01:23 UTC (rev 952) @@ -916,7 +916,12 @@ } - private FormParameter getParameter( String name ) { + /** + * get the form parameter with the given name + * @param name + * @return the form parameter with this name + */ + public FormParameter getParameter( String name ) { final FormParameter parameter = ((FormParameter) getFormParameters().get( name )); return parameter != null ? parameter : UNKNOWN_PARAMETER; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-02 10:11:42
|
Revision: 951 http://httpunit.svn.sourceforge.net/httpunit/?rev=951&view=rev Author: wolfgang_fahl Date: 2008-05-02 03:11:40 -0700 (Fri, 02 May 2008) Log Message: ----------- javadoc warnings removed Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/BlockElement.java trunk/httpunit/src/com/meterware/httpunit/Button.java trunk/httpunit/src/com/meterware/httpunit/HTMLElementBase.java trunk/httpunit/src/com/meterware/httpunit/HTMLElementScriptable.java trunk/httpunit/src/com/meterware/httpunit/HttpException.java trunk/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java trunk/httpunit/src/com/meterware/httpunit/SubmitButton.java trunk/httpunit/src/com/meterware/httpunit/WebForm.java trunk/httpunit/src/com/meterware/httpunit/WebRequestSource.java trunk/httpunit/src/com/meterware/httpunit/WebResponse.java trunk/httpunit/src/com/meterware/httpunit/WebWindow.java trunk/httpunit/src/com/meterware/httpunit/cookies/CookieJar.java trunk/httpunit/src/com/meterware/httpunit/scripting/ScriptableDelegate.java Modified: trunk/httpunit/src/com/meterware/httpunit/BlockElement.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/BlockElement.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/BlockElement.java 2008-05-02 10:11:40 UTC (rev 951) @@ -127,8 +127,8 @@ /** * optional do the event if it's defined - * @param event - * @return + * @param eventScript - the script to work on + * @return true if the event script was handled */ public boolean doEventScript(String eventScript) { return this.getScriptingHandler().doEventScript(eventScript); @@ -138,7 +138,7 @@ * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup * execute the script if it's assigned by calling doEvent for the script * @param eventName - * @return + * @return true if the event with the given name was handled */ public boolean handleEvent(String eventName) { return this.getScriptingHandler().handleEvent(eventName); Modified: trunk/httpunit/src/com/meterware/httpunit/Button.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/Button.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/Button.java 2008-05-02 10:11:40 UTC (rev 951) @@ -82,7 +82,9 @@ /** * the onClickSequence for this button - * @return + * @param x - the x position + * @param y - the y position + * @return if the onClickSequence was handled */ protected boolean doOnClickSequence(int x,int y) throws IOException, SAXException { verifyButtonEnabled(); @@ -104,9 +106,9 @@ /** * return the last result of verifyButtonEnabled or the - * intial enabled state derived from !isDisabled as originally setDisabled + * initial enabled state derived from !isDisabled as originally setDisabled * needed to fix bug report [ 1289151 ] Order of events in button.click() is wrong - * @return + * @return whether the button was originally enabled */ public boolean wasEnabled() { return _wasEnabled; Modified: trunk/httpunit/src/com/meterware/httpunit/HTMLElementBase.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HTMLElementBase.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/HTMLElementBase.java 2008-05-02 10:11:40 UTC (rev 951) @@ -84,8 +84,8 @@ /** * optional do the event if it's defined - * @param event - * @return + * @param eventScript + * @return true if the event script was run */ public boolean doEventScript(String eventScript) { return this.getScriptingHandler().doEventScript(eventScript); @@ -95,7 +95,7 @@ * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup * execute the script if it's assigned by calling doEvent for the script * @param eventName - * @return + * @return whether the event was handled */ public boolean handleEvent(String eventName) { return this.getScriptingHandler().handleEvent(eventName); Modified: trunk/httpunit/src/com/meterware/httpunit/HTMLElementScriptable.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HTMLElementScriptable.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/HTMLElementScriptable.java 2008-05-02 10:11:40 UTC (rev 951) @@ -63,7 +63,7 @@ /** * get the content of the given attribute * @param attributeName - * @return + * @return the attribute as a string */ public String getAttribute(String attributeName) { return _element.getAttribute(attributeName); @@ -90,7 +90,7 @@ * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup * execute the script if it's assigned by calling doEvent for the script * @param eventName - * @return + * @return whether the event with the givne name was handled */ public boolean handleEvent(String eventName) { // check whether onclick is activated Modified: trunk/httpunit/src/com/meterware/httpunit/HttpException.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HttpException.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/HttpException.java 2008-05-02 10:11:40 UTC (rev 951) @@ -107,7 +107,7 @@ /** * get the response Message of this http Exception - * @return + * @return the response message */ public String getResponseMessage() { return _responseMessage; Modified: trunk/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java 2008-05-02 10:11:40 UTC (rev 951) @@ -60,7 +60,7 @@ /** * are we running in the Eclipse IDE? - * @return + * @return whether we are running in the Eclipse environment */ public static boolean isEclipse() { StackTraceElement[] ste = new Throwable().getStackTrace(); @@ -185,7 +185,7 @@ /** * parse an InputStream to a string (for debugging) * @param is - * @return + * @return the string gotten from the inputString */ public static String parseISToString(java.io.InputStream is){ java.io.DataInputStream din = new java.io.DataInputStream(is); @@ -196,6 +196,7 @@ sb.append(line+"\n"); } }catch(Exception ex){ + // TODO handle exception properly here ex.getMessage(); }finally{ try{ Modified: trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java 2008-05-02 10:11:40 UTC (rev 951) @@ -803,7 +803,7 @@ * check whether the given node is a Web link by checking that * the node is of type "A" * @param node - the node to check - * @return + * @return whether the given node represents a web link */ public static boolean isWebLink( Node node ) { /* Modified: trunk/httpunit/src/com/meterware/httpunit/SubmitButton.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/SubmitButton.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/SubmitButton.java 2008-05-02 10:11:40 UTC (rev 951) @@ -201,7 +201,7 @@ /** * addValues if not disabled and pressed * @param processor - the ParameterProcessor used - * @characterSet - the active character set + * @param characterSet - the active character set * @throws IOException if addValues fails */ protected void addValues( ParameterProcessor processor, String characterSet ) throws IOException { Modified: trunk/httpunit/src/com/meterware/httpunit/WebForm.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-05-02 10:11:40 UTC (rev 951) @@ -308,8 +308,8 @@ * Creates and returns a web request which will simulate the submission of this form by pressing the specified button. * If the button is null, simulates the pressing of the default button. * @param button - the submitbutton to be pressed - may be null - * @param - x the x position - * @param - y the y position + * @param x - the x position + * @param y - the y position **/ public WebRequest getRequest( SubmitButton button, int x, int y ) { if (button == null) Modified: trunk/httpunit/src/com/meterware/httpunit/WebRequestSource.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebRequestSource.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/WebRequestSource.java 2008-05-02 10:11:40 UTC (rev 951) @@ -167,7 +167,7 @@ /** * get the relative URL for a weblink * change spaces to %20 - * @return + * @return the relative URL as a string */ protected String getRelativeURL() { String result = HttpUnitUtils.encodeSpaces( HttpUnitUtils.trimFragment( getDestination() ) ); @@ -243,7 +243,7 @@ * submit the given event for the given request * @param event * @param request - * @return + * @return the response for the submitted Request * @throws IOException * @throws SAXException */ @@ -267,8 +267,8 @@ /** * optional do the event if it's defined - * @param event - * @return + * @param eventScript - the script to handle + * @return whether the script was handled */ public boolean doEventScript(String eventScript) { return this.getScriptingHandler().doEventScript(eventScript); @@ -278,7 +278,7 @@ * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup * execute the script if it's assigned by calling doEvent for the script * @param eventName - * @return + * @return whether the event with the given name was handled */ public boolean handleEvent(String eventName) { return this.getScriptingHandler().handleEvent(eventName); Modified: trunk/httpunit/src/com/meterware/httpunit/WebResponse.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebResponse.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/WebResponse.java 2008-05-02 10:11:40 UTC (rev 951) @@ -726,7 +726,7 @@ /** * open a a new Window with the given name and relative URL * @param name - the name of the window - * @param relativeURL - the relative URL to be used + * @param relativeUrl - the relative URL to be used * @return the WebResponse as a DomWindowProxy */ public DomWindowProxy openNewWindow( String name, String relativeUrl ) throws IOException, SAXException { @@ -906,7 +906,7 @@ /** * Constructs a response object. - * @see [ 1159858 ] patch for RFE 1159844 (parsing intercepted pages) + * see [ 1159858 ] patch for RFE 1159844 (parsing intercepted pages) * @param frame the frame to hold the response * @param url the url from which the response was received * Modified: trunk/httpunit/src/com/meterware/httpunit/WebWindow.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebWindow.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/WebWindow.java 2008-05-02 10:11:40 UTC (rev 951) @@ -138,7 +138,7 @@ /** * Submits a web request and returns a response, using all state developed so far as stored in * cookies as requested by the server. - * @see patch [ 1155415 ] Handle redirect instructions which can lead to a loop + * see patch [ 1155415 ] Handle redirect instructions which can lead to a loop * @exception SAXException thrown if there is an error parsing the retrieved page * @return the WebResponse or null **/ Modified: trunk/httpunit/src/com/meterware/httpunit/cookies/CookieJar.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/cookies/CookieJar.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/cookies/CookieJar.java 2008-05-02 10:11:40 UTC (rev 951) @@ -185,7 +185,7 @@ /** * Returns the value of the specified cookie. - * @name - the name of the cookie to get the value for + * @param name - the name of the cookie to get the value for * @return the value of the cookie **/ public String getCookieValue( String name ) { Modified: trunk/httpunit/src/com/meterware/httpunit/scripting/ScriptableDelegate.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/scripting/ScriptableDelegate.java 2008-05-02 06:53:46 UTC (rev 950) +++ trunk/httpunit/src/com/meterware/httpunit/scripting/ScriptableDelegate.java 2008-05-02 10:11:40 UTC (rev 951) @@ -63,7 +63,7 @@ /** * Executes the specified scripted event. - * @parm eventScript - the eventScript to execute + * @param eventScript - the eventScript to execute **/ public boolean doEventScript( String eventScript ) { if (eventScript.length() == 0) return true; @@ -74,7 +74,7 @@ * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup * execute the script if it's assigned by calling doEvent for the script * @param eventName - * @return + * @return whether the event with the given name was handled */ public boolean handleEvent(String eventName) { String eventScript=(String)get(eventName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-02 07:06:21
|
Revision: 950 http://httpunit.svn.sourceforge.net/httpunit/?rev=950&view=rev Author: wolfgang_fahl Date: 2008-05-01 23:53:46 -0700 (Thu, 01 May 2008) Log Message: ----------- added BrowserDisplay example by Matt Smith and improved other examples somewhat Modified Paths: -------------- trunk/httpunit/examples/Example.java trunk/httpunit/examples/ExampleTest.java trunk/httpunit/examples/NearWords.java Added Paths: ----------- trunk/httpunit/examples/BrowserDisplayer.java Added: trunk/httpunit/examples/BrowserDisplayer.java =================================================================== --- trunk/httpunit/examples/BrowserDisplayer.java (rev 0) +++ trunk/httpunit/examples/BrowserDisplayer.java 2008-05-02 06:53:46 UTC (rev 950) @@ -0,0 +1,123 @@ +import com.meterware.httpunit.*; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; + + +/** + * This example is from http://m0smith.freeshell.org/blog-portletunit/2008/05/bare-bones-browser-launch-for-java-use + * @author Matthew O. Smith + * + */ +public class BrowserDisplayer { + /** + * Show the response in a browser. + * + * @param response + * the response + * @throws Exception + * on error + */ + public static void showResponseInBrowser(WebResponse response) throws Exception { + String text = response.getText(); + File f = File.createTempFile("httpUnit", ".html"); + f.deleteOnExit(); + PrintWriter fod = new PrintWriter(new FileOutputStream(f)); + fod.print("<head><base href=\"'http://localhost'/\"> </head>"); + fod.print(text); + fod.close(); + URL url = f.toURL(); + openURL(url); + } + + /** + * Bare Bones Browser Launch Version 1.5 (December 10, 2005) By Dem + * Pilafian. Supports: Mac OS X, GNU/Linux, Unix, Windows XP + * + * Example Usage: String url = "http://www.centerkey.com/"; + * BareBonesBrowserLaunch.openURL(url); Public Domain Software -- Free to + * Use as You Like + * + * @param url + * the url to open + * @throws ClassNotFoundException + * getting class + * @throws NoSuchMethodException + * yes + * @throws SecurityException + * well + * @throws InvocationTargetException + * trying to invloke + * @throws IllegalAccessException + * trying to access + * @throws IllegalArgumentException + * bad arguement + * @throws IOException + * opening window + * @throws InterruptedException waiting + */ + public static void openURL(URL url) throws ClassNotFoundException, NoSuchMethodException, + IllegalAccessException, InvocationTargetException, IOException, InterruptedException { + String osName = System.getProperty("os.name"); + + if (osName.startsWith("Mac OS")) { + Class fileMgr = Class.forName("com.apple.eio.FileManager"); + Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class }); + openURL.invoke(null, new Object[] {url.toString() }); + } else if (osName.startsWith("Windows")) { + String cmdLine = "rundll32 url.dll,FileProtocolHandler " + url.toString(); + Process exec = Runtime.getRuntime().exec(cmdLine); + exec.waitFor(); + } else { // assume Unix or Linux + String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" }; + String browser = null; + for (int count = 0; count < browsers.length && browser == null; count++) { if (Runtime.getRuntime().exec(new String[] {"which", browsers[count] }).waitFor() == 0) { browser = browsers[count]; } } if (browser == null) { throw new IllegalStateException("Could not find web browser"); } else { Runtime.getRuntime().exec(new String[] {browser, url.toString() }); + } + } + } + + /** + * open a given url indirectly + * @param params + */ + public static void main( String[] params ) { + try { + if (params.length < 1) { + System.out.println( "Usage: java BrowserDisplay [url]" ); + System.out.println( ""); + System.out.println( "will demonstrate usage with the url 'http://www.meterware.com' now ..."); + String[] defaultParams={"http://www.meterware.com"}; + params=defaultParams; + } + // direct call first + String url=params[0]; + openURL(new URL(url)); + // and now indirectly + // 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( url ); + WebResponse response = wc.getResponse( request ); + showResponseInBrowser(response); + + // find the link which contains the string "HttpUnit" and click it + WebLink httpunitLink = response.getFirstMatchingLink( WebLink.MATCH_CONTAINED_TEXT, "HttpUnit" ); + response = httpunitLink.click(); + showResponseInBrowser(response); + System.out.println("Your browser should show three pages now:"); + System.out.println("1. a direct invocation of "+url); + System.out.println("2. an indirect invocation of "+url+" via httpunit"); + System.out.println("3. the result httpunit clicking the httpunit link on 2."); + + + } catch (Exception e) { + System.err.println( "Exception: " + e ); + } +} +} Modified: trunk/httpunit/examples/Example.java =================================================================== --- trunk/httpunit/examples/Example.java 2008-04-30 20:53:46 UTC (rev 949) +++ trunk/httpunit/examples/Example.java 2008-05-02 06:53:46 UTC (rev 950) @@ -1,3 +1,4 @@ +/** everything you need to start is in the com.meterware.httpunit package **/ import com.meterware.httpunit.*; /** This is a simple example of using HttpUnit to read and understand web pages. **/ @@ -4,25 +5,26 @@ public class Example { - public static void main( String[] params ) { - try { - // create the conversation object which will maintain state for us - WebConversation wc = new WebConversation(); + 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 ); + // Obtain the main page on the meterware web site + String url="http://www.meterware.com"; + WebRequest request = new GetMethodWebRequest( url ); + 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(); + // 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" ); + // print out the number of links on the HttpUnit main page + System.out.println( "The HttpUnit main page '"+url+"' contains " + response.getLinks().length + " links" ); - } catch (Exception e) { - System.err.println( "Exception: " + e ); - } + } catch (Exception e) { + System.err.println( "Exception: " + e ); } + } } Modified: trunk/httpunit/examples/ExampleTest.java =================================================================== --- trunk/httpunit/examples/ExampleTest.java 2008-04-30 20:53:46 UTC (rev 949) +++ trunk/httpunit/examples/ExampleTest.java 2008-05-02 06:53:46 UTC (rev 950) @@ -9,69 +9,99 @@ public class ExampleTest extends TestCase { + /** + * run this testcase as a suite from the command line + * @param args - ignored + */ public static void main(String args[]) { junit.textui.TestRunner.run( suite() ); } + /** + * supply this test cases as part of a suite + * @return + */ public static Test suite() { return new TestSuite( ExampleTest.class ); } + /** + * constructor with name parameter needed for suite creation + * @param name + */ public ExampleTest( String name ) { super( name ); } + /** + * try getting a response for the given Conversation and Request + * show an error message if a 404 error appears + * @param conversation - the conversation to use + * @param request + * @return the response + * @throws an Exception if getting the response fails + */ + public WebResponse tryGetResponse(WebConversation conversation,WebRequest request) throws Exception { + WebResponse response=null; + try { + response = conversation.getResponse( request ); + } catch (HttpNotFoundException nfe) { + System.err.println("The URL '"+request.getURL()+"' is not active any more"); + throw nfe; + } + return response; + } - /** - * Verifies that the welcome page has exactly one form, with the single parameter, "name" - **/ - public void testWelcomePage() throws Exception { - WebConversation conversation = new WebConversation(); - WebRequest request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" ); - - WebResponse response = conversation.getResponse( request ); - WebForm forms[] = response.getForms(); - assertEquals( 1, forms.length ); - assertEquals( 1, forms[0].getParameterNames().length ); - assertEquals( "name", forms[0].getParameterNames()[0] ); - } + /** + * Verifies that the welcome page has exactly one form, with the single parameter, "name" + **/ + public void testWelcomePage() throws Exception { + WebConversation conversation = new WebConversation(); + WebRequest request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" ); + WebResponse response = tryGetResponse(conversation, request ); + + WebForm forms[] = response.getForms(); + assertEquals( 1, forms.length ); + assertEquals( 1, forms[0].getParameterNames().length ); + assertEquals( "name", forms[0].getParameterNames()[0] ); + } - /** - * Verifies that submitting the login form without entering a name results in a page - * containing the text "Login failed" - **/ - public void testBadLogin() throws Exception { - WebConversation conversation = new WebConversation(); - WebRequest request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" ); + /** + * Verifies that submitting the login form without entering a name results in a page + * containing the text "Login failed" + **/ + public void testBadLogin() throws Exception { + WebConversation conversation = new WebConversation(); + WebRequest request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" ); - WebResponse response = conversation.getResponse( request ); - WebForm loginForm = response.getForms()[0]; - request = loginForm.getRequest(); - response = conversation.getResponse( request ); - assertTrue( "Login not rejected", response.getText().indexOf( "Login failed" ) != -1 ); - } + WebResponse response = tryGetResponse(conversation, request ); + WebForm loginForm = response.getForms()[0]; + request = loginForm.getRequest(); + response = conversation.getResponse( request ); + assertTrue( "Login not rejected", response.getText().indexOf( "Login failed" ) != -1 ); + } - /** - * Verifies that submitting the login form with the name "master" results - * in a page containing the text "Top Secret" - **/ - public void testGoodLogin() throws Exception { - WebConversation conversation = new WebConversation(); - WebRequest request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" ); + /** + * Verifies that submitting the login form with the name "master" results + * in a page containing the text "Top Secret" + **/ + public void testGoodLogin() throws Exception { + WebConversation conversation = new WebConversation(); + WebRequest request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" ); - WebResponse response = conversation.getResponse( request ); - WebForm loginForm = response.getForms()[0]; - request = loginForm.getRequest(); - request.setParameter( "name", "master" ); - response = conversation.getResponse( request ); - assertTrue( "Login not accepted", response.getText().indexOf( "You made it!" ) != -1 ); + WebResponse response = tryGetResponse(conversation, request ); + WebForm loginForm = response.getForms()[0]; + request = loginForm.getRequest(); + request.setParameter( "name", "master" ); + response = conversation.getResponse( request ); + assertTrue( "Login not accepted", response.getText().indexOf( "You made it!" ) != -1 ); - assertEquals( "Page title", "Top Secret", response.getTitle() ); - } + assertEquals( "Page title", "Top Secret", response.getTitle() ); + } } Modified: trunk/httpunit/examples/NearWords.java =================================================================== --- trunk/httpunit/examples/NearWords.java 2008-04-30 20:53:46 UTC (rev 949) +++ trunk/httpunit/examples/NearWords.java 2008-05-02 06:53:46 UTC (rev 950) @@ -17,7 +17,11 @@ try { if (params.length < 1) { System.out.println( "Usage: java NearWords [pattern]" ); - System.out.println( "where [pattern] may contain '?' to match any character" ); + System.out.println( "where [pattern] may contain '?' to match any character" ); + System.out.println( ""); + System.out.println( "will demonstrate usage with the pattern 'test' now ..."); + String[] defaultParams={"test"}; + params=defaultParams; } WordSeeker seeker = new WordSeeker(); @@ -35,12 +39,19 @@ } - +/** + * subclass to seek words from the Merriam-Webster Online search + * as of 2008-05-02 + * + */ class WordSeeker { public WordSeeker() { try { - WebRequest request = new GetMethodWebRequest( "http://www.m-w.com/" ); + HttpUnitOptions.setScriptingEnabled(false); + String url="http://www.m-w.com/"; + System.out.println("visiting "+url); + WebRequest request = new GetMethodWebRequest( url ); response = conversation.getResponse( request ); } catch (Exception e) { throw new RuntimeException( "Error retrieving form: " + e ); @@ -49,35 +60,20 @@ public String[] getWordsMatching( String pattern ) throws SAXException, IOException, java.net.MalformedURLException { - WebForm lookupForm = getFormWithName( "dict" ); - WebRequest request = lookupForm.getRequest(); - request.setParameter( "va", pattern ); - request.setParameter( "book", "Dictionary" ); - response = conversation.getResponse( request ); - - return getOptionsFromResponse(); + System.out.println("getting Words matching '"+pattern+"'"); + WebForm lookupForm = response.getFormWithID("search_form"); + WebRequest request = lookupForm.getRequest(); + request.setParameter( "va", pattern ); + request.setParameter( "book", "Dictionary" ); + response = conversation.getResponse( request ); + return getOptionsFromResponse(); } - private WebConversation conversation = new WebConversation(); private WebResponse response; - private WebForm getFormWithName( String name ) throws SAXException { - WebForm[] forms = response.getForms(); - for (int i=0; i < forms.length; i++) { - Node formNode = forms[i].getDOMSubtree(); - NamedNodeMap nnm = formNode.getAttributes(); - Node nameNode = nnm.getNamedItem( "name" ); - if (nameNode == null) continue; - if (nameNode.getNodeValue().equalsIgnoreCase( name )) { - return forms[i]; - } - } - return null; - } - private String[] getOptionsFromResponse() throws SAXException { String[] words; WebForm[] forms = response.getForms(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2008-04-30 20:53:48
|
Revision: 949 http://httpunit.svn.sourceforge.net/httpunit/?rev=949&view=rev Author: russgold Date: 2008-04-30 13:53:46 -0700 (Wed, 30 Apr 2008) Log Message: ----------- Cleaning up release notes - part 1 Modified Paths: -------------- trunk/httpunit/doc/release_notes.html Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-04-30 13:46:58 UTC (rev 948) +++ trunk/httpunit/doc/release_notes.html 2008-04-30 20:53:46 UTC (rev 949) @@ -21,6 +21,12 @@ <h2>Revision History:</h2> <h3>Version 1.7 Released 2008-04-27</h3> +<h4>Acknowledgements:</h4> +Thanks to Stefan H\xFCbner for supplying a patch for URL-decoding of parameters in ServletUnit +Thanks to Archimedes Trajano for supplying code to support non-JSSE SSL providers +Thanks to Bobby Abraham for adding the capability of deleting a cookie manually +Thanks for Rafal Krzewski for adding special handling for form actions containing a parameter named "action." + <h4>Notes:</h4> <ol> <li>Upgraded NekoHTML to 1.9.6</li> @@ -51,17 +57,34 @@ handleEvent is now the method to call for handling events by name e.g. onchange, onmousedown, onclick, onmouseup, onblur, onfocus (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=839">r839</a>) </li> -</ol> +</ol> +<h4>Problems fixed:</h4> +<h5>Content and Parsing:</h5> +<ol> + <li>bug #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1705925&group_id=6550&atid=106550">1705925</a> URL-encoded parameter values were not decoded properly if HttpUnitOptions.setDefaultCharacterSet() is set to something different than ISO-8859-1</li> + <li>bug #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1371204&group_id=6550&atid=106550">1371204</a> there was no way to change or delete a server-supplied cookie from a test</li> + <li>bug #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1843978&group_id=6550&atid=106550">1843978</a> the value of a SELECT control could not be set if the web page defined a namespace URI</li> + <li>patch #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155792&group_id=6550&atid=306550">1155792</a> could not set the action for a form if its original action had a parameter named "action" </li> +</ol> <h4>Additions:</h4> <h5> Content and Parsing:</h5> <ol> <li>Basic authentication now can support authorization only after challenge and different passwords for different realms.</li> - <li>Added support for rudimentary (RFC 2109) digest authentication.</li> + <li>Added support for rudimentary (RFC 2109) digest authentication.</li> <li>Added "overrideContextType" property to ClientProperties to permit handling of files served with the wrong content type.</li> - <li>27-Mar-2006 Created a custom HttpUnit DOM</li> -</ol> + <li>patch #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=844084&group_id=6550&atid=306550">844084</a> added "sendReferer" property to ClientProperties to permit testing of sites when the referer header is blocked + by a firewall or proxy server</li> + <li>Added <a href="api/com/meterware/httpunit/HttpsProtocolSupport.html#useProvider(java.lang.String,%20java.lang.String)">HttpsProtocolSupport.useProvider</a> to override the default selection of the JSSE for SSL support</li> + <li>Added <a href="api/com/meterware/httpunit/HttpsProtocolSupport.html#useIBM()">HttpsProtocolSupport.useIBM</a> to select the SSL support provided by IBM WebSphere (which must be in the classpath)</li> + <li></li> + <li>27-Mar-2006 Created a custom HttpUnit DOM</li> +</ol> +<h5>ServletUnit</h5> +<ol> + <li>ServletUnitHttpRequest.getDateHeader() has been implemented; previously it always returned -1</li> +</ol> <h5>Pseudoserver:</h5> <ol> <li> @@ -79,67 +102,6 @@ The following list of changes has been extracted from this subversion log with patch and subversion repository links being inserted. <ol> - <li>ServletUnitHttpRequest.getDateHeader() always "returns -1"? by Yu Chen - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=788">r788</a>, - <a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=791">r791</a>) - </li> - <li>Fix for <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1705925&group_id=6550&atid=106550">1705925</a> - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=792">r792</a>) - </li> - <li>new tests and some comments - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=793">r793</a>) - </li> - <li>proposed patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1152036&group_id=6550&atid=306550">1152036</a> - not enabled - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=794">r794</a>) - </li> - <li>comments for some suggestions - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=795">r795</a>) - </li> - <li>fixed for abstract setProxy - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=796">r796</a>) - </li> - <li> [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=844084&group_id=6550&atid=106550">844084</a> ] Block HTTP referer added - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=797">r797</a>) - </li> - <li>IBM Websphere https protocol support - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=798">r798</a>) - </li> - <li>[ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1520925&group_id=6550&atid=306550">1520925</a> ] SSL patch - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=799">r799</a>) - </li> - <li>[ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1371208&group_id=6550&atid=306550">1371208</a> ] Patch for Cookie bug #1371204 - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=800">r800</a>) - </li> - <li>new package plus tests - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=801">r801</a>) - </li> - <li>extended TestSuite - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=802">r802</a>) - </li> - <li>new tests - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=803">r803</a>) - </li> - <li>BR <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1843978&group_id=6550&atid=106550">1843978</a> - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=804">r804</a>) - </li> - <li>javadoc - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=805">r805</a>) - </li> - <li>1.6.3. prep - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=806">r806</a>) - </li> - <li>patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=18386699&group_id=6550&atid=306550">18386699</a> - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=807">r807</a>) - </li> - <li>pending patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155792&group_id=6550&atid=306550">1155792</a> - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=808">r808</a>) - </li> - <li>deactivated test and deprecated function for Patch [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1838699&group_id=6550&atid=306550">1838699</a> ] - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=809">r809</a>) - </li> - <li>svn - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=810">r810</a>) - </li> <li><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=885326&group_id=6550&atid=206550">885326</a> checked but no go (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=811">r811</a>) </li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-30 13:47:01
|
Revision: 948 http://httpunit.svn.sourceforge.net/httpunit/?rev=948&view=rev Author: wolfgang_fahl Date: 2008-04-30 06:46:58 -0700 (Wed, 30 Apr 2008) Log Message: ----------- for bug report [ 1156972 ] isWebLink doesn't recognize all anchor tags by fregienj it's decided to later implement getAnchors - testcase changed to mirror this decision and comments adapted Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java Modified: trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java 2008-04-30 05:54:54 UTC (rev 947) +++ trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java 2008-04-30 13:46:58 UTC (rev 948) @@ -809,13 +809,15 @@ /* * Bug report [ 1156972 ] isWebLink doesn't recognize all anchor tags * by fregienj claims this be changed to check whether the case-insensitive node name is "A" + * -> should be isAnchor method and getAnchor */ boolean result=false; String tagName = ((Element) node).getTagName(); if (!tagName.equalsIgnoreCase( "area" ) && !tagName.equalsIgnoreCase( "a")) { } else { - // pre 1.7 code - result=(node.getAttributes().getNamedItem( "href" ) != null); + // pre 1.7 code - still active + result=(node.getAttributes().getNamedItem( "href" ) != null); + // proposed patch - not activated // result=true; } return result; Modified: trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java 2008-04-30 05:54:54 UTC (rev 947) +++ trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java 2008-04-30 13:46:58 UTC (rev 948) @@ -83,12 +83,15 @@ WebConversation wc = new WebConversation(); WebResponse response=wc.getResponse( getHostPath() + "/NonHref.html" ); WebLink[] links = response.getLinks(); + // TODO implement and test this + // WebLink[] links = response.getAnchors(); assertNotNull( links ); - this.warnDisabled("testFindNonHrefLinks()","pending decision for bug report [ 1156972 ] -> does an <a> node to have href to be considered a link?"); - boolean decided=false; + boolean decided=true; if (decided) { - assertEquals( 1, links.length ); - } + assertEquals( 0, links.length ); + } else { + this.warnDisabled("testFindNonHrefLinks()","pending decision for bug report [ 1156972 ] -> does an <a> node to have href to be considered a link?"); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-30 05:54:58
|
Revision: 947 http://httpunit.svn.sourceforge.net/httpunit/?rev=947&view=rev Author: wolfgang_fahl Date: 2008-04-29 22:54:54 -0700 (Tue, 29 Apr 2008) Log Message: ----------- not for release notes: update for latest bug fix Modified Paths: -------------- trunk/httpunit/doc/release_notes.html Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-04-30 05:49:08 UTC (rev 946) +++ trunk/httpunit/doc/release_notes.html 2008-04-30 05:54:54 UTC (rev 947) @@ -469,6 +469,9 @@ </li> <li>test case for [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1535018&group_id=6550&atid=106550">1535018</a> ] Sub frame recognition - getSubframeContents by Oliver GL<br />there is the almost original version of the testCase xtestSubFrameRecognition and a working version<br />testSubFrameRecognition the difference between the two and the link in the response of today shows that people have a hard time understanding how the getFrameContents and getSubframeContents functions work. (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=939">r939</a>) + </li> + <li>bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1283878&group_id=6550&atid=106550">1283878</a> ] FileNotFoundException using Sun JDK 1.5 on empty error pages by Roger Lindsj\xF6 checked with his + test case and fixed with his patch proposal (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=946">r946</a>) </li> </ol> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-30 05:49:12
|
Revision: 946 http://httpunit.svn.sourceforge.net/httpunit/?rev=946&view=rev Author: wolfgang_fahl Date: 2008-04-29 22:49:08 -0700 (Tue, 29 Apr 2008) Log Message: ----------- bug report [ 1283878 ] FileNotFoundException using Sun JDK 1.5 on empty error pages by Roger Lindsj?\195?\182 checked with his test case and fixed with his patch proposal Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/HttpWebResponse.java trunk/httpunit/test/com/meterware/httpunit/WebClientTest.java Modified: trunk/httpunit/src/com/meterware/httpunit/HttpWebResponse.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HttpWebResponse.java 2008-04-29 17:44:37 UTC (rev 945) +++ trunk/httpunit/src/com/meterware/httpunit/HttpWebResponse.java 2008-04-30 05:49:08 UTC (rev 946) @@ -20,6 +20,7 @@ * *******************************************************************************************************************/ import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -70,15 +71,53 @@ + /** + * get the input stream for the given connection + * @param connection + * @return + * @throws IOException + */ private InputStream getInputStream( URLConnection connection ) throws IOException { - return isResponseOnErrorStream( connection ) - ? ((HttpURLConnection) connection).getErrorStream() - : connection.getInputStream(); + InputStream result=null; + // check whether there is an error stream + if (isResponseOnErrorStream( connection )) { + result=((HttpURLConnection) connection).getErrorStream(); + } else { + // if there is no error stream it depends on the response code + try { + result=connection.getInputStream(); + } catch (java.io.FileNotFoundException fnfe) { + // as of JDK 1.5 a null inputstream might have been returned here + // see bug report [ 1283878 ] FileNotFoundException using Sun JDK 1.5 on empty error pages + // by Roger Lindsj\xF6 + if (isErrorResponse(connection)) { + // fake an empty error stream + result=new ByteArrayInputStream(new byte[0]); + } else { + throw fnfe; + } + } + } + return result; } + /** + * check whether a response code >=400 was received + * @param connection + * @return + */ + private boolean isErrorResponse(URLConnection connection ) { + return _responseCode >= HttpURLConnection.HTTP_BAD_REQUEST; + } + + /** + * check whether the response is on the error stream + * @param connection + * @return + */ private boolean isResponseOnErrorStream( URLConnection connection ) { - return _responseCode >= HttpURLConnection.HTTP_BAD_REQUEST && ((HttpURLConnection) connection).getErrorStream() != null; + return isErrorResponse(connection) && ((HttpURLConnection) connection).getErrorStream() != null; } Modified: trunk/httpunit/test/com/meterware/httpunit/WebClientTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebClientTest.java 2008-04-29 17:44:37 UTC (rev 945) +++ trunk/httpunit/test/com/meterware/httpunit/WebClientTest.java 2008-04-30 05:49:08 UTC (rev 946) @@ -738,6 +738,31 @@ } } + /** + * test for bug report [ 1283878 ] FileNotFoundException using Sun JDK 1.5 on empty error pages + * by Roger Lindsj\xF6 + * @throws Exception + */ + public void testEmptyErrorPage() throws Exception { + boolean originalState = + HttpUnitOptions.getExceptionsThrownOnErrorStatus(); + HttpUnitOptions.setExceptionsThrownOnErrorStatus( false ); + + try { + WebConversation wc = new WebConversation(); + defineResource( "emptyError", "", 404); + WebRequest request = new GetMethodWebRequest( getHostPath() +"/emptyError" ); + WebResponse response = wc.getResponse( request ); + assertEquals( 404, response.getResponseCode() ); + assertEquals( 0, response.getContentLength() ); + } catch (java.io.FileNotFoundException fnfe) { + fnfe.printStackTrace(); + assertTrue("There should be not file not found exception '"+fnfe.getMessage()+"'",false); + } finally { + // Restore exceptions state + HttpUnitOptions.setExceptionsThrownOnErrorStatus(originalState ); + } + } /** * test GZIP begin disabled This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-29 17:44:46
|
Revision: 945 http://httpunit.svn.sourceforge.net/httpunit/?rev=945&view=rev Author: wolfgang_fahl Date: 2008-04-29 10:44:37 -0700 (Tue, 29 Apr 2008) Log Message: ----------- more tests for bug report [ 1432236 ] Downloading gif images uses up sockets added as suggested by Sir Runcible Spoon and rlindsjo Number of sockets available seems to vary from 3800 over 5700 to some 15000 Modified Paths: -------------- trunk/httpunit/test/com/meterware/httpunit/WebImageTest.java Modified: trunk/httpunit/test/com/meterware/httpunit/WebImageTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebImageTest.java 2008-04-28 08:24:33 UTC (rev 944) +++ trunk/httpunit/test/com/meterware/httpunit/WebImageTest.java 2008-04-29 17:44:37 UTC (rev 945) @@ -98,6 +98,62 @@ } // for } // for } + + public static final int MAX_GIFTESTCOUNT=15000; + + + /** + * test for bug report [ 1432236 ] Downloading gif images uses up sockets + * by Sir Runcible Spoon and rlindsjo + * as responded in the sourceforge tracker by himself + * */ + public void dotestGetImageManyTimes(WebConversation wc,String url) throws Exception { + String delim=""; + boolean withDebug=true; + int i=1; + for (;i<=MAX_GIFTESTCOUNT;i++) { + if (withDebug) { + if (i%500==0) { + System.out.print(delim+i); + delim=", "; + System.out.flush(); + if (i%10000==0) { + System.out.println(); + } + } + } + try { + WebResponse resp = wc.getResponse(url); + // Enable line below to not get too many open files / sockets + // resp.getInputStream().close(); + } catch (java.net.BindException jnbe) { + String msg="There should be no exception for "+url+" but there is as BindException '"+jnbe.getMessage()+"' after "+i+" gif image accesses"; + // System.out.println(msg); + assertTrue(msg,false); + } + } // for + assertTrue("the test loop should have been performed "+MAX_GIFTESTCOUNT+" times",i>=MAX_GIFTESTCOUNT); + } + + /** + * test for bug report [ 1432236 ] Downloading gif images uses up sockets + * by Sir Runcible Spoon + * as responded by himself and rlindsjo + * @throws Exception + */ + public void xtestGetImageManyTimes2() throws Exception { + WebConversation wc = new WebConversation(); + byte[] gif1x1={0x47,0x49,0x46,0x38,0x39,0x61,0x01,0x00,0x01,0x00, // GIF89a... + (byte)0xF0,0x00,0x00,0x15,0x15,0x15,0x00,0x00,0x00,0x21, + (byte)0xF9,0x04,0x01,0x00,0x00,0x00,0x00,0x2C,0x00,0x00, + 0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44, + 0x01,0x00,0x3B}; + defineResource( "image", gif1x1, "image/gif"); + // slow version of test with internal image definition + // dotestGetImageManyTimes(wc,getHostPath() + "/image"); + // faster version of test with an image on the local webserver + dotestGetImageManyTimes(wc,"http://localhost/1x1.gif"); + } public void testFindImageAndLink() throws Exception { defineResource( "SimplePage.html", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-28 08:24:38
|
Revision: 944 http://httpunit.svn.sourceforge.net/httpunit/?rev=944&view=rev Author: wolfgang_fahl Date: 2008-04-28 01:24:33 -0700 (Mon, 28 Apr 2008) Log Message: ----------- not for release notes: sorted according to Russell's suggestions Modified Paths: -------------- trunk/httpunit/doc/release_notes.html Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-04-23 05:44:39 UTC (rev 943) +++ trunk/httpunit/doc/release_notes.html 2008-04-28 08:24:33 UTC (rev 944) @@ -1,46 +1,88 @@ <html> <head><title>httpunit 1.7 release notes</title></head> <body> -<pre> -HttpUnit release notes +<h1>HttpUnit release notes</h1> -Known problems: - 1. The "accept-charset" attribute for forms is ignored; the page content character set is used to encode any response. - This behavior matches that currently used by IE and Navigator. - 2. Defining a form parameter with the same name or ID as a JavaScript Form function will cause that function not to - be callable. +<h3>Known problems:</h3> +<ol> + <li>The "accept-charset" attribute for forms is ignored; the page content character set is used to encode any response. + This behavior matches that currently used by IE and Navigator.</li> + <li>Defining a form parameter with the same name or ID as a JavaScript Form function will cause that function not to + be callable.</li> +</ol> +<h3>Limitations:</h3> +<ol> + <li>JDK 1.4.2 or higher is required</li> + <li>JavaScript support does not include some DOM properties</li> + <li>The JavaScript assignment Document.cookie= does not restrict the cookie by path and domain</li> + <li>Only table cells and explicit paragraphs are recognized as text blocks</li> +</ol> -Limitations: - 1. JDK 1.4.2 or higher is required - 2. JavaScript support does not include some DOM properties - 3. The JavaScript assignment Document.cookie= does not restrict the cookie by path and domain - 4. Only table cells and explicit paragraphs are recognized as text blocks +<h2>Revision History:</h2> - -Revision History: -================= - - -14-Apr-2008 PseudoServer was incorrectly parsing chunk lengths as decimal rather than hexadecimal -06-Apr-2008 bugfix 1110071: cannot increase length of a select control -</pre> -<h3>1.7 2008-04-19</h3> +<h3>Version 1.7 Released 2008-04-27</h3> +<h4>Notes:</h4> +<ol> + <li>Upgraded NekoHTML to 1.9.6</li> + <li>Upgraded Xerces to 2.6.1</li> + <li>Upgraded Rhino to 1.6R5</li> + <li>5-Jul-2007: + The PostMethodWebRequest.setMimeEncoded method has been removed. Mime encoding, if desired, should now be + specified when constructing the object.</li> + <li>28-Jun-2007: + WebLink.click() now only returns the contents of the frame containing the link. Previously, if there was no + event involved and the link included a frame reference, it would return the contents of the referenced frame. + </li> + <li>26-Nov-2006: + HttpUnit configuration management has been moved from CVS to subversion at http://httpunit.svn.sourceforge.net/svnroot/httpunit/trunk/httpunit + </li> + <li>28-Mar-2006: + The build now uses the ant-dependencies task (see http://www.httpunit.org/doc/dependencies.html) rather than + keeping the dependent jars in cvs.</li> + <li>made some controls (RadioButton,RadioGroupForm) public to support Radiobutton testing better + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=787">r787</a>) + </li> + <li>some refactoring: HttpUnitUtils.handleException is now called where a simple printStackTrace was + found in the past. The boolean flag HttpUnitUtil.EXCEPTION_DEBUG now controls whether this happens + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=822">r822</a>) + </li> + <li>The doScript method has been refactored - it is now deprecated and renamed to doScriptEvent to make clear + that this method expects a full script to work on. A click will now also fire the mousedown and mouseup events. + handleEvent is now the method to call for handling events by name e.g. onchange, onmousedown, onclick, onmouseup, onblur, onfocus + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=839">r839</a>) + </li> +</ol> +<h4>Additions:</h4> +<h5> Content and Parsing:</h5> +<ol> + <li>Basic authentication now can support authorization only after challenge and different passwords for + different realms.</li> + <li>Added support for rudimentary (RFC 2109) digest authentication.</li> + <li>Added "overrideContextType" property to ClientProperties to permit handling of files served with the + wrong content type.</li> + <li>27-Mar-2006 Created a custom HttpUnit DOM</li> +</ol> +<h5>Pseudoserver:</h5> +<ol> + <li> +31-Mar-2006: Added WebResource.suppressAutomaticContentTypeHeader to permit generation of responses without the + Content-Type header.</li> +</ol> +<h4>Acknowledgements</h4> +Thanks to the very many people that have supplied bugfixed and patches from 2005 to 2008 - please follow +the links to the sourceforge.net tracker items in the list of problems fixed below to find out the details about each contributor. +<h4>Problems corrected:</h4> Bug fixes and patches from 2007-12 to 2008-04-19: for a full subversion log you might want to issue the subversion command:<br /> - <code> svn log https://httpunit.svn.sourceforge.net/svnroot/httpunit</code><br /> + + <br /><code> svn log https://httpunit.svn.sourceforge.net/svnroot/httpunit</code><br /><br /> The following list of changes has been extracted from this subversion log with patch and subversion repository links being inserted. - -<ol> - <li>made some controls public - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=787">r787</a>) +<ol> + <li>ServletUnitHttpRequest.getDateHeader() always "returns -1"? by Yu Chen + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=788">r788</a>, + <a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=791">r791</a>) </li> - <li>ServletUnitHttpRequest.getDateHeader() always "returns -1"?<br />Date sent: Wed, 19 Dec 2007 11:17:36 -0700<br />by Yu Chen - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=788">r788</a>) - </li> - <li>ServletUnitHttpRequest.getDateHeader() always "returns -1"?<br />Date sent: Wed, 19 Dec 2007 11:17:36 -0700<br />by Yu Chen - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=791">r791</a>) - </li> <li>Fix for <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1705925&group_id=6550&atid=106550">1705925</a> (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=792">r792</a>) </li> @@ -131,9 +173,6 @@ <li>added test for iFrame problem (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=821">r821</a>) </li> - <li>some refactoring - (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=822">r822</a>) - </li> <li>added stub for testCreateElement (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=823">r823</a>) </li> @@ -377,7 +416,7 @@ <li>bug #<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1110071&group_id=6550&atid=106550">1110071</a>: javascript cannot increase length of a select control (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=914">r914</a>) </li> - <li>Parse chunk lengths as hex + <li>14-Apr-2008 PseudoServer was incorrectly parsing chunk lengths as decimal rather than hexadecimal (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=915">r915</a>) </li> <li>test for Bug Report <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1937946&group_id=6550&atid=106550">1937946</a> added (but disabled for HttpUnitSuite since it needs index.html on localhost<br />convenience addition to be able to test this bug report on a Mac @@ -432,47 +471,9 @@ (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=939">r939</a>) </li> </ol> + +<h3>Version 1.6.2 released 2006-03-27:</h3> <pre> - 5-Jul-2007: - Notes: The PostMethodWebRequest.setMimeEncoded method has been removed. Mime encoding, if desired, should now be - specified when constructing the object. - -28-Jun-2007: - Notes: WebLink.click() now only returns the contents of the frame containing the link. Previously, if there was no - event involved and the link included a frame reference, it would return the contents of the referenced frame. - -26-Dec-2006: - Additions: - Content and Parsing: - 1. Basic authentication now can support authorization only after challenge and different passwords for - different realms. - 2. Added support for rudimentary (RFC 2109) digest authentication. - - 1-Dec-2006: - Additions: - Content and Parsing: - 1. Added "overrideContextType" property to ClientProperties to permit handling of files served with the - wrong content type. -26-Nov-2006: - Notes: HttpUnit has been moved to subversion at http://httpunit.svn.sourceforge.net/svnroot/httpunit/trunk/httpunit - -31-Mar-2006: - Additions: - PseudoServer: - 1. Added WebResource.suppressAutomaticContentTypeHeader to permit generation of responses without the - Content-Type header. - -28-Mar-2006: - Notes: - 1. The build now uses the ant-dependencies task (see http://www.httpunit.org/doc/dependencies.html) rather than - keeping the dependent jars in cvs. - -27-Mar-2006 - Additions: - Content and Parsing: - 1. Created a custom HttpUnit DOM - -27-Mar-2006 1.6.2: Acknowledgements: Thanks for Fabrizio Giustina for suggesting a way to make the TableRow object publically accessible. @@ -485,8 +486,9 @@ 2. Added support for Servlet API 2.4 3. Implemented ServletContext.getServletContextName 4. (PseudoServer) made HttpRequest class public - - 6-Mar-2005 1.6.1 +</pre> + <h3>Version 1.6.1 released 2005-03-06 </h3> +<pre> Acknowledgements: Thanks to Hanson Char for identifying a JDK 1.5 incompatibility. Thanks to Satish Kolli for fixing bug #1040770 @@ -523,9 +525,9 @@ PseudoServer 16. Made all WebResource constructors public - - -3-Oct-2004 1.6 +</pre> +<h3>Version 1.6 released 2004-10-03</h3> +<pre> Acknowledgements: Thanks to Chris Hane for making it easier to add support for javascript properties and for providing support for getAttribute() to handle any property defined in the underlying Node. @@ -673,9 +675,9 @@ 1. Upgraded NekoHTML to 0.9.1 2. Upgraded Xerces to 2.4.0 3. Upgraded Rhino to 1.5R4.1 - - -21-Aug-2003 1.5.4 +</pre> +<h3>Version 1.5.4 released 2003-08-21</h3> +<pre> Acknowledgements: Thanks to David D. Kilzer for: creating thorough tests for URLs containing navigation and showing a way to handle them, and @@ -721,9 +723,10 @@ 9. bug #734133: javascript: URLs were ignored if "javascript:" is not all lower case. ServletUnit 10. bug #744214: ServletUnit does not recognize subframes - - 4-Apr-2003 1.5.3 -Acknowledgements: +</pre> + <h3>Version 1.5.3 released 2004-04-04</h3> + <pre> + Acknowledgements: Thanks to Andrew Bickerton for: correcting the handling of document.open for non-HTML pages and new pages with base tags, correcting the document.write append problem, @@ -787,9 +790,9 @@ to ClientProperties, permitting them to be set per WebClient rather than just globally. The old properties have been deprecated, and now access the defaults for ClientProperties. Tests which set the HttpUnitOptions properties before creating their WebClients will be unaffected. - - - 3-Mar-2003 1.5.2 +</pre> +<h3>Version 1.5.2 released 2003-03-03</h3> +<pre> Acknowledgements: Thanks to John Sinclair for noting the lack of line breaks in manifest.mf and proposing a fix Thanks to Bernhard Wagner for simplifying some string comparison code in ParsedHTML and WebTable @@ -871,10 +874,9 @@ Notes: 1. Upgraded NekoHTML to 0.7.2 which no longer generates superfluous <form> tags. 2. Removed a number of deprecated methods - - -18-Dec-2002 1.5.1 - +</pre> +<h3>Version 1.5.1 released 2002-12-18</h3> +<pre> Acknowledgements: Thanks to Geert Bevin for fixing a problem with comparing cookies Thanks to Troy Waldrep for pointing out the non-standard Refresh header definition accepted in popular browsers @@ -924,9 +926,9 @@ Notes: 1. Upgraded NekoHTML to 0.7.1 - - - 3-Nov-2002 1.5 +</pre> +<h3>Version 1.5. released 2002-11-03</h3> +<pre> Acknowledgements: Thanks to Ken Corbin for adding tests for disabled and read-only parameters. Thanks to Geert Bevin for fixing a problem with generation of cookie headers that affects some servers. @@ -1023,8 +1025,9 @@ 20. RFE #585495 ServletUnit now supports HttpServletResponse.setContentLength. 21. ServletUnit now implements HttpServletRequest.getLocale() and getLocales() - - 2-Oct-2002 1.4.6 +</pre> + <h3>Version 1.4.6 released 2002-10-02</h3> +<pre> Acknowledgements: Thanks to Ville Skytt� for removing the test dependency on xerces. Thanks to Donald Ball for pointing out the problem with the behavior of Select.selectedIndex. @@ -1061,8 +1064,9 @@ 9. Link.href is now read-write. 10. The Navigator object is now supported. - -30-Aug-2002 1.4.5 +</pre> +<h3>Version 1.4.5 released 2002-08-30</h3> +<pre> Acknowledgements: Thanks to Steve Heath for an example on how to make JSPs work with ServletUnit. Thanks to Rajan Narasimhan for fixing the relative URL computation problem. @@ -1136,8 +1140,9 @@ Notes: 1. The class com.meterware.httpunit.ScriptableObject has been renamed as com.meterware.httpunit.scripting.ScriptableDelegate - -20-Jun-2002 1.4.1 +</pre> +<h3>Version 1.4.1 released 2002-06-20</h3> +<pre> Acknowledgements: Thanks to Stefan Renz for finding the file control value bug and providing a fix. Thanks to Frank Carver for extending base 64 encoding to handle character values > 127. @@ -1186,8 +1191,9 @@ 2. The version of JTidy included with this release is 4-Aug-2000-r7, which seems to have fewer problems with classloading; however, it is also described as a "less stable" pre-release. - - 6-Mar-2002 1.4 +</pre> + <h3>Version 1.4. released 2002-03-06</h3> + <pre> Acknowledgements: Thanks to Didier Besset for correcting the WebForm methods: hasParameterNamed and hasParameterStartingWithPrefix Thanks to Stefan G. Renz for identifying the infinite loop bug in frame handling @@ -1258,15 +1264,15 @@ This property is initialized from the HttpUnitOptions property of the same name when the WebClient object is created. This allows finer control over this behavior. Tests which depend on this setting should no longer interfere with one another. - - -28-Nov-2001 1.3.0 +</pre> +<h3>Version 1.3.0 released 2001-11-28</h3> +<pre> Acknowledgements: Thanks to Oliver Imbusch for finding and fixing problems with parsing of encoded link parameter names and values and of link URLs with parameters and fragments. Thanks to Paul Frantz and Dave Glowacki for finding and fixing problems with parsing of link parameter names without values. Thanks to Didier Besset for new WebForm methods: hasParameterNamed and hasParameterStartingWithPrefix - Thanks to Peter Ro�bach for catching some typos in the tutorial. + Thanks to Peter Ro\xDFbach for catching some typos in the tutorial. Thanks to Benoit Xhenseval for adding a mechanism to handle HTML parser errors. Thanks to Benoit Xhenseval for optimizing the use of DOMs and StringBuffers. Thanks to Bradley Smith for implementing getParameterNames in ServletUnit. @@ -1309,10 +1315,10 @@ 10. HttpUnit now pre-allocates StringBuffer instances to their most likely size 11. DOMs are no longer copied when passed internally' 12. ByteTag objects no longer allocate Hashtable unless required +</pre> +<h3>Version 1.2.7 released 2001-10-25 </h3> +<pre> - -25-Oct-2001 1.2.7 - Acknowledgements: Thanks to Chris Stevenson for identifying a problem with forms lacking an action Thanks to Drew Varner for more sophisticated cookie handling, including Set-Cookie2 code @@ -1375,8 +1381,9 @@ 19. Now recognizes a Charset header if no charset is specified in the Content-type header. There are some servers which send this non-standard header. - - 6-Jul-2001 1.2.6 +</pre> + <h3>Version 1.2.6 released 2001-07-06</h3> + <pre> Acknowledgements: Thanks to Marcos Tarruella for adding a test case for the Base64 class @@ -1393,9 +1400,9 @@ Problems corrected: 1. The cookbook was missing parentheses for its constructors 2. Updated the NearWords example to accomodate changes to the Merriam-Webster site - - -18-Jun-2001 1.2.5 +</pre> +<h3>Version 1.2.5 released 2001-06-18</h3> +<pre> Acknowledgements: Thanks to Rolf Schmidiger for corrected behavior when failing to find a site Thanks to Tom Watkins, Deepa Dihr, Marcos Tarruella for their implementation of @@ -1429,9 +1436,9 @@ 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 +</pre> +<h3>Version 1.2.4 released 2001-05-05</h3> +<pre> Acknowledgements: Thanks to Jim Kimball for finding and fixing the redirection of subframes @@ -1452,8 +1459,9 @@ 3. Added getID to WebForm 4. Added getFormWithID to HTMLSegment interface - -2-Apr-01 1.2.3 +</pre> +<h3>Version 1.2.3 released 2001-04-02 </h3> +<pre> Acknowledgements: Thanks to Silvio Samadelli for improved cookie-recognition logic @@ -1467,8 +1475,9 @@ Additions: 1. The Referer header is now sent for requests derived from links and forms. - -08-Jan-01 1.2.2 +</pre> +<h3>Version 1.2.2 released 2001-01-08 </h3> +<pre> Acknowledgements: Thanks to Rocky Rhodes for finding the multiple cookie bug Thanks to Scott Croco for correcting the response code problem @@ -1483,8 +1492,9 @@ or a file not found exception. 3. Creating a request from a form with an empty <select> tag was generating a SingleValuedParameterException. 4. Corrected IllegalArgumentException: sun.io.CharToByteUTF-8 that happened in JDK 1.1.x - -01-Jan-01 1.2.1 +</pre> +<h3>Version 1.2.1 released 2001-01-01</h3> +<pre> Acknowledgements: Thanks to Toyoshi Ushio for helping with the handling of non-English scripts and for translating the home page and cookbook into Japanese. @@ -1500,8 +1510,9 @@ 4. WebConversation now has a new public base class: WebClient 5. Any message header may now be defined, using: WebClient.setHeaderField and will be sent on all subsequent requests 6. Forms may now be retrieved by their name attributes, using WebResponse.getFormWithName() - -16-Nov-00 1.2 +</pre> +<h3>Version 1.2 released 2000-11-16</h3> +<pre> Acknowledgements: Thanks to Robert Krueger for providing an interface to the xerces parser for XML web responses. Thanks to Marco Tamanti and Gabriele Antonelli for suggesting ways to support file URLs @@ -1517,8 +1528,9 @@ 3. XML parsing is now supported. If WebResponse.getDOM is called for a non-HTML response (content type is not "text/html"), the xerces parser will be invoked to treat the response as XML. 4. File URLs (file:xxx) are now supported - -17-Oct-00 1.1 +</pre> +<h3>Version 1.1 released 2000-10-17</h3> +<pre> Acknowledgements: Thanks to Seth Ladd for specific exceptions from WebConversation.getResponse Thanks to Dave Glowacki for suggestions on convenience methods in WebResponse and WebLink, @@ -1553,10 +1565,9 @@ 10. WebConversation now supports getCookieNames and getCookieValue to return the current cookies 11. The WebResponse now can return the response code associated with it (2xx) 12. Non-breaking spaces are converted to spaces on any conversion to text - - -1-Sep-00 1.0 - +</pre> +<h3>Version 1.0 released 2000-09-01</h3> +<pre> Acknowledgements: Thanks to Jan Ohrstrom for his additions to WebConversation @@ -1573,9 +1584,9 @@ 6. WebConversation now throws AuthorizationRequiredException when the web server rejects a request because of authorization problems. 7. WebConversation now supports basic authentication via the setAuthorization method. - - -4-Aug-00 0.9.5 +</pre> +<h3>Version 0.9.5 released 2000-08-04</h3> +<pre> General: 1. Nested tables are now supported (examples to follow) by using WebTable.getTableCell 2. table columns and rows used only for formatting may now be ignored using WebTable.purgeEmptyCells @@ -1590,35 +1601,37 @@ 4. Added WebTable.purgeEmptyCells to eliminate meaningless spacing information 5. Added copyright notices to most source files 6. Added support for checkboxes, radio buttons, text areas, and selects - - -29-Jun-00 0.9.1 +</pre> +<h3>Version 0.9.1 released 2000-06-29</h3> +<pre> Additions: 1. The PostMethodWebRequest class is now public. 2. Row and column spans are now handled 3. Formatting inside table cells is ignored in computing the text value of a cell - -19-Jun-00 0.9 +</pre> +<h3>Version 0.9 released 2000-06-19</h3> +<pre> Additions: 1. The parser may be tested during the build by issuing the command: 'ant test -Dclasspath="%classpath%"' 2. WebResponse now can return an array of the top-level tables in the HTML response. Each table may now be asked for its size and the contents of each of its cells. - - -5-Jun-00 0.8.2 -Additions: +</pre> +<h3>Version 0.8.2 released 2000-06-05</h3> +<pre>Additions: WebResponse now has a getDOM method which permits examination of the DOM equivalent of the response. - -1-Jun-00 0.8.1 +</pre> +<h3>Version 0.8.1 released 2000-06-01</h3> +<pre> Problems corrected: Default parameter values are ignored Parameter values without explicit types were being ignored, rather than defaulting to TEXT Additions: ExampleTest now demonstrates the use of httpunit and JUnit to test servlets NearWords demonstrates the use of httpunit to access web site functionality - -03-May-00 0.8 +</pre> +<h3>Version 0.8 released 2000-05-03</h3> +<pre> Initial public release </pre> </body> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-23 05:44:44
|
Revision: 943 http://httpunit.svn.sourceforge.net/httpunit/?rev=943&view=rev Author: wolfgang_fahl Date: 2008-04-22 22:44:39 -0700 (Tue, 22 Apr 2008) Log Message: ----------- not for release notes: uncompressed version of jar file Added Paths: ----------- trunk/httpunit/lib/httpunit_uncompressed.jar Added: trunk/httpunit/lib/httpunit_uncompressed.jar =================================================================== (Binary files differ) Property changes on: trunk/httpunit/lib/httpunit_uncompressed.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-23 05:43:22
|
Revision: 942 http://httpunit.svn.sourceforge.net/httpunit/?rev=942&view=rev Author: wolfgang_fahl Date: 2008-04-22 22:43:20 -0700 (Tue, 22 Apr 2008) Log Message: ----------- jars added to subversion repository Modified Paths: -------------- trunk/httpunit/build.xml Added Paths: ----------- trunk/httpunit/lib/ trunk/httpunit/lib/httpunit.jar Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-04-23 05:41:41 UTC (rev 941) +++ trunk/httpunit/build.xml 2008-04-23 05:43:20 UTC (rev 942) @@ -69,8 +69,6 @@ </path> - - <!-- =================================================================== --> <!-- Prepares the build directory --> <!-- =================================================================== --> @@ -260,10 +258,16 @@ Build-Time: ${TSTAMP} Revision: ${revision} </echo> + <!-- compressed default jar file --> <jar jarfile="${lib.dir}/${name}.jar" manifest="${build.dir}/info.txt"> <fileset dir="${build.classes}" includes="com/**"/> <fileset dir="META-INF" includes="*.dtd"/> </jar> + <!-- non compressed default jar file --> + <jar jarfile="${lib.dir}/${name}_uncompressed.jar" manifest="${build.dir}/info.txt" compress="false" > + <fileset dir="${build.classes}" includes="com/**"/> + <fileset dir="META-INF" includes="*.dtd"/> + </jar> </target> Added: trunk/httpunit/lib/httpunit.jar =================================================================== (Binary files differ) Property changes on: trunk/httpunit/lib/httpunit.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-23 05:41:48
|
Revision: 941 http://httpunit.svn.sourceforge.net/httpunit/?rev=941&view=rev Author: wolfgang_fahl Date: 2008-04-22 22:41:41 -0700 (Tue, 22 Apr 2008) Log Message: ----------- RCSID added Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java Modified: trunk/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java 2008-04-19 17:36:45 UTC (rev 940) +++ trunk/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java 2008-04-23 05:41:41 UTC (rev 941) @@ -38,7 +38,13 @@ * @author <a href="mailto:bx...@bi...">Benoit Xhenseval</a> **/ public abstract class HttpUnitOptions { + /** + * ID for Revision Control System - will show in the class file and + * can be looked for using the ident command of RCS + */ + private final static String RCSID="$Id$"; + public static final String ORIGINAL_SCRIPTING_ENGINE_FACTORY = "com.meterware.httpunit.javascript.JavaScriptEngineFactory"; private static final String NEW_SCRIPTING_ENGINE_FACTORY = "com.meterware.httpunit.dom.DomBasedScriptingEngineFactory"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-19 17:36:46
|
Revision: 940 http://httpunit.svn.sourceforge.net/httpunit/?rev=940&view=rev Author: wolfgang_fahl Date: 2008-04-19 10:36:45 -0700 (Sat, 19 Apr 2008) Log Message: ----------- not for release notes: release notes updated Modified Paths: -------------- trunk/httpunit/doc/release_notes.html Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-04-19 17:17:48 UTC (rev 939) +++ trunk/httpunit/doc/release_notes.html 2008-04-19 17:36:45 UTC (rev 940) @@ -406,7 +406,31 @@ </li> <li>test case for bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1376739&group_id=6550&atid=306550">1376739</a> ] iframe tag not recognized if Javascript code contains '<'<br />by Nathan Jakubiak added<br />The supplied patch unfortunately does not work and is therefore only added as a comment (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=929">r929</a>) - </li> + </li> + <li>test case for bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1390695&group_id=6550&atid=106550">1390695</a> ] bad error message<br />by Martin Olsson<br />added and fixed to FormParameter now to throw a NoSuchParameterException instead of an UnusedUploadFileException: + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=932">r932</a>) + </li> + <li>test case for bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1390695&group_id=6550&atid=106550">1390695</a> ] bad error message<br />by Martin Olsson<br />added and fixed to FormParameter now to throw a NoSuchParameterException instead of an UnusedUploadFileException: + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=933">r933</a>) + </li> + <li>test for bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1393144&group_id=6550&atid=306550">1393144</a> ] URL args in form action are sent for GET forms by Nathan Jakubiak<br />added and disabled while bug is pending and waiting for patch + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=934">r934</a>) + </li> + <li>test for bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1432236&group_id=6550&atid=106550">1432236</a> ] Downloading gif images uses up sockets by Sir Runcible Spoon - with many images httpunit<br />might run out of resources. In the test environment up<br />to 10.000 image accesses where possible (taking some 7 minutes) with no problem - the test for 10 and 100 images is active + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=935">r935</a>) + </li> + <li>Test for bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1510495&group_id=6550&atid=106550">1510495</a> ] getParameterValue on a submit button fails by Julien HENRY added<br />if submit is done before getting the form parameter everything is fine + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=936">r936</a>) + </li> + <li>added test case for bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1510582&group_id=6550&atid=106550">1510582</a> ] setParameter fails with <input type="file"> by Julien Henry <br />and changed the behaviour of setparameter that a more<br />developer friendly exception with a hopefully better understandable message is thrown to point out that file parameters need a parameter of type java.io.File when being set + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=937">r937</a>) + </li> + <li>test for bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1534234&group_id=6550&atid=306550">1534234</a> ] HttpServletResponse.isCommitted() always false? (+ p a t c h)<br />by Olaf Klischat added. Unfortunately p a t c h does <br />break other tests - asking for improved test case and patch + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=938">r938</a>) + </li> + <li>test case for [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1535018&group_id=6550&atid=106550">1535018</a> ] Sub frame recognition - getSubframeContents by Oliver GL<br />there is the almost original version of the testCase xtestSubFrameRecognition and a working version<br />testSubFrameRecognition the difference between the two and the link in the response of today shows that people have a hard time understanding how the getFrameContents and getSubframeContents functions work. + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=939">r939</a>) + </li> </ol> <pre> 5-Jul-2007: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-19 17:17:49
|
Revision: 939 http://httpunit.svn.sourceforge.net/httpunit/?rev=939&view=rev Author: wolfgang_fahl Date: 2008-04-19 10:17:48 -0700 (Sat, 19 Apr 2008) Log Message: ----------- test case for [ 1535018 ] Sub frame recognition - getSubframeContents by Oliver GL there is the almost original version of the testCase xtestSubFrameRecognition and a working version testSubFrameRecognition the difference between the two and the link in the response of today shows that people have a hard time understanding how the getFrameContents and getSubframeContents functions work. Modified Paths: -------------- trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java Modified: trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java 2008-04-19 15:40:02 UTC (rev 938) +++ trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java 2008-04-19 17:17:48 UTC (rev 939) @@ -254,8 +254,92 @@ WebResponse response = _wc.getResponse( getHostPath() + "/Frames.html" ); assertEquals( "red subframe", _wc.getFrameContents( "red" ), response.getSubframeContents( "red" ) ); } + + /** + * test for bug report + * [ 1535018 ] Sub frame recognition - getSubframeContents + * by Oliver GL + * this is how it does not work ... + */ + public void xtestSubFrameRecognitionOriginal() throws Exception { + defineWebPage("frame1","frame1Content"); + defineWebPage("frame2","frame2Content"); + defineWebPage("frame3","frame3Content"); + String html="<html>\n"+ + "<head>\n"+ + "</head>\n"+ + "<frameset name=\"topset\" rows=\"65,*\">\n"+ + " <frame src=\"frame1.html\" name=\"Banner\" frameborder=\"0\" noresize scrolling=\"no\">\n"+ + " <frameset name=\"subset\" cols=\"180,*\">\n"+ + " <frame src=\"frame2.html\" name=\"Menu\" frameborder=\"0\" noresize scrolling=\"yes\">\n"+ + " <frame src=\"frame3.html\" name=\"Action\" frameborder=\"0\" noresize scrolling=\"auto\">\n"+ + " </frameset>\n"+ + "</frameset>\n"+ + "</html>"; + // for checking the resulting frame page in real browser ... + // System.out.println(html); + defineResource("frames.html",html); + WebResponse topResponse = _wc.getResponse( getHostPath() + "/frames.html" ); + String[] frameNames=topResponse.getFrameNames(); + // System.out.println("found "+frameNames.length+" frames"); + assertTrue(frameNames.length==3); + String[]expectedNames={"Banner","Menu","Action"}; + for (int i=0;i<frameNames.length;i++) { + // System.out.println("frame #"+i+" is '"+frameNames[i]+"'"); + assertTrue("frame #"+i+" should be '"+expectedNames[i]+"'",frameNames[i].equals(expectedNames[i])); + } + WebResponse bannerFrame=_wc.getFrameContents("Banner"); + for (int i=0;i<frameNames.length;i++) { + WebResponse subFrame =bannerFrame.getSubframeContents(frameNames[i]); + assertNotNull(subFrame); + } + } + + /** + * test for bug report + * [ 1535018 ] Sub frame recognition - getSubframeContents + * by Oliver GL + * and this is how it works + */ + public void testSubFrameRecognition() throws Exception { + String frame1Content= + " <frameset name=\"subset\" cols=\"180,*\">\n"+ + " <frame src=\"frame2.html\" name=\"Menu\" frameborder=\"0\" noresize scrolling=\"yes\">\n"+ + " <frame src=\"frame3.html\" name=\"Action\" frameborder=\"0\" noresize scrolling=\"auto\">\n"+ + " </frameset>"; + defineWebPage("frame1",frame1Content); + defineWebPage("frame2","frame2Content"); + defineWebPage("frame3","frame3Content"); + String html="<html>\n"+ + "<head>\n"+ + "</head>\n"+ + "<frameset name=\"topset\" rows=\"65,*\">\n"+ + " <frame src=\"frame1.html\" name=\"Banner\" frameborder=\"0\" noresize scrolling=\"no\">\n"+ + "</frameset>\n"+ + "</html>"; + // for checking the resulting frame page in real browser ... + // System.out.println(html); + defineResource("frames.html",html); + WebResponse topResponse = _wc.getResponse( getHostPath() + "/frames.html" ); + String[] frameNames=topResponse.getFrameNames(); + // System.out.println("found "+frameNames.length+" frames"); + String[]expectedTopNames={"Banner"}; + assertTrue(frameNames.length==expectedTopNames.length); + for (int i=0;i<frameNames.length;i++) { + // System.out.println("frame #"+i+" is '"+frameNames[i]+"'"); + assertTrue("frame #"+i+" should be '"+expectedTopNames[i]+"'",frameNames[i].equals(expectedTopNames[i])); + } + WebResponse bannerFrame=_wc.getFrameContents("Banner"); + String[] subFrameNames=bannerFrame.getFrameNames(); + String[] expectedSubNames={"Menu","Action"}; + for (int i=1;i<subFrameNames.length;i++) { + WebResponse subFrame =bannerFrame.getSubframeContents(subFrameNames[i]); + assertNotNull(subFrame); + } + } + public void testNestedSubFrames() throws Exception { defineResource( "SuperFrames.html", "<HTML><HEAD><TITLE>Initial</TITLE></HEAD>" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |