httpunit-commit Mailing List for httpunit (Page 51)
Brought to you by:
russgold
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(31) |
Oct
(39) |
Nov
(18) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(8) |
Feb
(5) |
Mar
(8) |
Apr
(25) |
May
(20) |
Jun
(23) |
Jul
(28) |
Aug
(10) |
Sep
(3) |
Oct
(32) |
Nov
(61) |
Dec
(24) |
2002 |
Jan
(50) |
Feb
(34) |
Mar
(35) |
Apr
(3) |
May
(25) |
Jun
(25) |
Jul
(30) |
Aug
(146) |
Sep
(49) |
Oct
(156) |
Nov
(121) |
Dec
(54) |
2003 |
Jan
(12) |
Feb
(79) |
Mar
(88) |
Apr
(26) |
May
(67) |
Jun
(29) |
Jul
(8) |
Aug
(16) |
Sep
(20) |
Oct
(17) |
Nov
|
Dec
(5) |
2004 |
Jan
|
Feb
(40) |
Mar
(30) |
Apr
(5) |
May
|
Jun
(83) |
Jul
(34) |
Aug
(20) |
Sep
(44) |
Oct
(46) |
Nov
|
Dec
(14) |
2005 |
Jan
(4) |
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(1) |
2006 |
Jan
|
Feb
|
Mar
(26) |
Apr
(8) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(36) |
May
(38) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(4) |
Oct
|
Nov
(18) |
Dec
(4) |
2009 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(35) |
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(9) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(21) |
Oct
(18) |
Nov
(1) |
Dec
|
From: Russell G. <rus...@us...> - 2002-10-02 16:20:49
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv7306/src/com/meterware/httpunit Modified Files: ParsedHTML.java WebLink.java Log Message: Converted link lookups to use standard mechanism Index: ParsedHTML.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- ParsedHTML.java 13 Sep 2002 14:17:25 -0000 1.28 +++ ParsedHTML.java 2 Oct 2002 16:20:45 -0000 1.29 @@ -123,16 +123,12 @@ * Returns the first link which contains the specified text. **/ public WebLink getLinkWith( String text ) { - WebLink[] links = getLinks(); - for (int i = 0; i < links.length; i++) { - if (HttpUnitUtils.contains( links[i].asText(), text )) return links[i]; - } - return null; + return getFirstMatchingLink( WebLink.MATCH_CONTAINED_TEXT, text ); } /** - * Returns the first link which contains an image with the specified text as its 'alt' attribute. + * Returns the link which contains the first image with the specified text as its 'alt' attribute. **/ public WebLink getLinkWithImageText( String text ) { WebImage image = getImageWithAltText( text ); @@ -142,29 +138,17 @@ /** * Returns the link found in the page with the specified ID. - * @exception SAXException thrown if there is an error parsing the response. **/ public WebLink getLinkWithID( String ID ) { - WebLink[] links = getLinks(); - for (int i = 0; i < links.length; i++) { - if (links[i].getID().equals( ID )) return links[i]; - else if (HttpUnitOptions.getMatchesIgnoreCase() && links[i].getID().equalsIgnoreCase( ID )) return links[i]; - } - return null; + return getFirstMatchingLink( WebLink.MATCH_ID, ID ); } /** * Returns the link found in the page with the specified name. - * @exception SAXException thrown if there is an error parsing the response. **/ public WebLink getLinkWithName( String name ) { - WebLink[] links = getLinks(); - for (int i = 0; i < links.length; i++) { - if (links[i].getName().equals( name )) return links[i]; - else if (HttpUnitOptions.getMatchesIgnoreCase() && links[i].getName().equalsIgnoreCase( name )) return links[i]; - } - return null; + return getFirstMatchingLink( WebLink.MATCH_NAME, name ); } Index: WebLink.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebLink.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- WebLink.java 27 Sep 2002 15:49:02 -0000 1.29 +++ WebLink.java 2 Oct 2002 16:20:45 -0000 1.30 @@ -42,6 +42,15 @@ /** Predicate to match part or all of a link's URL string. **/ public final static HTMLElementPredicate MATCH_URL_STRING; + /** Predicate to match part or all of a link's contained text. **/ + public final static HTMLElementPredicate MATCH_CONTAINED_TEXT; + + /** Predicate to match a link's ID. **/ + public final static HTMLElementPredicate MATCH_ID; + + /** Predicate to match a link's name. **/ + public final static HTMLElementPredicate MATCH_NAME; + private Scriptable _scriptable; @@ -160,6 +169,25 @@ }; }; + MATCH_CONTAINED_TEXT = new HTMLElementPredicate() { + public boolean matchesCriteria( Object htmlElement, Object criteria ) { + return HttpUnitUtils.contains( ((WebLink) htmlElement).asText(), (String) criteria ); + }; + }; + + + MATCH_ID = new HTMLElementPredicate() { + public boolean matchesCriteria( Object htmlElement, Object criteria ) { + return HttpUnitUtils.matches( ((WebLink) htmlElement).getID(), (String) criteria ); + }; + }; + + + MATCH_NAME = new HTMLElementPredicate() { + public boolean matchesCriteria( Object htmlElement, Object criteria ) { + return HttpUnitUtils.matches( ((WebLink) htmlElement).getName(), (String) criteria ); + }; + }; } |
From: Russell G. <rus...@us...> - 2002-10-02 15:04:47
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/servletunit In directory usw-pr-cvs1:/tmp/cvs-serv10297/test/com/meterware/servletunit Modified Files: WebXMLTest.java Log Message: Added a test for empty web.xml parameter values Index: WebXMLTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/WebXMLTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- WebXMLTest.java 6 Sep 2002 15:06:52 -0000 1.11 +++ WebXMLTest.java 2 Oct 2002 15:04:43 -0000 1.12 @@ -129,6 +129,7 @@ wxs.addServlet( "/SimpleServlet", SimpleGetServlet.class ); wxs.addContextParam( "icecream", "vanilla" ); wxs.addContextParam( "cone", "waffle" ); + wxs.addContextParam( "topping", "" ); ServletRunner sr = new ServletRunner( toInputStream( wxs.asText() ) ); ServletUnitClient client = sr.newClient(); @@ -138,6 +139,7 @@ assertNotNull( "ServletContext should not be null", sc ); assertEquals( "ServletContext.getInitParameter()", "vanilla", sc.getInitParameter( "icecream" ) ); assertEquals( "init parameter: cone", "waffle", sc.getInitParameter( "cone" ) ); + assertEquals( "init parameter: topping", "", sc.getInitParameter( "topping" ) ); assertNull( "ServletContext.getInitParameter() should be null", sc.getInitParameter( "shoesize" ) ); } @@ -340,7 +342,6 @@ static class Servlet2 extends SimpleGetServlet {} static class Servlet3 extends SimpleGetServlet {} static class Servlet4 extends SimpleGetServlet {} - static class Servlet5 extends SimpleGetServlet {} } |
From: Russell G. <rus...@us...> - 2002-10-02 14:50:43
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/servletunit In directory usw-pr-cvs1:/tmp/cvs-serv4944/test/com/meterware/servletunit Modified Files: HttpServletResponseTest.java Log Message: #585495: HttpServletResponse setContentLength is now supported Index: HttpServletResponseTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/HttpServletResponseTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- HttpServletResponseTest.java 22 Aug 2002 15:48:41 -0000 1.4 +++ HttpServletResponseTest.java 2 Oct 2002 14:50:39 -0000 1.5 @@ -66,6 +66,7 @@ public void testSimpleResponse() throws Exception { ServletUnitHttpResponse servletResponse = new ServletUnitHttpResponse(); servletResponse.setContentType( "text/html" ); + servletResponse.setContentLength( 65 ); PrintWriter pw = servletResponse.getWriter(); pw.println( "<html><head><title>Sample Page</title></head><body></body></html>" ); @@ -73,6 +74,7 @@ assertEquals( "Status code", HttpServletResponse.SC_OK, response.getResponseCode() ); assertEquals( "Content type", "text/html", response.getContentType() ); assertEquals( "Title", "Sample Page", response.getTitle() ); + assertEquals( "Content length", 65, response.getContentLength() ); } |
From: Russell G. <rus...@us...> - 2002-10-02 14:50:42
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv4944/doc Modified Files: release_notes.txt Log Message: #585495: HttpServletResponse setContentLength is now supported Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.171 retrieving revision 1.172 diff -u -r1.171 -r1.172 --- release_notes.txt 2 Oct 2002 13:57:53 -0000 1.171 +++ release_notes.txt 2 Oct 2002 14:50:39 -0000 1.172 @@ -20,6 +20,7 @@ 1. WebForm now supports 'isReadOnlyParameter' and 'isDisabledParameter' which allow checking of the state of a particular form parameter. Note that if multiple controls exist with the same name, these methods only return true when all such controls are read-only or disabled, as appropriate. + 2. RFE #585495 ServletUnit now supports HttpServletResponse.setContentLength. 2-Oct-2002 1.4.6 Acknowledgements: |
From: Russell G. <rus...@us...> - 2002-10-02 14:50:42
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit In directory usw-pr-cvs1:/tmp/cvs-serv4944/src/com/meterware/servletunit Modified Files: ServletUnitHttpResponse.java Log Message: #585495: HttpServletResponse setContentLength is now supported Index: ServletUnitHttpResponse.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpResponse.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ServletUnitHttpResponse.java 22 Aug 2002 15:48:41 -0000 1.11 +++ ServletUnitHttpResponse.java 2 Oct 2002 14:50:39 -0000 1.12 @@ -319,7 +319,7 @@ * HTTP Content-Length header. **/ public void setContentLength( int len ) { - throw new RuntimeException( "setContentLength not implemented" ); + setIntHeader( "Content-Length", len ); } |
From: Russell G. <rus...@us...> - 2002-10-02 13:58:02
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv16852/src/com/meterware/httpunit Modified Files: WebForm.java Log Message: from Ken Corbin: Added support for detection of read-only and disabled parameters Index: WebForm.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v retrieving revision 1.64 retrieving revision 1.65 diff -u -r1.64 -r1.65 --- WebForm.java 25 Sep 2002 15:24:37 -0000 1.64 +++ WebForm.java 2 Oct 2002 13:57:55 -0000 1.65 @@ -19,14 +19,12 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import com.meterware.httpunit.scripting.ScriptableDelegate; import com.meterware.httpunit.scripting.NamedDelegate; +import com.meterware.httpunit.scripting.ScriptableDelegate; import java.io.IOException; import java.net.URL; - import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -391,6 +389,24 @@ /** + * Returns true if the named parameter is read-only. If more than one control exists with the same name, + * will return true only if all such controls are read-only. + **/ + public boolean isReadOnlyParameter( String name ) { + return getParameter( name ).isReadOnlyParameter(); + } + + + /** + * Returns true if the named parameter is disabled. If more than one control exists with the same name, + * will return true only if all such controls are read-only. + **/ + public boolean isDisabledParameter( String name ) { + return getParameter( name ).isDisabledParameter(); + } + + + /** * Creates and returns a web request which will simulate the submission of this form with an unnamed submit button. **/ public WebRequest getRequest() { @@ -672,141 +688,6 @@ } - -class FormParameter { - - void addControl( FormControl control ) { - _controls = null; - if (_name == null) _name = control.getName(); - if (!_name.equalsIgnoreCase( control.getName() )) throw new RuntimeException( "all controls should have the same name" ); - if (control.isExclusive()) { - getRadioGroup().addRadioButton( (RadioButtonFormControl) control ); - } else { - _controlList.add( control ); - } - } - - - private FormControl[] getControls() { - if (_controls == null) _controls = (FormControl[]) _controlList.toArray( new FormControl[ _controlList.size() ] ); - return _controls; - } - - - Object getScriptableObject() { - if (getControls().length == 1) { - return getControls()[0].getDelegate(); - } else { - ArrayList list = new ArrayList(); - for (int i = 0; i < _controls.length; i++) { - FormControl control = _controls[i]; - if (control instanceof CheckboxFormControl) { - list.add( control.getScriptableObject() ); - } - } - return list.toArray( new ScriptableDelegate[ list.size() ] ); - } - } - - - String[] getValues() { - ArrayList valueList = new ArrayList(); - FormControl[] controls = getControls(); - for (int i = 0; i < controls.length; i++) { - valueList.addAll( Arrays.asList( controls[i].getValues() ) ); - } - return (String[]) valueList.toArray( new String[ valueList.size() ] ); - } - - - void setValues( String[] values ) { - ArrayList list = new ArrayList( values.length ); - list.addAll( Arrays.asList( values ) ); - for (int i = 0; i < getControls().length; i++) getControls()[i].claimRequiredValues( list ); - for (int i = 0; i < getControls().length; i++) getControls()[i].claimUniqueValue( list ); - for (int i = 0; i < getControls().length; i++) getControls()[i].claimValue( list ); - if (!list.isEmpty()) throw new UnusedParameterValueException( _name, (String) list.get(0) ); - } - - - void setFiles( UploadFileSpec[] fileArray ) { - ArrayList list = new ArrayList( fileArray.length ); - list.addAll( Arrays.asList( fileArray ) ); - for (int i = 0; i < getControls().length; i++) getControls()[i].claimUploadSpecification( list ); - if (!list.isEmpty()) throw new UnusedUploadFileException( _name, fileArray.length - list.size(), fileArray.length ); - } - - - String[] getOptions() { - ArrayList optionList = new ArrayList(); - FormControl[] controls = getControls(); - for (int i = 0; i < controls.length; i++) { - optionList.addAll( Arrays.asList( controls[i].getDisplayedOptions() ) ); - } - return (String[]) optionList.toArray( new String[ optionList.size() ] ); - } - - - String[] getOptionValues() { - ArrayList valueList = new ArrayList(); - for (int i = 0; i < getControls().length; i++) { - valueList.addAll( Arrays.asList( getControls()[i].getOptionValues() ) ); - } - return (String[]) valueList.toArray( new String[ valueList.size() ] ); - } - - - boolean isMultiValuedParameter() { - FormControl[] controls = getControls(); - for (int i = 0; i < controls.length; i++) { - if (controls[i].isMultiValued()) return true; - if (!controls[i].isExclusive() && controls.length > 1) return true; - } - return false; - } - - - int getNumTextParameters() { - int result = 0; - FormControl[] controls = getControls(); - for (int i = 0; i < controls.length; i++) { - if (controls[i].isTextControl()) result++; - } - return result; - } - - - boolean isTextParameter() { - FormControl[] controls = getControls(); - for (int i = 0; i < controls.length; i++) { - if (controls[i].isTextControl()) return true; - } - return false; - } - - - boolean isFileParameter() { - FormControl[] controls = getControls(); - for (int i = 0; i < controls.length; i++) { - if (controls[i].isFileParameter()) return true; - } - return false; - } - - - private FormControl[] _controls; - private ArrayList _controlList = new ArrayList(); - private RadioGroupFormControl _group; - private String _name; - - private RadioGroupFormControl getRadioGroup() { - if (_group == null) { - _group = new RadioGroupFormControl(); - _controlList.add( _group ); - } - return _group; - } -} //========================================== class PresetFormParameter ================================================= |
From: Russell G. <rus...@us...> - 2002-10-02 13:58:01
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv16852/test/com/meterware/httpunit Modified Files: FormParametersTest.java Log Message: from Ken Corbin: Added support for detection of read-only and disabled parameters Index: FormParametersTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FormParametersTest.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- FormParametersTest.java 27 Sep 2002 16:30:13 -0000 1.15 +++ FormParametersTest.java 2 Oct 2002 13:57:56 -0000 1.16 @@ -260,6 +260,11 @@ WebForm form = page.getForms()[0]; WebRequest request = page.getForms()[0].getRequest(); + assertFalse( "'color' incorrectly reported as read-only", form.isReadOnlyParameter( "color" ) ); + assertFalse( "'species' incorrectly reported as read-only", form.isReadOnlyParameter( "species" ) ); + assertTrue( "'big' should be reported as read-only", form.isReadOnlyParameter( "big" ) ); + assertTrue( "'age' should be reported as read-only", form.isReadOnlyParameter( "age" ) ); + assertMatchingSet( "selected color", new String[] { "red" }, form.getParameterValues( "color" ) ); assertEquals( "selected animal", "kangaroo", form.getParameterValue( "species" ) ); assertEquals( "age", "12", form.getParameterValue( "age" ) ); @@ -294,6 +299,11 @@ WebForm form = page.getForms()[0]; WebRequest request = page.getForms()[0].getRequest(); assertEquals( "Expected request URL", getHostPath() + "/ask?species=kangaroo", request.getURL().toExternalForm() ); + + assertFalse( "'color' incorrectly reported as disabled", form.isDisabledParameter( "color" ) ); + assertFalse( "'species' incorrectly reported as disabled", form.isDisabledParameter( "species" ) ); + assertTrue( "'big' should be reported as disabled", form.isDisabledParameter( "big" ) ); + assertTrue( "'age' should be reported as disabled", form.isDisabledParameter( "age" ) ); assertMatchingSet( "selected color", new String[] { "red" }, form.getParameterValues( "color" ) ); assertEquals( "selected animal", "kangaroo", form.getParameterValue( "species" ) ); |
From: Russell G. <rus...@us...> - 2002-10-02 13:58:01
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv16852/doc Modified Files: release_notes.txt Log Message: from Ken Corbin: Added support for detection of read-only and disabled parameters Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.170 retrieving revision 1.171 diff -u -r1.170 -r1.171 --- release_notes.txt 2 Oct 2002 13:12:44 -0000 1.170 +++ release_notes.txt 2 Oct 2002 13:57:53 -0000 1.171 @@ -11,7 +11,17 @@ Revision History: - 1-Oct-2002 + 2-Oct-2002 + +Acknowledgements: + Thanks to Ken Corbin for adding tests for disabled and read-only parameters. + +Additions: + 1. WebForm now supports 'isReadOnlyParameter' and 'isDisabledParameter' which allow checking of the state of a + particular form parameter. Note that if multiple controls exist with the same name, these methods only return + true when all such controls are read-only or disabled, as appropriate. + + 2-Oct-2002 1.4.6 Acknowledgements: Thanks to Ville Skyttä for removing the test dependency on xerces. Thanks to Donald Ball for pointing out the problem with the behavior of Select.selectedIndex. |
From: Russell G. <rus...@us...> - 2002-10-02 13:16:41
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv3311/doc Modified Files: faq.html Log Message: for 1.4.6 release Index: faq.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/faq.html,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- faq.html 25 Sep 2002 16:43:42 -0000 1.18 +++ faq.html 2 Oct 2002 13:16:38 -0000 1.19 @@ -124,7 +124,6 @@ If you do not have the Rhino JAR (js.jar) in your classpath, JavaScript features do not work. <a name="unsupported"><h3>How do I handle a page that uses JavaScript features that HttpUnit does not support?</h3></a> -The latest pre-release version supports disabling exceptions as a result of Javascript errors. If you call<blockquote><code>HttpUnitOptions.setExceptionsThrownOnScriptError( false );</code></blockquote>problems will recorded but will not throw exceptions. You can see the list of problems detected by calling<blockquote><code>HttpUnitOptions.getScriptErrorMessages();</code></blockquote> |
From: Russell G. <rus...@us...> - 2002-10-02 13:12:48
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv2080/doc Modified Files: release_notes.txt Log Message: prepare for 1.4.6 release Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.169 retrieving revision 1.170 diff -u -r1.169 -r1.170 --- release_notes.txt 1 Oct 2002 18:05:10 -0000 1.169 +++ release_notes.txt 2 Oct 2002 13:12:44 -0000 1.170 @@ -12,68 +12,42 @@ Revision History: 1-Oct-2002 -Problems fixed: - 1. Bug #617065: using Javascript to set an option in a drop-down box does not unset other options. - -Additions: - 1. Added support for the Navigator object. - 2. Created a ClientProperties object to hold per-client properties. Each new web client is initialized from the - default, but may be configured independently. - -27-Sep-2002 -Problems fixed: - 1. Disabled form parameters were being submitted with requests and could be modified by setParameter calls. - -Additions: - 1. The Javascript property Link.href is now read-write. - -26-Sep-2002 -Problems fixed: - 1. A Javascript URL containing a question mark was incorrectly being URL-encoded. - 2. HTML comments at the start of a JavaScript were not being completely ignored - -25-Sep-2002 -Problems fixed: - 1. Bug #604478 - setting the form action did not always update the predefined parameter list. This could cause a request - to be sent with the wrong URL parameters. - 2. Form, Image, and Link names are now properly treated as case-sensitive within Javascript. - -13-Sep-2002 Acknowledgements: + Thanks to Ville Skyttä for removing the test dependency on xerces. + Thanks to Donald Ball for pointing out the problem with the behavior of Select.selectedIndex. Thanks to Jin Zhao for help in expanding the search possibilities for links. -Additions: - 1. The mechanism for search for links has been expanded to permit arbitrary search criteria and to retrieve - either the first match or all matches. - 2. It is now possible to control the handling of script errors by calling HttpUnitOptions.setExceptionsThrownOnScriptError. - If the exceptions are not thrown, the error messages will instead be available via HttpUnitOptions.getScriptErrorMessages() - - 9-Sep-2002 -Acknowledgement: - 1. Thanks to Donald Ball for pointing out the problem with the behavior of Select.selectedIndex. - -Additions: - 1. Select.selectedIndex is now read/write. - - 6-Sep-2002 -Acknowledgments: - 1. Thanks to Ville Skyttä for removing the test dependency on xerces. - - 5-Sep-2002 -Additions: - 1. The web XML tests will now work with any jaxp-compliant parser, not just xerces. - Problems fixed: 1. An attempt to set a non-existent parameter now correctly throws NoSuchParameterException rather than UnusedParameterValueException. 2. Obtaining the URL from a javascript: request no longer throws MalformedURLException. + 3. Bug #604478 - setting the form action did not always update the predefined parameter list. This could cause a request + to be sent with the wrong URL parameters. + 4. Form, Image, and Link names are now properly treated as case-sensitive within Javascript. + 5. A Javascript URL containing a question mark was incorrectly being URL-encoded. + 6. HTML comments at the start of a JavaScript were not being completely ignored + 7. Disabled form parameters were being submitted with requests and could be modified by setParameter calls. + 8. Bug #617065: using Javascript to set an option in a drop-down box does not unset other options. + +Additions: + Content and parsing enhancements: + 1. When no response is received from a server, HttpUnit will now throw HttpServerNotFoundException, which is a + subclass of HttpNotFoundException. This should aid in diagnosing response failures. + 2. When a 404 (not found status) is received from a server, the accompanying message is now available + from HttpNotFoundException.getResponseMessage(). + 3. The mechanism for search for links has been expanded to permit arbitrary search criteria and to retrieve + either the first match or all matches. + 4. Some per-client properties are now stored in a per-client object. Each new web client is initialized from the + default, but may also be configured independently by retrieving the clientProperties object. + + Scripting enhancements: + 6. It is now possible to control the handling of script errors by calling HttpUnitOptions.setExceptionsThrownOnScriptError. + If the exceptions are not thrown, the error messages will instead be available via HttpUnitOptions.getScriptErrorMessages() + 7. The forms, images, links, and Form.elements arrays now handle string indexes + 8. Select.selectedIndex is now read/write. + 9. Link.href is now read-write. + 10. The Navigator object is now supported. -Additions: - 1. The forms, images, links, and Form.elements arrays now handle string indexes - 2. When no response is received from a server, HttpUnit will now throw HttpServerNotFoundException, which is a - subclass of HttpNotFoundException. This should aid in diagnosing response failures. - 3. When a 404 (not found status) is received from a server, the accompanying message is now available - from HttpNotFoundException.getResponseMessage(). 30-Aug-2002 1.4.5 Acknowledgements: |
From: Russell G. <rus...@us...> - 2002-10-02 13:12:48
|
Update of /cvsroot/httpunit/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv2080 Modified Files: build.xml Log Message: prepare for 1.4.6 release Index: build.xml =================================================================== RCS file: /cvsroot/httpunit/httpunit/build.xml,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- build.xml 27 Sep 2002 16:09:51 -0000 1.48 +++ build.xml 2 Oct 2002 13:12:44 -0000 1.49 @@ -5,7 +5,7 @@ <project name="httpunit" default="jar" basedir="."> <property name="name" value="httpunit" /> <property name="Name" value="HttpUnit" /> - <property name="version" value="1.4.5" /> + <property name="version" value="1.4.6" /> <property name="debug" value="on" /> <property name="deprecation" value="off" /> |
From: Russell G. <rus...@us...> - 2002-10-01 18:05:13
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv28436/test/com/meterware/httpunit/javascript Modified Files: FormScriptingTest.java Log Message: bug #617065: corrected handling of Javascript for drop-down boxes Index: FormScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- FormScriptingTest.java 25 Sep 2002 15:24:37 -0000 1.11 +++ FormScriptingTest.java 1 Oct 2002 18:05:10 -0000 1.12 @@ -551,7 +551,7 @@ defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" + "function selectOptionNum( the_select, index ) { \n" + " for (var i = 0; i < the_select.length; i++) {\n" + - " the_select.options[i].selected = (i == index);\n" + + " if (i == index) the_select.options[i].selected = true;\n" + " }\n" + "}\n" + "</script></head>" + |
From: Russell G. <rus...@us...> - 2002-10-01 18:05:13
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv28436/doc Modified Files: release_notes.txt Log Message: bug #617065: corrected handling of Javascript for drop-down boxes Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.168 retrieving revision 1.169 diff -u -r1.168 -r1.169 --- release_notes.txt 1 Oct 2002 16:11:47 -0000 1.168 +++ release_notes.txt 1 Oct 2002 18:05:10 -0000 1.169 @@ -12,6 +12,9 @@ Revision History: 1-Oct-2002 +Problems fixed: + 1. Bug #617065: using Javascript to set an option in a drop-down box does not unset other options. + Additions: 1. Added support for the Navigator object. 2. Created a ClientProperties object to hold per-client properties. Each new web client is initialized from the |
From: Russell G. <rus...@us...> - 2002-10-01 18:05:13
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv28436/src/com/meterware/httpunit Modified Files: FormControl.java Log Message: bug #617065: corrected handling of Javascript for drop-down boxes Index: FormControl.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- FormControl.java 27 Sep 2002 16:30:13 -0000 1.25 +++ FormControl.java 1 Oct 2002 18:05:10 -0000 1.26 @@ -887,6 +887,7 @@ private boolean _defaultSelected; private boolean _selected; private int _index; + private Options _container; Option() { @@ -910,7 +911,8 @@ } - void setIndex( int index ) { + void setIndex( Options container, int index ) { + _container = container; _index = index; } @@ -958,6 +960,7 @@ public void setSelected( boolean selected ) { _selected = selected; + if (selected) _container.optionSet( _index ); } @@ -980,7 +983,7 @@ _options[i] = new Option( getValue( nl.item(i).getFirstChild() ), getOptionValue( nl.item(i) ), nl.item(i).getAttributes().getNamedItem( "selected" ) != null ); - _options[i].setIndex(i); + _options[i].setIndex( this, i ); } } @@ -1082,7 +1085,16 @@ expandOptionsArray(); } _options[i] = (Option) option; - _options[i].setIndex(i); + _options[i].setIndex( this, i ); + if (option.isSelected()) ensureUniqueOption(i); + } + } + + + private void ensureUniqueOption( int i ) { + if (_multiSelect) return; + for (int j = 0; j < _options.length; j++) { + _options[j]._selected = (i == j); } } @@ -1104,6 +1116,12 @@ public Object get( int index ) { return _options[ index ]; + } + + + /** Invoked when an option is set true. **/ + void optionSet( int i ) { + ensureUniqueOption(i); } |
From: Russell G. <rus...@us...> - 2002-10-01 16:12:20
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv18719/doc Modified Files: Javascript-support.html release_notes.txt Log Message: Added support for Javascript Navigator object Index: Javascript-support.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/Javascript-support.html,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- Javascript-support.html 27 Sep 2002 15:49:01 -0000 1.16 +++ Javascript-support.html 1 Oct 2002 16:11:47 -0000 1.17 @@ -10,9 +10,10 @@ <h4>properties</h4> <ul> <li>document - the associated Document object</li> +<li>location - r/w full URL only</li> +<li>navigator - the Navigator object</li> <li>self - the Window itself</li> <li>window - a synonym for self</li> -<li>location - r/w full URL only</li> </ul> <h4>events</h4> <ul> @@ -24,6 +25,20 @@ <li>confirm() - invokes a callback supplied via WebClient.setDialogResponder to return the user's response. By default, the callback returns true. Users may change this by supplying an implementation of DialogResponder.</li> <li>prompt() - invokes a callback supplied via WebClient.setDialogResponder to return the user's response</li> +</ul> + +<h3>Navigator</h3> +<h4>properties</h4> +<ul> +<li>appCodeName - the code name set in ClientProperties.setApplicationCodeName()</li> +<li>appName - the name of the browser, as set in ClientProperties.setApplicationName()</li> +<li>appVersion - the browser version, set in ClientProperties.setApplicationVersion()</li> +<li>plugins - an empty array of objects, since plugins are not universally supported</li> +<li>userAgent - the name of the user agent, set by ClientProperties.setUserAgent or derived from the code name and version</li> +</ul> +<h4>methods</h4> +<ul> +<li>javaEnabled - always returns false to indicate that applets are not supported</li> </ul> <h3>Document</h3> Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.167 retrieving revision 1.168 diff -u -r1.167 -r1.168 --- release_notes.txt 27 Sep 2002 16:30:12 -0000 1.167 +++ release_notes.txt 1 Oct 2002 16:11:47 -0000 1.168 @@ -11,6 +11,12 @@ Revision History: + 1-Oct-2002 +Additions: + 1. Added support for the Navigator object. + 2. Created a ClientProperties object to hold per-client properties. Each new web client is initialized from the + default, but may be configured independently. + 27-Sep-2002 Problems fixed: 1. Disabled form parameters were being submitted with requests and could be modified by setParameter calls. @@ -51,6 +57,7 @@ 1. Thanks to Ville Skyttä for removing the test dependency on xerces. 5-Sep-2002 +Additions: 1. The web XML tests will now work with any jaxp-compliant parser, not just xerces. Problems fixed: |
From: Russell G. <rus...@us...> - 2002-10-01 16:11:52
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv18719/test/com/meterware/httpunit Modified Files: WebClientTest.java Log Message: Added support for Javascript Navigator object Index: WebClientTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebClientTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- WebClientTest.java 24 Jul 2002 17:32:08 -0000 1.6 +++ WebClientTest.java 1 Oct 2002 16:11:48 -0000 1.7 @@ -55,13 +55,6 @@ } - public void testHeaderFields() throws Exception { - WebConversation wc = new WebConversation(); - wc.setHeaderField( "user-agent", "Mozilla 6" ); - assertEquals( "Mozilla 6", wc.getUserAgent() ); - } - - public void testCookies() throws Exception { String resourceName = "something/baking"; String resourceValue = "the desired content"; @@ -122,6 +115,23 @@ assertEquals( "content type", "text/html", response.getContentType() ); assertEquals( "number of cookies", 1, wc.getCookieNames().length ); assertEquals( "cookie 'CUSTOMER' value", "WILE_E_COYOTE", wc.getCookieValue( "CUSTOMER" ) ); + } + + + public void testHeaderFields() throws Exception { + defineResource( "getHeaders", new PseudoServlet() { + public WebResource getGetResponse() { + StringBuffer sb = new StringBuffer(); + sb.append( getHeader( "Junky" ) ).append( "<-->" ).append( getHeader( "User-Agent" ) ); + return new WebResource( sb.toString(), "text/plain" ); + } + } ); + + WebConversation wc = new WebConversation(); + wc.getClientProperties().setUserAgent( "me alone" ); + wc.setHeaderField( "junky", "Mozilla 6" ); + WebResponse wr = wc.getResponse( getHostPath() + "/getHeaders" ); + assertEquals( "headers found", "Mozilla 6<-->me alone", wr.getText() ); } |
From: Russell G. <rus...@us...> - 2002-10-01 16:11:52
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv18719/test/com/meterware/httpunit/javascript Modified Files: ScriptingTest.java Log Message: Added support for Javascript Navigator object Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- ScriptingTest.java 27 Sep 2002 15:49:02 -0000 1.26 +++ ScriptingTest.java 1 Oct 2002 16:11:49 -0000 1.27 @@ -455,4 +455,31 @@ } + public void testNavigatorObject() throws Exception { + defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" + + "function viewProperties() { \n" + + " alert( 'appName=' + navigator.appName );\n" + + " alert( 'appCodeName=' + navigator.appCodeName )\n;" + + " alert( 'appVersion=' + navigator.appVersion )\n;" + + " alert( 'userAgent=' + navigator.userAgent )\n;" + + " alert( 'javaEnabled=' + navigator.javaEnabled() )\n;" + + " alert( '# plugins=' + navigator.plugins.length )\n;" + + "}" + + "</script></head>\n" + + "<body onLoad='viewProperties()'>\n" + + "</body></html>" ); + HttpUnitOptions.setExceptionsThrownOnScriptError( true ); + WebConversation wc = new WebConversation(); + wc.getClientProperties().setApplicationID( "Internet Explorer", "Mozilla", "4.0" ); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + assertEquals( "Alert message 1", "appName=Internet Explorer", wc.popNextAlert() ); + assertEquals( "Alert message 2", "appCodeName=Mozilla", wc.popNextAlert() ); + assertEquals( "Alert message 3", "appVersion=4.0", wc.popNextAlert() ); + assertEquals( "Alert message 4", "userAgent=Mozilla/4.0", wc.popNextAlert() ); + assertEquals( "Alert message 5", "javaEnabled=false", wc.popNextAlert() ); + assertEquals( "Alert message 6", "# plugins=0", wc.popNextAlert() ); + assertNull( "Alert should have been removed", wc.getNextAlert() ); + } + + } |
From: Russell G. <rus...@us...> - 2002-10-01 16:11:51
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv18719/src/com/meterware/httpunit Modified Files: WebClient.java WebResponse.java Added Files: ClientProperties.java Log Message: Added support for Javascript Navigator object ***** Error reading new file[Errno 2] No such file or directory: 'ClientProperties.java' Index: WebClient.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- WebClient.java 5 Sep 2002 19:29:55 -0000 1.31 +++ WebClient.java 1 Oct 2002 16:11:47 -0000 1.32 @@ -197,18 +197,28 @@ /** + * Returns the properties associated with this client. + */ + public ClientProperties getClientProperties() { + return _clientProperties; + } + + + /** * Specifies the user agent identification. Used to trigger browser-specific server behavior. + * @deprecated as of 1.4.6. Use ClientProperties#setUserAgent instead. **/ public void setUserAgent( String userAgent ) { - setHeaderField( "User-Agent", userAgent ); + getClientProperties().setUserAgent( userAgent ); } /** * Returns the current user agent setting. + * @deprecated as of 1.4.6. Use ClientProperties#getUserAgent instead. **/ public String getUserAgent() { - return getHeaderField( "User-Agent" ); + return getClientProperties().getUserAgent(); } @@ -351,6 +361,7 @@ * Returns the value of all current header fields. **/ protected Dictionary getHeaderFields() { + setHeaderField( "User-Agent", getClientProperties().getUserAgent() ); Hashtable result = (Hashtable) _headers.clone(); if (getCookieHeaderField() != null) result.put( "Cookie", getCookieHeaderField() ); return result; @@ -422,6 +433,8 @@ private List _clientListeners = new ArrayList(); private DialogResponder _dialogResponder = new DialogAdapter(); + + private ClientProperties _clientProperties = ClientProperties.getDefaultProperties().cloneProperties(); /** Index: WebResponse.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- WebResponse.java 13 Sep 2002 14:17:25 -0000 1.79 +++ WebResponse.java 1 Oct 2002 16:11:48 -0000 1.80 @@ -543,6 +543,11 @@ } + public ClientProperties getClientProperties() { + return _client.getClientProperties(); + } + + public HTMLPage.Scriptable getDocument() throws SAXException { return getReceivedPage().getScriptableObject(); } |
From: Russell G. <rus...@us...> - 2002-10-01 16:11:51
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv18719/src/com/meterware/httpunit/javascript Modified Files: JavaScript.java Log Message: Added support for Javascript Navigator object Index: JavaScript.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- JavaScript.java 26 Sep 2002 21:49:35 -0000 1.23 +++ JavaScript.java 1 Oct 2002 16:11:48 -0000 1.24 @@ -93,6 +93,7 @@ InvocationTargetException, ClassDefinitionException, PropertyException { ScriptableObject.defineClass( scope, Window.class ); ScriptableObject.defineClass( scope, Document.class ); + ScriptableObject.defineClass( scope, Navigator.class ); ScriptableObject.defineClass( scope, Link.class ); ScriptableObject.defineClass( scope, Form.class ); ScriptableObject.defineClass( scope, Control.class ); @@ -267,7 +268,8 @@ static public class Window extends JavaScriptEngine { - private Document _document; + private Document _document; + private Navigator _navigator; public String getClassName() { @@ -290,12 +292,20 @@ } + public Navigator jsGet_navigator() { + return _navigator; + } + + void initialize( JavaScriptEngine parent, ScriptableDelegate scriptable ) throws JavaScriptException, NotAFunctionException, PropertyException, SAXException { super.initialize( parent, scriptable ); _document = (Document) Context.getCurrentContext().newObject( this, "Document" ); _document.initialize( this, getDelegate().getDocument() ); + _navigator = (Navigator) Context.getCurrentContext().newObject( this, "Navigator" ); + _navigator.initialize( this, getDelegate() ); + getDelegate().load(); } @@ -423,6 +433,57 @@ private HTMLPage.Scriptable getDelegate() { return (HTMLPage.Scriptable) _scriptable; + } + + } + + + static public class Navigator extends JavaScriptEngine { + + public String getClassName() { + return "Navigator"; + } + + + void initialize( JavaScriptEngine parent, ScriptableDelegate scriptable ) + throws JavaScriptException, NotAFunctionException, PropertyException, SAXException { + _scriptable = scriptable; + if (parent != null) setParentScope( parent ); + } + + + public String jsGet_appName() { + return getDelegate().getClientProperties().getApplicationName(); + } + + + public String jsGet_appCodeName() { + return getDelegate().getClientProperties().getApplicationCodeName(); + } + + + public String jsGet_appVersion() { + return getDelegate().getClientProperties().getApplicationVersion(); + } + + + public String jsGet_userAgent() { + return getDelegate().getClientProperties().getUserAgent(); + } + + + public Object[] jsGet_plugins() { + return new Object[0]; + } + + + public boolean jsFunction_javaEnabled() { + return false; // no support is provided for applets at present + } + + + private WebResponse.Scriptable getDelegate() { + return (WebResponse.Scriptable) _scriptable; } } |
From: Russell G. <rus...@us...> - 2002-09-27 16:30:15
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv6011/test/com/meterware/httpunit Modified Files: FormParametersTest.java Log Message: Added support for the disabled attribute for form parameters Index: FormParametersTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FormParametersTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- FormParametersTest.java 5 Sep 2002 14:46:56 -0000 1.14 +++ FormParametersTest.java 27 Sep 2002 16:30:13 -0000 1.15 @@ -281,6 +281,41 @@ } + public void testDisabledControls() throws Exception { + defineWebPage( "Default", "<form method=GET action = '/ask'>" + + "<Input disabled type=checkbox name=color value=red checked>" + + "<Input type=checkbox name=color value=blue>" + + "<Input type=radio name=species value=hippo disabled>" + + "<Input type=radio name=species value=kangaroo checked>" + + "<Input type=radio name=species value=lemur>" + + "<textarea name='big' disabled rows=2 cols=40>stop me</textarea>" + + "<Input type=text name=age value=12 disabled value='12'></form>" ); + WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); + WebForm form = page.getForms()[0]; + WebRequest request = page.getForms()[0].getRequest(); + assertEquals( "Expected request URL", getHostPath() + "/ask?species=kangaroo", request.getURL().toExternalForm() ); + + assertMatchingSet( "selected color", new String[] { "red" }, form.getParameterValues( "color" ) ); + assertEquals( "selected animal", "kangaroo", form.getParameterValue( "species" ) ); + assertEquals( "age", "12", form.getParameterValue( "age" ) ); + + assertMatchingSet( "color choices", new String[] { "red", "blue" }, form.getOptionValues( "color" ) ); + assertMatchingSet( "species choices", new String[] { "kangaroo", "lemur" }, form.getOptionValues( "species" ) ); + + validateSetParameterRejected( request, "color", "blue", "unchecking 'red'" ); + validateSetParameterRejected( request, "color", new String[] { "blue" }, "unchecking 'red'" ); + validateSetParameterRejected( request, "species", "hippo", "selecting 'hippo'" ); + validateSetParameterRejected( request, "age", "15", "changing a read-only text parameter value" ); + validateSetParameterRejected( request, "big", "go-go", "changing a read-only textarea parameter value" ); + + request.setParameter( "color", "red" ); + request.setParameter( "color", new String[] { "red", "blue" } ); + request.setParameter( "species", "lemur" ); + request.setParameter( "age", "12" ); + request.setParameter( "big", "stop me" ); + } + + public void testFileParameterValue() throws Exception { defineWebPage( "Default", "<form method=POST action='/ask'>" + "<Input type=file name=File>" + |
From: Russell G. <rus...@us...> - 2002-09-27 16:30:15
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv6011/src/com/meterware/httpunit Modified Files: FormControl.java Log Message: Added support for the disabled attribute for form parameters Index: FormControl.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- FormControl.java 9 Sep 2002 20:04:25 -0000 1.24 +++ FormControl.java 27 Sep 2002 16:30:13 -0000 1.25 @@ -135,7 +135,7 @@ * Returns true if this control is read-only. **/ boolean isReadOnly() { - return _readOnly; + return _readOnly || _disabled; } @@ -406,7 +406,7 @@ void addValues( ParameterProcessor processor, String characterSet ) throws IOException { - if (isChecked()) processor.addParameter( getName(), getQueryValue(), characterSet ); + if (isChecked() && !isDisabled()) processor.addParameter( getName(), getQueryValue(), characterSet ); } @@ -638,7 +638,7 @@ void addValues( ParameterProcessor processor, String characterSet ) throws IOException { - if (getName().length() > 0) processor.addParameter( getName(), getValues()[0], characterSet ); + if (!isDisabled() && getName().length() > 0) processor.addParameter( getName(), getValues()[0], characterSet ); } @@ -862,6 +862,7 @@ void addValues( ParameterProcessor processor, String characterSet ) throws IOException { + if (isDisabled()) return; for (int i = 0; i < getValues().length; i++) { processor.addParameter( getName(), getValues()[i], characterSet ); } |
From: Russell G. <rus...@us...> - 2002-09-27 16:30:15
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv6011/doc Modified Files: release_notes.txt Log Message: Added support for the disabled attribute for form parameters Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.166 retrieving revision 1.167 diff -u -r1.166 -r1.167 --- release_notes.txt 27 Sep 2002 15:49:01 -0000 1.166 +++ release_notes.txt 27 Sep 2002 16:30:12 -0000 1.167 @@ -12,8 +12,11 @@ Revision History: 27-Sep-2002 +Problems fixed: + 1. Disabled form parameters were being submitted with requests and could be modified by setParameter calls. + Additions: - 1. The Javascript property Link.href is now read-write + 1. The Javascript property Link.href is now read-write. 26-Sep-2002 Problems fixed: |
From: Russell G. <rus...@us...> - 2002-09-27 16:09:55
|
Update of /cvsroot/httpunit/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv31082 Modified Files: build.xml Log Message: Enable javadoc for pseudoserver Index: build.xml =================================================================== RCS file: /cvsroot/httpunit/httpunit/build.xml,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- build.xml 6 Sep 2002 15:06:51 -0000 1.47 +++ build.xml 27 Sep 2002 16:09:51 -0000 1.48 @@ -27,7 +27,7 @@ <property name="archive.dir" value="${dist.dir}/${name}-${version}" /> <property name="classpath" value="" /> <property name="web.dir" value="web" /> - <property name="packages" value="com.meterware.httpunit,com.meterware.servletunit" /> + <property name="packages" value="com.meterware.httpunit,com.meterware.servletunit,com.meterware.pseudoserver" /> <property name="test.class" value="com.meterware.httpunit.HttpUnitSuite" /> <property name="servlet.test.class" value="com.meterware.servletunit.ServletUnitSuite" /> |
From: Russell G. <rus...@us...> - 2002-09-27 15:49:04
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv22163/test/com/meterware/httpunit/javascript Modified Files: ScriptingTest.java Log Message: Made Link href Javascript property writeable Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- ScriptingTest.java 26 Sep 2002 21:49:35 -0000 1.25 +++ ScriptingTest.java 27 Sep 2002 15:49:02 -0000 1.26 @@ -368,6 +368,24 @@ } + public void testLinkProperties() throws Exception { + defineResource( "somewhere.html?with=values", "you made it!" ); + defineResource( "OnCommand.html", "<html><head></head>" + + "<body>" + + "<a name=target href='nowhere.html'>" + + "<a name=control href='#' onClick=\"document.target.href='somewhere.html?with=values';\">green</a>" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + WebLink link = response.getLinkWithName( "target" ); + assertEquals( "initial value", "nowhere.html", link.getURLString() ); + response.getLinkWithName( "control" ).click(); + assertEquals( "changed reference", getHostPath() + "/somewhere.html?with=values", link.getRequest().getURL().toExternalForm() ); + response = link.click(); + assertEquals( "New page", "you made it!", response.getText() ); + } + + public void testLinkIndexes() throws Exception { defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" + "function alertLinks() { " + |
From: Russell G. <rus...@us...> - 2002-09-27 15:49:04
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv22163/src/com/meterware/httpunit Modified Files: FixedURLWebRequestSource.java WebLink.java WebRequestSource.java Log Message: Made Link href Javascript property writeable Index: FixedURLWebRequestSource.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FixedURLWebRequestSource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FixedURLWebRequestSource.java 29 Aug 2002 15:32:44 -0000 1.1 +++ FixedURLWebRequestSource.java 27 Sep 2002 15:49:02 -0000 1.2 @@ -27,6 +27,7 @@ /** + * An implementation of web request source whose URL does not change under user action. * * @author <a href="mailto:rus...@ac...">Russell Gold</a> **/ @@ -74,6 +75,13 @@ protected void addPresetParameter( String name, String value ) { _presetParameterMap.put( name, HttpUnitUtils.withNewValue( (String[]) _presetParameterMap.get( name ), value ) ); _presetParameterList.add( new PresetParameter( name, value ) ); + } + + + protected void setDestination( String destination ) { + super.setDestination( destination ); + _presetParameterList = null; + _presetParameterMap = null; } Index: WebLink.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebLink.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- WebLink.java 13 Sep 2002 14:17:25 -0000 1.28 +++ WebLink.java 27 Sep 2002 15:49:02 -0000 1.29 @@ -46,16 +46,10 @@ /** - * Returns the URL referenced by this link. This may be a relative URL. + * Returns the URL referenced by this link. This may be a relative URL. It will not include any fragment identifier. **/ public String getURLString() { - String href = NodeUtils.getNodeAttribute( getNode(), "href" ); - final int hashIndex = href.indexOf( '#' ); - if (hashIndex < 0) { - return href; - } else { - return href.substring( 0, hashIndex ); - } + return getRelativeURL(); } @@ -104,6 +98,15 @@ return getReference().toExternalForm(); } else { return super.get( propertyName ); + } + } + + + public void set( String propertyName, Object value ) { + if (propertyName.equals( "href" )) { + setDestination( (String) value ); + } else { + super.set( propertyName, value ); } } Index: WebRequestSource.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- WebRequestSource.java 26 Sep 2002 18:22:33 -0000 1.14 +++ WebRequestSource.java 27 Sep 2002 15:49:02 -0000 1.15 @@ -112,7 +112,7 @@ } - private String getRelativeURL() { + protected String getRelativeURL() { String result = trimFragment( getDestination() ); if (result.trim().length() == 0) result = getBaseURL().getFile(); return result; |