httpunit-commit Mailing List for httpunit (Page 17)
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-07-21 01:07:42
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14846/doc Modified Files: release_notes.txt Log Message: bug #990914: access frame element in Javascript Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.355 retrieving revision 1.356 diff -u -r1.355 -r1.356 --- release_notes.txt 11 Jul 2004 03:11:32 -0000 1.355 +++ release_notes.txt 21 Jul 2004 01:07:32 -0000 1.356 @@ -13,6 +13,10 @@ Revision History: +20-Jul-2004 + Problems fixed: + 1. bug #990914: WebFrame scriptables are now accessible by getElementById + 9-Jul-2004 Additions: 1. rfe #974791: WebForm now supports submitNoButton to submit a form without any of its buttons. This permits |
From: Russell G. <rus...@us...> - 2004-07-11 03:11:42
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20863/src/com/meterware/httpunit Modified Files: SubmitButton.java WebForm.java Log Message: rfe #974791: added WebForm.submitNoButton Index: SubmitButton.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/SubmitButton.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- SubmitButton.java 29 Jun 2004 23:24:12 -0000 1.18 +++ SubmitButton.java 11 Jul 2004 03:11:32 -0000 1.19 @@ -29,6 +29,9 @@ **/ public class SubmitButton extends Button { + private boolean _fake; + + public String getType() { return (isImageButton()?IMAGE_BUTTON_TYPE:SUBMIT_BUTTON_TYPE); } @@ -98,6 +101,22 @@ } + static SubmitButton createFakeSubmitButton( WebForm form ) { + return new SubmitButton( form, /* fake */ true ); + } + + + private SubmitButton( WebForm form, boolean fake ) { + this( form ); + _fake = fake; + } + + + boolean isFake() { + return _fake; + } + + void setPressed( boolean pressed ) { _pressed = pressed; } Index: WebForm.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v retrieving revision 1.93 retrieving revision 1.94 diff -u -r1.93 -r1.94 --- WebForm.java 2 Jul 2004 22:15:23 -0000 1.93 +++ WebForm.java 11 Jul 2004 03:11:32 -0000 1.94 @@ -81,6 +81,15 @@ /** + * Submits this form using the web client from which it was originally obtained, ignoring any buttons defined for the form. + * @since 1.5.5 + **/ + public WebResponse submitNoButton() throws SAXException, IOException { + return submit( SubmitButton.createFakeSubmitButton( this /* fake */ ) ); + } + + + /** * Submits the form without also invoking the button's "onclick" event. */ WebResponse doFormSubmit( SubmitButton button ) throws IOException, SAXException { @@ -263,6 +272,8 @@ if (HttpUnitOptions.getParameterValuesValidated()) { if (button == null) { throw new IllegalUnnamedSubmitButtonException(); + } else if (button.isFake()) { + // bypass checks } else if (!getSubmitButtonVector().contains( button )) { throw new IllegalSubmitButtonException( button ); } else if (button.isDisabled()) { |
From: Russell G. <rus...@us...> - 2004-07-11 03:11:42
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20863/test/com/meterware/httpunit Modified Files: WebFormTest.java Log Message: rfe #974791: added WebForm.submitNoButton Index: WebFormTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFormTest.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- WebFormTest.java 2 Jul 2004 22:15:23 -0000 1.32 +++ WebFormTest.java 11 Jul 2004 03:11:32 -0000 1.33 @@ -93,6 +93,8 @@ fail( "Should have rejected request as ambiguous" ); } catch (IllegalRequestParameterException e) { } + WebResponse noButton = form.submitNoButton(); + assertEquals( "Expected response", "You made it!", noButton.getText() ); } |
From: Russell G. <rus...@us...> - 2004-07-11 03:11:41
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20863/doc Modified Files: release_notes.txt Log Message: rfe #974791: added WebForm.submitNoButton Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.354 retrieving revision 1.355 diff -u -r1.354 -r1.355 --- release_notes.txt 11 Jul 2004 02:38:33 -0000 1.354 +++ release_notes.txt 11 Jul 2004 03:11:32 -0000 1.355 @@ -13,7 +13,11 @@ Revision History: - 8-Jul-2004 + 9-Jul-2004 + Additions: + 1. rfe #974791: WebForm now supports submitNoButton to submit a form without any of its buttons. This permits + testing of server response to a Javascript-style submit without using JavaScript. + Problems fixed: 1. bug #986397: Subframe included fragments in their source attributes now ignore those fragments when generating requests. |
From: Russell G. <rus...@us...> - 2004-07-11 02:38:43
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16759/src/com/meterware/httpunit Modified Files: HttpUnitUtils.java WebFrame.java WebRequestSource.java Log Message: bug #986397: remove fragments from subframe initial requests Index: HttpUnitUtils.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- HttpUnitUtils.java 30 Jun 2004 00:01:21 -0000 1.17 +++ HttpUnitUtils.java 11 Jul 2004 02:38:34 -0000 1.18 @@ -224,6 +224,16 @@ } + /** + * Strips the fragment identifier (if any) from the Url. + */ + static String trimFragment( String rawUrl ) { + if (isJavaScriptURL( rawUrl )) return rawUrl; + final int hashIndex = rawUrl.indexOf( '#' ); + return hashIndex < 0 ? rawUrl: rawUrl.substring( 0, hashIndex ); + } + + static class ClasspathEntityResolver implements EntityResolver { public InputSource resolveEntity( String publicID, String systemID ) { Index: WebFrame.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebFrame.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- WebFrame.java 13 Jun 2004 20:57:25 -0000 1.13 +++ WebFrame.java 11 Jul 2004 02:38:34 -0000 1.14 @@ -75,7 +75,7 @@ WebRequest getInitialRequest() { return new GetMethodWebRequest( _baseURL, - NodeUtils.getNodeAttribute( _element, "src" ), + HttpUnitUtils.trimFragment( NodeUtils.getNodeAttribute( _element, "src" ) ), _selector ); } Index: WebRequestSource.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- WebRequestSource.java 28 Jun 2004 23:18:16 -0000 1.36 +++ WebRequestSource.java 11 Jul 2004 02:38:34 -0000 1.37 @@ -153,23 +153,12 @@ protected String getRelativeURL() { - String result = HttpUnitUtils.trimAll( trimFragment( getDestination() ) ); + String result = HttpUnitUtils.trimAll( HttpUnitUtils.trimFragment( getDestination() ) ); if (result.trim().length() == 0) result = getBaseURL().getFile(); return result; } - private String trimFragment( String href ) { - if (HttpUnitUtils.isJavaScriptURL( href )) return href; - final int hashIndex = href.indexOf( '#' ); - if (hashIndex < 0) { - return href; - } else { - return href.substring( 0, hashIndex ); - } - } - - //----------------------------- protected members --------------------------------------------- /** @@ -343,7 +332,7 @@ * Gets all parameters from a URL **/ private String getParametersString() { - String url = trimFragment( getDestination() ); + String url = HttpUnitUtils.trimFragment( getDestination() ); if (url.trim().length() == 0) url = getBaseURL().toExternalForm(); if (HttpUnitUtils.isJavaScriptURL( url )) return ""; final int questionMarkIndex = url.indexOf("?"); |
From: Russell G. <rus...@us...> - 2004-07-11 02:38:43
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16759/test/com/meterware/httpunit Modified Files: WebFrameTest.java Log Message: bug #986397: remove fragments from subframe initial requests Index: WebFrameTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFrameTest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- WebFrameTest.java 2 Jul 2004 22:09:28 -0000 1.19 +++ WebFrameTest.java 11 Jul 2004 02:38:34 -0000 1.20 @@ -104,6 +104,19 @@ } + public void testFrameRequestsWithFragments() throws Exception { + defineResource( "Frames.html", + "<HTML><HEAD><TITLE>Initial</TITLE></HEAD>" + + "<FRAMESET cols=\"20%,80%\">" + + " <FRAME src='Linker.html' name=\"red\">" + + " <FRAME src='Form.html#middle' name=blue>" + + "</FRAMESET></HTML>" ); + WebResponse response = _wc.getResponse( getHostPath() + "/Frames.html" ); + WebRequest[] requests = response.getFrameRequests(); + assertEquals( "URL for second request", getHostPath() + "/Form.html", requests[1].getURL().toExternalForm() ); + } + + public void testFrameLoading() throws Exception { _wc.getResponse( getHostPath() + "/Frames.html" ); |
From: Russell G. <rus...@us...> - 2004-07-11 02:38:43
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16759/doc Modified Files: release_notes.txt Log Message: bug #986397: remove fragments from subframe initial requests Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.353 retrieving revision 1.354 diff -u -r1.353 -r1.354 --- release_notes.txt 30 Jun 2004 00:01:20 -0000 1.353 +++ release_notes.txt 11 Jul 2004 02:38:33 -0000 1.354 @@ -13,6 +13,10 @@ Revision History: + 8-Jul-2004 + Problems fixed: + 1. bug #986397: Subframe included fragments in their source attributes now ignore those fragments when generating requests. + 29-Jun-2004 Problems fixed: 1. bug #805921: WebForm.selectImageButtonPosition was misleadingly public and should not have been used. |
From: Russell G. <rus...@us...> - 2004-07-05 15:26:00
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7151/src/com/meterware/httpunit Modified Files: WebConversation.java Log Message: Fixed up logging connecting message Index: WebConversation.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebConversation.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- WebConversation.java 23 Jun 2004 23:24:00 -0000 1.36 +++ WebConversation.java 5 Jul 2004 15:25:51 -0000 1.37 @@ -57,9 +57,7 @@ URLConnection connection = openConnection( getRequestURL( request ) ); if (HttpUnitOptions.isLoggingHttpHeaders()) { String urlString = request.getURLString(); - String rawUrl = request.getURL().toExternalForm(); - String target = rawUrl.substring( 0, rawUrl.indexOf( urlString ) ); - System.out.println( "\nConnecting to " + target ); + System.out.println( "\nConnecting to " + request.getURL().getHost() ); System.out.println( "Sending:: " + request.getMethod() + " " + urlString ); } sendHeaders( connection, getHeaderFields( request.getURL() ) ); |
From: Russell G. <rus...@us...> - 2004-07-02 22:15:32
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12742/src/com/meterware/httpunit Modified Files: WebForm.java Log Message: Verify ambiguous button on submit Index: WebForm.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- WebForm.java 29 Jun 2004 23:24:13 -0000 1.92 +++ WebForm.java 2 Jul 2004 22:15:23 -0000 1.93 @@ -64,7 +64,7 @@ * inhibits the submission, will return the updated contents of the frame containing this form. **/ public WebResponse submit( SubmitButton button ) throws IOException, SAXException { - return button.doOnClickEvent() ? doFormSubmit( button ) : getCurrentFrameContents(); + return (button == null || button.doOnClickEvent()) ? doFormSubmit( button ) : getCurrentFrameContents(); } |
From: Russell G. <rus...@us...> - 2004-07-02 22:15:32
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12742/test/com/meterware/httpunit Modified Files: WebFormTest.java Log Message: Verify ambiguous button on submit Index: WebFormTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFormTest.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- WebFormTest.java 29 Jun 2004 23:24:13 -0000 1.31 +++ WebFormTest.java 2 Jul 2004 22:15:23 -0000 1.32 @@ -23,9 +23,11 @@ import com.meterware.pseudoserver.WebResource; import java.net.HttpURLConnection; +import java.io.IOException; import junit.framework.Test; import junit.framework.TestSuite; +import org.xml.sax.SAXException; /** @@ -76,6 +78,24 @@ } + public void testAmbiguousSubmitFromForm() throws Exception { + defineWebPage( "Form", "<form method=GET id=main action = 'tryMe'>" + + "<Input type=text Name=name>" + + "<input type=\"checkbox\" name=second checked>Enabled" + + "<input type='submit' name='left'><input type='submit' name='right'>" + + "</form>" ); + defineResource( "/tryMe?name=master&second=on", "You made it!" ); + WebResponse wr = _wc.getResponse( getHostPath() + "/Form.html" ); + WebForm form = wr.getFormWithID( "main" ); + form.setParameter( "name", "master" ); + try { + form.submit(); + fail( "Should have rejected request as ambiguous" ); + } catch (IllegalRequestParameterException e) { + } + } + + public void testSubmitFromButton() throws Exception { defineWebPage( "Form", "<form method=GET id=main action = 'tryMe'>" + "<Input type=text Name=name>" + |
From: Russell G. <rus...@us...> - 2004-07-02 22:09:37
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11342/test/com/meterware/httpunit/javascript Modified Files: FrameScriptingTest.java ScriptingTest.java Log Message: bug #983930: recognize out-of-form button with type 'button' Index: FrameScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FrameScriptingTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- FrameScriptingTest.java 30 Jun 2004 23:54:49 -0000 1.4 +++ FrameScriptingTest.java 2 Jul 2004 22:09:28 -0000 1.5 @@ -214,47 +214,5 @@ assertEquals("Links in green frame", 1, _wc.getFrameContents("green").getLinks().length); assertEquals("Links in blue frame", 0, _wc.getFrameContents("blue").getLinks().length); } - - - /** - * Verifies that an open call from a subframe can specify another frame name. - */ - public void testOpenIntoSubframe() throws Exception { - defineResource( "Frames.html", - "<html><head><frameset>" + - " <frame name='banner'>" + - " <frame src='main.html' name='main'>" + - "</frameset></html>" ); - defineResource( "target.txt", "You made it!" ); - defineWebPage( "main", "<button id='button' onclick=\"window.open( 'target.txt', 'banner' )\">" ); - - _wc.getResponse( getHostPath() + "/Frames.html" ); - ((Button) _wc.getFrameContents( "main" ).getElementWithID( "button" )).click(); - assertEquals( "Num open windows", 1, _wc.getOpenWindows().length ); - assertEquals( "New banner", "You made it!", _wc.getFrameContents( "banner" ).getText() ); - assertNotNull( "Original button no longer there", _wc.getFrameContents( "main" ).getElementWithID( "button" ) ); - } - - - - /** - * Verifies that an open call from a subframe can specify another frame name. - */ - public void testSelfOpenFromSubframe() throws Exception { - defineResource( "Frames.html", - "<html><head><frameset>" + - " <frame name='banner' src='banner.html'>" + - " <frame name='main' src='main.html'>" + - "</frameset></html>" ); - defineResource( "target.txt", "You made it!" ); - defineWebPage( "main", "<button id='button2' onclick=\"window.open( 'target.txt', 'banner' )\">" ); - defineWebPage( "banner", "<button id='button1' onclick=\"window.open( 'target.txt', '_self' )\">" ); - - _wc.getResponse( getHostPath() + "/Frames.html" ); - ((Button) _wc.getFrameContents( "banner" ).getElementWithID( "button1" )).click(); - assertEquals( "Num open windows", 1, _wc.getOpenWindows().length ); - assertEquals( "New banner", "You made it!", _wc.getFrameContents( "banner" ).getText() ); - assertNotNull( "Second frame no longer there", _wc.getFrameContents( "main" ).getElementWithID( "button2" ) ); - } private WebConversation _wc; } Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- ScriptingTest.java 27 Jun 2004 16:59:48 -0000 1.62 +++ ScriptingTest.java 2 Jul 2004 22:09:28 -0000 1.63 @@ -712,12 +712,15 @@ public void testButtonWithoutForm() throws Exception { - defineWebPage( "OnCommand", "<button id='mybutton' onclick='alert( \"I heard you!\" )'>" ); + defineWebPage( "OnCommand", "<button id='mybutton' onclick='alert( \"I heard you!\" )'>" + + "<button id='yourbutton' type='button' onclick='alert( \"Loud and Clear.\" )'>"); WebConversation wc = new WebConversation(); WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); - Button button = (Button) response.getElementWithID( "mybutton" ); - button.click(); + ((Button) response.getElementWithID( "mybutton" )).click(); assertEquals( "Alert message 1", "I heard you!", wc.popNextAlert() ); + + ((Button) response.getElementWithID( "yourbutton" )).click(); + assertEquals( "Alert message 2", "Loud and Clear.", wc.popNextAlert() ); } |
From: Russell G. <rus...@us...> - 2004-07-02 22:09:36
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11342/test/com/meterware/httpunit Modified Files: WebFrameTest.java Log Message: bug #983930: recognize out-of-form button with type 'button' Index: WebFrameTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFrameTest.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- WebFrameTest.java 13 Jun 2004 20:57:28 -0000 1.18 +++ WebFrameTest.java 2 Jul 2004 22:09:28 -0000 1.19 @@ -412,5 +412,47 @@ } + /** + * Verifies that an open call from a subframe can specify another frame name. + */ + public void testOpenIntoSubframe() throws Exception { + defineResource( "Frames.html", + "<html><head><frameset>" + + " <frame name='banner'>" + + " <frame src='main.html' name='main'>" + + "</frameset></html>" ); + defineResource( "target.txt", "You made it!" ); + defineWebPage( "main", "<button id='button' onclick=\"window.open( 'target.txt', 'banner' )\">" ); + + _wc.getResponse( getHostPath() + "/Frames.html" ); + ((Button) _wc.getFrameContents( "main" ).getElementWithID( "button" )).click(); + assertEquals( "Num open windows", 1, _wc.getOpenWindows().length ); + assertEquals( "New banner", "You made it!", _wc.getFrameContents( "banner" ).getText() ); + assertNotNull( "Original button no longer there", _wc.getFrameContents( "main" ).getElementWithID( "button" ) ); + } + + + + /** + * Verifies that an open call from a subframe can specify another frame name. + */ + public void testSelfOpenFromSubframe() throws Exception { + defineResource( "Frames.html", + "<html><head><frameset>" + + " <frame name='banner' src='banner.html'>" + + " <frame name='main' src='main.html'>" + + "</frameset></html>" ); + defineResource( "target.txt", "You made it!" ); + defineWebPage( "main", "<button id='button2' onclick=\"window.open( 'target.txt', 'banner' )\">" ); + defineWebPage( "banner", "<button id='button1' onclick=\"window.open( 'target.txt', '_self' )\">" ); + + _wc.getResponse( getHostPath() + "/Frames.html" ); + ((Button) _wc.getFrameContents( "banner" ).getElementWithID( "button1" )).click(); + assertEquals( "Num open windows", 1, _wc.getOpenWindows().length ); + assertEquals( "New banner", "You made it!", _wc.getFrameContents( "banner" ).getText() ); + assertNotNull( "Second frame no longer there", _wc.getFrameContents( "main" ).getElementWithID( "button2" ) ); + } + + private WebConversation _wc; } |
From: Russell G. <rus...@us...> - 2004-07-02 22:09:36
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11342/src/com/meterware/httpunit Modified Files: ParsedHTML.java Log Message: bug #983930: recognize out-of-form button with type 'button' Index: ParsedHTML.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- ParsedHTML.java 29 Jun 2004 23:17:33 -0000 1.55 +++ ParsedHTML.java 2 Jul 2004 22:09:27 -0000 1.56 @@ -560,13 +560,19 @@ private HTMLElement newControlWithoutForm( ParsedHTML parsedHTML, Element element ) { if (element.getNodeName().equalsIgnoreCase( "button" ) && - NodeUtils.getNodeAttribute( element, "type" ).equals( "" )) { + isValidNonFormButtonType( NodeUtils.getNodeAttribute( element, "type" ) )) { return parsedHTML.toButtonWithoutForm( element ); } else { return null; } } + + private boolean isValidNonFormButtonType( String buttonType ) { + return buttonType.equals( "" ) || buttonType.equalsIgnoreCase( "button" ); + } + + private WebForm getForm( NodeUtils.PreOrderTraversal pot ) { return getRootContext( pot )._activeForm; } |
From: Russell G. <rus...@us...> - 2004-06-30 23:54:58
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23600/src/com/meterware/httpunit Modified Files: GetMethodWebRequest.java HeaderOnlyWebRequest.java WebClient.java WebResponse.java WebWindow.java Log Message: bug #981872: handle window.open targetted to a frame Index: GetMethodWebRequest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/GetMethodWebRequest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- GetMethodWebRequest.java 13 Jun 2004 20:57:25 -0000 1.19 +++ GetMethodWebRequest.java 30 Jun 2004 23:54:48 -0000 1.20 @@ -87,6 +87,14 @@ /** + * Constructs a web request for a javascript open call. + **/ + GetMethodWebRequest( URL urlBase, String urlString, FrameSelector frame, String target ) { + super( urlBase, urlString, frame, target ); + } + + + /** * Constructs a web request for a form. **/ GetMethodWebRequest( WebForm sourceForm, ParameterHolder parameterHolder, SubmitButton button, int x, int y ) { Index: HeaderOnlyWebRequest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HeaderOnlyWebRequest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HeaderOnlyWebRequest.java 13 Jun 2004 20:57:25 -0000 1.3 +++ HeaderOnlyWebRequest.java 30 Jun 2004 23:54:48 -0000 1.4 @@ -49,6 +49,11 @@ //-------------------------------- protected members --------------------------- + protected HeaderOnlyWebRequest( URL urlBase, String urlString, FrameSelector frame, String target ) { + super( urlBase, urlString, frame, target ); + } + + protected HeaderOnlyWebRequest( URL urlBase, String urlString, String target ) { super( urlBase, urlString, target ); } Index: WebClient.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- WebClient.java 29 Jun 2004 23:17:33 -0000 1.58 +++ WebClient.java 30 Jun 2004 23:54:48 -0000 1.59 @@ -460,7 +460,7 @@ void updateFrameContents( WebWindow requestWindow, String requestTarget, WebResponse response, RequestContext requestContext ) throws IOException, SAXException { if (response.getFrame() == FrameSelector.NEW_FRAME) { - WebWindow window = new WebWindow( this ); + WebWindow window = new WebWindow( this, requestWindow.getCurrentPage() ); if (!WebRequest.NEW_WINDOW.equalsIgnoreCase( requestTarget )) window.setName( requestTarget ); response.setFrame( window.getTopFrame() ); window.updateFrameContents( response, requestContext ); @@ -475,16 +475,6 @@ } - WebResponse openInNewWindow( WebRequest request, String windowName, WebResponse opener ) throws IOException, SAXException { - WebWindow window = new WebWindow( this, opener ); - window.setName( windowName ); - WebResponse response = window.getResponse( request ); - _openWindows.add( window ); - reportWindowOpened( window ); - return response; - } - - void close( WebWindow window ) { if (!_openWindows.contains( window )) throw new IllegalStateException( "Window is already closed" ); _openWindows.remove( window ); Index: WebResponse.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v retrieving revision 1.131 retrieving revision 1.132 diff -u -r1.131 -r1.132 --- WebResponse.java 30 Jun 2004 00:01:22 -0000 1.131 +++ WebResponse.java 30 Jun 2004 23:54:49 -0000 1.132 @@ -674,18 +674,8 @@ public Scriptable open( String urlString, String name, String features, boolean replace ) throws IOException, SAXException { if (urlString == null || urlString.trim().length() == 0) urlString = "about:"; - GetMethodWebRequest request = new GetMethodWebRequest( getURL(), urlString ); - - // TODO this logic is so close to that used for regular links (except that it ignores subframe names), isn't there a way to combine them? - - WebWindow[] windows = _client.getOpenWindows(); - for (int i = 0; i < windows.length; i++) { - WebWindow window = windows[i]; - if (window.getName().equals( name )) return window.getResponse( request ).getScriptableObject(); - } - if (WebRequest.SAME_FRAME.equalsIgnoreCase( name )) return WebResponse.this.getWindow().getResponse( request ).getScriptableObject(); - - return _client.openInNewWindow( request, name, WebResponse.this ).getScriptableObject(); + GetMethodWebRequest request = new GetMethodWebRequest( getURL(), urlString, _frame, name ); + return _window.getResponse( request ).getScriptableObject(); } Index: WebWindow.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebWindow.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- WebWindow.java 13 Jun 2004 20:57:27 -0000 1.18 +++ WebWindow.java 30 Jun 2004 23:54:49 -0000 1.19 @@ -159,7 +159,7 @@ WebResponse response = null; String urlString = request.getURLString().trim(); if (urlString.startsWith( "about:" )) { - response = WebResponse.createBlankResponse(); + response = new DefaultWebResponse( _client, _frameContents.getTargetFrame( request ), null, "" ); } else if (!HttpUnitUtils.isJavaScriptURL( urlString )) { response = _client.newResponse( request, _frameContents.getTargetFrame( request ) ); } else { |
From: Russell G. <rus...@us...> - 2004-06-30 23:54:58
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23600/test/com/meterware/httpunit/javascript Modified Files: FrameScriptingTest.java Log Message: bug #981872: handle window.open targetted to a frame Index: FrameScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FrameScriptingTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- FrameScriptingTest.java 5 Dec 2003 04:06:54 -0000 1.3 +++ FrameScriptingTest.java 30 Jun 2004 23:54:49 -0000 1.4 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2003, Russell Gold +* Copyright (c) 2003-2004, 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 @@ -19,10 +19,7 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import com.meterware.httpunit.HttpUnitTest; -import com.meterware.httpunit.WebConversation; -import com.meterware.httpunit.WebResponse; -import com.meterware.httpunit.WebLink; +import com.meterware.httpunit.*; import junit.framework.Test; import junit.framework.TestSuite; @@ -218,5 +215,46 @@ assertEquals("Links in blue frame", 0, _wc.getFrameContents("blue").getLinks().length); } + + /** + * Verifies that an open call from a subframe can specify another frame name. + */ + public void testOpenIntoSubframe() throws Exception { + defineResource( "Frames.html", + "<html><head><frameset>" + + " <frame name='banner'>" + + " <frame src='main.html' name='main'>" + + "</frameset></html>" ); + defineResource( "target.txt", "You made it!" ); + defineWebPage( "main", "<button id='button' onclick=\"window.open( 'target.txt', 'banner' )\">" ); + + _wc.getResponse( getHostPath() + "/Frames.html" ); + ((Button) _wc.getFrameContents( "main" ).getElementWithID( "button" )).click(); + assertEquals( "Num open windows", 1, _wc.getOpenWindows().length ); + assertEquals( "New banner", "You made it!", _wc.getFrameContents( "banner" ).getText() ); + assertNotNull( "Original button no longer there", _wc.getFrameContents( "main" ).getElementWithID( "button" ) ); + } + + + + /** + * Verifies that an open call from a subframe can specify another frame name. + */ + public void testSelfOpenFromSubframe() throws Exception { + defineResource( "Frames.html", + "<html><head><frameset>" + + " <frame name='banner' src='banner.html'>" + + " <frame name='main' src='main.html'>" + + "</frameset></html>" ); + defineResource( "target.txt", "You made it!" ); + defineWebPage( "main", "<button id='button2' onclick=\"window.open( 'target.txt', 'banner' )\">" ); + defineWebPage( "banner", "<button id='button1' onclick=\"window.open( 'target.txt', '_self' )\">" ); + + _wc.getResponse( getHostPath() + "/Frames.html" ); + ((Button) _wc.getFrameContents( "banner" ).getElementWithID( "button1" )).click(); + assertEquals( "Num open windows", 1, _wc.getOpenWindows().length ); + assertEquals( "New banner", "You made it!", _wc.getFrameContents( "banner" ).getText() ); + assertNotNull( "Second frame no longer there", _wc.getFrameContents( "main" ).getElementWithID( "button2" ) ); + } private WebConversation _wc; } |
From: Russell G. <rus...@us...> - 2004-06-30 23:54:58
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23600/test/com/meterware/httpunit Modified Files: WebClientTest.java Log Message: bug #981872: handle window.open targetted to a frame Index: WebClientTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebClientTest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- WebClientTest.java 23 Jun 2004 23:24:00 -0000 1.19 +++ WebClientTest.java 30 Jun 2004 23:54:49 -0000 1.20 @@ -27,10 +27,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.UnknownHostException; -import java.net.ConnectException; +import java.net.*; import java.util.ArrayList; import java.util.List; import java.util.zip.GZIPOutputStream; @@ -500,7 +497,9 @@ try { wc.getResponse( "http://meterware.com" ); - } catch (ConnectException e) {} + } catch (ConnectException e) { + } catch (SocketException e) { + } assertEquals( "Submitted host header", "meterware.com", wc.getHeaderField( "Host" ) ); } |
From: Russell G. <rus...@us...> - 2004-06-30 00:02:04
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22246/doc Modified Files: release_notes.txt Log Message: Corrected parsing of refresh urls Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.352 retrieving revision 1.353 diff -u -r1.352 -r1.353 --- release_notes.txt 29 Jun 2004 23:55:22 -0000 1.352 +++ release_notes.txt 30 Jun 2004 00:01:20 -0000 1.353 @@ -17,7 +17,9 @@ Problems fixed: 1. bug #805921: WebForm.selectImageButtonPosition was misleadingly public and should not have been used. It has been made package-private, and new means are provided to submit positional image buttons (see additions). - 2. bug #982097: HTTP Urls not preserved in submit requests + 2. bug #982097: http urls being used as request parameters were being mangled + 3. bug #803041: HTML entity & now recognized in refresh URL tag + 4. bug #803095: Absolute URLs now supported in refresh URL tag Additions: 1. rfe #766768: getText() methods now translate <br> tags as newlines. |
From: Russell G. <rus...@us...> - 2004-06-30 00:01:33
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22246/test/com/meterware/httpunit Modified Files: WebPageTest.java Log Message: Corrected parsing of refresh urls Index: WebPageTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- WebPageTest.java 28 Jun 2004 23:13:24 -0000 1.36 +++ WebPageTest.java 30 Jun 2004 00:01:24 -0000 1.37 @@ -353,6 +353,23 @@ } + public void testMetaRefreshAbsoluteURLRequestWithAmpersandEncoding() throws Exception { + String refreshURL = "http://localhost:8080/someapp/secure/?username=abc&somevalue=abc"; + String page = "<html><head><title>Sample</title>" + + "<meta Http-equiv=refresh content='2;URL=\"http://localhost:8080/someapp/secure/?username=abc&somevalue=abc\"></head>\n" + + "<body>This has no data\n" + + "</body></html>\n"; + defineResource( "SimplePage.html", page ); + + WebConversation wc = new WebConversation(); + WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); + WebResponse simplePage = wc.getResponse( request ); + + assertEquals( "Refresh URL", refreshURL, simplePage.getRefreshRequest().getURL().toExternalForm() ); + assertEquals( "Refresh delay", 2, simplePage.getRefreshDelay() ); + } + + public void testMetaRefreshURLRequestNoDelay() throws Exception { String refreshURL = getHostPath() + "/NextPage.html"; String page = "<html><head><title>Sample</title>" + |
From: Russell G. <rus...@us...> - 2004-06-30 00:01:33
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22246/src/com/meterware/httpunit Modified Files: HttpUnitUtils.java WebResponse.java Log Message: Corrected parsing of refresh urls Index: HttpUnitUtils.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- HttpUnitUtils.java 29 Jun 2004 23:10:44 -0000 1.16 +++ HttpUnitUtils.java 30 Jun 2004 00:01:21 -0000 1.17 @@ -206,6 +206,24 @@ } + static String replaceEntities( String string ) { + int i = 0; + int ampIndex; + while ((ampIndex = string.indexOf( '&', i )) >= 0) { + int semiColonIndex = string.indexOf( ';', ampIndex+1 ); + if (semiColonIndex < 0) continue; + + String entityName = string.substring( ampIndex+1, semiColonIndex ); + if (entityName.equalsIgnoreCase( "amp" )) { + string = string.substring( 0, ampIndex ) + '&' + string.substring( semiColonIndex+1 ); + i = ampIndex + 1; + } + + } + return string; + } + + static class ClasspathEntityResolver implements EntityResolver { public InputSource resolveEntity( String publicID, String systemID ) { Index: WebResponse.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v retrieving revision 1.130 retrieving revision 1.131 diff -u -r1.130 -r1.131 --- WebResponse.java 28 Jun 2004 23:13:24 -0000 1.130 +++ WebResponse.java 30 Jun 2004 00:01:22 -0000 1.131 @@ -31,7 +31,6 @@ import java.net.MalformedURLException; import java.util.Hashtable; import java.util.Vector; -import java.util.StringTokenizer; import java.util.zip.GZIPInputStream; import org.w3c.dom.Document; @@ -999,24 +998,31 @@ String refreshHeader = _refreshHeader != null ? _refreshHeader : getHeaderField( "Refresh" ); if (refreshHeader == null) return; - StringTokenizer st = new StringTokenizer( refreshHeader, ";" ); - while (st.hasMoreTokens()) { - String token = st.nextToken(); - if (token.length() == 0) continue; - try { - if (Character.isDigit( token.charAt(0) )) { - _refreshDelay = Integer.parseInt( token ); - } else { - _refreshRequest = new GetMethodWebRequest( _pageURL, getRefreshURL( token ), _frame.getName() ); - } - } catch (NumberFormatException e) { - System.out.println( "Unable to interpret refresh tag: \"" + refreshHeader + '"' ); - } + int semicolonIndex = refreshHeader.indexOf( ';' ); + if (semicolonIndex < 0) { + interpretRefreshHeaderElement( refreshHeader, refreshHeader ); + } else { + interpretRefreshHeaderElement( refreshHeader.substring( 0, semicolonIndex ), refreshHeader ); + interpretRefreshHeaderElement( refreshHeader.substring( semicolonIndex+1 ), refreshHeader ); } if (_refreshRequest == null) _refreshRequest = new GetMethodWebRequest( _pageURL, _pageURL.toString(), _frame.getName() ); } + private void interpretRefreshHeaderElement( String token, String refreshHeader ) { + if (token.length() == 0) return; + try { + if (Character.isDigit( token.charAt(0) )) { + _refreshDelay = Integer.parseInt( token ); + } else { + _refreshRequest = new GetMethodWebRequest( _pageURL, getRefreshURL( token ), _frame.getName() ); + } + } catch (NumberFormatException e) { + System.out.println( "Unable to interpret refresh tag: \"" + refreshHeader + '"' ); + } + } + + private String getRefreshURL( String text ) { text = text.trim(); if (!text.toUpperCase().startsWith( "URL" )) { @@ -1024,7 +1030,7 @@ } else { int splitIndex = text.indexOf( '=' ); String value = text.substring( splitIndex+1 ).trim(); - return HttpUnitUtils.stripQuotes( value ); + return HttpUnitUtils.replaceEntities( HttpUnitUtils.stripQuotes( value ) ); } } |
From: Russell G. <rus...@us...> - 2004-06-29 23:55:32
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21198/src/com/meterware/httpunit Modified Files: WebRequest.java Log Message: bug #982097: http urls used as parameters were being mangled Index: WebRequest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- WebRequest.java 28 Jun 2004 23:08:51 -0000 1.61 +++ WebRequest.java 29 Jun 2004 23:55:22 -0000 1.62 @@ -116,7 +116,7 @@ private String getNormalizedURL( String url ) { - if (url.lastIndexOf( "//" ) > url.indexOf( "://" ) + 1) return getNormalizedURL( stripDoubleSlashes( url ) ); + if (url.lastIndexOf( "//" ) > url.lastIndexOf( "://" ) + 1) return getNormalizedURL( stripDoubleSlashes( url ) ); if (url.indexOf( "/.." ) > 0) return getNormalizedURL( stripUpNavigation( url ) ); if (url.indexOf( "/./" ) > 0) return getNormalizedURL( stripInPlaceNavigation( url ) ); return url; |
From: Russell G. <rus...@us...> - 2004-06-29 23:55:32
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21198/test/com/meterware/httpunit Modified Files: NormalizeURLTest.java Log Message: bug #982097: http urls used as parameters were being mangled Index: NormalizeURLTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/NormalizeURLTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NormalizeURLTest.java 28 Jun 2004 23:08:52 -0000 1.2 +++ NormalizeURLTest.java 29 Jun 2004 23:55:22 -0000 1.3 @@ -349,4 +349,11 @@ } + public void testUrlAsParameter() throws Exception { + String desiredUrl = "http://localhost:3333/composite/addobserver?url=http://localhost:8081/"; + WebRequest request = new GetMethodWebRequest( desiredUrl ); + assertEquals( "URL", desiredUrl, request.getURL().toExternalForm() ); + } + + } |
From: Russell G. <rus...@us...> - 2004-06-29 23:55:30
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21198/doc Modified Files: release_notes.txt Log Message: bug #982097: http urls used as parameters were being mangled Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.351 retrieving revision 1.352 diff -u -r1.351 -r1.352 --- release_notes.txt 29 Jun 2004 23:24:12 -0000 1.351 +++ release_notes.txt 29 Jun 2004 23:55:22 -0000 1.352 @@ -17,6 +17,7 @@ Problems fixed: 1. bug #805921: WebForm.selectImageButtonPosition was misleadingly public and should not have been used. It has been made package-private, and new means are provided to submit positional image buttons (see additions). + 2. bug #982097: HTTP Urls not preserved in submit requests Additions: 1. rfe #766768: getText() methods now translate <br> tags as newlines. @@ -26,7 +27,6 @@ form.submit( button, x, y ) button.click( x, y ) ->>>>>>> 1.350 28-Jun-2004 Additions: 1. rfe #901172: "text/xhtml" is now recognized as a valid HTML "content-type" |
From: Russell G. <rus...@us...> - 2004-06-29 23:24:21
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14646/src/com/meterware/httpunit Modified Files: Button.java SubmitButton.java WebForm.java Log Message: Added new methods to submit image button clicks with position Index: Button.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/Button.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Button.java 24 Jun 2004 23:32:24 -0000 1.14 +++ Button.java 29 Jun 2004 23:24:12 -0000 1.15 @@ -77,11 +77,16 @@ * For a submit button this typically submits the form. */ public void click() throws IOException, SAXException { - if (isDisabled()) throw new IllegalStateException( "Button" + (getName().length() == 0 ? "" : " '" + getName() + "'") + " is disabled and may not be clicked." ); + verifyButtonEnabled(); if (doOnClickEvent()) doButtonAction(); } + protected void verifyButtonEnabled() { + if (isDisabled()) throw new IllegalStateException( "Button" + (getName().length() == 0 ? "" : " '" + getName() + "'") + " is disabled and may not be clicked." ); + } + + /** * Returns true if this button is disabled, meaning that it cannot be clicked. **/ Index: SubmitButton.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/SubmitButton.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- SubmitButton.java 5 Dec 2003 04:06:53 -0000 1.17 +++ SubmitButton.java 29 Jun 2004 23:24:12 -0000 1.18 @@ -41,6 +41,19 @@ } + /** + * Performs the action associated with clicking this button after running any 'onClick' script. + * For a submit button this typically submits the form. + * + * @since 1.5.5 + */ + public void click( int x, int y ) throws IOException, SAXException { + if (!isImageButton()) throw new IllegalStateException( "May only specify positions for an image button" ); + verifyButtonEnabled(); + if (doOnClickEvent()) getForm().doFormSubmit( this, x, y ); + } + + //--------------------------------- Button methods ---------------------------------------------- Index: WebForm.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- WebForm.java 28 Jun 2004 23:06:05 -0000 1.91 +++ WebForm.java 29 Jun 2004 23:24:13 -0000 1.92 @@ -69,6 +69,18 @@ /** + * Submits this form using the web client from which it was originally obtained. + * Will usually return the result of that submission; however, if the submit button's 'onclick' + * or the form's 'onsubmit' event is triggered and + * inhibits the submission, will return the updated contents of the frame containing this form. + * @since 1.5.5 + **/ + public WebResponse submit( SubmitButton button, int x, int y ) throws IOException, SAXException { + return button.doOnClickEvent() ? doFormSubmit( button, x, y ) : getCurrentFrameContents(); + } + + + /** * Submits the form without also invoking the button's "onclick" event. */ WebResponse doFormSubmit( SubmitButton button ) throws IOException, SAXException { @@ -76,6 +88,11 @@ } + WebResponse doFormSubmit( SubmitButton button, int x, int y ) throws IOException, SAXException { + return submitRequest( getAttribute( "onsubmit" ), getRequest( button, x, y ) ); + } + + /** * Returns the method defined for this form. **/ @@ -481,7 +498,7 @@ * and there is no guarantee over the order of parameters transmitted. */ public WebRequest newUnvalidatedRequest() { - return newUnvalidatedRequest( (SubmitButton) null ); + return newUnvalidatedRequest( null ); } @@ -513,7 +530,7 @@ /** * Specifies the position at which an image button (if any) was clicked. **/ - public void selectImageButtonPosition( SubmitButton imageButton, int x, int y ) { + void selectImageButtonPosition( SubmitButton imageButton, int x, int y ) { imageButton.setLocation( x, y ); } |
From: Russell G. <rus...@us...> - 2004-06-29 23:24:21
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14646/test/com/meterware/httpunit Modified Files: WebFormTest.java Log Message: Added new methods to submit image button clicks with position Index: WebFormTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFormTest.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- WebFormTest.java 6 May 2003 13:31:04 -0000 1.30 +++ WebFormTest.java 29 Jun 2004 23:24:13 -0000 1.31 @@ -93,6 +93,19 @@ } + public void testSubmitFromPositionalButton() throws Exception { + defineResource( "ask?age=12&update=name&update.x=5&update.y=15", "You made it!", "text/plain" ); + defineWebPage( "Default", "<form id='form' method=GET action = \"/ask\">" + + "<Input type=text name=age value=12>" + + "<Input type=image name=update value=name src=\"\">" + + "</form>" ); + WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); + SubmitButton button = page.getFormWithID( "form" ).getSubmitButton( "update" ); + button.click( 5, 15 ); + assertEquals( "Result of click", "You made it!", _wc.getCurrentPage().getText() ); + } + + public void testFindNoForm() throws Exception { defineWebPage( "NoForms", "This has no forms but it does" + "have <a href=\"/other.html\">an active link</A>" + |
From: Russell G. <rus...@us...> - 2004-06-29 23:24:20
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14646/doc Modified Files: release_notes.txt Log Message: Added new methods to submit image button clicks with position Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.350 retrieving revision 1.351 diff -u -r1.350 -r1.351 --- release_notes.txt 29 Jun 2004 23:17:33 -0000 1.350 +++ release_notes.txt 29 Jun 2004 23:24:12 -0000 1.351 @@ -14,11 +14,19 @@ Revision History: 29-Jun-2004 + Problems fixed: + 1. bug #805921: WebForm.selectImageButtonPosition was misleadingly public and should not have been used. + It has been made package-private, and new means are provided to submit positional image buttons (see additions). + Additions: 1. rfe #766768: getText() methods now translate <br> tags as newlines. 2. HttpUnit now catches an attempt to load an included script from a page included with "getResource" rather than "getResponse." + 3. Click positions on image buttons may now be specified using one of: + form.submit( button, x, y ) + button.click( x, y ) +>>>>>>> 1.350 28-Jun-2004 Additions: 1. rfe #901172: "text/xhtml" is now recognized as a valid HTML "content-type" |