httpunit-commit Mailing List for httpunit (Page 16)
Brought to you by:
russgold
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(31) |
Oct
(39) |
Nov
(18) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(8) |
Feb
(5) |
Mar
(8) |
Apr
(25) |
May
(20) |
Jun
(23) |
Jul
(28) |
Aug
(10) |
Sep
(3) |
Oct
(32) |
Nov
(61) |
Dec
(24) |
2002 |
Jan
(50) |
Feb
(34) |
Mar
(35) |
Apr
(3) |
May
(25) |
Jun
(25) |
Jul
(30) |
Aug
(146) |
Sep
(49) |
Oct
(156) |
Nov
(121) |
Dec
(54) |
2003 |
Jan
(12) |
Feb
(79) |
Mar
(88) |
Apr
(26) |
May
(67) |
Jun
(29) |
Jul
(8) |
Aug
(16) |
Sep
(20) |
Oct
(17) |
Nov
|
Dec
(5) |
2004 |
Jan
|
Feb
(40) |
Mar
(30) |
Apr
(5) |
May
|
Jun
(83) |
Jul
(34) |
Aug
(20) |
Sep
(44) |
Oct
(46) |
Nov
|
Dec
(14) |
2005 |
Jan
(4) |
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(1) |
2006 |
Jan
|
Feb
|
Mar
(26) |
Apr
(8) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(36) |
May
(38) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(4) |
Oct
|
Nov
(18) |
Dec
(4) |
2009 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(35) |
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(9) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(21) |
Oct
(18) |
Nov
(1) |
Dec
|
From: Russell G. <rus...@us...> - 2004-08-08 17:38:29
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21020/src/com/meterware/httpunit/javascript Modified Files: JavaScript.java JavaScriptEngineFactory.java Log Message: Support onload event for framesets Index: JavaScript.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- JavaScript.java 24 Jun 2004 23:35:18 -0000 1.60 +++ JavaScript.java 8 Aug 2004 17:38:18 -0000 1.61 @@ -81,6 +81,15 @@ } + /** + * Runs the onload event for the specified web response. + */ + public static void load( WebResponse response ) throws ClassDefinitionException, InstantiationException, IllegalAccessException, InvocationTargetException, PropertyException, JavaScriptException, SAXException, NotAFunctionException { + if (!(response.getScriptableObject().getScriptEngine() instanceof JavaScriptEngine)) run( response ); + response.getScriptableObject().load(); + } + + private static void initHTMLObjects( Scriptable scope ) throws IllegalAccessException, InstantiationException, InvocationTargetException, ClassDefinitionException, PropertyException { ScriptableObject.defineClass( scope, Window.class ); @@ -425,8 +434,6 @@ _screen = (Screen) Context.getCurrentContext().newObject( this, "Screen" ); _screen.setClientProperties( getDelegate().getClientProperties() ); - - getDelegate().load(); } Index: JavaScriptEngineFactory.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScriptEngineFactory.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- JavaScriptEngineFactory.java 14 Oct 2002 04:19:06 -0000 1.7 +++ JavaScriptEngineFactory.java 8 Aug 2004 17:38:18 -0000 1.8 @@ -53,6 +53,18 @@ } + public void load( WebResponse response ) { + try { + JavaScript.load( response ); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException( e.toString() ); + } + } + + public void setThrowExceptionsOnError( boolean throwExceptions ) { JavaScript.setThrowExceptionsOnError( throwExceptions ); } |
From: Russell G. <rus...@us...> - 2004-08-08 17:38:28
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21020/src/com/meterware/httpunit Modified Files: FrameHolder.java HTMLPage.java HttpUnitOptions.java RequestContext.java Log Message: Support onload event for framesets Index: FrameHolder.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FrameHolder.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- FrameHolder.java 16 Jun 2004 01:10:55 -0000 1.11 +++ FrameHolder.java 8 Aug 2004 17:38:18 -0000 1.12 @@ -181,6 +181,7 @@ createSubFrames( frame, response.getFrameSelectors() ); WebRequest[] requests = response.getFrameRequests(); for (int i = 0; i < requests.length; i++) response.getWindow().getSubframeResponse( requests[ i ], requestContext ); + HttpUnitOptions.getScriptingEngine().load( response ); } } } Index: HTMLPage.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLPage.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- HTMLPage.java 13 Jun 2004 20:57:25 -0000 1.32 +++ HTMLPage.java 8 Aug 2004 17:38:18 -0000 1.33 @@ -65,9 +65,15 @@ * Returns the onLoad event script. */ public String getOnLoadEvent() throws SAXException { - NodeList nl = ((Document) getOriginalDOM()).getElementsByTagName( "body" ); - if (nl.getLength() == 0) return ""; - return ((Element) nl.item(0)).getAttribute( "onload" ); + Element mainElement = getMainElement( ((Document) getOriginalDOM()) ); + return mainElement == null ? "" : mainElement.getAttribute( "onload" ); + } + + + private Element getMainElement( Document document ) { + NodeList nl = document.getElementsByTagName( "frameset" ); + if (nl.getLength() == 0) nl = document.getElementsByTagName( "body" ); + return nl.getLength() == 0 ? null : ((Element) nl.item(0)); } Index: HttpUnitOptions.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- HttpUnitOptions.java 4 Jun 2004 01:20:03 -0000 1.41 +++ HttpUnitOptions.java 8 Aug 2004 17:38:18 -0000 1.42 @@ -474,6 +474,7 @@ private static final ScriptingEngineFactory NULL_SCRIPTING_ENGINE_FACTORY = new ScriptingEngineFactory() { public boolean isEnabled() { return false; } public void associate( WebResponse response ) {} + public void load( WebResponse response ) {} public void setThrowExceptionsOnError( boolean throwExceptions ) {} public boolean isThrowExceptionsOnError() { return false; } public String[] getErrorMessages() { return new String[ 0 ]; } Index: RequestContext.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/RequestContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RequestContext.java 17 Nov 2002 00:17:06 -0000 1.1 +++ RequestContext.java 8 Aug 2004 17:38:18 -0000 1.2 @@ -41,7 +41,7 @@ void runScripts() throws SAXException { for (Iterator iterator = _newResponses.iterator(); iterator.hasNext();) { WebResponse response = (WebResponse) iterator.next(); - HttpUnitOptions.getScriptingEngine().associate( response ); + HttpUnitOptions.getScriptingEngine().load( response ); } } } |
From: Russell G. <rus...@us...> - 2004-08-08 17:38:28
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/scripting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21020/src/com/meterware/httpunit/scripting Modified Files: ScriptingEngineFactory.java Log Message: Support onload event for framesets Index: ScriptingEngineFactory.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/scripting/ScriptingEngineFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ScriptingEngineFactory.java 13 Sep 2002 18:34:57 -0000 1.3 +++ ScriptingEngineFactory.java 8 Aug 2004 17:38:18 -0000 1.4 @@ -39,6 +39,12 @@ public void associate( WebResponse response ); /** + * Runs the 'onload' event (if any) for the specified HTML web response. Will associate a scripting engine with + * the response if that has not already been done. + **/ + public void load( WebResponse response ); + + /** * Determines whether script errors result in exceptions or warning messages. */ public void setThrowExceptionsOnError( boolean throwExceptions ); |
From: Russell G. <rus...@us...> - 2004-08-08 17:38:27
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21020/doc Modified Files: release_notes.txt Log Message: Support onload event for framesets Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.359 retrieving revision 1.360 diff -u -r1.359 -r1.360 --- release_notes.txt 28 Jul 2004 09:02:25 -0000 1.359 +++ release_notes.txt 8 Aug 2004 17:38:18 -0000 1.360 @@ -13,6 +13,13 @@ Revision History: + 8-Aug-2004 + Thanks to Guillaume Dandurand <Gui...@cn...> for supplying code to get the onload event when the page + is a frameset rather than a regular page. + + Problems fixed: + 1. A frameset 'onload' event is now invoked after all of its subframes have been loaded + 28-Jul-2004 Additions: 1. rfe #986876: The WebClient.addCookie method has been deprecated, since its behavior is actually a bit confusing |
From: Russell G. <rus...@us...> - 2004-07-28 09:11:21
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6284/src/com/meterware/httpunit Modified Files: WebForm.java Log Message: annotate age of checkbox setting methods Index: WebForm.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v retrieving revision 1.94 retrieving revision 1.95 diff -u -r1.94 -r1.95 --- WebForm.java 11 Jul 2004 03:11:32 -0000 1.94 +++ WebForm.java 28 Jul 2004 09:11:07 -0000 1.95 @@ -608,6 +608,7 @@ * @param name the name of the checkbox parameter * @throws IllegalArgumentException if the specified parameter is not a checkbox or there is more than one * control with that name. + * @since 1.5.4 */ public void toggleCheckbox( String name ) { FormParameter parameter = getParameter( name ); @@ -622,6 +623,7 @@ * @param value of the checkbox parameter * @throws IllegalArgumentException if the specified parameter is not a checkbox or if there is no checkbox * with the specified name and value. + * @since 1.5.5 */ public void toggleCheckbox( String name, String value ) { FormParameter parameter = getParameter( name ); @@ -636,6 +638,7 @@ * @param state the new state of the checkbox * @throws IllegalArgumentException if the specified parameter is not a checkbox or there is more than one * control with that name. + * @since 1.5.4 */ public void setCheckbox( String name, boolean state ) { FormParameter parameter = getParameter( name ); @@ -651,6 +654,7 @@ * @param state the new state of the checkbox * @throws IllegalArgumentException if the specified parameter is not a checkbox or if there is no checkbox * with the specified name and value. + * @since 1.5.5 */ public void setCheckbox( String name, String value, boolean state ) { FormParameter parameter = getParameter( name ); |
From: Russell G. <rus...@us...> - 2004-07-28 09:02:37
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4789/test/com/meterware/httpunit Modified Files: WebClientTest.java WebPageTest.java Log Message: rfe# 986876: allow replacement of client-generated cookie Index: WebClientTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebClientTest.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- WebClientTest.java 30 Jun 2004 23:54:49 -0000 1.20 +++ WebClientTest.java 28 Jul 2004 09:02:26 -0000 1.21 @@ -208,6 +208,26 @@ } + public void testManualCookies() throws Exception { + defineResource( "bounce", new CookieEcho() ); + WebConversation wc = new WebConversation(); + wc.putCookie( "CUSTOMER", "WILE_E_COYOTE" ); + WebResponse response = wc.getResponse( getHostPath() + "/bounce" ); + assertEquals( "Cookies sent", "CUSTOMER=WILE_E_COYOTE", response.getText() ); + wc.putCookie( "CUSTOMER", "ROAD RUNNER" ); + response = wc.getResponse( getHostPath() + "/bounce" ); + assertEquals( "Cookies sent", "CUSTOMER=ROAD RUNNER", response.getText() ); + } + + + class CookieEcho extends PseudoServlet { + + public WebResource getGetResponse() throws IOException { + return new WebResource( getHeader( "Cookie" ) ); + } + } + + public void testHeaderFields() throws Exception { defineResource( "getHeaders", new PseudoServlet() { public WebResource getGetResponse() { Index: WebPageTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- WebPageTest.java 23 Jul 2004 01:31:04 -0000 1.38 +++ WebPageTest.java 28 Jul 2004 09:02:26 -0000 1.39 @@ -19,9 +19,6 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import com.meterware.pseudoserver.PseudoServlet; -import com.meterware.pseudoserver.WebResource; - import java.io.PrintWriter; import java.io.FileWriter; import java.io.File; |
From: Russell G. <rus...@us...> - 2004-07-28 09:02:37
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4789/test/com/meterware/httpunit/javascript Modified Files: ScriptingTest.java Log Message: rfe# 986876: allow replacement of client-generated cookie Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- ScriptingTest.java 2 Jul 2004 22:09:28 -0000 1.63 +++ ScriptingTest.java 28 Jul 2004 09:02:27 -0000 1.64 @@ -704,7 +704,7 @@ "</body></html>" ); addResourceHeader( "OnCommand.html", "Set-Cookie: age=12"); WebConversation wc = new WebConversation(); - wc.addCookie( "height", "tall" ); + wc.putCookie( "height", "tall" ); wc.getResponse( getHostPath() + "/OnCommand.html" ); assertEquals( "Alert message 1", "cookies: age=12; height=tall", wc.popNextAlert() ); assertNull( "Alert should have been removed", wc.getNextAlert() ); |
From: Russell G. <rus...@us...> - 2004-07-28 09:02:37
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/cookies In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4789/test/com/meterware/httpunit/cookies Modified Files: CookieTest.java Log Message: rfe# 986876: allow replacement of client-generated cookie Index: CookieTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/cookies/CookieTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- CookieTest.java 12 Feb 2004 22:46:43 -0000 1.9 +++ CookieTest.java 28 Jul 2004 09:02:27 -0000 1.10 @@ -156,7 +156,7 @@ public void testHeaderGeneration() throws Exception { CookieJar jar = new CookieJar(); - jar.addCookie( "zero", "nil" ); + jar.putCookie( "zero", "nil" ); jar.updateCookies( newJar( "www.meterware.com/servlets/standard/AServlet", "first=ready" ) ); jar.updateCookies( newJar( "www.meterware.com/servlets/AnotherServlet", "second=set" ) ); jar.updateCookies( newJar( "www.httpunit.org", "zero=go; domain=.httpunit.org" ) ); |
From: Russell G. <rus...@us...> - 2004-07-28 09:02:35
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4789/src/com/meterware/httpunit/cookies Modified Files: CookieJar.java Log Message: rfe# 986876: allow replacement of client-generated cookie Index: CookieJar.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies/CookieJar.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- CookieJar.java 12 Feb 2004 22:46:42 -0000 1.9 +++ CookieJar.java 28 Jul 2004 09:02:26 -0000 1.10 @@ -85,6 +85,7 @@ /** * Defines a cookie to be sent to the server on every request. This bypasses the normal mechanism by which only * certain cookies are sent based on their host and path. + * @deprecated as of 1.5.5, use #setCookie **/ public void addCookie( String name, String value ) { _globalCookies.add( new Cookie( name, value ) ); @@ -92,6 +93,19 @@ /** + * Defines a cookie to be sent to the server on every request. This bypasses the normal mechanism by which only + * certain cookies are sent based on their host and path. + **/ + public void putCookie( String name, String value ) { + for (Iterator iterator = _globalCookies.iterator(); iterator.hasNext();) { + Cookie cookie = (Cookie) iterator.next(); + if (name.equals( cookie.getName() )) iterator.remove(); + } + _globalCookies.add( new Cookie( name, value ) ); + } + + + /** * Returns the name of all the active cookies in this cookie jar. **/ public String[] getCookieNames() { |
From: Russell G. <rus...@us...> - 2004-07-28 09:02:35
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4789/src/com/meterware/httpunit Modified Files: WebClient.java WebResponse.java Log Message: rfe# 986876: allow replacement of client-generated cookie Index: WebClient.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- WebClient.java 30 Jun 2004 23:54:48 -0000 1.59 +++ WebClient.java 28 Jul 2004 09:02:25 -0000 1.60 @@ -163,6 +163,7 @@ /** * Defines a cookie to be sent to the server on every request. + * @deprecated as of 1.5.5, use #putCookie instead. **/ public void addCookie( String name, String value ) { _cookieJar.addCookie( name, value ); @@ -170,6 +171,14 @@ /** + * Defines a cookie to be sent to the server on every request. This overrides any previous setting for this cookie name. + **/ + public void putCookie( String name, String value ) { + _cookieJar.putCookie( name, value ); + } + + + /** * Returns the name of all the active cookies which will be sent to the server. **/ public String[] getCookieNames() { Index: WebResponse.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v retrieving revision 1.132 retrieving revision 1.133 diff -u -r1.132 -r1.133 --- WebResponse.java 30 Jun 2004 23:54:49 -0000 1.132 +++ WebResponse.java 28 Jul 2004 09:02:25 -0000 1.133 @@ -1118,7 +1118,7 @@ void setCookie( String name, String value ) { - _client.addCookie( name, value ); + _client.putCookie( name, value ); } |
From: Russell G. <rus...@us...> - 2004-07-28 09:02:34
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4789/doc Modified Files: release_notes.txt Log Message: rfe# 986876: allow replacement of client-generated cookie Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.358 retrieving revision 1.359 diff -u -r1.358 -r1.359 --- release_notes.txt 23 Jul 2004 01:31:03 -0000 1.358 +++ release_notes.txt 28 Jul 2004 09:02:25 -0000 1.359 @@ -13,6 +13,12 @@ Revision History: +28-Jul-2004 + Additions: + 1. rfe #986876: The WebClient.addCookie method has been deprecated, since its behavior is actually a bit confusing + and replaced with "putCookie" allowing subsequent the replacement of a cookie value defined by a previous + call to "putCookie." + 22-Jul-2004 Acknowledgements: Thanks to Kazuaki Matsuhashi <mat...@qu...> for correcting the handling of non-Latin link parameters |
From: Russell G. <rus...@us...> - 2004-07-23 04:04:37
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31848/test/com/meterware/httpunit Modified Files: EncodingTest.java Log Message: patch #995853: decode link parameters based on page character set Index: EncodingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/EncodingTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- EncodingTest.java 23 Jul 2004 01:31:04 -0000 1.1 +++ EncodingTest.java 23 Jul 2004 04:04:28 -0000 1.2 @@ -208,7 +208,7 @@ } - public void testJapaneseLinkParam() throws Exception { + public void testJapaneseLinkParamNameWithValue() throws Exception { String japaneseUrl = "request?%A5%D8%A5%EB%A5%D7=2"; defineWebPage( "Linker", "<a id='link' href='" + japaneseUrl + "'>goThere</a>" ); setResourceCharSet( "Linker.html", "EUC-JP", true ); @@ -221,4 +221,17 @@ } + public void testJapaneseLinkParamNameWithoutValue() throws Exception { + String japaneseUrl = "request?%A5%D8%A5%EB%A5%D7"; + defineWebPage( "Linker", "<a id='link' href='" + japaneseUrl + "'>goThere</a>" ); + setResourceCharSet( "Linker.html", "EUC-JP", true ); + defineResource( japaneseUrl, "You made it!" ); + + WebConversation wc = new WebConversation(); + WebResponse formPage = wc.getResponse( getHostPath() + "/Linker.html" ); + WebResponse target = formPage.getLinkWithID( "link" ).click(); + assertEquals( "Resultant page", "You made it!", target.getText() ); + } + + } |
From: Russell G. <rus...@us...> - 2004-07-23 04:04:36
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31848/src/com/meterware/httpunit Modified Files: WebRequestSource.java Log Message: patch #995853: decode link parameters based on page character set Index: WebRequestSource.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- WebRequestSource.java 23 Jul 2004 01:31:04 -0000 1.38 +++ WebRequestSource.java 23 Jul 2004 04:04:27 -0000 1.39 @@ -352,12 +352,17 @@ ? null : ((index == param.length() - 1) ? getEmptyParameterValue() - : HttpUnitUtils.decode( param.substring( index + 1 ), _baseResponse.getCharacterSet() ).trim() )); - String name = (index < 0) ? param.trim() : HttpUnitUtils.decode( param.substring( 0, index ), _baseResponse.getCharacterSet() ).trim(); + : decode( param.substring( index + 1 ) ) )); + String name = (index < 0) ? decode( param ) : decode( param.substring( 0, index ) ); addPresetParameter( name, value ); } + private String decode( String string ) { + return HttpUnitUtils.decode( string, _baseResponse.getCharacterSet() ).trim(); + } + + abstract protected String getEmptyParameterValue(); } |
From: Russell G. <rus...@us...> - 2004-07-23 04:04:36
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31848/doc Modified Files: todo.txt Log Message: patch #995853: decode link parameters based on page character set Index: todo.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/todo.txt,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- todo.txt 15 Mar 2004 02:42:16 -0000 1.42 +++ todo.txt 23 Jul 2004 04:04:24 -0000 1.43 @@ -8,7 +8,7 @@ Medium priority: o Support optional tags which hide their contents (as in OBJECT, etc.) -o Check conformance with RFC 2109 - not currently sending $Version=1 string +o Check conformance with RFC 2109/2965 - not currently sending $Version=1 string o Documentation, Documentation |
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9976/src/com/meterware/httpunit Modified Files: FixedURLWebRequestSource.java HttpUnitUtils.java ParsedHTML.java WebImage.java WebLink.java WebRequestSource.java Log Message: patch #995853: decode link parameters based on page character set Index: FixedURLWebRequestSource.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FixedURLWebRequestSource.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- FixedURLWebRequestSource.java 13 Jun 2004 20:57:25 -0000 1.4 +++ FixedURLWebRequestSource.java 23 Jul 2004 01:31:04 -0000 1.5 @@ -36,10 +36,12 @@ private static final String[] NO_VALUES = new String[0]; private Map _presetParameterMap; private ArrayList _presetParameterList; + private String _characterSet; - public FixedURLWebRequestSource( WebResponse response, Node node, URL baseURL, String destination, FrameSelector frame, String defaultTarget ) { + public FixedURLWebRequestSource( WebResponse response, Node node, URL baseURL, String destination, FrameSelector frame, String defaultTarget, String characterSet ) { super( response, node, baseURL, destination, frame, defaultTarget ); + _characterSet = characterSet; } @@ -152,6 +154,11 @@ } + String getCharacterSet() { + return _characterSet; + } + + private boolean equals( String[] left, String[] right ) { if (left.length != right.length) return false; List rightValues = Arrays.asList( right ); Index: HttpUnitUtils.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- HttpUnitUtils.java 11 Jul 2004 02:38:34 -0000 1.18 +++ HttpUnitUtils.java 23 Jul 2004 01:31:04 -0000 1.19 @@ -20,6 +20,8 @@ * *******************************************************************************************************************/ import java.util.StringTokenizer; +import java.io.ByteArrayOutputStream; +import java.io.UnsupportedEncodingException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -65,32 +67,72 @@ } /** - * Returns an interpretation of the specified URL-encoded string. - * FIXME: currently assumes iso-8859-1 character set. + * Returns an interpretation of the specified URL-encoded string, using the iso-8859-1 character set. **/ public static String decode( String byteString ) { - char[] chars = byteString.toCharArray(); - StringBuffer sb = new StringBuffer(chars.length); - char[] hexNum = { '0', '0', '0' }; + return decode( byteString, "iso-8859-1" ); + } - int i = 0; - while (i < chars.length) { - if (chars[i] == '+') { - i++; - sb.append( ' ' ); - } else if (chars[i] == '%') { - i++; - hexNum[1] = chars[i++]; - hexNum[2] = chars[i++]; - sb.append( (char) Integer.parseInt( new String( hexNum ), 16 ) ); + + + /** + * Decodes a URL safe string into its original form using the + * specified character set. Escaped characters are converted back + * to their original representation. + * + * This method is copied from the <b>Jakarta Commons Codec</b>; + * <code>org.apache.commons.codec.net.URLCodec</code> class. + * + * @param string URL safe string to convert into its original form + * @return original string + * @throws IllegalArgumentException thrown if URL decoding is unsuccessful, + */ + public static String decode( String string, String charset ) { + try { + if (string == null) return null; + + return new String( decodeUrl( string.getBytes( "US-ASCII" ) ), charset ); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException( e.toString() ); + } + } + + + /** + * Decodes an array of URL safe 7-bit characters into an array of + * original bytes. Escaped characters are converted back to their + * original representation. + * + * This method is copied from the <b>Jakarta Commons Codec</b>; + * <code>org.apache.commons.codec.net.URLCodec</code> class. + * + * @param pArray array of URL safe characters + * @return array of original bytes + */ + private static final byte[] decodeUrl( byte[] pArray ) throws IllegalArgumentException { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + for (int i = 0; i < pArray.length; i++) { + int b = pArray[i]; + if (b == '+') { + buffer.write( ' ' ); + } else if (b != '%') { + buffer.write( b ); } else { - sb.append( chars[i++] ); + try { + int u = Character.digit( (char) pArray[++i], 16 ); + int l = Character.digit( (char) pArray[++i], 16 ); + if (u == -1 || l == -1) throw new IllegalArgumentException( "Invalid URL encoding" ); + buffer.write( (char) ((u << 4) + l) ); + } catch (ArrayIndexOutOfBoundsException e) { + throw new IllegalArgumentException( "Invalid URL encoding" ); + } } } - return sb.toString(); + return buffer.toByteArray(); } + /** * creates a parser using JAXP API. */ Index: ParsedHTML.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- ParsedHTML.java 21 Jul 2004 01:07:32 -0000 1.57 +++ ParsedHTML.java 23 Jul 2004 01:31:04 -0000 1.58 @@ -675,7 +675,7 @@ private WebLink toLinkAnchor( Element child ) { - return (!isWebLink( child )) ? null : new WebLink( _response, _baseURL, child, _frame, _baseTarget ); + return (!isWebLink( child )) ? null : new WebLink( _response, _baseURL, child, _frame, _baseTarget, _characterSet ); } @@ -685,7 +685,7 @@ private WebImage toWebImage( Element child ) { - return new WebImage( _response, this, _baseURL, child, _frame, _baseTarget ); + return new WebImage( _response, this, _baseURL, child, _frame, _baseTarget, _characterSet ); } Index: WebImage.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebImage.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- WebImage.java 13 Jun 2004 20:57:25 -0000 1.10 +++ WebImage.java 23 Jul 2004 01:31:04 -0000 1.11 @@ -41,8 +41,8 @@ private String _alt; - WebImage( WebResponse response, ParsedHTML parsedHTML, URL baseURL, Node node, FrameSelector sourceFrame, String defaultTarget ) { - super( response, node, baseURL, NodeUtils.getNodeAttribute( node, "src" ), sourceFrame, defaultTarget ); + WebImage( WebResponse response, ParsedHTML parsedHTML, URL baseURL, Node node, FrameSelector sourceFrame, String defaultTarget, String characterSet ) { + super( response, node, baseURL, NodeUtils.getNodeAttribute( node, "src" ), sourceFrame, defaultTarget, characterSet ); _node = node; _parsedHTML = parsedHTML; _src = NodeUtils.getNodeAttribute( _node, "src" ); Index: WebLink.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebLink.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- WebLink.java 27 Jun 2004 19:29:15 -0000 1.43 +++ WebLink.java 23 Jul 2004 01:31:04 -0000 1.44 @@ -165,8 +165,8 @@ * Contructs a web link given the URL of its source page and the DOM extracted * from that page. **/ - WebLink( WebResponse response, URL baseURL, Node node, FrameSelector sourceFrame, String defaultTarget ) { - super( response, node, baseURL, NodeUtils.getNodeAttribute( node, "href" ), sourceFrame, defaultTarget ); + WebLink( WebResponse response, URL baseURL, Node node, FrameSelector sourceFrame, String defaultTarget, String characterSet ) { + super( response, node, baseURL, NodeUtils.getNodeAttribute( node, "href" ), sourceFrame, defaultTarget, characterSet ); } Index: WebRequestSource.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- WebRequestSource.java 11 Jul 2004 02:38:34 -0000 1.37 +++ WebRequestSource.java 23 Jul 2004 01:31:04 -0000 1.38 @@ -352,8 +352,8 @@ ? null : ((index == param.length() - 1) ? getEmptyParameterValue() - : HttpUnitUtils.decode( param.substring( index + 1 ) ).trim() )); - String name = (index < 0) ? param.trim() : HttpUnitUtils.decode( param.substring( 0, index ) ).trim(); + : HttpUnitUtils.decode( param.substring( index + 1 ), _baseResponse.getCharacterSet() ).trim() )); + String name = (index < 0) ? param.trim() : HttpUnitUtils.decode( param.substring( 0, index ), _baseResponse.getCharacterSet() ).trim(); addPresetParameter( name, value ); } |
From: Russell G. <rus...@us...> - 2004-07-23 01:31:13
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9976/src/com/meterware/servletunit Modified Files: RequestContext.java Log Message: patch #995853: decode link parameters based on page character set Index: RequestContext.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/RequestContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- RequestContext.java 2 Mar 2004 10:54:14 -0000 1.3 +++ RequestContext.java 23 Jul 2004 01:31:04 -0000 1.4 @@ -45,7 +45,7 @@ RequestContext( URL url ) { _url = url; String file = _url.getFile(); - if (file.indexOf( '?' ) >= 0) loadParameters( file.substring( file.indexOf( '?' )+1 ) ); + if (file.indexOf( '?' ) >= 0) loadParameters( file.substring( file.indexOf( '?' )+1 ), /* urlEncoded */ true ); } @@ -99,7 +99,7 @@ * have_equals -> initial: record parameter with null value * have_value -> initial: record parameter with value **/ - void loadParameters( String queryString ) { + void loadParameters( String queryString, boolean urlEncoded ) { if (queryString.length() == 0) return; StringTokenizer st = new StringTokenizer( queryString, "&=", /* return tokens */ true ); int state = STATE_INITIAL; @@ -119,11 +119,11 @@ state = STATE_INITIAL; } } else if (state == STATE_INITIAL) { - name = HttpUnitUtils.decode( token ); + name = (!urlEncoded) ? token : HttpUnitUtils.decode( token, getMessageEncoding() ); value = ""; state = STATE_HAVE_NAME; } else { - value = HttpUnitUtils.decode( token ); + value = (!urlEncoded) ? token : HttpUnitUtils.decode( token, getMessageEncoding() ); state = STATE_HAVE_VALUE; } } @@ -152,7 +152,7 @@ private Hashtable getParameters() { if (_messageBody != null) { - loadParameters( getMessageBodyAsString() ); + loadParameters( getMessageBodyAsString(), /* urlEncoded */ false ); _messageBody = null; } if (_visibleParameters == null) { @@ -177,7 +177,7 @@ private String getMessageBodyAsString() { try { - return _messageEncoding == null ? new String( _messageBody ) : new String( _messageBody, _messageEncoding ); + return new String( _messageBody, getMessageEncoding() ); } catch (UnsupportedEncodingException e) { return ""; } @@ -194,4 +194,9 @@ } + private String getMessageEncoding() { + return _messageEncoding == null ? HttpUnitUtils.DEFAULT_CHARACTER_SET : _messageEncoding; + } + + } |
From: Russell G. <rus...@us...> - 2004-07-23 01:31:13
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9976/doc Modified Files: release_notes.txt Log Message: patch #995853: decode link parameters based on page character set Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.357 retrieving revision 1.358 diff -u -r1.357 -r1.358 --- release_notes.txt 21 Jul 2004 23:17:31 -0000 1.357 +++ release_notes.txt 23 Jul 2004 01:31:03 -0000 1.358 @@ -13,6 +13,13 @@ Revision History: +22-Jul-2004 + Acknowledgements: + Thanks to Kazuaki Matsuhashi <mat...@qu...> for correcting the handling of non-Latin link parameters + + Problems fixed: + 1. patch #995853: decode link parameters based on page character set + 21-Jul-2004 Acknowledgements: Thanks to Darrell DeBoer <bi...@us...> for providing a patch for select box functionality |
From: Russell G. <rus...@us...> - 2004-07-23 01:31:13
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9976/test/com/meterware/httpunit Modified Files: HttpUnitSuite.java WebPageTest.java Added Files: EncodingTest.java Log Message: patch #995853: decode link parameters based on page character set ***** Error reading new file[Errno 2] No such file or directory: 'EncodingTest.java' Index: HttpUnitSuite.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HttpUnitSuite.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- HttpUnitSuite.java 27 Jun 2004 19:29:15 -0000 1.33 +++ HttpUnitSuite.java 23 Jul 2004 01:31:04 -0000 1.34 @@ -59,6 +59,7 @@ result.addTest( ParsingTestSuite.suite() ); result.addTest( NormalizeURLTest.suite() ); result.addTest( TextBlockTest.suite() ); + result.addTest( EncodingTest.suite() ); if (HTMLParserFactory.getHTMLParser().getClass().getName().indexOf("NekoHTML") >= 0) result.addTest( NekoEnhancedScriptingTest.suite() ); addOptionalTestCase( result, "com.meterware.httpunit.XMLPageTest" ); Index: WebPageTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- WebPageTest.java 30 Jun 2004 00:01:24 -0000 1.37 +++ WebPageTest.java 23 Jul 2004 01:31:04 -0000 1.38 @@ -150,157 +150,6 @@ } - public void testSpecifiedEncoding() throws Exception { - String hebrewTitle = "\u05d0\u05d1\u05d2\u05d3"; - String page = "<html><head><title>" + hebrewTitle + "</title></head>\n" + - "<body>This has no data\n" + - "</body></html>\n"; - defineResource( "SimplePage.html", page ); - setResourceCharSet( "SimplePage.html", "iso-8859-8", true ); - - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); - WebResponse simplePage = wc.getResponse( request ); - - assertEquals( "Title", hebrewTitle, simplePage.getTitle() ); - assertEquals( "Character set", "iso-8859-8", simplePage.getCharacterSet() ); - } - - - public void testQuotedEncoding() throws Exception { - String hebrewTitle = "\u05d0\u05d1\u05d2\u05d3"; - String page = "<html><head><title>" + hebrewTitle + "</title></head>\n" + - "<body>This has no data\n" + - "</body></html>\n"; - defineResource( "SimplePage.html", page ); - setResourceCharSet( "SimplePage.html", "\"iso-8859-8\"", true ); - - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); - WebResponse simplePage = wc.getResponse( request ); - - assertEquals( "Title", hebrewTitle, simplePage.getTitle() ); - assertEquals( "Character set", "iso-8859-8", simplePage.getCharacterSet() ); - } - - - public void testUnspecifiedEncoding() throws Exception { - String hebrewTitle = "\u05d0\u05d1\u05d2\u05d3"; - String page = "<html><head><title>" + hebrewTitle + "</title></head>\n" + - "<body>This has no data\n" + - "</body></html>\n"; - defineResource( "SimplePage.html", page ); - setResourceCharSet( "SimplePage.html", "iso-8859-8", false ); - - HttpUnitOptions.setDefaultCharacterSet( "iso-8859-8" ); - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); - WebResponse simplePage = wc.getResponse( request ); - - assertEquals( "Character set", "iso-8859-8", simplePage.getCharacterSet() ); - assertEquals( "Title", hebrewTitle, simplePage.getTitle() ); - } - - - public void testMetaEncoding() throws Exception { - String hebrewTitle = "\u05d0\u05d1\u05d2\u05d3"; - String page = "<html><head><title>" + hebrewTitle + "</title>" + - "<meta Http_equiv=content-type content=\"text/html; charset=iso-8859-8\"></head>\n" + - "<body>This has no data\n" + - "</body></html>\n"; - defineResource( "SimplePage.html", page ); - setResourceCharSet( "SimplePage.html", "iso-8859-8", false ); - - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); - WebResponse simplePage = wc.getResponse( request ); - - assertEquals( "Character set", "iso-8859-8", simplePage.getCharacterSet() ); - assertEquals( "Title", hebrewTitle, simplePage.getTitle() ); - } - - - public void testHebrewForm() throws Exception { - String hebrewName = "\u05d0\u05d1\u05d2\u05d3"; - defineResource( "HebrewForm.html", - "<html><head></head>" + - "<form method=POST action=\"SayHello\">" + - "<input type=text name=name><input type=submit></form></body></html>" ); - setResourceCharSet( "HebrewForm.html", "iso-8859-8", true ); - defineResource( "SayHello", new PseudoServlet() { - public WebResource getPostResponse() { - try { - String name = getParameter( "name" )[0]; - WebResource result = new WebResource( "<html><body><table><tr><td>Hello, " + - new String( name.getBytes( "iso-8859-1" ), "iso-8859-8" ) + - "</td></tr></table></body></html>" ); - result.setCharacterSet( "iso-8859-8" ); - result.setSendCharacterSet( true ); - return result; - } catch (java.io.UnsupportedEncodingException e) { - return null; - } - } - } ); - - WebConversation wc = new WebConversation(); - WebResponse formPage = wc.getResponse( getHostPath() + "/HebrewForm.html" ); - WebForm form = formPage.getForms()[0]; - WebRequest request = form.getRequest(); - request.setParameter( "name", hebrewName ); - - WebResponse answer = wc.getResponse( request ); - String[][] cells = answer.getTables()[0].asText(); - - assertEquals( "Message", "Hello, " + hebrewName, cells[0][0] ); - assertEquals( "Character set", "iso-8859-8", answer.getCharacterSet() ); - } - - - public void testEncodedRequestWithoutForm() throws Exception { - String hebrewName = "\u05d0\u05d1\u05d2\u05d3"; - defineResource( "SayHello", new PseudoServlet() { - public WebResource getPostResponse() { - try { - String name = getParameter( "name" )[0]; - WebResource result = new WebResource( "<html><body><table><tr><td>Hello, " + - new String( name.getBytes( "iso-8859-1" ), "iso-8859-8" ) + - "</td></tr></table></body></html>" ); - result.setCharacterSet( "iso-8859-8" ); - result.setSendCharacterSet( true ); - return result; - } catch (java.io.UnsupportedEncodingException e) { - return null; - } - } - } ); - - WebConversation wc = new WebConversation(); - HttpUnitOptions.setDefaultCharacterSet( "iso-8859-8" ); - WebRequest request = new PostMethodWebRequest( getHostPath() + "/SayHello" ); - request.setParameter( "name", hebrewName ); - - WebResponse answer = wc.getResponse( request ); - String[][] cells = answer.getTables()[0].asText(); - - assertEquals( "Message", "Hello, " + hebrewName, cells[0][0] ); - assertEquals( "Character set", "iso-8859-8", answer.getCharacterSet() ); - } - - - public void testUnsupportedEncoding() throws Exception { - defineResource( "SimplePage.html", "not much here" ); - addResourceHeader( "SimplePage.html", "Content-type: text/plain; charset=BOGUS"); - - WebConversation wc = new WebConversation(); - WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); - WebResponse simplePage = wc.getResponse( request ); - - assertEquals( "Text", "not much here", simplePage.getText() ); - assertEquals( "Character set", WebResponse.getDefaultEncoding(), simplePage.getCharacterSet() ); - } - - public void testRefreshHeader() throws Exception { String refreshURL = getHostPath() + "/NextPage.html"; String page = "<html><head><title>Sample</title></head>\n" + |
From: Russell G. <rus...@us...> - 2004-07-23 01:29:06
|
Update of /cvsroot/httpunit/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9660 Modified Files: build.xml Log Message: add DTDs back to classpath Index: build.xml =================================================================== RCS file: /cvsroot/httpunit/httpunit/build.xml,v retrieving revision 1.74 retrieving revision 1.75 diff -u -r1.74 -r1.75 --- build.xml 23 Jul 2004 01:13:02 -0000 1.74 +++ build.xml 23 Jul 2004 01:28:56 -0000 1.75 @@ -151,6 +151,7 @@ <classpath> <path refid="base.classpath" /> <pathelement location="${build.classes}" /> + <pathelement location="META-INF" /> <pathelement location="${test.classes}" /> </classpath> </java> |
From: Russell G. <rus...@us...> - 2004-07-23 01:13:11
|
Update of /cvsroot/httpunit/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7177 Modified Files: build.xml Log Message: include DTDs in jar Index: build.xml =================================================================== RCS file: /cvsroot/httpunit/httpunit/build.xml,v retrieving revision 1.73 retrieving revision 1.74 diff -u -r1.73 -r1.74 --- build.xml 27 Jun 2004 16:00:33 -0000 1.73 +++ build.xml 23 Jul 2004 01:13:02 -0000 1.74 @@ -91,9 +91,6 @@ <exclude name="**/JUnitServlet.java" unless="junit.present" /> <exclude name="**/javascript/*" unless="rhino.present" /> </javac> - <copy todir="${build.classes}"> - <fileset dir="META-INF" includes="*.dtd"/> - </copy> </target> @@ -185,7 +182,10 @@ Build-Date: ${TODAY} Build-Time: ${TSTAMP} </echo> - <jar jarfile="${lib.dir}/${name}.jar" basedir="${build.classes}" includes="com/**" manifest="${build.dir}/info.txt" /> + <jar jarfile="${lib.dir}/${name}.jar" manifest="${build.dir}/info.txt"> + <fileset dir="${build.classes}" includes="com/**"/> + <fileset dir="META-INF" includes="*.dtd"/> + </jar> </target> |
From: Russell G. <rus...@us...> - 2004-07-21 23:17:40
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23258/test/com/meterware/httpunit/javascript Modified Files: FormScriptingTest.java Log Message: patch #879193: enhanced select control javascript behavior Index: FormScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- FormScriptingTest.java 28 Jun 2004 23:06:06 -0000 1.30 +++ FormScriptingTest.java 21 Jul 2004 23:17:32 -0000 1.31 @@ -736,6 +736,7 @@ " alert( 'select 2nd option value is ' + choices.options[1].value )\n;" + " if (choices.options[0].selected) alert( 'red selected' );\n" + " if (choices.options[1].selected) alert( 'blue selected' );\n" + + " if (choices[1].selected) alert( 'blue selected again' );\n" + "}\n" + "</script></head>" + "<body onLoad='viewSelect( document.the_form.choices )'>" + @@ -754,6 +755,7 @@ assertEquals( "3rd message", "select option 0 is red", wc.popNextAlert() ); assertEquals( "4th message", "select 2nd option value is 3", wc.popNextAlert() ); assertEquals( "5th message", "blue selected", wc.popNextAlert() ); + assertEquals( "6th message", "blue selected again", wc.popNextAlert() ); response.getLinks()[0].mouseOver(); assertEquals( "before change message", "selected #1", wc.popNextAlert() ); @@ -763,6 +765,32 @@ } + public void testFormSelectDefaults() throws Exception { + defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" + + "function viewSelect( form ) { \n" + + " alert( 'first default index= ' + form.first.selectedIndex )\n;" + + " alert( 'second default index= ' + form.second.selectedIndex )\n;" + + " alert( 'third default index= ' + form.third.selectedIndex )\n;" + + " alert( 'fourth default index= ' + form.fourth.selectedIndex )\n;" + + "}\n" + + "</script></head>" + + "<body onLoad='viewSelect( document.the_form )'>" + + "<form name='the_form'>" + + " <select name='first'><option value='1'>red<option value='3'>blue</select>" + + " <select name='second' multiple><option value='1'>red<option value='3'>blue</select>" + + " <select name='third' size=2><option value='1'>red<option value='3'>blue</select>" + + " <select name='fourth' multiple size=1><option value='1'>red<option value='3'>blue</select>" + + "</form>" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + wc.getResponse( getHostPath() + "/OnCommand.html" ); + assertEquals( "1st message", "first default index= 0", wc.popNextAlert() ); + assertEquals( "2nd message", "second default index= -1", wc.popNextAlert() ); + assertEquals( "3rd message", "third default index= -1", wc.popNextAlert() ); + assertEquals( "4th message", "fourth default index= 0", wc.popNextAlert() ); + } + + public void testFileSubmitProperties() throws Exception { File file = new File( "temp.html" ); defineResource( "OnCommand.html", "<html><head></head>" + |
From: Russell G. <rus...@us...> - 2004-07-21 23:17:40
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23258/src/com/meterware/httpunit Modified Files: FormControl.java Log Message: patch #879193: enhanced select control javascript behavior Index: FormControl.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- FormControl.java 9 Mar 2004 20:31:03 -0000 1.46 +++ FormControl.java 21 Jul 2004 23:17:32 -0000 1.47 @@ -961,10 +961,11 @@ super( form, node ); if (!node.getNodeName().equalsIgnoreCase( "select" )) throw new RuntimeException( "Not a select element" ); - _multiSelect = NodeUtils.isNodeAttributePresent( node, "multiple" ); - _listBox = _multiSelect || NodeUtils.isNodeAttributePresent( node, "size" ); + int size = NodeUtils.getAttributeValue( node, "size", 0); + _multiSelect = NodeUtils.isNodeAttributePresent( node, "multiple" ); + _listBox = size > 1 || (_multiSelect && size != 1); - _selectionOptions = _multiSelect ? (Options) new MultiSelectOptions( node ) : (Options) new SingleSelectOptions( node ); + _selectionOptions = _listBox ? (Options) new MultiSelectOptions( node ) : (Options) new SingleSelectOptions( node ); } @@ -1008,6 +1009,11 @@ } + public Object get(int index) { + return _selectionOptions.get( index ); + } + + private String getSelectedValue() { String[] values = getValues(); return (values.length == 0 ? "" : values[0] ); |
From: Russell G. <rus...@us...> - 2004-07-21 23:17:40
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23258/doc Modified Files: release_notes.txt Log Message: patch #879193: enhanced select control javascript behavior Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.356 retrieving revision 1.357 diff -u -r1.356 -r1.357 --- release_notes.txt 21 Jul 2004 01:07:32 -0000 1.356 +++ release_notes.txt 21 Jul 2004 23:17:31 -0000 1.357 @@ -13,6 +13,14 @@ Revision History: +21-Jul-2004 + Acknowledgements: + Thanks to Darrell DeBoer <bi...@us...> for providing a patch for select box functionality + + Additions: + 1. patch #879193: Select now behaves as a multiselect listbox if it has size > 1 or if multiple is set and the size is not set to 1. + 2. patch #879193: The name of a select box may now be treated as an array of options. + 20-Jul-2004 Problems fixed: 1. bug #990914: WebFrame scriptables are now accessible by getElementById |
From: Russell G. <rus...@us...> - 2004-07-21 01:07:43
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14846/src/com/meterware/httpunit Modified Files: HTMLElementBase.java ParsedHTML.java WebFrame.java Log Message: bug #990914: access frame element in Javascript Index: HTMLElementBase.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLElementBase.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- HTMLElementBase.java 27 Jun 2004 19:29:15 -0000 1.6 +++ HTMLElementBase.java 21 Jul 2004 01:07:32 -0000 1.7 @@ -123,7 +123,9 @@ * Creates and returns a scriptable object for this control. Subclasses should override this if they use a different * implementation of Scriptable. */ - abstract protected ScriptableDelegate newScriptable(); + protected ScriptableDelegate newScriptable() { + return new HTMLElementScriptable( this ); + } /** Index: ParsedHTML.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- ParsedHTML.java 2 Jul 2004 22:09:27 -0000 1.56 +++ ParsedHTML.java 21 Jul 2004 01:07:32 -0000 1.57 @@ -665,7 +665,7 @@ private WebFrame toWebFrame( Element element ) { - return new WebFrame( _baseURL, element, _frame ); + return new WebFrame( _response, _baseURL, element, _frame ); } @@ -1040,7 +1040,7 @@ class WebIFrame extends WebFrame implements ContentConcealer { public WebIFrame( URL baseURL, Node frameNode, FrameSelector parentFrame ) { - super( baseURL, frameNode, parentFrame ); + super( _response, baseURL, frameNode, parentFrame ); } } Index: WebFrame.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebFrame.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- WebFrame.java 11 Jul 2004 02:38:34 -0000 1.14 +++ WebFrame.java 21 Jul 2004 01:07:33 -0000 1.15 @@ -32,26 +32,23 @@ private FrameSelector _selector; + private WebResponse _response; private Node _element; private URL _baseURL; - protected ScriptableDelegate newScriptable() { - return null; - } - - protected ScriptableDelegate getParentDelegate() { - return null; + return _response.getScriptableObject().getDocument(); } //---------------------------------------- package methods ----------------------------------------- - WebFrame( URL baseURL, Node frameNode, FrameSelector parentFrame ) { + WebFrame( WebResponse response, URL baseURL, Node frameNode, FrameSelector parentFrame ) { super( frameNode ); + _response = response; _element = frameNode; _baseURL = baseURL; _selector = getFrameSelector( parentFrame ); |
From: Russell G. <rus...@us...> - 2004-07-21 01:07:43
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14846/test/com/meterware/httpunit/javascript Modified Files: FrameScriptingTest.java Log Message: bug #990914: access frame element in Javascript Index: FrameScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FrameScriptingTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- FrameScriptingTest.java 2 Jul 2004 22:09:28 -0000 1.5 +++ FrameScriptingTest.java 21 Jul 2004 01:07:33 -0000 1.6 @@ -29,9 +29,14 @@ * More complex tests of frame functionality. * * @author <a href="and...@hp...">Andrew Bickerton</a> + * @author <a href="rus...@ht...">Russell Gold</a> **/ public class FrameScriptingTest extends HttpUnitTest { + + private WebConversation _wc; + + public static void main(String args[]) { junit.textui.TestRunner.run( suite() ); } @@ -193,6 +198,7 @@ assertEquals( "Result of click", "You made it!", result.getText() ); } + /** * Verifies that when JavaScript overwrites an empty frame, other empty frames stay empty. */ @@ -214,5 +220,18 @@ assertEquals("Links in green frame", 1, _wc.getFrameContents("green").getLinks().length); assertEquals("Links in blue frame", 0, _wc.getFrameContents("blue").getLinks().length); } - private WebConversation _wc; + + + /** + * Verifies that when JavaScript overwrites an empty frame, other empty frames stay empty. + */ + public void testIFrameAccessById() throws Exception { + defineWebPage( "Frames", + "<iframe id='frame1'></iframe>" + + "<script>" + + "var frame = document.getElementById('frame1');" + + "</script>" ); + + _wc.getResponse(getHostPath() + "/Frames.html"); + } } |