httpunit-commit Mailing List for httpunit (Page 45)
Brought to you by:
russgold
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(31) |
Oct
(39) |
Nov
(18) |
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(8) |
Feb
(5) |
Mar
(8) |
Apr
(25) |
May
(20) |
Jun
(23) |
Jul
(28) |
Aug
(10) |
Sep
(3) |
Oct
(32) |
Nov
(61) |
Dec
(24) |
| 2002 |
Jan
(50) |
Feb
(34) |
Mar
(35) |
Apr
(3) |
May
(25) |
Jun
(25) |
Jul
(30) |
Aug
(146) |
Sep
(49) |
Oct
(156) |
Nov
(121) |
Dec
(54) |
| 2003 |
Jan
(12) |
Feb
(79) |
Mar
(88) |
Apr
(26) |
May
(67) |
Jun
(29) |
Jul
(8) |
Aug
(16) |
Sep
(20) |
Oct
(17) |
Nov
|
Dec
(5) |
| 2004 |
Jan
|
Feb
(40) |
Mar
(30) |
Apr
(5) |
May
|
Jun
(83) |
Jul
(34) |
Aug
(20) |
Sep
(44) |
Oct
(46) |
Nov
|
Dec
(14) |
| 2005 |
Jan
(4) |
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(1) |
| 2006 |
Jan
|
Feb
|
Mar
(26) |
Apr
(8) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(36) |
May
(38) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(4) |
Oct
|
Nov
(18) |
Dec
(4) |
| 2009 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(35) |
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(9) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(21) |
Oct
(18) |
Nov
(1) |
Dec
|
|
From: Russell G. <rus...@us...> - 2002-11-03 17:37:41
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver
In directory usw-pr-cvs1:/tmp/cvs-serv17912/src/com/meterware/pseudoserver
Added Files:
package.html
Log Message:
update JavaDoc
--- NEW FILE ---
<html><body>
A test framework for HTTP clients, using a simplified HTTP server. The {@link com.meterware.pseudoserver.PseudoServer}
class is a simple HTTP server which can be programmed with the results required by a test. Results may either be
staticly defined or dynamically created, using the {@link com.meterware.pseudoserver.PseudoServlet} class.
</body></html>
|
|
From: Russell G. <rus...@us...> - 2002-11-03 15:46:19
|
Update of /cvsroot/httpunit/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv17692
Modified Files:
build.xml
Log Message:
Add Javadoc for cookies package
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- build.xml 3 Nov 2002 06:31:53 -0000 1.52
+++ build.xml 3 Nov 2002 15:46:16 -0000 1.53
@@ -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,com.meterware.pseudoserver" />
+ <property name="packages" value="com.meterware.httpunit,com.meterware.servletunit,com.meterware.pseudoserver,com.meterware.httpunit.cookies" />
<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-11-03 06:31:56
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv19108/doc
Modified Files:
release_notes.txt
Log Message:
prepare for 1.5 release
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -r1.206 -r1.207
--- release_notes.txt 31 Oct 2002 15:17:01 -0000 1.206
+++ release_notes.txt 3 Nov 2002 06:31:53 -0000 1.207
@@ -6,74 +6,27 @@
Limitations:
1. JDK 1.2 or higher is required
- 2. JavaScript support does not include document.write and some DOM properties
+ 2. JavaScript support does not include Document.open() and some DOM properties
Revision History:
-31-Oct-2002
-Problems fixed:
- 1. When a JavaScript event resulted in submitting a request and bypassed the normal mechanism, WebForm.submit and
- WebLink.click() did not return the changed page.
-
-30-Oct-2002
-Acknowledgements:
- Thanks to Troy Waldrep for fixing the JavaScript / HTML end-comment bug
- Thanks to EdA-qa mort-ora-y for findind and fixing the MIME-encoding bug
-
-Problems fixed:
- 1. JavaScript ending with --> rather than the proper end-comment // --> was being treated as a syntax error
- 2. Bug #626822 Controls without names are no longer sent as part of a MIME-encoded message
- 3. Bug #618140 JavaScript access to the file submit control value was not working
-
-Additions:
- 1. Added the HeadMethodWebRequest class
-
-24-Oct-2002
-Acknowledgements:
- Thanks to Andy Clark for help using the NekoHTML filter capability.
-
-Additions:
- 1. document.write and writeln are now supported for embedded uses
- 2. ServletUnit now implements HttpServletRequest.getLocale() and getLocales()
-
-22-Oct-2002
-Acknowledgements:
- Thanks to Troy Waldrep for help with the new handling of response statuses and messages.
-
-Problems fixed:
- 1. A bad certificate on an https connection was incorrectly being flagged as a no-such-server exception. This
- is fixed on JDK 1.4, due to a correct in the JDK. On previous versions of the JDK, HttpUnit is using a
- workaround, which cannot detect the difference.
-
-Notes:
- 1. The exception HttpServerNotFoundException has been removed. When no server is found, HttpUnit now throws the
- standard exception: java.net.UnknownHostException
- 2. The required jars are now included in the distribution, so it is not necessary to download them separately.
- This was an oversight.
-
-21-Oct-2002
-Problems fixed:
- 1. The cookie fixes of 17-Oct had caused ServletUnit to see multiple servlets in an application with varying paths
- as being in separate sessions.
- 2. ServletUnit now explicitly specifies its locale for generating dates as Locale.US to comply with RFC-1123
-
-17-Oct-2002
-Additions:
- 1. Cookies are now restricted by their origin server, rather than being sent on every request.
- 2. A new package com.meterware.httpunit.cookies, now exists to support the cookie functionality.
-
-14-Oct-2002
+ 3-Nov-2002 1.5
Acknowledgements:
+ Thanks to Ken Corbin for adding tests for disabled and read-only parameters.
+ Thanks to Geert Bevin for fixing a problem with generation of cookie headers that affects some servers.
+ Thanks to Richard Harris for adding support for the title attribute for links,
+ for adding the JavaScript Navigator.platform property,
+ for adding Javascript support for the Screen object,
+ for pointing out the value of retaining the same ScriptingEngine instance for a ScriptableDelegate,
+ for adding stubs for various unimplemented JavaScript Window properties.
+ and for finding a case where the handling of JavaScript comments was not working.
Thanks to Stefan Renz for describing the correct way to set up proxy servers in Java 2 and later.
-Additions:
- 1. The proxy server may now be specified by calling WebClient.setProxyServer. This should also ensure that the
- correct authorization header is sent.
+ Thanks to Troy Waldrep for help with the new handling of response statuses and messages.
+ and for fixing the JavaScript / HTML end-comment bug
+ Thanks to Andy Clark for help using the NekoHTML filter capability.
+ Thanks to EdA-qa mort-ora-y for findind and fixing the MIME-encoding bug
-Problems fixed:
- 1. Requests created by calling the web request constructors directly, rather than being derived from an HTML page
- were always using the Latin-1 encoding, rather than the user-specified default encoding.
-13-Oct-2002
Notes:
1. The NekoHTML parser is now supported. If it is present in the classpath, it will be used in preference to JTidy.
Note that NekoHTML is a much more forgiving parser than JTidy, properly handling a lot of bad HTML that JTidy
@@ -82,86 +35,78 @@
it is really needed. NekoHTML is the current preferred parser and will probably be required to support certain
JavaScript enhancements. Ultimately, it is possible that JTidy support will be dropped.
2. The version of xerces now included in the distribution is 2.2, which is required for NekoHTML.
+ 3. The exception HttpServerNotFoundException has been removed. When no server is found, HttpUnit now throws the
+ standard exception: java.net.UnknownHostException
+ 4. The required jars are now included in the distribution, so it is not necessary to download them separately.
+ This was an oversight.
-12-Oct-2002
-Acknowledgements:
- Thanks to Richard Harris for finding a case where the handling of JavaScript comments was not working.
-
-Problems fixed:
- 1. Under certain circumstances, the first line of a JavaScript section was being treated as though commented out.
-
-10-Oct-2002
-Problems fixed:
- 1. Window.open was implemented with parameters backwards in 8-Oct-2002 build
- 2. Window.opener property was not returning undefined value for non-top-level windows in 8-Oct-2002 build
-
-Additions:
- 1. Added support for Window.parent
- 2. Added support for Window.<subframe-name>
- 3. Added WebWindow.getOpenedWindow() to return a window by its name.
- 4. You may now close a window by calling window.close(). This will trigger any active listeners. If the window closed
- the main window, another window will be promoted to that status.
- 5. Added support for Window.close() and Window.closed
-
- 9-Oct-2002
-Acknowledgements:
- Thanks to Richard Harris for adding stubs for various unimplemented JavaScript Window properties.
-Additions:
- 1. Added support for the following JavaScript Window properties: frames, name, opener, top
- 2. Added do-nothing stubs for the Window properties and functions: closed, close(), moveTo(), focus(), setTimeout()
-Problems fixed:
- 1. ServletUnit was not supporting mappings for the default servlet.
-
- 8-Oct-2002
-Acknowledgements:
- Thanks to Richard Harris for adding support for the title attribute for links,
- for adding the JavaScript Navigator.platform property,
- for adding Javascript support for the Screen object,
- for pointing out the value of retaining the same ScriptingEngine instance for a ScriptableDelegate.
-
-Additions:
- 1. Links, forms, and images now have a readable title property.
- 2. The navigator object now supports the readable 'platform' property.
- 3. The screen object is now supported, with properties availHeight and availWidth
- 4. The Window.open function is now supported
-
-Problems fixed:
- 1. When not using Latin-1 encoding, URL string characters *, _, and - were improperly being encoded
- 2. AuthorizationRequiredException was being thrown even when exceptions on error status was disabled
- 3. Repeated requests for the same JavaScript domain objects returned new and different instances, thus
- preventing identity tests.
-
-
- 4-Oct-2002
-Additions:
- 1. WebClient now supports a WebWindowListener which will be called when a new window is opened.
-
- 3-Oct-2002
-Acknowledgements:
- Thanks to Geert Bevin for fixing a problem with generation of cookie headers that affects some servers.
-
-Additions:
- 1. Following the "_blank" target now creates a new web window, with its own set of frames. Following links or submitting
- forms will update the window from which the request originated. Requests may also now be initiated from an open window.
- The list of open windows is a property of the web client.
- 2. The mechanism for searching for tables has been expanded to permit arbitrary search criteria, similar to that
- for links.
Problems fixed:
- 1. The cookie header was being generated with a space after each ";" separator.
-
- 2-Oct-2002
+ Content and parsing
+ 1. The cookie header was being generated with a space after each ";" separator.
+ 2. AuthorizationRequiredException was being thrown even when exceptions on error status was disabled
+ 3. A bad certificate on an https connection was incorrectly being flagged as a no-such-server exception. This
+ is fixed on JDK 1.4, due to a correct in the JDK. On previous versions of the JDK, HttpUnit is using a
+ workaround, which cannot detect the difference.
+ 4. Bug #626822 Controls without names are no longer sent as part of a MIME-encoded message
+ Internationalization
+ 5. When not using Latin-1 encoding, URL string characters *, _, and - were improperly being encoded
+ 6. Requests created by calling the web request constructors directly, rather than being derived from an HTML page
+ were always using the Latin-1 encoding, rather than the user-specified default encoding.
+ JavaScript
+ 7. Repeated requests for the same JavaScript domain objects returned new and different instances, thus
+ preventing identity tests.
+ 8. Under certain circumstances, the first line of a JavaScript section was being treated as though commented out.
+ 9. JavaScript ending with --> rather than the proper end-comment // --> was being treated as a syntax error
+ 10. When a JavaScript event resulted in submitting a request and bypassed the normal mechanism, WebForm.submit and
+ WebLink.click() did not return the changed page.
+ 11. Bug #618140 JavaScript access to the file submit control value was not working
+ ServletUnit
+ 12. ServletUnit was not supporting mappings for the default servlet.
+ 13. ServletUnit now explicitly specifies its locale for generating dates as Locale.US to comply with RFC-1123
+
+
+Additions:
+ Content and parsing enhancements:
+ 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 #614397 <input> parameters with unrecognized type fields are now treated as text fields. This appears
+ to match the behavior in most browsers.
+ 3. Links, forms, and images now have a readable title property.
+
+ Web navigation enhancements:
+ 4. Following the "_blank" target now creates a new web window, with its own set of frames. Following links or submitting
+ forms will update the window from which the request originated. Requests may also now be initiated from an open window.
+ The list of open windows is a property of the web client.
+ 5. The mechanism for searching for tables has been expanded to permit arbitrary search criteria, similar to that
+ for links.
+ 6. WebClient now supports a WebWindowListener which will be called when a new window is opened or closed.
+ 7. Added WebWindow.getOpenedWindow() to return a window by its name.
+ 8. You may now close a window by calling window.close(). This will trigger any active listeners. If the window closed
+ the main window, another window will be promoted to that status.
+ 9. Added the HeadMethodWebRequest class to support HEAD method requests
+
+ Security and state-management enhancements:
+ 10. The proxy server may now be specified by calling WebClient.setProxyServer. This should also ensure that the
+ correct authorization header is sent.
+ 11. Cookies are now restricted by their origin server, rather than being sent on every request.
+ 12. A new package com.meterware.httpunit.cookies, now exists to support the cookie functionality.
+
+ Scripting enhancements:
+ 13. The navigator object now supports the readable 'platform' property.
+ 14. The screen object is now supported, with properties availHeight and availWidth
+ 15. Added support for Location.replace()
+ 16. Added support for Window methods: open(), and close()
+ 17. Added support for Window properties: closed, frames, name, opener, top, parent, and <subframe-name>
+ 18. Added do-nothing stubs for the Window properties and functions: moveTo(), focus(), setTimeout()
+ 19. document.write and writeln are now supported for processing a page while it is being loaded. This only
+ works if the default NekoHTML parser is being used.
+
+ ServletUnit enhancements:
+ 20. RFE #585495 ServletUnit now supports HttpServletResponse.setContentLength.
+ 21. ServletUnit now implements HttpServletRequest.getLocale() and getLocales()
-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. RFE #585495 ServletUnit now supports HttpServletResponse.setContentLength.
- 3. RFE #614397 <input> parameters with unrecognized type fields are now treated as text fields. This appears
- to match the behavior in most browsers.
2-Oct-2002 1.4.6
Acknowledgements:
|
|
From: Russell G. <rus...@us...> - 2002-11-03 06:31:56
|
Update of /cvsroot/httpunit/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv19108
Modified Files:
build.xml
Log Message:
prepare for 1.5 release
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- build.xml 22 Oct 2002 20:15:32 -0000 1.51
+++ build.xml 3 Nov 2002 06:31:53 -0000 1.52
@@ -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.6" />
+ <property name="version" value="1.5" />
<property name="debug" value="on" />
<property name="deprecation" value="off" />
|
|
From: Russell G. <rus...@us...> - 2002-11-03 06:31:17
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv18976/src/com/meterware/httpunit/javascript
Modified Files:
JavaScript.java
Log Message:
Support location.replace
Index: JavaScript.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- JavaScript.java 1 Nov 2002 14:55:02 -0000 1.36
+++ JavaScript.java 3 Nov 2002 06:31:14 -0000 1.37
@@ -102,6 +102,7 @@
abstract static class JavaScriptEngine extends ScriptableObject implements ScriptingEngine {
protected ScriptableDelegate _scriptable;
+ protected JavaScriptEngine _parent;
public String executeScript( String script ) {
@@ -189,6 +190,7 @@
throws SAXException, PropertyException, JavaScriptException, NotAFunctionException {
_scriptable = scriptable;
_scriptable.setScriptEngine( this );
+ _parent = parent;
if (parent != null) setParentScope( parent );
}
@@ -362,12 +364,22 @@
}
+ public void jsSet_location( String relativeURL ) throws IOException, SAXException {
+ setLocation( relativeURL );
+ }
+
+
+ void setLocation( String relativeURL ) throws IOException, SAXException {
+ getDelegate().setLocation( relativeURL );
+ }
+
+
void initialize( JavaScriptEngine parent, ScriptableDelegate scriptable )
throws JavaScriptException, NotAFunctionException, PropertyException, SAXException {
super.initialize( parent, scriptable );
_location = (Location) Context.getCurrentContext().newObject( this, "Location" );
- _location.setURL( ((WebResponse.Scriptable) scriptable).getURL() );
+ _location.initialize(this, ((WebResponse.Scriptable) scriptable).getURL() );
_navigator = (Navigator) Context.getCurrentContext().newObject( this, "Navigator" );
_navigator.setClientProperties( getDelegate().getClientProperties() );
@@ -463,6 +475,21 @@
}
+ public Object jsGet_location() {
+ return _parent == null ? NOT_FOUND : getWindow().jsGet_location();
+ }
+
+
+ public void jsSet_location( String urlString ) throws IOException, SAXException {
+ getWindow().setLocation( urlString );
+ }
+
+
+ private Window getWindow() {
+ return ((Window) _parent);
+ }
+
+
public void jsFunction_write( String string ) {
final StringBuffer documentWriteBuffer = getDocumentWriteBuffer();
documentWriteBuffer.append( string );
@@ -518,14 +545,31 @@
static public class Location extends JavaScriptEngine {
private URL _url;
+ private Window _window;
public String getClassName() {
return "Location";
}
- public void setURL( URL url ) {
+ void initialize( Window window, URL url ) {
+ _window = window;
_url = url;
+ }
+
+
+ public void jsFunction_replace( String urlString ) throws IOException, SAXException {
+ _window.setLocation( urlString );
+ }
+
+
+ /**
+ * Returns the default value of this scriptable object. In this case, it returns simply the URL as a string.
+ * Note that this method is necessary, since Rhino will only call the toString method directly if there are no
+ * Rhino methods defined (jsGet_*, jsFunction_*, etc.)
+ */
+ public Object getDefaultValue( Class typeHint ) {
+ return _url.toExternalForm();
}
|
|
From: Russell G. <rus...@us...> - 2002-11-03 06:31:17
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv18976/test/com/meterware/httpunit/javascript
Modified Files:
ScriptingTest.java
Log Message:
Support location.replace
Index: ScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- ScriptingTest.java 31 Oct 2002 00:26:18 -0000 1.42
+++ ScriptingTest.java 3 Nov 2002 06:31:14 -0000 1.43
@@ -373,6 +373,7 @@
"<body onLoad='alert(\"Window location is \" + window.location);alert(\"Document location is \" + document.location)'>" +
"<a href='#' onMouseOver=\"window.location='" + getHostPath() + "/Target.html';\">go</a>" +
"<a href='#' onMouseOver=\"document.location='" + getHostPath() + "/Target.html';\">go</a>" +
+ "<a href='#' onMouseOver=\"document.location.replace('" + getHostPath() + "/Target.html');\">go</a>" +
"</body>" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
@@ -386,6 +387,11 @@
response.getLinks()[1].mouseOver();
assertEquals( "3rd page URL", getHostPath() + "/Target.html", wc.getCurrentPage().getURL().toExternalForm() );
assertEquals( "3rd page", "You made it!", wc.getCurrentPage().getText() );
+
+ response = wc.getResponse( getHostPath() + "/OnCommand.html" );
+ response.getLinks()[2].mouseOver();
+ assertEquals( "4th page URL", getHostPath() + "/Target.html", wc.getCurrentPage().getURL().toExternalForm() );
+ assertEquals( "4th page", "You made it!", wc.getCurrentPage().getText() );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-03 06:31:17
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv18976/src/com/meterware/httpunit
Modified Files:
WebResponse.java
Log Message:
Support location.replace
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- WebResponse.java 1 Nov 2002 14:55:00 -0000 1.95
+++ WebResponse.java 3 Nov 2002 06:31:14 -0000 1.96
@@ -608,8 +608,6 @@
} else if (propertyName.equalsIgnoreCase( "parent" )) {
return getFrameName().equals( WebRequest.TOP_FRAME ) ? null
: _window.getFrameContents( WebFrame.getParentFrameName( getFrameName() ) ).getScriptableObject();
- } else if (propertyName.equalsIgnoreCase( "location" )) {
- return getURL().toExternalForm();
} else if (propertyName.equalsIgnoreCase( "opener" )) {
return getFrameName().equals( WebRequest.TOP_FRAME ) ? getScriptable( _window.getOpener() ) : null;
} else if (propertyName.equalsIgnoreCase( "closed" )) {
@@ -639,17 +637,14 @@
if (getFrameName().equals( WebRequest.TOP_FRAME )) {
_window.setName( value.toString() );
}
- } else if (propertyName.equalsIgnoreCase( "location" )) {
- try {
- getWindow().getResponse( new GetMethodWebRequest( _url, value.toString(), _frameName ) );
- } catch (IOException e) {
- throw new RuntimeException( "Error handling 'location=': " + e );
- } catch (SAXException e) {
- throw new RuntimeException( "Error handling 'location=': " + e );
- }
} else {
super.set( propertyName, value );
}
+ }
+
+
+ public void setLocation( String relativeURL ) throws IOException, SAXException {
+ getWindow().getResponse( new GetMethodWebRequest( _url, relativeURL, _frameName ) );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-03 06:28:41
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv18490/doc Modified Files: Javascript-support.html Log Message: Support location.replace Index: Javascript-support.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/Javascript-support.html,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- Javascript-support.html 25 Oct 2002 00:19:25 -0000 1.26 +++ Javascript-support.html 3 Nov 2002 06:28:36 -0000 1.27 @@ -12,7 +12,7 @@ <li>closed - true if the window has been closed</li> <li>document - the associated Document object</li> <li>frames - an array of subframes of this window</li> -<li>location - r/w full URL only</li> +<li>location - r/w the associated Location object, which may be treated as a URL string</li> <li>name - r/w the name of the window</li> <li>navigator - the Navigator object</li> <li>opener - r/o the window which opened this one (top-level frames only)</li> @@ -60,6 +60,12 @@ <h4>methods</h4> <ul> <li>javaEnabled - always returns false to indicate that applets are not supported</li> +</ul> + +<h3>Location</h3> +<h4>methods</h4> +<ul> +<li>replace - replaces the current window by doing a new request to the server</li> </ul> <h3>Document</h3> |
|
From: Russell G. <rus...@us...> - 2002-11-03 06:28:40
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv18490/src/com/meterware/httpunit
Modified Files:
HTMLPage.java
Log Message:
Support location.replace
Index: HTMLPage.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLPage.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- HTMLPage.java 24 Oct 2002 13:28:53 -0000 1.14
+++ HTMLPage.java 3 Nov 2002 06:28:36 -0000 1.15
@@ -166,11 +166,7 @@
delegate = getNamedItem( getImages(), propertyName );
if (delegate != null) return delegate;
- if (propertyName.equalsIgnoreCase( "location" )) {
- return getResponse().getScriptableObject().get( "location" );
- } else {
- return super.get( propertyName );
- }
+ return super.get( propertyName );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-01 14:55:32
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv21999/doc Modified Files: faq.html Log Message: Prepare for Location object Index: faq.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/faq.html,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- faq.html 14 Oct 2002 12:40:04 -0000 1.20 +++ faq.html 1 Nov 2002 14:54:58 -0000 1.21 @@ -27,6 +27,10 @@ <LI><A HREF="#javascript">How do I use HttpUnit to test my pages that use JavaScript?</A></LI> <LI><A HREF="#norhino">JavaScript is not being executed at all. Why not?</A></LI> <li><a href="#unsupported">How do I handle a page that uses JavaScript features that HttpUnit does not support?</a></li> +</ol><ol start=14> + +<LI><A HREF="#session">How can I see the servlet session between calls?</A></LI> +<li><a href="#JSP">Can I use JSPs with ServletUnit?</a></li> </OL> @@ -129,6 +133,31 @@ 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> + + +<h2>ServletUnit usage</h2> + +<A NAME="session"><h3>How can I see the servlet session between calls?</h3></A> +Servlet session is maintained on the server. Therefore, if you want to do this, you must be using <a href="servletunit-intro.html">ServletUnit</a>. +Once you have that working, you can get take advantage of the power of ServletUnit to get at internal values, +using the <a href="api/com/meterware/servletunit/InvocationContext.html"><code>InvocationContext</code></a> object. For example, +<pre><code> +ServletUnitClient client = ... // the client you have been using +client.getResponse( servlet-url ); // invoke your servlet normally + +// now get an invocation context using the <i>same</i> URL used to invoke the servlet +InvocationContext ic = client.newInvocationContext( servlet-url ); +// obain the session just used. Note: pass false to avoid creating it if it does not already exist +HttpSession session = ic.getRequest().getSession( false );</code></pre> + +Now you can examine the contents of the session to see what the servlet left in it. + +<a name="JSP"><h3>Can I use JSPs with ServletUnit?</h3></a> +Absolutely! But since you are now emulating the servlet environment, you will need to make sure that you have access +to the relevant classes. By default, ServletUnit is configured to use Jasper, the JSP engine which is part of Tomcat. +You will therefore need the Jasper jar in your classpath, along with any on which it depends. Once you have done that, +your JSPs should run, just as they would in Tomcat. + </BODY></HTML> |
|
From: Russell G. <rus...@us...> - 2002-11-01 14:55:06
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv21999/src/com/meterware/httpunit
Modified Files:
WebClient.java WebResponse.java
Log Message:
Prepare for Location object
Index: WebClient.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- WebClient.java 17 Oct 2002 23:50:48 -0000 1.44
+++ WebClient.java 1 Nov 2002 14:54:59 -0000 1.45
@@ -571,7 +571,7 @@
/**
* Examines the headers in the response and throws an exception if appropriate.
**/
- private void validateHeaders( WebResponse response ) throws HttpException, IOException {
+ private void validateHeaders( WebResponse response ) throws HttpException {
if (!getExceptionsThrownOnErrorStatus()) return;
if (response.getHeaderField( "WWW-Authenticate" ) != null) {
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- WebResponse.java 24 Oct 2002 13:28:53 -0000 1.94
+++ WebResponse.java 1 Nov 2002 14:55:00 -0000 1.95
@@ -609,7 +609,7 @@
return getFrameName().equals( WebRequest.TOP_FRAME ) ? null
: _window.getFrameContents( WebFrame.getParentFrameName( getFrameName() ) ).getScriptableObject();
} else if (propertyName.equalsIgnoreCase( "location" )) {
- return WebResponse.this._url.toExternalForm();
+ return getURL().toExternalForm();
} else if (propertyName.equalsIgnoreCase( "opener" )) {
return getFrameName().equals( WebRequest.TOP_FRAME ) ? getScriptable( _window.getOpener() ) : null;
} else if (propertyName.equalsIgnoreCase( "closed" )) {
@@ -650,6 +650,11 @@
} else {
super.set( propertyName, value );
}
+ }
+
+
+ public URL getURL() {
+ return WebResponse.this._url;
}
}
|
|
From: Russell G. <rus...@us...> - 2002-11-01 14:55:06
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv21999/src/com/meterware/httpunit/javascript
Modified Files:
JavaScript.java
Log Message:
Prepare for Location object
Index: JavaScript.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- JavaScript.java 31 Oct 2002 00:26:18 -0000 1.35
+++ JavaScript.java 1 Nov 2002 14:55:02 -0000 1.36
@@ -26,6 +26,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.io.IOException;
+import java.net.URL;
import org.mozilla.javascript.*;
import org.xml.sax.SAXException;
@@ -84,6 +85,7 @@
InvocationTargetException, ClassDefinitionException, PropertyException {
ScriptableObject.defineClass( scope, Window.class );
ScriptableObject.defineClass( scope, Document.class );
+ ScriptableObject.defineClass( scope, Location.class );
ScriptableObject.defineClass( scope, Navigator.class );
ScriptableObject.defineClass( scope, Screen.class );
ScriptableObject.defineClass( scope, Link.class );
@@ -301,9 +303,10 @@
static public class Window extends JavaScriptEngine {
- private Document _document;
- private Navigator _navigator;
- private Screen _screen;
+ private Document _document;
+ private Navigator _navigator;
+ private Location _location;
+ private Screen _screen;
private ElementArray _frames;
@@ -354,10 +357,18 @@
}
+ public Location jsGet_location() {
+ return _location;
+ }
+
+
void initialize( JavaScriptEngine parent, ScriptableDelegate scriptable )
throws JavaScriptException, NotAFunctionException, PropertyException, SAXException {
super.initialize( parent, scriptable );
+ _location = (Location) Context.getCurrentContext().newObject( this, "Location" );
+ _location.setURL( ((WebResponse.Scriptable) scriptable).getURL() );
+
_navigator = (Navigator) Context.getCurrentContext().newObject( this, "Navigator" );
_navigator.setClientProperties( getDelegate().getClientProperties() );
@@ -499,6 +510,27 @@
private HTMLPage.Scriptable getDelegate() {
return (HTMLPage.Scriptable) _scriptable;
+ }
+
+ }
+
+
+ static public class Location extends JavaScriptEngine {
+
+ private URL _url;
+
+ public String getClassName() {
+ return "Location";
+ }
+
+
+ public void setURL( URL url ) {
+ _url = url;
+ }
+
+
+ public String toString() {
+ return _url.toExternalForm();
}
}
|
|
From: Russell G. <rus...@us...> - 2002-11-01 14:55:06
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv21999/test/com/meterware/httpunit Modified Files: WebPageTest.java Log Message: Prepare for Location object Index: WebPageTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- WebPageTest.java 31 Oct 2002 15:17:17 -0000 1.23 +++ WebPageTest.java 1 Nov 2002 14:55:02 -0000 1.24 @@ -26,6 +26,7 @@ import junit.framework.TestSuite; import java.io.*; +import java.net.MalformedURLException; @@ -43,6 +44,9 @@ public static Test suite() { +// DefaultWebResponse blankResponse = new DefaultWebResponse( null, null, WebResponse.BLANK_HTML ); +// HttpUnitOptions.getScriptingEngine().associate( blankResponse ); + return new TestSuite( WebPageTest.class ); } |
|
From: Russell G. <rus...@us...> - 2002-10-31 15:17:52
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv12787/test/com/meterware/httpunit Modified Files: WebPageTest.java Log Message: Improve return from WebForm.submit and WebLink.click Index: WebPageTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- WebPageTest.java 14 Oct 2002 18:27:45 -0000 1.22 +++ WebPageTest.java 31 Oct 2002 15:17:17 -0000 1.23 @@ -19,22 +19,14 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ - import com.meterware.pseudoserver.PseudoServlet; import com.meterware.pseudoserver.WebResource; -import java.net.URL; - import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; -import java.util.Dictionary; -import java.util.Vector; - import java.io.*; -import org.w3c.dom.Document; /** @@ -71,7 +63,7 @@ WebConversation wc = new WebConversation(); try { WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); - WebResponse simplePage = wc.getResponse( request ); + wc.getResponse( request ); fail( "Did not complain about missing page" ); } catch (HttpNotFoundException e) { } @@ -120,7 +112,7 @@ try { WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest( "file:" + file.getAbsolutePath() ); - WebResponse simplePage = wc.getResponse( request ); + wc.getResponse( request ); fail( "Should have complained about missing file" ); } catch (java.io.FileNotFoundException e) { } @@ -319,10 +311,8 @@ /** * Test the meta tag content retrieval - * @author <a href="mailto:bx...@bi...">Benoit Xhenseval</a> **/ public void testMetaTag() throws Exception { - String refreshURL = getHostPath() + "/NextPage.html"; String page = "<html><head><title>Sample</title>" + "<meta Http-equiv=\"Expires\" content=\"now\"/>\n" + "<meta name=\"robots\" content=\"index,follow\"/>" + @@ -344,10 +334,8 @@ /** * test the stylesheet retrieval - * @author <a href="mailto:bx...@bi...">Benoit Xhenseval</a> **/ public void testGetExternalStylesheet() throws Exception { - String refreshURL = getHostPath() + "/NextPage.html"; String page = "<html><head><title>Sample</title>" + "<link rev=\"made\" href=\"/Me...@my...\"/>" + "<link type=\"text/css\" rel=\"stylesheet\" href=\"/style.css\"/>" + @@ -362,16 +350,6 @@ assertEquals( "Stylesheet","/style.css",simplePage.getExternalStyleSheet()); } - - private String toUnicode( String string ) { - StringBuffer sb = new StringBuffer( ); - char[] chars = string.toCharArray(); - for (int i = 0; i < chars.length; i++) { - sb.append( "\\u" ); - sb.append( Integer.toHexString( chars[i] ) ); - } - return sb.toString(); - } /** |
|
From: Russell G. <rus...@us...> - 2002-10-31 15:17:51
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv12787/src/com/meterware/httpunit
Modified Files:
WebForm.java WebLink.java
Log Message:
Improve return from WebForm.submit and WebLink.click
Index: WebForm.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- WebForm.java 13 Oct 2002 23:53:48 -0000 1.68
+++ WebForm.java 31 Oct 2002 15:17:06 -0000 1.69
@@ -57,11 +57,13 @@
/**
* Submits this form using the web client from which it was originally obtained.
+ * Will usually return the result of that submission; however, if a scripted event is triggered which
+ * inhibits the submission, will return the updated contents of the frame containing this form.
**/
WebResponse submit( SubmitButton button ) throws IOException, SAXException {
String event = getAttribute( "onsubmit" );
if (event.length() == 0 || getScriptableObject().doEvent( event )) return submitRequest( getRequest( button ) );
- return getBaseResponse();
+ return getBaseResponse().getWindow().getFrameContents( getTarget() );
}
Index: WebLink.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebLink.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- WebLink.java 14 Oct 2002 04:19:06 -0000 1.33
+++ WebLink.java 31 Oct 2002 15:17:14 -0000 1.34
@@ -78,11 +78,13 @@
/**
* Submits a request as though the user had clicked on this link. Will also fire the 'onClick' event if defined.
+ * If clicking results in submitting a request, will return the result of that submission; otherwise, will
+ * return the updated contents of the frame containing this link.
**/
public WebResponse click() throws IOException, SAXException {
String event = getAttribute( "onclick" );
if (event.length() == 0 || getScriptableObject().doEvent( event )) return submitRequest();
- return getBaseResponse();
+ return getBaseResponse().getWindow().getFrameContents( getTarget() );
}
|
|
From: Russell G. <rus...@us...> - 2002-10-31 15:17:41
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv12787/doc
Modified Files:
release_notes.txt
Log Message:
Improve return from WebForm.submit and WebLink.click
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -r1.205 -r1.206
--- release_notes.txt 31 Oct 2002 04:54:58 -0000 1.205
+++ release_notes.txt 31 Oct 2002 15:17:01 -0000 1.206
@@ -10,6 +10,11 @@
Revision History:
+31-Oct-2002
+Problems fixed:
+ 1. When a JavaScript event resulted in submitting a request and bypassed the normal mechanism, WebForm.submit and
+ WebLink.click() did not return the changed page.
+
30-Oct-2002
Acknowledgements:
Thanks to Troy Waldrep for fixing the JavaScript / HTML end-comment bug
|
|
From: Russell G. <rus...@us...> - 2002-10-31 04:55:04
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv14865/doc
Modified Files:
release_notes.txt
Log Message:
bug #618140: implement JavaScript support for FileSubmit control
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -r1.204 -r1.205
--- release_notes.txt 31 Oct 2002 04:21:28 -0000 1.204
+++ release_notes.txt 31 Oct 2002 04:54:58 -0000 1.205
@@ -18,6 +18,7 @@
Problems fixed:
1. JavaScript ending with --> rather than the proper end-comment // --> was being treated as a syntax error
2. Bug #626822 Controls without names are no longer sent as part of a MIME-encoded message
+ 3. Bug #618140 JavaScript access to the file submit control value was not working
Additions:
1. Added the HeadMethodWebRequest class
|
|
From: Russell G. <rus...@us...> - 2002-10-31 04:55:04
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv14865/src/com/meterware/httpunit
Modified Files:
FormControl.java
Log Message:
bug #618140: implement JavaScript support for FileSubmit control
Index: FormControl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- FormControl.java 22 Oct 2002 20:15:34 -0000 1.30
+++ FormControl.java 31 Oct 2002 04:54:58 -0000 1.31
@@ -730,6 +730,24 @@
private UploadFileSpec _fileToUpload;
+ protected FormControl.Scriptable newScriptable() {
+ return new Scriptable();
+ }
+
+
+ class Scriptable extends FormControl.Scriptable {
+
+ public Object get( String propertyName ) {
+ if (propertyName.equalsIgnoreCase( "value" )) {
+ return getSelectedName();
+ } else {
+ return super.get( propertyName );
+ }
+ }
+
+
+ }
+
public FileSubmitFormControl( WebForm form, Node node ) {
super( form, node );
}
@@ -747,7 +765,12 @@
* Returns the name of the selected file, if any.
*/
public String[] getValues() {
- return new String[] { _fileToUpload == null ? "" : _fileToUpload.getFileName() };
+ return new String[] { getSelectedName() };
+ }
+
+
+ private String getSelectedName() {
+ return _fileToUpload == null ? "" : _fileToUpload.getFileName();
}
|
|
From: Russell G. <rus...@us...> - 2002-10-31 04:55:03
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv14865/test/com/meterware/httpunit/javascript
Modified Files:
FormScriptingTest.java
Log Message:
bug #618140: implement JavaScript support for FileSubmit control
Index: FormScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- FormScriptingTest.java 1 Oct 2002 18:05:10 -0000 1.12
+++ FormScriptingTest.java 31 Oct 2002 04:54:58 -0000 1.13
@@ -19,19 +19,12 @@
* DEALINGS IN THE SOFTWARE.
*
*******************************************************************************************************************/
-import com.meterware.httpunit.WebConversation;
-import com.meterware.httpunit.WebResponse;
-import com.meterware.httpunit.WebForm;
-import com.meterware.httpunit.HttpUnitTest;
-import com.meterware.httpunit.WebRequest;
-import com.meterware.httpunit.WebClient;
-import com.meterware.httpunit.WebLink;
+import com.meterware.httpunit.*;
import com.meterware.pseudoserver.PseudoServlet;
import com.meterware.pseudoserver.WebResource;
import java.io.IOException;
-
-import org.xml.sax.SAXException;
+import java.io.File;
import junit.textui.TestRunner;
import junit.framework.TestSuite;
@@ -326,13 +319,13 @@
"</body></html>" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
- WebForm form = response.getFormWithName( "realform" );
+ response.getFormWithName( "realform" );
verifyCheckbox( /* default */ wc, true, /* checked */ true, /* value */ "good" );
verifyCheckbox( /* default */ wc, false, /* checked */ false, /* value */ "bad" );
}
- private void verifyCheckbox( WebClient wc, boolean defaultChecked, boolean checked, String value ) throws SAXException {
+ private void verifyCheckbox( WebClient wc, boolean defaultChecked, boolean checked, String value ) {
assertEquals( "Message " + 1 + "-1", "checkbox ready default = " + defaultChecked, wc.popNextAlert() );
assertEquals( "Message " + 1 + "-2", "checkbox ready checked = " + checked, wc.popNextAlert() );
assertEquals( "Message " + 1 + "-3", "checkbox ready value = " + value, wc.popNextAlert() );
@@ -384,13 +377,13 @@
"</body></html>" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
- WebForm form = response.getFormWithName( "realform" );
+ response.getFormWithName( "realform" );
verifyRadio( /* default */ wc, true, /* checked */ true, /* value */ "good" );
verifyRadio( /* default */ wc, false, /* checked */ false, /* value */ "bad" );
}
- private void verifyRadio( WebClient wc, boolean defaultChecked, boolean checked, String value ) throws SAXException {
+ private void verifyRadio( WebClient wc, boolean defaultChecked, boolean checked, String value ) {
assertEquals( "Message " + 1 + "-1", "radio ready default = " + defaultChecked, wc.popNextAlert() );
assertEquals( "Message " + 1 + "-2", "radio ready checked = " + checked, wc.popNextAlert() );
assertEquals( "Message " + 1 + "-3", "radio ready value = " + value, wc.popNextAlert() );
@@ -509,6 +502,27 @@
response.getFormWithName( "the_form" ).setParameter( "choices", "1" );
response.getLinks()[0].mouseOver();
assertEquals( "after change message", "selected #0", wc.popNextAlert() );
+ }
+
+
+ public void testFileSubmitProperties() throws Exception {
+ File file = new File( "temp.html" );
+ defineResource( "OnCommand.html", "<html><head></head>" +
+ "<body'>" +
+ "<form name='the_form'>" +
+ " <input type='file' name='file'>" +
+ "</form>" +
+ "<a href='#' onMouseOver=\"alert( 'file selected is [' + document.the_form.file.value + ']' );\">which</a>" +
+ "</body></html>" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
+ response.getLinks()[0].mouseOver();
+ assertEquals( "1st message", "file selected is []", wc.popNextAlert() );
+
+ WebForm form = response.getFormWithName( "the_form" );
+ form.setParameter( "file", new UploadFileSpec[] { new UploadFileSpec( file ) } );
+ response.getLinks()[0].mouseOver();
+ assertEquals( "2nd message", "file selected is [" + file.getAbsolutePath() + "]", wc.popNextAlert() );
}
|
|
From: Russell G. <rus...@us...> - 2002-10-31 04:21:31
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv27354/src/com/meterware/httpunit
Modified Files:
MimeEncodedMessageBody.java
Log Message:
Don't MIME-encode parameters w/o names
Index: MimeEncodedMessageBody.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/MimeEncodedMessageBody.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- MimeEncodedMessageBody.java 24 Oct 2002 13:28:53 -0000 1.13
+++ MimeEncodedMessageBody.java 31 Oct 2002 04:21:28 -0000 1.14
@@ -103,6 +103,8 @@
public void addParameter( String name, String value, String characterSet ) throws IOException {
+ if (name == null || name.length() == 0) return;
+
writeLn( _outputStream, "--" + BOUNDARY );
writeLn( _outputStream, "Content-Disposition: form-data; name=\"" + name + '"' ); // XXX need to handle non-ascii names here
writeLn( _outputStream, "Content-Type: text/plain; charset=" + getRequest().getCharacterSet() );
|
|
From: Russell G. <rus...@us...> - 2002-10-31 04:21:31
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv27354/doc
Modified Files:
release_notes.txt
Log Message:
Don't MIME-encode parameters w/o names
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -r1.203 -r1.204
--- release_notes.txt 31 Oct 2002 00:26:18 -0000 1.203
+++ release_notes.txt 31 Oct 2002 04:21:28 -0000 1.204
@@ -13,9 +13,11 @@
30-Oct-2002
Acknowledgements:
Thanks to Troy Waldrep for fixing the JavaScript / HTML end-comment bug
+ Thanks to EdA-qa mort-ora-y for findind and fixing the MIME-encoding bug
Problems fixed:
1. JavaScript ending with --> rather than the proper end-comment // --> was being treated as a syntax error
+ 2. Bug #626822 Controls without names are no longer sent as part of a MIME-encoded message
Additions:
1. Added the HeadMethodWebRequest class
|
|
From: Russell G. <rus...@us...> - 2002-10-31 00:26:21
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv13341/test/com/meterware/httpunit/javascript
Modified Files:
ScriptingTest.java
Log Message:
Accomodate JavaScript ending with --> rather than // -->
Index: ScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- ScriptingTest.java 24 Oct 2002 13:28:55 -0000 1.41
+++ ScriptingTest.java 31 Oct 2002 00:26:18 -0000 1.42
@@ -203,7 +203,7 @@
"<body'><script language='JavaScript'>\n" +
"<!-- hide this\n" +
"sayCheese();" +
- "// end hiding -->" +
+ "-->" +
"</script></body></html>" );
WebConversation wc = new WebConversation();
wc.getResponse( getHostPath() + "/OnCommand.html" );
|
|
From: Russell G. <rus...@us...> - 2002-10-31 00:26:21
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv13341/src/com/meterware/httpunit/javascript
Modified Files:
JavaScript.java
Log Message:
Accomodate JavaScript ending with --> rather than // -->
Index: JavaScript.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- JavaScript.java 24 Oct 2002 13:28:54 -0000 1.34
+++ JavaScript.java 31 Oct 2002 00:26:18 -0000 1.35
@@ -105,7 +105,10 @@
public String executeScript( String script ) {
try {
script = script.trim();
- if (script.startsWith( "<!--" )) script = withoutFirstLine( script );
+ if (script.startsWith( "<!--" )) {
+ script = withoutFirstLine( script );
+ if (script.endsWith( "-->" )) script = script.substring( 0, script.lastIndexOf( "-->" ));
+ }
Context.getCurrentContext().evaluateString( this, script, "httpunit", 0, null );
StringBuffer buffer = getDocumentWriteBuffer();
return buffer.toString();
|
|
From: Russell G. <rus...@us...> - 2002-10-31 00:26:21
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv13341/doc
Modified Files:
release_notes.txt
Log Message:
Accomodate JavaScript ending with --> rather than // -->
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -r1.202 -r1.203
--- release_notes.txt 25 Oct 2002 00:19:25 -0000 1.202
+++ release_notes.txt 31 Oct 2002 00:26:18 -0000 1.203
@@ -10,6 +10,16 @@
Revision History:
+30-Oct-2002
+Acknowledgements:
+ Thanks to Troy Waldrep for fixing the JavaScript / HTML end-comment bug
+
+Problems fixed:
+ 1. JavaScript ending with --> rather than the proper end-comment // --> was being treated as a syntax error
+
+Additions:
+ 1. Added the HeadMethodWebRequest class
+
24-Oct-2002
Acknowledgements:
Thanks to Andy Clark for help using the NekoHTML filter capability.
|
|
From: Russell G. <rus...@us...> - 2002-10-31 00:25:49
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv13058/src/com/meterware/httpunit
Modified Files:
GetMethodWebRequest.java
Added Files:
HeadMethodWebRequest.java HeaderOnlyWebRequest.java
Log Message:
Added support for HEAD requests
***** Error reading new file[Errno 2] No such file or directory: 'HeadMethodWebRequest.java'
***** Error reading new file[Errno 2] No such file or directory: 'HeaderOnlyWebRequest.java'
Index: GetMethodWebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/GetMethodWebRequest.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- GetMethodWebRequest.java 29 Aug 2002 15:32:44 -0000 1.16
+++ GetMethodWebRequest.java 31 Oct 2002 00:25:45 -0000 1.17
@@ -20,12 +20,11 @@
*
*******************************************************************************************************************/
import java.net.URL;
-import java.io.IOException;
/**
* An HTTP request using the GET method.
**/
-public class GetMethodWebRequest extends WebRequest {
+public class GetMethodWebRequest extends HeaderOnlyWebRequest {
/**
@@ -57,21 +56,6 @@
**/
public String getMethod() {
return "GET";
- }
-
-
- /**
- * Returns the query string defined for this request.
- **/
- public String getQueryString() {
- try {
- URLEncodedString encoder = new URLEncodedString();
- getParameterHolder().recordPredefinedParameters( encoder );
- getParameterHolder().recordParameters( encoder );
- return encoder.getString();
- } catch (IOException e) {
- throw new RuntimeException( "Programming error: " + e ); // should never happen
- }
}
|