httpunit-commit Mailing List for httpunit (Page 25)
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...> - 2003-09-19 20:21:52
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv17038/doc
Modified Files:
release_notes.txt
Log Message:
Chris Hane: Added support for generic HTMLElement properties
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.309
retrieving revision 1.310
diff -u -r1.309 -r1.310
--- release_notes.txt 27 Aug 2003 02:16:06 -0000 1.309
+++ release_notes.txt 19 Sep 2003 18:53:42 -0000 1.310
@@ -13,11 +13,34 @@
Revision History:
+16-Sep-2003
+Acknowledgements:
+ Thanks to Chris Hane for making it easier to add support for javascript properties and for providing support for
+ getAttribute() to handle any property defined in the underlying Node
-26-Aug-2003
Additions:
1. HTMLElement now supports a getAttribute method to return the value of any named attribute.
- 2. WebResponse and TableCell now support getElementsWithAttribute to return all contained HTML elements with
+ 2. PseudoServer can now received chunked requests, and will not send a "Content-Length" header if a
+ "Transfer-Encoding: chunked" has been defined.
+ 3. Added support for javascript Input.tabindex and Text.maxlength properties (read-only)
+
+11-Sep-2003
+Additions:
+ 1. PseudoServer now pools its ServerSocket's in order to be more gracious regarding system resources. Pooling can
+ be controlled via the properties: socketReleaseWaitTime and waitThreshhold.
+Problems fixed:
+ 1. The HeadMethodWebRequest was actually sending the GET method, as was any HeaderOnlyWebRequest.
+ 2. PseudoServer now supports any method handled by a PseudoServlet. Previously, it only handled GET, POST, and PUT.
+ It is simple necessary to override the getResponse method to make this work.
+ 3. Bug #804585: Undocumented method in API: the javascript documentation referred to the old location of the
+ getNextAlert and popNextAlert methods
+ 4. Bug #804559: Documentation incomplete in download: removed the pending links from the incomplete user manual.
+ 5. The tutorial referred to a method without specifying the object to which it belongs
+ 6. The HeadMethodWebRequest was actually sending a GET method
+
+26-Aug-2003
+Additions:
+ 1. WebResponse and TableCell now support getElementsWithAttribute to return all contained HTML elements with
the specified attribute.
21-Aug-2003 1.5.4
|
|
From: Russell G. <rus...@us...> - 2003-09-19 20:19:31
|
Update of /cvsroot/httpunit/httpunit/sitedocs/doc In directory sc8-pr-cvs1:/tmp/cvs-serv17038/sitedocs/doc Modified Files: javascript-support.html Log Message: Chris Hane: Added support for generic HTMLElement properties Index: javascript-support.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/sitedocs/doc/javascript-support.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- javascript-support.html 15 Sep 2003 11:49:44 -0000 1.2 +++ javascript-support.html 19 Sep 2003 18:53:43 -0000 1.3 @@ -147,8 +147,9 @@ <h2>Input (inherits from HTMLElement)</h2> <h4>properties</h4> <ul> -<li>form - read-only - the form containing the input</li> -<li>name - read-only - the name of the control</li> +<li>form - read-only - the form containing the input</li> +<li>name - read-only - the name of the control</li> +<li>tabindex - read-only - the index of the control for tabbing </ul> <h4>methods</h4> <ul> @@ -164,7 +165,8 @@ <h2>Text (inherits from Input)</h2> <h4>properties</h4> <ul> -<li>value - read/write - the current text value</li> +<li>value - read/write - the current text value</li> +<li>maxlength - read-only - the maximum number of characters which may be entered </ul> <h4>events</h4> <ul> |
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv17038/src/com/meterware/httpunit
Modified Files:
FormControl.java HTMLElement.java HTMLElementBase.java
HTMLElementScriptable.java TableCell.java
WebRequestSource.java
Log Message:
Chris Hane: Added support for generic HTMLElement properties
Index: FormControl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- FormControl.java 24 Jun 2003 22:40:36 -0000 1.42
+++ FormControl.java 19 Sep 2003 18:53:43 -0000 1.43
@@ -80,6 +80,8 @@
_disabled = NodeUtils.isNodeAttributePresent( node, "disabled" );
_onChangeEvent = NodeUtils.getNodeAttribute( node, "onchange" );
_onClickEvent = NodeUtils.getNodeAttribute( node, "onclick" );
+
+ supportAttribute( "tabindex" );
}
@@ -756,6 +758,7 @@
class TextFieldFormControl extends TextFormControl {
public TextFieldFormControl( WebForm form, Node node ) {
super( form, node, NodeUtils.getNodeAttribute( node, "value" ) );
+ supportAttribute( "maxlength" );
}
}
Index: HTMLElement.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLElement.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HTMLElement.java 27 Aug 2003 02:16:06 -0000 1.3
+++ HTMLElement.java 19 Sep 2003 18:53:43 -0000 1.4
@@ -62,6 +62,12 @@
/**
+ * Returns true if this element may have an attribute with the specified name.
+ */
+ boolean isSupportedAttribute( String name );
+
+
+ /**
* Returns the delegate which supports scripting this element.
*/
ScriptableDelegate getScriptableDelegate();
Index: HTMLElementBase.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLElementBase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HTMLElementBase.java 27 Aug 2003 02:16:06 -0000 1.4
+++ HTMLElementBase.java 19 Sep 2003 18:53:43 -0000 1.5
@@ -22,6 +22,9 @@
import org.w3c.dom.Node;
import com.meterware.httpunit.scripting.ScriptableDelegate;
+import java.util.List;
+import java.util.ArrayList;
+
/**
*
@@ -33,7 +36,7 @@
private Node _node;
private ScriptableDelegate _scriptable;
-
+ private List _supportedAttributes = new ArrayList();
public String getID() {
@@ -70,6 +73,10 @@
protected HTMLElementBase( Node node ) {
_node = node;
+ supportAttribute( "id" );
+ supportAttribute( "class" );
+ supportAttribute( "title" );
+ supportAttribute( "name" );
}
@@ -78,6 +85,11 @@
}
+ public boolean isSupportedAttribute( String name ) {
+ return _supportedAttributes.contains( name );
+ }
+
+
protected String getAttribute( final String name, String defaultValue ) {
return NodeUtils.getNodeAttribute( getNode(), name, defaultValue );
}
@@ -85,6 +97,11 @@
protected Node getNode() {
return _node;
+ }
+
+
+ protected void supportAttribute( String name ) {
+ _supportedAttributes.add( name );
}
Index: HTMLElementScriptable.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLElementScriptable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HTMLElementScriptable.java 30 Dec 2002 21:46:54 -0000 1.1
+++ HTMLElementScriptable.java 19 Sep 2003 18:53:43 -0000 1.2
@@ -34,6 +34,8 @@
public Object get( String propertyName ) {
if (propertyName.equalsIgnoreCase( "title" )) {
return _element.getTitle();
+ } else if (_element.isSupportedAttribute( propertyName )) {
+ return _element.getAttribute( propertyName );
} else {
return super.get( propertyName );
}
Index: TableCell.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/TableCell.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TableCell.java 27 Aug 2003 02:16:06 -0000 1.14
+++ TableCell.java 19 Sep 2003 18:53:43 -0000 1.15
@@ -116,6 +116,14 @@
}
+ /**
+ * Returns true if this element may have an attribute with the specified name.
+ */
+ public boolean isSupportedAttribute( String name ) {
+ return false;
+ }
+
+
public boolean equals( Object obj ) {
return obj instanceof TableCell && equals( (TableCell) obj );
}
Index: WebRequestSource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- WebRequestSource.java 27 Aug 2003 02:16:06 -0000 1.32
+++ WebRequestSource.java 19 Sep 2003 18:53:43 -0000 1.33
@@ -270,6 +270,11 @@
}
+ public boolean isSupportedAttribute( String name ) {
+ return false;
+ }
+
+
String getAttribute( final String name, String defaultValue ) {
return NodeUtils.getNodeAttribute( _node, name, defaultValue );
}
|
|
From: Russell G. <rus...@us...> - 2003-09-19 19:44:18
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv17038/test/com/meterware/httpunit/javascript
Modified Files:
FormScriptingTest.java HTMLElementTest.java
Log Message:
Chris Hane: Added support for generic HTMLElement properties
Index: FormScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- FormScriptingTest.java 23 Jun 2003 23:54:04 -0000 1.24
+++ FormScriptingTest.java 19 Sep 2003 18:53:43 -0000 1.25
@@ -28,7 +28,6 @@
import junit.textui.TestRunner;
import junit.framework.TestSuite;
-import org.xml.sax.SAXException;
/**
Index: HTMLElementTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/HTMLElementTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HTMLElementTest.java 28 Mar 2003 03:22:34 -0000 1.3
+++ HTMLElementTest.java 19 Sep 2003 18:53:43 -0000 1.4
@@ -105,4 +105,18 @@
}
+ public void testElementProperties() throws Exception {
+ defineWebPage( "start",
+ "<form name='perform' title=fifth>" +
+ " <input name='name' maxlength=20 tabindex='1'>" +
+ "</form>" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
+
+ assertEquals( "tabindex", "1", response.getScriptableObject().evaluateURL( "document.perform.name.tabindex") );
+ assertEquals( "maxlength", "20", response.getScriptableObject().evaluateURL( "document.perform.name.maxlength") );
+ }
+
+
+
}
|
|
From: Russell G. <rus...@us...> - 2003-09-17 01:21:21
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv15606/test/com/meterware/httpunit
Modified Files:
WebClientTest.java
Log Message:
PseudoServer support for chunked messages
Index: WebClientTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebClientTest.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- WebClientTest.java 6 Jul 2003 13:21:16 -0000 1.15
+++ WebClientTest.java 17 Sep 2003 01:21:15 -0000 1.16
@@ -29,6 +29,7 @@
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPOutputStream;
@@ -53,6 +54,96 @@
public WebClientTest( String name ) {
super( name );
}
+
+ public void testNoSuchServer() throws Exception {
+ WebConversation wc = new WebConversation();
+
+ try {
+ wc.getResponse( "http://no.such.host" );
+ fail( "Should have rejected the request" );
+ } catch (UnknownHostException e) {
+ }
+ }
+
+
+ public void testNotFound() throws Exception {
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/nothing.htm" );
+ try {
+ wc.getResponse( request );
+ fail( "Should have rejected the request" );
+ } catch (HttpNotFoundException e) {
+ assertEquals( "Response code", HttpURLConnection.HTTP_NOT_FOUND, e.getResponseCode() );
+ assertEquals( "Response message", "unable to find /nothing.htm", e.getResponseMessage() );
+ }
+ }
+
+
+ public void testNotModifiedResponse() throws Exception {
+ defineResource( "error.htm", "Not Modified", 304 );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/error.htm" );
+ WebResponse response = wc.getResponse( request );
+ assertEquals( "Response code", 304, response.getResponseCode() );
+ response.getText();
+ response.getInputStream().read();
+ }
+
+
+ public void testInternalErrorException() throws Exception {
+ defineResource( "error.htm", "Internal error", 501 );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/error.htm" );
+ try {
+ wc.getResponse( request );
+ fail( "Should have rejected the request" );
+ } catch (HttpException e) {
+ assertEquals( "Response code", 501, e.getResponseCode() );
+ }
+ }
+
+
+ public void testInternalErrorDisplay() throws Exception {
+ defineResource( "error.htm", "Internal error", 501 );
+
+ WebConversation wc = new WebConversation();
+ wc.setExceptionsThrownOnErrorStatus( false );
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/error.htm" );
+ WebResponse response = wc.getResponse( request );
+ assertEquals( "Response code", 501, response.getResponseCode() );
+ assertEquals( "Message contents", "Internal error", response.getText().trim() );
+ }
+
+
+ public void testSimpleGet() throws Exception {
+ String resourceName = "something/interesting";
+ String resourceValue = "the desired content";
+
+ defineResource( resourceName, resourceValue );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + '/' + resourceName );
+ WebResponse response = wc.getResponse( request );
+ assertEquals( "requested resource", resourceValue, response.getText().trim() );
+ assertEquals( "content type", "text/html", response.getContentType() );
+ }
+
+
+ public void testFunkyGet() throws Exception {
+ String resourceName = "ID=03.019c010101010001.00000001.a202000000000019. 0d09/login/";
+ String resourceValue = "the desired content";
+
+ defineResource( resourceName, resourceValue );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + '/' + resourceName );
+ WebResponse response = wc.getResponse( request );
+ assertEquals( "requested resource", resourceValue, response.getText().trim() );
+ assertEquals( "content type", "text/html", response.getContentType() );
+ }
+
public void testCookies() throws Exception {
String resourceName = "something/baking";
|
|
From: Russell G. <rus...@us...> - 2003-09-17 01:21:21
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/pseudoserver
In directory sc8-pr-cvs1:/tmp/cvs-serv15606/test/com/meterware/pseudoserver
Modified Files:
PseudoServerTest.java
Added Files:
SocketConnection.java
Log Message:
PseudoServer support for chunked messages
***** Error reading new file[Errno 2] No such file or directory: 'SocketConnection.java'
Index: PseudoServerTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/pseudoserver/PseudoServerTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PseudoServerTest.java 15 Sep 2003 12:01:32 -0000 1.10
+++ PseudoServerTest.java 17 Sep 2003 01:21:15 -0000 1.11
@@ -19,20 +19,15 @@
* DEALINGS IN THE SOFTWARE.
*
*******************************************************************************************************************/
-import com.meterware.httpunit.*;
-
import junit.framework.TestSuite;
import java.net.HttpURLConnection;
-import java.net.UnknownHostException;
import java.net.Socket;
import java.io.OutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.BufferedInputStream;
-import org.xml.sax.SAXException;
-
public class PseudoServerTest extends HttpUserAgentTest {
@@ -51,93 +46,19 @@
}
- public void testNoSuchServer() throws Exception {
- WebConversation wc = new WebConversation();
-
- try {
- wc.getResponse( "http://no.such.host" );
- fail( "Should have rejected the request" );
- } catch (UnknownHostException e) {
- }
- }
-
-
- public void testNotFound() throws Exception {
- WebConversation wc = new WebConversation();
- WebRequest request = new GetMethodWebRequest( getHostPath() + "/nothing.htm" );
- try {
- wc.getResponse( request );
- fail( "Should have rejected the request" );
- } catch (HttpNotFoundException e) {
- assertEquals( "Response code", HttpURLConnection.HTTP_NOT_FOUND, e.getResponseCode() );
- assertEquals( "Response message", "unable to find /nothing.htm", e.getResponseMessage() );
- }
+ public void testNotFoundStatus() throws Exception {
+ SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
+ SocketConnection.SocketResponse response = conn.getResponse( "GET", "/nothing.htm" );
+ assertEquals( "Response code", HttpURLConnection.HTTP_NOT_FOUND, response.getResponseCode() );
}
- public void testNotModifiedResponse() throws Exception {
+ public void testStatusSpecification() throws Exception {
defineResource( "error.htm", "Not Modified", 304 );
- WebConversation wc = new WebConversation();
- WebRequest request = new GetMethodWebRequest( getHostPath() + "/error.htm" );
- WebResponse response = wc.getResponse( request );
+ SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
+ SocketConnection.SocketResponse response = conn.getResponse( "GET", "/error.htm" );
assertEquals( "Response code", 304, response.getResponseCode() );
- response.getText();
- response.getInputStream().read();
- }
-
-
- public void testInternalErrorException() throws Exception {
- defineResource( "error.htm", "Internal error", 501 );
-
- WebConversation wc = new WebConversation();
- WebRequest request = new GetMethodWebRequest( getHostPath() + "/error.htm" );
- try {
- wc.getResponse( request );
- fail( "Should have rejected the request" );
- } catch (HttpException e) {
- assertEquals( "Response code", 501, e.getResponseCode() );
- }
- }
-
-
- public void testInternalErrorDisplay() throws Exception {
- defineResource( "error.htm", "Internal error", 501 );
-
- WebConversation wc = new WebConversation();
- wc.setExceptionsThrownOnErrorStatus( false );
- WebRequest request = new GetMethodWebRequest( getHostPath() + "/error.htm" );
- WebResponse response = wc.getResponse( request );
- assertEquals( "Response code", 501, response.getResponseCode() );
- assertEquals( "Message contents", "Internal error", response.getText().trim() );
- }
-
-
- public void testSimpleGet() throws Exception {
- String resourceName = "something/interesting";
- String resourceValue = "the desired content";
-
- defineResource( resourceName, resourceValue );
-
- WebConversation wc = new WebConversation();
- WebRequest request = new GetMethodWebRequest( getHostPath() + '/' + resourceName );
- WebResponse response = wc.getResponse( request );
- assertEquals( "requested resource", resourceValue, response.getText().trim() );
- assertEquals( "content type", "text/html", response.getContentType() );
- }
-
-
- public void testFunkyGet() throws Exception {
- String resourceName = "ID=03.019c010101010001.00000001.a202000000000019. 0d09/login/";
- String resourceValue = "the desired content";
-
- defineResource( resourceName, resourceValue );
-
- WebConversation wc = new WebConversation();
- WebRequest request = new GetMethodWebRequest( getHostPath() + '/' + resourceName );
- WebResponse response = wc.getResponse( request );
- assertEquals( "requested resource", resourceValue, response.getText().trim() );
- assertEquals( "content type", "text/html", response.getContentType() );
}
@@ -192,8 +113,6 @@
}
-
-
/**
* This verifies that the PseudoServer can be restricted to a HTTP/1.0.
*/
@@ -225,21 +144,87 @@
String expectedResponse = prefix + name;
defineResource( resourceName, new PseudoServlet() {
-
public WebResource getPostResponse() {
return new WebResource( prefix + getParameter( "name" )[0], "text/plain" );
}
} );
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest( getHostPath() + '/' + resourceName );
- request.setParameter( "name", name );
- WebResponse response = wc.getResponse( request );
- assertEquals( "Content type", "text/plain", response.getContentType() );
- assertEquals( "Response", expectedResponse, response.getText().trim() );
+ SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
+ SocketConnection.SocketResponse response = conn.getResponse( "POST", '/' + resourceName, "name=" + name );
+ assertEquals( "Content type", "text/plain", response.getHeader( "Content-Type" ) );
+ assertEquals( "Response", expectedResponse, new String( response.getBody() ) );
+ }
+
+
+ public void testChunkedRequest() throws Exception {
+ super.defineResource( "/chunkedServlet", new PseudoServlet() {
+ public WebResource getPostResponse() {
+ return new WebResource( super.getBody(), "text/plain" );
+ }
+ } );
+
+ SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
+ conn.startChunkedResponse( "POST", "/chunkedServlet" );
+ conn.sendChunk( "This " );
+ conn.sendChunk( "is " );
+ conn.sendChunk( "chunked.");
+ SocketConnection.SocketResponse response = conn.getResponse();
+ assertEquals( "retrieved body", "This is chunked.", new String( response.getBody() ) );
+ }
+
+
+ public void testChunkedResponse() throws Exception {
+ defineResource( "/chunkedServlet", new PseudoServlet() {
+ public WebResource getGetResponse() {
+ WebResource webResource = new WebResource( "5\r\nSent \r\n3\r\nin \r\n07\r\nchunks.\r\n0\r\n", "text/plain" );
+ webResource.addHeader( "Transfer-Encoding: chunked" );
+ return webResource;
+ }
+ } );
+
+ SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
+ SocketConnection.SocketResponse response = conn.getResponse( "GET", "/chunkedServlet" );
+ assertEquals( "retrieved body", "Sent in chunks.", new String( response.getBody() ) );
+ assertNull( "No Content-Length header should have been sent", response.getHeader( "Content-Length" ) );
}
+ public void testPersistentConnection() throws Exception {
+ super.defineResource( "/testServlet", new TestMethodServlet() );
+
+ SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
+ SocketConnection.SocketResponse resp1 = conn.getResponse( "HEAD", "/testServlet" );
+ assertEquals( "test-header", "test-value1", resp1.getHeader( "test-header1") );
+
+ SocketConnection.SocketResponse resp2 = conn.getResponse( "GET", "/testServlet" );
+ assertEquals( "retrieved body", TestMethodServlet.GET_DATA, new String( resp2.getBody() ) );
+
+ SocketConnection.SocketResponse resp3 = conn.getResponse( "OPTIONS", "/testServlet" );
+ assertEquals( "allow header", "GET", resp3.getHeader( "Allow") );
+ }
+
+
+ private class TestMethodServlet extends PseudoServlet {
+
+ private static final String GET_DATA = "This is from the TestMethodServlet - GET";
+
+ public WebResource getResponse( String method ) throws IOException {
+ if (method.equals( "GET" )) {
+ return new WebResource( GET_DATA );
+ } else if (method.equals( "HEAD" )) {
+ WebResource headResource = new WebResource( "" );
+ headResource.addHeader( "test-header1:test-value1" );
+ return headResource;
+ } else if (method.equals( "OPTIONS" )) {
+ WebResource optionsResource = new WebResource( GET_DATA );
+ optionsResource.addHeader( "Allow:GET" );
+ optionsResource.addHeader( "test-header1:test-value1" );
+ return optionsResource;
+ } else {
+ return super.getResponse( method );
+ }
+ }
+ }
public void testBadMethodUsingPseudoServlet() throws Exception {
@@ -247,21 +232,30 @@
defineResource( resourceName, new PseudoServlet() {} );
- try {
- WebConversation wc = new WebConversation();
- WebRequest request = new HeadMethodWebRequest( getHostPath() + '/' + resourceName );
- wc.getResponse( request );
- fail( "Should have rejected HEAD request" );
- } catch (HttpException e) {
- assertEquals( "Status code returned", HttpURLConnection.HTTP_BAD_METHOD, e.getResponseCode() );
- }
+ SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
+ SocketConnection.SocketResponse response = conn.getResponse( "HEAD", '/' + resourceName );
+ assertEquals( "Status code returned", HttpURLConnection.HTTP_BAD_METHOD, response.getResponseCode() );
}
public void testClasspathDirectory() throws Exception {
- WebConversation wc = new WebConversation();
mapToClasspath( "/some/classes" );
- wc.getResponse( getHostPath() + "/some/classes/" + PseudoServerTest.class.getName().replace('.','/') + ".class" );
+
+ SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
+ conn.getResponse( "GET", "/some/classes/" + SocketConnection.SocketResponse.class.getName().replace('.','/') + ".class" );
+ }
+
+
+ public void testPseudoServletRequestAccess() throws Exception {
+ defineResource( "/properties", new PseudoServlet() {
+ public WebResource getGetResponse() {
+ return new WebResource( super.getRequest().getURI(), "text/plain" );
+ }
+ } );
+
+ SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
+ SocketConnection.SocketResponse response = conn.getResponse( "GET", "/properties" );
+ assertEquals( "retrieved body", "/properties", new String( response.getBody() ) );
}
|
|
From: Russell G. <rus...@us...> - 2003-09-17 01:21:21
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver
In directory sc8-pr-cvs1:/tmp/cvs-serv15606/src/com/meterware/pseudoserver
Modified Files:
HttpRequest.java PseudoServer.java PseudoServlet.java
WebResource.java
Added Files:
ReceivedHttpMessage.java
Log Message:
PseudoServer support for chunked messages
***** Error reading new file[Errno 2] No such file or directory: 'ReceivedHttpMessage.java'
Index: HttpRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/HttpRequest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HttpRequest.java 15 Sep 2003 12:01:32 -0000 1.5
+++ HttpRequest.java 17 Sep 2003 01:21:15 -0000 1.6
@@ -21,49 +21,42 @@
*******************************************************************************************************************/
import com.meterware.httpunit.HttpUnitUtils;
-import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.IOException;
-import java.io.Reader;
import java.util.StringTokenizer;
import java.util.Hashtable;
-import java.util.Enumeration;
/**
* Represents a single HTTP request, extracted from the input stream.
*/
-class HttpRequest {
+class HttpRequest extends ReceivedHttpMessage {
- private static final int CR = 13;
- private static final int LF = 10;
-
- private Reader _reader;
private String _protocol;
private String _command;
private String _uri;
- private Hashtable _headers = new Hashtable();
private Hashtable _parameters;
- private byte[] _requestBody;
HttpRequest( InputStream inputStream ) throws IOException {
- StringTokenizer st = new StringTokenizer( readHeaderLine( inputStream ) );
+ super( inputStream );
+ }
+
+
+ protected void interpretMessageHeader( String messageHeader ) {
+ StringTokenizer st = new StringTokenizer( messageHeader );
_command = st.nextToken();
_uri = st.nextToken();
_protocol = st.nextToken();
-
- readHeaders( inputStream );
- readContent( inputStream );
}
- Reader getReader() {
- return _reader;
+ protected void appendMessageHeader( StringBuffer sb ) {
+ sb.append( _command ).append( ' ' ).append( _uri ).append( ' ' ).append( _protocol );
}
+
String getCommand() {
return _command;
}
@@ -78,85 +71,26 @@
}
- String getHeader( String name ) {
- return (String) _headers.get( name.toUpperCase() );
- }
-
-
- byte[] getBody() {
- return _requestBody;
- }
-
-
/**
* Returns the parameter with the specified name. If no such parameter exists, will
* return null.
**/
String[] getParameter( String name ) {
if (_parameters == null) {
- _parameters = readParameters( new String( _requestBody ) );
+ _parameters = readParameters( new String( getBody() ) );
}
return (String[]) _parameters.get( name );
}
- public String toString() {
- StringBuffer sb = new StringBuffer( "HttpRequest[ ");
- sb.append( _command ).append( ' ' ).append( _uri ).append( ' ' ).append( _protocol ).append( "\n" );
- for (Enumeration e = _headers.keys(); e.hasMoreElements();) {
- Object key = e.nextElement();
- sb.append( " " ).append( key ).append( ": " ).append( _headers.get( key ) ).append( "\n" );
- }
- sb.append( " body contains " ).append( getBody().length ).append( " byte(s) ]" );
- return sb.toString();
- }
-
-
- private void readContent( InputStream inputStream ) throws IOException {
- _requestBody = new byte[ getContentLength() ];
- inputStream.read( _requestBody );
- _reader = new InputStreamReader( new ByteArrayInputStream( _requestBody ) );
- }
-
-
- private int getContentLength() {
- try {
- return Integer.parseInt( getHeader( "Content-Length" ) );
- } catch (NumberFormatException e) {
- return 0;
- }
- }
-
-
- private void readHeaders( InputStream inputStream ) throws IOException {
- String lastHeader = null;
-
- String header = readHeaderLine( inputStream );
- while (header.length() > 0) {
- if (header.charAt(0) <= ' ') {
- if (lastHeader == null) continue;
- _headers.put( lastHeader, _headers.get( lastHeader ) + header.trim() );
- } else {
- lastHeader = header.substring( 0, header.indexOf(':') ).toUpperCase();
- _headers.put( lastHeader, header.substring( header.indexOf(':')+1 ).trim() );
- }
- header = readHeaderLine( inputStream );
- }
- }
-
-
- private String readHeaderLine( InputStream inputStream ) throws IOException {
- StringBuffer sb = new StringBuffer();
- int b = inputStream.read();
- while (b != CR) {
- sb.append( (char) b );
- b = inputStream.read();
+ boolean wantsKeepAlive() {
+ if ("Keep-alive".equalsIgnoreCase( getConnectionHeader() )) {
+ return true;
+ } else if (_protocol.equals( "HTTP/1.1" )) {
+ return !"Close".equalsIgnoreCase( getConnectionHeader() );
+ } else {
+ return false;
}
-
- b = inputStream.read();
- if (b != LF) throw new IOException( "Bad header line termination: " + b );
-
- return sb.toString();
}
@@ -188,20 +122,10 @@
}
- boolean wantsKeepAlive() {
- if ("Keep-alive".equalsIgnoreCase( getConnectionHeader() )) {
- return true;
- } else if (_protocol.equals( "HTTP/1.1" )) {
- return !"Close".equalsIgnoreCase( getConnectionHeader() );
- } else {
- return false;
- }
- }
-
-
private String getConnectionHeader() {
return getHeader( "Connection" );
}
+
}
Index: PseudoServer.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/PseudoServer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- PseudoServer.java 15 Sep 2003 12:01:32 -0000 1.11
+++ PseudoServer.java 17 Sep 2003 01:21:15 -0000 1.12
@@ -515,8 +515,61 @@
}
static synchronized void release( ServerSocket serverSocket ) throws IOException {
- _sockets.add( serverSocket );
- _outstandingSockets--;
- synchronized (_releaseSemaphore) { _releaseSemaphore.notify(); }
+ if (_sockets.size() >= 2 * PseudoServer.getWaitThreshhold()) {
+ serverSocket.close();
+ } else {
+ _sockets.add( serverSocket );
+ _outstandingSockets--;
+ synchronized (_releaseSemaphore) { _releaseSemaphore.notify(); }
+ }
}
}
+
+
+class RecordingOutputStream extends OutputStream {
+
+ private OutputStream _nestedStream;
+ private PrintStream _log;
+
+
+ public RecordingOutputStream( OutputStream nestedStream, PrintStream log ) {
+ _nestedStream = nestedStream;
+ _log = log;
+ }
+
+
+ public void write( int b ) throws IOException {
+ _nestedStream.write( b );
+ _log.println( "sending " + Integer.toHexString( b ) );
+ }
+
+
+ public void write( byte b[], int offset, int len ) throws IOException {
+ _nestedStream.write( b, offset, len );
+ _log.print( "sending" );
+ for (int i = offset; i < offset+len; i++) {
+ _log.print( ' ' + Integer.toHexString( b[i] ) );
+ }
+ _log.println();
+ }
+}
+
+
+class RecordingInputStream extends InputStream {
+
+ private InputStream _nestedStream;
+ private PrintStream _log;
+
+
+ public RecordingInputStream( InputStream nestedStream, PrintStream log ) {
+ _nestedStream = nestedStream;
+ _log = log;
+ }
+
+
+ public int read() throws IOException {
+ int value = _nestedStream.read();
+ if (value != -1) _log.print( ' ' + Integer.toHexString( value ) );
+ return value;
+ }
+}
\ No newline at end of file
Index: PseudoServlet.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/PseudoServlet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PseudoServlet.java 15 Sep 2003 12:01:32 -0000 1.3
+++ PseudoServlet.java 17 Sep 2003 01:21:15 -0000 1.4
@@ -107,7 +107,13 @@
}
+ protected HttpRequest getRequest() {
+ return _requestStream;
+ }
+
+
private HttpRequest _requestStream;
+
}
Index: WebResource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/WebResource.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WebResource.java 15 Sep 2003 12:01:32 -0000 1.7
+++ WebResource.java 17 Sep 2003 01:21:15 -0000 1.8
@@ -62,6 +62,8 @@
if (header.toLowerCase().startsWith( "content-length" )) _hasExplicitContentLengthHeader = true;
if (header.trim().toLowerCase().startsWith( "connection" ) &&
header.trim().toLowerCase().endsWith( "close") ) _closesConnection = true;
+ if (header.trim().toLowerCase().startsWith( "transfer-encoding" ) &&
+ header.trim().toLowerCase().endsWith( "chunked") ) _isChunked = true;
}
@@ -105,13 +107,18 @@
String[] getHeaders() throws UnsupportedEncodingException {
final Vector effectiveHeaders = (Vector) _headers.clone();
if (!_hasExplicitContentTypeHeader) effectiveHeaders.add( getContentTypeHeader() );
- if (_stream == null && !_hasExplicitContentLengthHeader) effectiveHeaders.add( getContentLengthHeader() );
+ if (_stream == null && !_hasExplicitContentLengthHeader && !isChunked()) effectiveHeaders.add( getContentLengthHeader() );
String[] headers = new String[ effectiveHeaders.size() ];
effectiveHeaders.copyInto( headers );
return headers;
}
+ private boolean isChunked() {
+ return _isChunked;
+ }
+
+
boolean closesConnection() {
return _closesConnection;
}
@@ -206,6 +213,7 @@
private boolean _hasExplicitContentTypeHeader;
private boolean _hasExplicitContentLengthHeader;
private Vector _headers = new Vector();
+ private boolean _isChunked;
}
|
|
From: Russell G. <rus...@us...> - 2003-09-15 12:05:21
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1:/tmp/cvs-serv6715/src/com/meterware/httpunit Modified Files: WebRequest.java MessageBodyWebRequest.java Log Message: The HeadMethodWebRequest was actually sending a GET method Index: WebRequest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- WebRequest.java 4 May 2003 15:09:05 -0000 1.56 +++ WebRequest.java 15 Sep 2003 12:05:11 -0000 1.57 @@ -24,11 +24,7 @@ import java.io.InputStream; import java.io.OutputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLEncoder; -import java.net.URLStreamHandler; +import java.net.*; import java.util.*; @@ -442,6 +438,7 @@ * Performs any additional processing necessary to complete the request. **/ protected void completeRequest( URLConnection connection ) throws IOException { + if (connection instanceof HttpURLConnection) ((HttpURLConnection) connection).setRequestMethod( getMethod() ); } Index: MessageBodyWebRequest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/MessageBodyWebRequest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- MessageBodyWebRequest.java 19 Aug 2002 18:52:26 -0000 1.9 +++ MessageBodyWebRequest.java 15 Sep 2003 12:05:12 -0000 1.10 @@ -89,7 +89,7 @@ * Performs any additional processing necessary to complete the request. **/ protected void completeRequest( URLConnection connection ) throws IOException { - ((HttpURLConnection) connection).setRequestMethod( getMethod() ); + super.completeRequest( connection ); connection.setDoInput( true ); connection.setDoOutput( true ); |
|
From: Russell G. <rus...@us...> - 2003-09-15 12:01:36
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver
In directory sc8-pr-cvs1:/tmp/cvs-serv5813/src/com/meterware/pseudoserver
Modified Files:
PseudoServlet.java WebResource.java HttpRequest.java
PseudoServer.java
Log Message:
Added server socket pooling
Index: PseudoServlet.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/PseudoServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PseudoServlet.java 18 Mar 2003 19:35:33 -0000 1.2
+++ PseudoServlet.java 15 Sep 2003 12:01:32 -0000 1.3
@@ -43,7 +43,7 @@
} else if (methodType.equalsIgnoreCase( "POST" )) {
return getPostResponse();
} else {
- throw new RuntimeException( methodType + " not implemented" );
+ throw new UnknownMethodException( methodType );
}
}
@@ -52,7 +52,7 @@
* Returns a resource object as a result of a get request.
**/
public WebResource getGetResponse() throws IOException {
- throw new RuntimeException( "get not implemented" );
+ throw new UnknownMethodException( "GET" );
}
@@ -60,7 +60,7 @@
* Returns a resource object as a result of a post request.
**/
public WebResource getPostResponse() throws IOException {
- throw new RuntimeException( "post not implemented" );
+ throw new UnknownMethodException( "POST" );
}
@@ -68,7 +68,7 @@
* Returns a resource object as a result of a put request.
**/
public WebResource getPutResponse() throws IOException {
- throw new RuntimeException( "put not implemented" );
+ throw new UnknownMethodException( "PUT" );
}
Index: WebResource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/WebResource.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WebResource.java 19 Mar 2003 15:26:06 -0000 1.6
+++ WebResource.java 15 Sep 2003 12:01:32 -0000 1.7
@@ -131,6 +131,16 @@
}
+ static String toString( byte[] contentsAsBytes ) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < contentsAsBytes.length; i++) {
+ byte contentsAsByte = contentsAsBytes[i];
+ sb.append( Integer.toHexString( contentsAsByte ) ).append( ' ' );
+ }
+ return sb.toString();
+ }
+
+
private byte[] getContentsAsBytes() throws UnsupportedEncodingException {
if (_contents != null) {
return _contents;
Index: HttpRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/HttpRequest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HttpRequest.java 24 Jun 2003 22:39:41 -0000 1.4
+++ HttpRequest.java 15 Sep 2003 12:01:32 -0000 1.5
@@ -55,9 +55,6 @@
_uri = st.nextToken();
_protocol = st.nextToken();
- if (!_command.equals( "GET" ) && !_command.equals( "POST" ) && !_command.equals( "PUT" )) {
- throw new UnknownMethodException( _command );
- }
readHeaders( inputStream );
readContent( inputStream );
}
Index: PseudoServer.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/PseudoServer.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PseudoServer.java 24 Jun 2003 22:39:41 -0000 1.10
+++ PseudoServer.java 15 Sep 2003 12:01:32 -0000 1.11
@@ -36,6 +36,48 @@
private String _maxProtocolLevel = "1.1";
+ /** Time in msec to wait for an outstanding server socket to be released before creating a new one. **/
+ private static int _socketReleaseWaitTime = 50;
+
+ /** Number of outstanding server sockets that must be present before trying to wait for one to be released. **/
+ private static int _waitThreshhold = 10;
+
+
+ /**
+ * Returns the amount of time the pseudo server will wait for a server socket to be released (in msec)
+ * before allocating a new one. See also #getWaitThreshhold.
+ */
+ public static int getSocketReleaseWaitTime() {
+ return _socketReleaseWaitTime;
+ }
+
+
+ /**
+ * Returns the amount of time the pseudo server will wait for a server socket to be released (in msec)
+ * before allocating a new one. See also #getWaitThreshhold.
+ */
+ public static void setSocketReleaseWaitTime( int socketReleaseWaitTime ) {
+ _socketReleaseWaitTime = socketReleaseWaitTime;
+ }
+
+
+ /**
+ * Returns the number of server sockets that must have been allocated and not returned before waiting for one
+ * to be returned.
+ */
+ public static int getWaitThreshhold() {
+ return _waitThreshhold;
+ }
+
+
+ /**
+ * Specifies the number of server sockets that must have been allocated and not returned before waiting for one
+ * to be returned.
+ */
+ public static void setWaitThreshhold( int waitThreshhold ) {
+ _waitThreshhold = waitThreshhold;
+ }
+
public PseudoServer() {
Thread t = new Thread() {
@@ -55,7 +97,7 @@
}
}
try {
- if (_serverSocket != null) _serverSocket.close();
+ if (_serverSocket != null) ServerSocketFactory.release( _serverSocket );
_serverSocket = null;
} catch (IOException e) {
}
@@ -330,8 +372,7 @@
private ServerSocket getServerSocket() throws IOException {
synchronized (this) {
- if (_serverSocket == null) _serverSocket = new ServerSocket(0);
- _serverSocket.setSoTimeout( 1000 );
+ if (_serverSocket == null) _serverSocket = ServerSocketFactory.newServerSocket();
}
return _serverSocket;
}
@@ -446,4 +487,36 @@
private String _responseText = "OK";
private boolean _headersWritten;
+
+}
+
+
+
+class ServerSocketFactory {
+
+ static private ArrayList _sockets = new ArrayList();
+
+ static private int _outstandingSockets;
+
+ static private Object _releaseSemaphore = new Object();
+
+ static synchronized ServerSocket newServerSocket() throws IOException {
+ if (_sockets.isEmpty() && _outstandingSockets > PseudoServer.getWaitThreshhold()) {
+ try { synchronized( _releaseSemaphore) {_releaseSemaphore.wait( PseudoServer.getSocketReleaseWaitTime() ); } } catch (InterruptedException e) {};
+ }
+ _outstandingSockets++;
+ if (!_sockets.isEmpty()) {
+ return (ServerSocket) _sockets.remove(0);
+ } else {
+ ServerSocket serverSocket = new ServerSocket(0);
+ serverSocket.setSoTimeout( 1000 );
+ return serverSocket;
+ }
+ }
+
+ static synchronized void release( ServerSocket serverSocket ) throws IOException {
+ _sockets.add( serverSocket );
+ _outstandingSockets--;
+ synchronized (_releaseSemaphore) { _releaseSemaphore.notify(); }
+ }
}
|
|
From: Russell G. <rus...@us...> - 2003-09-15 12:01:36
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/pseudoserver
In directory sc8-pr-cvs1:/tmp/cvs-serv5813/test/com/meterware/pseudoserver
Modified Files:
PseudoServerTest.java
Log Message:
Added server socket pooling
Index: PseudoServerTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/pseudoserver/PseudoServerTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PseudoServerTest.java 24 Jun 2003 22:39:41 -0000 1.9
+++ PseudoServerTest.java 15 Sep 2003 12:01:32 -0000 1.10
@@ -31,6 +31,8 @@
import java.io.IOException;
import java.io.BufferedInputStream;
+import org.xml.sax.SAXException;
+
public class PseudoServerTest extends HttpUserAgentTest {
@@ -235,6 +237,24 @@
WebResponse response = wc.getResponse( request );
assertEquals( "Content type", "text/plain", response.getContentType() );
assertEquals( "Response", expectedResponse, response.getText().trim() );
+ }
+
+
+
+
+ public void testBadMethodUsingPseudoServlet() throws Exception {
+ String resourceName = "tellMe";
+
+ defineResource( resourceName, new PseudoServlet() {} );
+
+ try {
+ WebConversation wc = new WebConversation();
+ WebRequest request = new HeadMethodWebRequest( getHostPath() + '/' + resourceName );
+ wc.getResponse( request );
+ fail( "Should have rejected HEAD request" );
+ } catch (HttpException e) {
+ assertEquals( "Status code returned", HttpURLConnection.HTTP_BAD_METHOD, e.getResponseCode() );
+ }
}
|
|
From: Russell G. <rus...@us...> - 2003-09-15 11:51:16
|
Update of /cvsroot/httpunit/httpunit/doc/tutorial
In directory sc8-pr-cvs1:/tmp/cvs-serv3324/doc/tutorial
Modified Files:
task1editor-entry.html
Log Message:
Corrected code error in tutorial
Index: task1editor-entry.html
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/tutorial/task1editor-entry.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- task1editor-entry.html 23 May 2003 03:07:30 -0000 1.4
+++ task1editor-entry.html 15 Sep 2003 11:51:13 -0000 1.5
@@ -94,7 +94,7 @@
form.setParameter( "home1", "Denver Broncos" );
form.setParameter( "tiebreaker", "1" );
- SubmitButton saveButton = getSubmitButton( "save", "Save" ); // (2) select the desired submit button
+ SubmitButton saveButton = form.getSubmitButton( "save", "Save" ); // (2) select the desired submit button
response = form.submit( saveButton ); // (3) submit the form
assertEquals( "Away team 0", "", form.getParameterValue( "away0" ) ); // (4) verify the response
|
|
From: Russell G. <rus...@us...> - 2003-09-15 11:50:48
|
Update of /cvsroot/httpunit/httpunit/doc/manual In directory sc8-pr-cvs1:/tmp/cvs-serv3189/doc/manual Modified Files: toc.html Log Message: bug #804559: disabled unsatisfied links in user manual Index: toc.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/manual/toc.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- toc.html 20 Feb 2003 20:51:19 -0000 1.2 +++ toc.html 15 Sep 2003 11:50:43 -0000 1.3 @@ -12,11 +12,12 @@ <a href="introduction.html">Introduction</a><br> <a href="installing.html">Installing HttpUnit</a><br> <a href="retrieving.html">Retrieving Web Pages</a><br> +<!-- <br><a href="section2.html" class="toc-section">Working with Links and Forms</a><br> <br><a href="section3.html" class="toc-section">Deciphering Tables</a><br> <br><a href="section4.html" class="toc-section">Handling Frame structure</a><br> <br><a href="section5.html" class="toc-section">Using JavaScript</a><br> -<br><a href="../api/index.html" target="_top">HttpUnit API</a><br> +<br><a href="../api/index.html" target="_top">HttpUnit API</a><br> --> <!-- <a href="LICENSE">License</a><br> <a href="feedback.html">Feedback and Troubleshooting</a><br> |
|
From: Russell G. <rus...@us...> - 2003-09-15 11:49:51
|
Update of /cvsroot/httpunit/httpunit/sitedocs/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv2905/sitedocs/doc
Modified Files:
javascript-support.html
Log Message:
bug #804585: corrected reference to popNextAlert and getNextAlert methods
Index: javascript-support.html
===================================================================
RCS file: /cvsroot/httpunit/httpunit/sitedocs/doc/javascript-support.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- javascript-support.html 18 May 2003 13:01:06 -0000 1.1
+++ javascript-support.html 15 Sep 2003 11:49:44 -0000 1.2
@@ -28,7 +28,7 @@
</ul>
<h4>methods</h4>
<ul>
-<li>alert() - queues up an alert message, accessible via WebResponse.getNextAlert() or popNextAlert()</li>
+<li>alert() - queues up an alert message, accessible via WebClient.getNextAlert() or popNextAlert()</li>
<li>close() - closes the window</li>
<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>
|
|
From: Russell G. <rus...@us...> - 2003-08-27 02:16:10
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv18415/test/com/meterware/httpunit
Modified Files:
WebPageTest.java
Log Message:
Support search by attribute
Index: WebPageTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- WebPageTest.java 6 Jul 2003 13:20:09 -0000 1.32
+++ WebPageTest.java 27 Aug 2003 02:16:06 -0000 1.33
@@ -464,4 +464,21 @@
assertImplement( "element with name 'aForm'", simplePage.getElementsWithName( "aForm" ), WebForm.class );
assertImplement( "element with name 'color'", simplePage.getElementsWithName( "color" ), FormControl.class );
}
+
+
+ public void testGetElementsByAttribute() throws Exception {
+ defineResource( "SimplePage.html",
+ "<html><head><title>A Sample Page</title></head>\n" +
+ "<body><form class='first' name='aForm'><input name=color></form>" +
+ "have <a id='link1' href='/other.html'>an <b>active</b> link</A>\n" +
+ "<img id='23' src='/images/arrow.gif' ALT='Next -->' WIDTH=1 HEIGHT=4>\n" +
+ "</body></html>\n" );
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" );
+ WebResponse simplePage = wc.getResponse( request );
+ assertImplement( "elements with class 'first'", simplePage.getElementsWithAttribute( "class", "first" ), WebForm.class );
+ assertImplement( "elements with name 'color'", simplePage.getElementsWithAttribute( "name", "color" ), FormControl.class );
+ assertImplement( "elements with id 'link1'", simplePage.getElementsWithAttribute( "id", "link1" ), WebLink.class );
+ assertImplement( "elements with src '/images/arrow.gif'", simplePage.getElementsWithAttribute( "src", "/images/arrow.gif" ), WebImage.class );
+ }
}
|
|
From: Russell G. <rus...@us...> - 2003-08-27 02:16:10
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv18415/src/com/meterware/httpunit
Modified Files:
HTMLElement.java HTMLElementBase.java HTMLSegment.java
ParsedHTML.java TableCell.java WebRequestSource.java
WebResponse.java
Log Message:
Support search by attribute
Index: HTMLElement.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLElement.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HTMLElement.java 17 Jun 2003 11:16:15 -0000 1.2
+++ HTMLElement.java 27 Aug 2003 02:16:06 -0000 1.3
@@ -55,6 +55,13 @@
/**
+ * Returns the value of the attribute of this element with the specified name.
+ * Returns the empty string if no such attribute exists.
+ */
+ String getAttribute( String name );
+
+
+ /**
* Returns the delegate which supports scripting this element.
*/
ScriptableDelegate getScriptableDelegate();
Index: HTMLElementBase.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLElementBase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HTMLElementBase.java 17 Jun 2003 11:16:15 -0000 1.3
+++ HTMLElementBase.java 27 Aug 2003 02:16:06 -0000 1.4
@@ -73,7 +73,7 @@
}
- protected String getAttribute( final String name ) {
+ public String getAttribute( final String name ) {
return NodeUtils.getNodeAttribute( getNode(), name );
}
Index: HTMLSegment.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLSegment.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- HTMLSegment.java 6 Jul 2003 13:20:08 -0000 1.11
+++ HTMLSegment.java 27 Aug 2003 02:16:06 -0000 1.12
@@ -43,6 +43,12 @@
/**
+ * Returns the HTMLElements found with the specified attribute value.
+ */
+ public HTMLElement[] getElementsWithAttribute( String name, String value ) throws SAXException;
+
+
+ /**
* Returns a list of HTML element names contained in this HTML section.
*/
public String[] getElementNames() throws SAXException;
Index: ParsedHTML.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- ParsedHTML.java 6 Jul 2003 13:20:08 -0000 1.50
+++ ParsedHTML.java 27 Aug 2003 02:16:06 -0000 1.51
@@ -172,6 +172,20 @@
/**
+ * Returns the HTML elements with an attribute with the specified name and value.
+ */
+ public HTMLElement[] getElementsWithAttribute( String name, String value ) {
+ loadElements();
+ ArrayList elements = new ArrayList();
+ for (Iterator i = _elements.values().iterator(); i.hasNext();) {
+ HTMLElement element = (HTMLElement) i.next();
+ if (value.equals( element.getAttribute( name ))) elements.add( element );
+ }
+ return (HTMLElement[]) elements.toArray( new HTMLElement[ elements.size() ] );
+ }
+
+
+ /**
* Returns a list of HTML element names contained in this HTML section.
*/
public String[] getElementNames() {
Index: TableCell.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/TableCell.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TableCell.java 17 Jun 2003 11:16:15 -0000 1.13
+++ TableCell.java 27 Aug 2003 02:16:06 -0000 1.14
@@ -111,7 +111,7 @@
}
- private String getAttribute( final String name ) {
+ public String getAttribute( final String name ) {
return NodeUtils.getNodeAttribute( _element, name );
}
Index: WebRequestSource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- WebRequestSource.java 17 Jun 2003 11:16:15 -0000 1.31
+++ WebRequestSource.java 27 Aug 2003 02:16:06 -0000 1.32
@@ -265,7 +265,7 @@
protected void addPresetParameter( String name, String value );
- String getAttribute( final String name ) {
+ public String getAttribute( final String name ) {
return NodeUtils.getNodeAttribute( _node, name );
}
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- WebResponse.java 6 Jul 2003 13:21:16 -0000 1.121
+++ WebResponse.java 27 Aug 2003 02:16:06 -0000 1.122
@@ -304,6 +304,14 @@
/**
+ * Returns the HTMLElements found with the specified attribute value.
+ */
+ public HTMLElement[] getElementsWithAttribute( String name, String value ) throws SAXException {
+ return getReceivedPage().getElementsWithAttribute( name, value );
+ }
+
+
+ /**
* Returns the forms found in the page in the order in which they appear.
* @exception SAXException thrown if there is an error parsing the response.
**/
|
|
From: Russell G. <rus...@us...> - 2003-08-27 02:16:10
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver
In directory sc8-pr-cvs1:/tmp/cvs-serv18415/src/com/meterware/pseudoserver
Modified Files:
HttpUserAgentTest.java
Log Message:
Support search by attribute
Index: HttpUserAgentTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/HttpUserAgentTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HttpUserAgentTest.java 6 Jul 2003 13:20:09 -0000 1.12
+++ HttpUserAgentTest.java 27 Aug 2003 02:16:06 -0000 1.13
@@ -143,6 +143,7 @@
protected void assertImplement( String comment, Object[] objects, Class expectedClass ) {
+ if (objects.length == 0) fail( "No " + comment + " found." );
for (int i = 0; i < objects.length; i++) {
assertImplements( comment, objects[i], expectedClass );
}
|
|
From: Russell G. <rus...@us...> - 2003-08-27 02:16:09
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv18415/doc
Modified Files:
release_notes.txt
Log Message:
Support search by attribute
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.308
retrieving revision 1.309
diff -u -r1.308 -r1.309
--- release_notes.txt 21 Aug 2003 11:52:37 -0000 1.308
+++ release_notes.txt 27 Aug 2003 02:16:06 -0000 1.309
@@ -13,6 +13,13 @@
Revision History:
+
+26-Aug-2003
+Additions:
+ 1. HTMLElement now supports a getAttribute method to return the value of any named attribute.
+ 2. WebResponse and TableCell now support getElementsWithAttribute to return all contained HTML elements with
+ the specified attribute.
+
21-Aug-2003 1.5.4
Acknowledgements:
Thanks to David D. Kilzer for:
|
|
From: Russell G. <rus...@us...> - 2003-08-22 10:42:10
|
Update of /cvsroot/httpunit/httpunit/sitedocs/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv21903/sitedocs/doc
Modified Files:
faq.xml
Log Message:
prepare for 1.5.4 release
Index: faq.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/sitedocs/doc/faq.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- faq.xml 20 Jun 2003 03:21:11 -0000 1.2
+++ faq.xml 21 Aug 2003 11:52:37 -0000 1.3
@@ -57,8 +57,11 @@
<faq id="uncheck">
<question>How do I uncheck a checkbox?</question>
<answer><![CDATA[The setParameter call lets you specify the values per parameter name. An unchecked checkbox has no value to transmit, so you would call:
- <pre><code> form.setParameter( "checkbox-name", new String[0] );</code></pre>or
- <pre><code> form.removeParameter( "checkbox-name" );</code></pre>]]></answer>
+ <pre><code> form.setParameter( "checkbox-name", new String[0] );</code></pre> or
+ <pre><code> form.removeParameter( "checkbox-name" );</code></pre>
+ As of 1.5.4, you have alternatives. If the checkbox's name is unique, you can say:
+ <pre><code> form.setCheckbox( "checkbox-name", false );</code></pre> or
+ <pre><code> form.toggleCheckbox( "checkbox-name" );</code></pre>]]></answer>
</faq>
<faq id="hidden">
<question>Why can't I change hidden parameter values?</question>
|
|
From: Russell G. <rus...@us...> - 2003-08-22 10:42:10
|
Update of /cvsroot/httpunit/httpunit/sitedocs
In directory sc8-pr-cvs1:/tmp/cvs-serv21903/sitedocs
Modified Files:
news.xml
Log Message:
prepare for 1.5.4 release
Index: news.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/sitedocs/news.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- news.xml 18 May 2003 05:20:47 -0000 1.1
+++ news.xml 21 Aug 2003 11:52:37 -0000 1.2
@@ -1,6 +1,6 @@
<?xml version='1.0' ?>
<news>
+ <item date="21-Aug-2003">HttpUnit 1.5.4 released</item>
<item date="16-May-2003">New web site format created</item>
- <item date="2-May-2003" url='http://www.httpunit.org/prerelease/httpunit-1.5.4-d-05May.zip'>Added WebForm.getOptions() support for radio buttons and checkboxes</item>
<item date="4-Apr-2003">HttpUnit 1.5.3 released</item>
</news>
|
|
From: Russell G. <rus...@us...> - 2003-08-22 10:18:08
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv21903
Modified Files:
build.xml
Log Message:
prepare for 1.5.4 release
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- build.xml 18 May 2003 14:15:45 -0000 1.67
+++ build.xml 21 Aug 2003 11:52:36 -0000 1.68
@@ -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.5.3" />
+ <property name="version" value="1.5.4" />
<property name="debug" value="on" />
<property name="deprecation" value="off" />
|
|
From: Russell G. <rus...@us...> - 2003-08-22 10:18:08
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv21903/doc
Modified Files:
release_notes.txt
Log Message:
prepare for 1.5.4 release
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.307
retrieving revision 1.308
diff -u -r1.307 -r1.308
--- release_notes.txt 6 Jul 2003 13:21:16 -0000 1.307
+++ release_notes.txt 21 Aug 2003 11:52:37 -0000 1.308
@@ -13,71 +13,52 @@
Revision History:
- 6-Jul-2003
-Additions:
- 1. WebResponse and TableCell now support getElementsWithName and getElementNames to look up HTML elements.
-Problems fixed:
- 1. gzip'ed responses were sometimes truncated.
-
-24-Jun-2003
-Additions:
- 1. rfe #721424: You can now set checkbox values in a form via: setCheckbox(name,boolean) or toggleCheckbox(name).
- These methods will throw an exception if the specified parameter is not a checkbox or if more than
- one control has the name.
- 2. PseudoServer now permits setting the maximum protocol level. If it is 1.0, all responses will be forced to
- HTTP/1.0 no matter the protocol of the request.
-
-20-Jun-2003
-Acknowledgements:
- Thanks to Brian O'Kelley for supplying a way to disable use of the proxy server.
- Thanks to David Kilzer for submitting the WebLink.MATCH_TEXT predicate
-
-Additions:
- 1. rfe #751505: Add clearProxyServer() to disable the use of the proxy server
- 2. rfe #744360: Added getFirstMatchingForm and getMatchingForms() methods to WebResponse and HTMLSegment
- 3. rfe #756453: Made Button.isDisabled() method public
- 4: rfe #717752: Added WebLink.MATCH_TEXT predicate to match link text exactly
-
-17-Jun-2003
+21-Aug-2003 1.5.4
Acknowledgements:
+ Thanks to David D. Kilzer for:
+ creating thorough tests for URLs containing navigation and showing a way to handle them, and
+ submitting the WebLink.MATCH_TEXT predicate.
Thanks to Lloyd McKenzie for finding a problem with listing cookie names and suggesting a fix.
+ Thanks to Brian O'Kelley for supplying a way to disable use of the proxy server.
-Problems fixed:
- 1. bug #750846: Cannot retrieve all cookie names when both global and site-specific cookies are defined.
- 2. bug #744214: ServletUnit does not recognize subframes
-
-Additions:
- 1. rfe #723895: A new class CookieProperties now supports relaxing cookie matching rules for path, domain, or both.
- 2. It is now possible to define a CookieListener on CookieProperties to watch for cookie rejection events
-
- 4-Jun-2003
Additions:
- 1. You can now get the value of context parameters from a ServletRunner via the getContextParameter method
-
-23-May-2002
-Problems fixed:
- 1. bug #721989: scripts did not see id attributes of form controls.
- 2. bug #741965: cookies with explicit domain attributes are being rejected when their host is of the form HD
- where D is the explicit domain attribute and H contains a dot. Apparently, most browsers ignore this
- rule. Now, so does HttpUnit, if CookieProperties.setDomainMatchingStrict( false ) is called.
-
-22-May-2003
-Problems fixed:
- 1. bug #722788: WebForm.submit() was not invoking the 'onClick' event of the specified submit button.
- 2. bug #734133: javascript: URLs were ignored if "javascript:" is not all lower case.
+ Content and Parsing
+ 1. WebResponse and TableCell now support getElementsWithName and getElementNames to look up HTML elements.
+ 2. Form.getOptions() now works for radio buttons and checkboxes - as long as the desired name is located after the control.
+ 3. rfe #723895: A new class CookieProperties now supports relaxing cookie matching rules for path, domain, or both.
+ 4. It is now possible to define a CookieListener on CookieProperties to watch for cookie rejection events
+ 5. rfe #751505: Add clearProxyServer() to disable the use of the proxy server
+ 6. rfe #744360: Added getFirstMatchingForm and getMatchingForms() methods to WebResponse and HTMLSegment
+ 7. rfe #756453: Made Button.isDisabled() method public
+ 8: rfe #717752: Added WebLink.MATCH_TEXT predicate to match link text exactly
+ 9. rfe #721424: You can now set checkbox values in a form via: setCheckbox(name,boolean) or toggleCheckbox(name).
+ These methods will throw an exception if the specified parameter is not a checkbox or if more than
+ one control has the name.
+ ServletUnit
+ 10. JUnitServlet now supports a value of 'xml' for the format parameter, generating a format compatible with
+ ant's XMLResultFormatter
+ 11. You can now get the value of context parameters from a ServletRunner via the getContextParameter method
+ PseudoServer
+ 12. PseudoServer now permits setting the maximum protocol level. If it is 1.0, all responses will be forced to
+ HTTP/1.0 no matter the protocol of the request.
- 2-May-2003
-Acknowledgements:
- Thanks to David D. Kilzer for creating thorough tests for URLs containing navigation and showing a way to handle them.
-Additions:
- 1. JUnitServlet now supports a value of 'xml' for the format parameter, generating a format compatible with
- ant's XMLResultFormatter
- 2. Form.getOptions() now works for radio buttons and checkboxes - as long as the desired name is located after the control.
Problems fixed:
- 1. bug #717280: URLs with "../" in them were not resolved properly
- 2. bug #717640: <base> element was not being handled in the case when no host was specified.
- 3. When setting a selection control, HttpUnit would always select a value matching its first option if possible,
- rather than taking the first valid value.
+ Content and Parsing
+ 1. bug #717280: URLs with "../" in them were not resolved properly
+ 2. bug #717640: <base> element was not being handled in the case when no host was specified.
+ 3. When setting a selection control, HttpUnit would always select a value matching its first option if possible,
+ rather than taking the first valid value.
+ 4. bug #722788: WebForm.submit() was not invoking the 'onClick' event of the specified submit button.
+ 5. bug #721989: scripts did not see id attributes of form controls.
+ 6. bug #741965: cookies with explicit domain attributes are being rejected when their host is of the form HD
+ where D is the explicit domain attribute and H contains a dot. Apparently, most browsers ignore this
+ rule. Now, so does HttpUnit, if CookieProperties.setDomainMatchingStrict( false ) is called.
+ 7. bug #750846: Cannot retrieve all cookie names when both global and site-specific cookies are defined.
+ 8. gzip'ed responses were sometimes truncated.
+ JavaScript
+ 9. bug #734133: javascript: URLs were ignored if "javascript:" is not all lower case.
+ ServletUnit
+ 10. bug #744214: ServletUnit does not recognize subframes
4-Apr-2003 1.5.3
Acknowledgements:
|
|
From: Russell G. <rus...@us...> - 2003-08-20 12:45:47
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory sc8-pr-cvs1:/tmp/cvs-serv23336/test/com/meterware/httpunit Modified Files: WebImageTest.java Log Message: Fix compiler warnings Index: WebImageTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebImageTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- WebImageTest.java 29 Aug 2002 15:32:44 -0000 1.3 +++ WebImageTest.java 20 Aug 2003 12:06:15 -0000 1.4 @@ -19,9 +19,6 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import java.util.*; - -import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; |
|
From: Russell G. <rus...@us...> - 2003-08-20 12:40:19
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/servletunit In directory sc8-pr-cvs1:/tmp/cvs-serv23336/test/com/meterware/servletunit Modified Files: PassingTests.java ServletAccessTest.java ServletUnitTest.java SessionTest.java Log Message: Fix compiler warnings Index: PassingTests.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/PassingTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PassingTests.java 3 Dec 2001 19:14:59 -0000 1.1 +++ PassingTests.java 20 Aug 2003 12:06:15 -0000 1.2 @@ -20,9 +20,6 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ - -import java.util.*; - import junit.framework.TestCase; Index: ServletAccessTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/ServletAccessTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ServletAccessTest.java 3 Dec 2001 19:14:59 -0000 1.1 +++ ServletAccessTest.java 20 Aug 2003 12:06:15 -0000 1.2 @@ -20,10 +20,7 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ - import com.meterware.httpunit.WebResponse; - -import java.util.*; import javax.servlet.http.HttpServlet; Index: ServletUnitTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/ServletUnitTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ServletUnitTest.java 18 Jun 2002 16:53:21 -0000 1.3 +++ ServletUnitTest.java 20 Aug 2003 12:06:15 -0000 1.4 @@ -19,17 +19,9 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import java.util.Enumeration; import java.util.Vector; -import javax.servlet.ServletException; -import javax.servlet.http.*; - -import junit.framework.Test; import junit.framework.TestCase; -import junit.framework.TestSuite; - -import com.meterware.httpunit.*; /** * A base class for servlet unit tests. Index: SessionTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/SessionTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SessionTest.java 5 Nov 2001 18:54:51 -0000 1.3 +++ SessionTest.java 20 Aug 2003 12:06:15 -0000 1.4 @@ -19,16 +19,9 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import java.io.*; -import java.net.HttpURLConnection; -import javax.servlet.ServletException; -import javax.servlet.http.*; - import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; -import com.meterware.httpunit.*; /** * Tests the HttpSession implementation. @@ -72,7 +65,7 @@ ServletUnitHttpSession session = context.newSession(); long accessedAt = session.getLastAccessedTime(); assertTrue( "Session is not marked as new", session.isNew() ); - try { Thread.currentThread().sleep( 50 ); } catch (InterruptedException e) {}; + try { Thread.sleep( 50 ); } catch (InterruptedException e) {}; assertEquals( "Initial access time", accessedAt, context.getSession( session.getId() ).getLastAccessedTime() ); session.access(); assertTrue( "Last access time not changed", accessedAt != context.getSession( session.getId() ).getLastAccessedTime() ); |
|
From: Russell G. <rus...@us...> - 2003-08-20 12:38:42
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit In directory sc8-pr-cvs1:/tmp/cvs-serv23336/src/com/meterware/servletunit Modified Files: BasicAuthenticationRequiredException.java Log Message: Fix compiler warnings Index: BasicAuthenticationRequiredException.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/BasicAuthenticationRequiredException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BasicAuthenticationRequiredException.java 26 Nov 2001 14:20:12 -0000 1.1 +++ BasicAuthenticationRequiredException.java 20 Aug 2003 12:06:15 -0000 1.2 @@ -22,8 +22,6 @@ *******************************************************************************************************************/ import com.meterware.httpunit.AuthorizationRequiredException; -import java.io.IOException; - /** * Thrown when servletunit wants to indicate that a resource is protected in an application using Basic Authorization. |
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv23336/src/com/meterware/httpunit
Modified Files:
ClientProperties.java DialogAdapter.java ParameterHolder.java
UncheckedParameterHolder.java WebClient.java
WebWindowListener.java
Log Message:
Fix compiler warnings
Index: ClientProperties.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ClientProperties.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ClientProperties.java 19 Mar 2003 19:08:58 -0000 1.6
+++ ClientProperties.java 20 Aug 2003 12:06:15 -0000 1.7
@@ -226,8 +226,8 @@
}
- static ClientProperties cloneProperties() {
- return new ClientProperties( getDefaultProperties() );
+ ClientProperties cloneProperties() {
+ return new ClientProperties( this );
}
Index: DialogAdapter.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/DialogAdapter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DialogAdapter.java 21 Aug 2002 19:06:27 -0000 1.1
+++ DialogAdapter.java 20 Aug 2003 12:06:15 -0000 1.2
@@ -19,8 +19,6 @@
* DEALINGS IN THE SOFTWARE.
*
*******************************************************************************************************************/
-import java.util.*;
-
/**
*
Index: ParameterHolder.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParameterHolder.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ParameterHolder.java 4 Oct 2002 15:18:37 -0000 1.6
+++ ParameterHolder.java 20 Aug 2003 12:06:15 -0000 1.7
@@ -19,11 +19,7 @@
* DEALINGS IN THE SOFTWARE.
*
*******************************************************************************************************************/
-import java.io.File;
-import java.io.InputStream;
import java.io.IOException;
-
-import java.util.Enumeration;
/**
Index: UncheckedParameterHolder.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/UncheckedParameterHolder.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- UncheckedParameterHolder.java 14 Oct 2002 18:27:44 -0000 1.8
+++ UncheckedParameterHolder.java 20 Aug 2003 12:06:15 -0000 1.9
@@ -19,13 +19,10 @@
* DEALINGS IN THE SOFTWARE.
*
*******************************************************************************************************************/
-import java.io.File;
-import java.io.InputStream;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Enumeration;
-import java.net.URLEncoder;
/**
Index: WebClient.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- WebClient.java 23 Jun 2003 23:54:03 -0000 1.51
+++ WebClient.java 20 Aug 2003 12:06:15 -0000 1.52
@@ -30,7 +30,6 @@
import org.xml.sax.SAXException;
import com.meterware.httpunit.cookies.CookieJar;
-import com.meterware.httpunit.cookies.CookieJar;
/**
Index: WebWindowListener.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebWindowListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebWindowListener.java 4 Oct 2002 15:19:25 -0000 1.1
+++ WebWindowListener.java 20 Aug 2003 12:06:15 -0000 1.2
@@ -20,8 +20,6 @@
*
*******************************************************************************************************************/
-import java.lang.String;
-
/**
* A listener for web window openings and closings.
*
|