httpunit-commit Mailing List for httpunit (Page 43)
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-15 06:51:04
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv22418/doc
Modified Files:
release_notes.txt
Log Message:
638408: convert line endings to CRLF in Mime encoded messages
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.214
retrieving revision 1.215
diff -u -r1.214 -r1.215
--- release_notes.txt 13 Nov 2002 14:01:23 -0000 1.214
+++ release_notes.txt 15 Nov 2002 02:53:58 -0000 1.215
@@ -10,6 +10,10 @@
Revision History:
+14-Nov-2002
+Problems fixed:
+ 1. Bug #638406 Multi-line values in form data were using the platform-specific line ending rather than CRLF
+
12-Nov-2002
Acknowledgements:
Thanks to Michael McCallum for adding handling for bad character-set headers and an ant target to build the examples
|
|
From: Russell G. <rus...@us...> - 2002-11-15 06:50:53
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv29106/src/com/meterware/httpunit/javascript
Modified Files:
JavaScript.java
Log Message:
638306: Document.writeln now uses CRLF as terminator rather than 13
Index: JavaScript.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- JavaScript.java 13 Nov 2002 13:36:39 -0000 1.38
+++ JavaScript.java 15 Nov 2002 03:06:10 -0000 1.39
@@ -498,7 +498,7 @@
public void jsFunction_writeln( String string ) {
final StringBuffer documentWriteBuffer = getDocumentWriteBuffer();
- documentWriteBuffer.append( string ).append( 0x0D );
+ documentWriteBuffer.append( string ).append( (char) 0x0D ).append( (char) 0x0A );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-15 06:44:51
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv27410/src/com/meterware/httpunit
Modified Files:
WebApplet.java
Log Message:
support applet load, find, show-document
Index: WebApplet.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebApplet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebApplet.java 12 Nov 2002 13:41:54 -0000 1.1
+++ WebApplet.java 15 Nov 2002 00:07:33 -0000 1.2
@@ -1,10 +1,4 @@
package com.meterware.httpunit;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-
-import org.w3c.dom.Node;
-
/********************************************************************************************************************
* $Id$
*
@@ -25,6 +19,15 @@
* DEALINGS IN THE SOFTWARE.
*
*******************************************************************************************************************/
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.net.URLClassLoader;
+import java.applet.Applet;
+import java.io.IOException;
+
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
/**
* This class represents the embedding of an applet in a web page.
@@ -39,6 +42,7 @@
private String _baseTarget;
private URL _codeBase;
private String _className;
+ private Applet _applet;
final private String CLASS_EXTENSION = ".class";
@@ -108,4 +112,50 @@
public int getHeight() {
return Integer.parseInt( getAttribute( "height" ) );
}
+
+
+ public Applet getApplet() throws MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException {
+ if (_applet == null) {
+ ClassLoader cl = new URLClassLoader( getClassPath() );
+ Object o = cl.loadClass( getMainClassName() ).newInstance();
+ if (!(o instanceof Applet)) throw new RuntimeException( getMainClassName() + " is not an Applet" );
+ _applet = (Applet) o;
+ _applet.setStub( new AppletStubImpl( this ) );
+ }
+ return _applet;
+ }
+
+
+ private URL[] getClassPath() throws MalformedURLException {
+ return new URL[] { getCodeBase() };
+ }
+
+
+ String getBaseTarget() {
+ return _baseTarget;
+ }
+
+
+ WebApplet[] getAppletsInPage() {
+ try {
+ return _response.getApplets();
+ } catch (SAXException e) {
+ e.printStackTrace(); // should never happen.
+ return null;
+ }
+ }
+
+
+ void sendRequest( URL url, String target ) {
+ WebRequest wr = new GetMethodWebRequest( null, url.toExternalForm(), target );
+ try {
+ _response.getWindow().getResponse( wr );
+ } catch (IOException e) {
+ e.printStackTrace(); //To change body of catch statement use Options | File Templates.
+ throw new RuntimeException( e.toString() );
+ } catch (SAXException e) {
+ }
+ }
+
+
}
|
|
From: Russell G. <rus...@us...> - 2002-11-15 06:39:27
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv29106/doc Modified Files: release_notes.txt Log Message: 638306: Document.writeln now uses CRLF as terminator rather than 13 Index: release_notes.txt =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v retrieving revision 1.215 retrieving revision 1.216 diff -u -r1.215 -r1.216 --- release_notes.txt 15 Nov 2002 02:53:58 -0000 1.215 +++ release_notes.txt 15 Nov 2002 03:06:10 -0000 1.216 @@ -12,7 +12,8 @@ Revision History: 14-Nov-2002 Problems fixed: - 1. Bug #638406 Multi-line values in form data were using the platform-specific line ending rather than CRLF + 1. Bug #638406 Multi-line values in form data were using the platform-specific line ending rather than CRLF. + 2. Bug #638306 Document.writeln was writing the value "13" rather than CRLF as its terminator. 12-Nov-2002 Acknowledgements: |
|
From: Russell G. <rus...@us...> - 2002-11-15 06:30:38
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/pseudoserver
In directory usw-pr-cvs1:/tmp/cvs-serv27410/test/com/meterware/pseudoserver
Modified Files:
PseudoServerTest.java
Log Message:
support applet load, find, show-document
Index: PseudoServerTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/pseudoserver/PseudoServerTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PseudoServerTest.java 22 Oct 2002 15:12:54 -0000 1.6
+++ PseudoServerTest.java 15 Nov 2002 00:07:34 -0000 1.7
@@ -156,5 +156,12 @@
}
+ public void testClasspathDirectory() throws Exception {
+ WebConversation wc = new WebConversation();
+ mapToClasspath( "/some/classes" );
+ wc.getResponse( getHostPath() + "/some/classes/" + PseudoServerTest.class.getName().replace('.','/') + ".class" );
+ }
+
+
}
|
|
From: Russell G. <rus...@us...> - 2002-11-15 06:27:23
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv22418/test/com/meterware/httpunit Modified Files: FileUploadTest.java FormSubmitTest.java Log Message: 638408: convert line endings to CRLF in Mime encoded messages Index: FileUploadTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FileUploadTest.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- FileUploadTest.java 24 Jul 2002 17:32:08 -0000 1.12 +++ FileUploadTest.java 15 Nov 2002 02:53:59 -0000 1.13 @@ -24,6 +24,7 @@ import java.io.*; import java.util.StringTokenizer; +import java.net.URLEncoder; import javax.activation.DataSource; @@ -63,6 +64,7 @@ defineResource( "ListParams", new MimeEcho() ); defineWebPage( "Default", "<form method=POST action = \"ListParams\" enctype=\"multipart/form-data\"> " + "<Input type=text name=age value=12>" + + "<Textarea name=comment>first\nsecond</textarea>" + "<Input type=submit name=update value=age>" + "</form>" ); WebConversation wc = new WebConversation(); @@ -70,13 +72,11 @@ WebResponse simplePage = wc.getResponse( request ); WebRequest formSubmit = simplePage.getForms()[0].getRequest(); WebResponse encoding = wc.getResponse( formSubmit ); - assertEquals( "http://dummy?age=12&update=age", "http://dummy?" + encoding.getText().trim() ); + assertEquals( "http://dummy?age=12&comment=first%0D%0Asecond&update=age", "http://dummy?" + encoding.getText().trim() ); } public void testFileParameterValidation() throws Exception { - File file = new File( "temp.html" ); - defineWebPage( "Default", "<form method=POST action = \"ListParams\" enctype=\"multipart/form-data\"> " + "<Input type=file name=message>" + "<Input type=submit name=update value=age>" + @@ -372,7 +372,7 @@ private void appendFieldValue( String parameterName, StringBuffer sb, MimeBodyPart mbp ) throws IOException, MessagingException { - sb.append( parameterName ).append( "=" ).append( mbp.getContent() ); + sb.append( parameterName ).append( "=" ).append( URLEncoder.encode( mbp.getContent().toString(), "iso-8859-1" ) ); } Index: FormSubmitTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FormSubmitTest.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- FormSubmitTest.java 8 Nov 2002 01:59:38 -0000 1.28 +++ FormSubmitTest.java 15 Nov 2002 02:53:59 -0000 1.29 @@ -521,6 +521,7 @@ WebResponse wr = _wc.getResponse( getHostPath() + "/abc/form.html" ); WebForm form = wr.getForms()[0]; form.setParameter( "text_field-name*", "a value" ); + WebResponse response = form.submit(); assertEquals( "posted parameters", "text_field-name*=a+value&apply=Apply", response.getText() ); } |
|
From: Russell G. <rus...@us...> - 2002-11-15 06:26:30
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv22418/src/com/meterware/httpunit
Modified Files:
MimeEncodedMessageBody.java
Log Message:
638408: convert line endings to CRLF in Mime encoded messages
Index: MimeEncodedMessageBody.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/MimeEncodedMessageBody.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MimeEncodedMessageBody.java 31 Oct 2002 04:21:28 -0000 1.14
+++ MimeEncodedMessageBody.java 15 Nov 2002 02:53:59 -0000 1.15
@@ -109,7 +109,24 @@
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() );
writeLn( _outputStream, "" );
- writeLn( _outputStream, value, getRequest().getCharacterSet() );
+ writeLn( _outputStream, fixLineEndings( value ), getRequest().getCharacterSet() );
+ }
+
+
+ private final static char CR = 0x0D;
+ private final static char LF = 0x0A;
+
+ private String fixLineEndings( String value ) {
+ StringBuffer sb = new StringBuffer();
+ char[] chars = value.toCharArray();
+ for (int i = 0; i < chars.length; i++) {
+ if (chars[i] == CR || (chars[i] == LF && (i == 0 || chars[i-1] != CR))) {
+ sb.append( CR ).append( LF );
+ } else {
+ sb.append( chars[i] );
+ }
+ }
+ return sb.toString();
}
|
|
From: Russell G. <rus...@us...> - 2002-11-15 06:04:52
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv23996/test/com/meterware/httpunit
Modified Files:
HttpUnitTest.java
Log Message:
Correct 1.4 problem with applet context
Index: HttpUnitTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HttpUnitTest.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- HttpUnitTest.java 24 Jul 2002 17:28:57 -0000 1.22
+++ HttpUnitTest.java 15 Nov 2002 01:22:37 -0000 1.23
@@ -51,5 +51,9 @@
HttpUnitOptions.reset();
}
+ static {
+ new WebConversation();
+ }
+
}
|
|
From: Russell G. <rus...@us...> - 2002-11-15 05:49:44
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv23996/src/com/meterware/httpunit
Modified Files:
AppletContextImpl.java
Log Message:
Correct 1.4 problem with applet context
Index: AppletContextImpl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/AppletContextImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AppletContextImpl.java 15 Nov 2002 00:10:21 -0000 1.1
+++ AppletContextImpl.java 15 Nov 2002 01:22:37 -0000 1.2
@@ -24,6 +24,8 @@
import java.applet.Applet;
import java.net.URL;
import java.awt.*;
+import java.io.InputStream;
+import java.io.IOException;
/**
*
@@ -168,5 +170,61 @@
* @param status a string to display in the status window.
*/
public void showStatus( String status ) {
+ }
+
+
+ /**
+ * Returns the stream to which specified key is associated within this
+ * applet context. Returns <tt>null</tt> if the applet context contains
+ * no stream for this key.
+ * <p>
+ * For security reasons, mapping of streams and keys exists for each
+ * codebase. In other words, applet from one codebase cannot access
+ * the streams created by an applet from a different codebase
+ * <p>
+ * @return the stream to which this applet context maps the key
+ * @param key key whose associated stream is to be returned.
+ * @since JDK1.4
+ */
+ public InputStream getStream( String key ) {
+ return null;
+ }
+
+
+ /**
+ * Finds all the keys of the streams in this applet context.
+ * <p>
+ * For security reasons, mapping of streams and keys exists for each
+ * codebase. In other words, applet from one codebase cannot access
+ * the streams created by an applet from a different codebase
+ * <p>
+ * @return an Iterator of all the names of the streams in this applet
+ * context.
+ * @since JDK1.4
+ */
+ public Iterator getStreamKeys() {
+ return null;
+ }
+
+
+ /**
+ * Associates the specified stream with the specified key in this
+ * applet context. If the applet context previously contained a mapping
+ * for this key, the old value is replaced.
+ * <p>
+ * For security reasons, mapping of streams and keys exists for each
+ * codebase. In other words, applet from one codebase cannot access
+ * the streams created by an applet from a different codebase
+ * <p>
+ * @param key key with which the specified value is to be associated.
+ * @param stream stream to be associated with the specified key. If this
+ * parameter is <code>null<code>, the specified key is removed
+ * in this applet context.
+ * @throws <code>IOException</code> if the stream size exceeds a certain
+ * size limit. Size limit is decided by the implementor of this
+ * interface.
+ * @since JDK1.4
+ */
+ public void setStream( String key, InputStream stream ) throws IOException {
}
}
|
|
From: Russell G. <rus...@us...> - 2002-11-15 05:44:50
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv29106/src/com/meterware/httpunit
Modified Files:
WebLink.java
Log Message:
638306: Document.writeln now uses CRLF as terminator rather than 13
Index: WebLink.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebLink.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- WebLink.java 31 Oct 2002 15:17:14 -0000 1.34
+++ WebLink.java 15 Nov 2002 03:06:10 -0000 1.35
@@ -71,7 +71,7 @@
} else if (!getNode().hasChildNodes()) {
return "";
} else {
- return NodeUtils.asText( getNode().getChildNodes() );
+ return NodeUtils.asText( getNode().getChildNodes() ).trim();
}
}
|
|
From: Russell G. <rus...@us...> - 2002-11-15 05:43:41
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/applet
In directory usw-pr-cvs1:/tmp/cvs-serv27410/test/com/meterware/httpunit/applet
Modified Files:
AppletTest.java
Log Message:
support applet load, find, show-document
Index: AppletTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/applet/AppletTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AppletTest.java 12 Nov 2002 13:41:54 -0000 1.1
+++ AppletTest.java 15 Nov 2002 00:07:33 -0000 1.2
@@ -25,6 +25,8 @@
import com.meterware.httpunit.WebApplet;
import java.applet.Applet;
+import java.util.Enumeration;
+import java.net.URL;
import junit.textui.TestRunner;
import junit.framework.TestSuite;
@@ -94,7 +96,59 @@
public void testAppletLoading() throws Exception {
+ defineWebPage( "start", "<applet code='" + SimpleApplet.class.getName() +
+ ".class' codebase=/classes width=100 height=100></applet>");
+ mapToClasspath( "/classes" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
+ WebApplet wa = response.getApplets()[0];
+ Applet applet = wa.getApplet();
+ assertNotNull( "Applet was not loaded", applet );
+ assertEquals( "Applet class", SimpleApplet.class.getName(), applet.getClass().getName() );
+ }
+
+
+ public void testAppletFindFromApplet() throws Exception {
+ defineWebPage( "start", "<applet name=first code='" + SimpleApplet.class.getName() +
+ ".class' codebase=/classes width=100 height=100></applet>" +
+ "<applet name=second code='" + SecondApplet.class.getName() +
+ ".class' codebase=/classes width=100 height=100></applet>");
+ mapToClasspath( "/classes" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
+ Applet applet = response.getApplets()[0].getApplet();
+ Applet applet2 = applet.getAppletContext().getApplet( "second" );
+ assertNotNull( "Applet was not loaded", applet2 );
+ assertEquals( "Applet class", SecondApplet.class.getName(), applet2.getClass().getName() );
+
+ Enumeration applets = applet2.getAppletContext().getApplets();
+ assertNotNull( "No applet enumeration returned", applets );
+ assertTrue( "No applets in enumeration", applets.hasMoreElements() );
+ assertTrue( "First is not an applet", applets.nextElement() instanceof Applet );
+ assertTrue( "Only one applet in enumeration", applets.hasMoreElements() );
+ assertTrue( "Second is not an applet", applets.nextElement() instanceof Applet );
+ assertFalse( "More than two applets enumerated", applets.hasMoreElements() );
+ }
+
+
+ public void testShowDocument() throws Exception {
+ defineResource( "next.html", "You made it!" );
+ defineWebPage( "start", "<applet code='" + SimpleApplet.class.getName() +
+ ".class' codebase=/classes width=100 height=100></applet>");
+ mapToClasspath( "/classes" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
+ WebApplet wa = response.getApplets()[0];
+ Applet applet = wa.getApplet();
+ applet.getAppletContext().showDocument( new URL( getHostPath() + "/next.html" ) );
+ assertEquals( "current page URL", getHostPath() + "/next.html", wc.getCurrentPage().getURL().toExternalForm() );
+ }
+
+
+ public static class SimpleApplet extends Applet {
+ }
+ public static class SecondApplet extends Applet {
}
}
|
|
From: Russell G. <rus...@us...> - 2002-11-13 14:01:26
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv19457/test/com/meterware/httpunit
Modified Files:
WebPageTest.java
Log Message:
Handle unknown charsets reported by server
Index: WebPageTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- WebPageTest.java 5 Nov 2002 21:45:19 -0000 1.25
+++ WebPageTest.java 13 Nov 2002 14:01:24 -0000 1.26
@@ -262,6 +262,19 @@
}
+ public void testUnsupportedEncoding() throws Exception {
+ defineResource( "SimplePage.html", "not much here" );
+ addResourceHeader( "SimplePage.html", "Content-type: text/plain; charset=BOGUS");
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" );
+ WebResponse simplePage = wc.getResponse( request );
+
+ assertEquals( "Text", "not much here", simplePage.getText() );
+ assertEquals( "Character set", WebResponse.getDefaultEncoding(), simplePage.getCharacterSet() );
+ }
+
+
public void testRefreshHeader() throws Exception {
String refreshURL = getHostPath() + "/NextPage.html";
String page = "<html><head><title>Sample</title></head>\n" +
|
|
From: Russell G. <rus...@us...> - 2002-11-13 14:01:26
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver
In directory usw-pr-cvs1:/tmp/cvs-serv19457/src/com/meterware/pseudoserver
Modified Files:
PseudoServer.java WebResource.java
Log Message:
Handle unknown charsets reported by server
Index: PseudoServer.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/PseudoServer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PseudoServer.java 15 Aug 2002 00:06:32 -0000 1.2
+++ PseudoServer.java 13 Nov 2002 14:01:23 -0000 1.3
@@ -208,7 +208,6 @@
if (resource.getResponseCode() != HttpURLConnection.HTTP_OK) {
response.setResponse( resource.getResponseCode(), "" );
}
- response.addHeader( "Content-type: " + resource.getContentType() + resource.getCharacterSetParameter() );
String[] headers = resource.getHeaders();
for (int i = 0; i < headers.length; i++) {
response.addHeader( headers[i] );
Index: WebResource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/WebResource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebResource.java 24 Jul 2002 17:28:56 -0000 1.1
+++ WebResource.java 13 Nov 2002 14:01:23 -0000 1.2
@@ -54,6 +54,7 @@
public void addHeader( String header ) {
_headers.addElement( header );
+ if (header.toLowerCase().startsWith( "content-type" )) _hasExplicitContentTypeHeader = true;
}
@@ -87,8 +88,10 @@
String[] getHeaders() {
- String[] headers = new String[ _headers.size() ];
- _headers.copyInto( headers );
+ final Vector effectiveHeaders = (Vector) _headers.clone();
+ if (!_hasExplicitContentTypeHeader) effectiveHeaders.add( getContentTypeHeader() );
+ String[] headers = new String[ effectiveHeaders.size() ];
+ effectiveHeaders.copyInto( headers );
return headers;
}
@@ -102,8 +105,8 @@
}
- String getContentType() {
- return _contentType;
+ private String getContentTypeHeader() {
+ return "Content-type: " + _contentType + getCharacterSetParameter();
}
@@ -147,6 +150,7 @@
private boolean _sendCharacterSet;
private String _contentType = DEFAULT_CONTENT_TYPE;
private String _characterSet = DEFAULT_CHARACTER_SET;
+ private boolean _hasExplicitContentTypeHeader;
private Vector _headers = new Vector();
}
|
|
From: Russell G. <rus...@us...> - 2002-11-13 14:01:26
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv19457/doc
Modified Files:
release_notes.txt
Log Message:
Handle unknown charsets reported by server
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -r1.213 -r1.214
--- release_notes.txt 9 Nov 2002 23:34:27 -0000 1.213
+++ release_notes.txt 13 Nov 2002 14:01:23 -0000 1.214
@@ -10,6 +10,16 @@
Revision History:
+12-Nov-2002
+Acknowledgements:
+ Thanks to Michael McCallum for adding handling for bad character-set headers and an ant target to build the examples
+
+Problems fixed:
+ 1. Bad character-set headers from servers would result in an UnsupportedEncodingException.
+
+Additions:
+ 1. Added support for the location.href property
+
9-Nov-2002
Problems fixed:
1. As of 1.5, HttpUnit was not building if NekoHTML was not in the classpath. This is now fixed.
|
|
From: Russell G. <rus...@us...> - 2002-11-13 14:01:26
|
Update of /cvsroot/httpunit/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv19457
Modified Files:
build.xml
Log Message:
Handle unknown charsets reported by server
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- build.xml 9 Nov 2002 23:34:27 -0000 1.55
+++ build.xml 13 Nov 2002 14:01:22 -0000 1.56
@@ -21,6 +21,7 @@
<property name="build.dir" value="build" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="test.classes" value="${build.dir}/testclasses" />
+ <property name="example.classes" value="${build.dir}/examples" />
<property name="javadoc.dir" value="${docs.dir}/api" />
<property name="use.jtidy" value="" />
@@ -85,6 +86,21 @@
<exclude name="**/NekoHTMLParser.java" unless="nekoHTML.present" />
<exclude name="**/servletunit/*" unless="jsdk.present" />
<exclude name="**/javascript/*" unless="rhino.present" />
+ </javac>
+</target>
+
+
+<!-- =================================================================== -->
+<!-- Compiles the example code -->
+<!-- =================================================================== -->
+<target name="compile-examples" depends="compile">
+ <mkdir dir="${example.classes}" />
+ <javac srcdir="${examples.dir}" destdir="${example.classes}"
+ debug="${debug}" deprecation="${deprecation}" optimize="${optimize}">
+ <classpath>
+ <path refid="base.classpath" />
+ <pathelement location="${build.classes}" />
+ </classpath>
</javac>
</target>
|
|
From: Russell G. <rus...@us...> - 2002-11-13 14:01:26
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv19457/src/com/meterware/httpunit
Modified Files:
WebResponse.java
Log Message:
Handle unknown charsets reported by server
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- WebResponse.java 12 Nov 2002 13:41:54 -0000 1.98
+++ WebResponse.java 13 Nov 2002 14:01:23 -0000 1.99
@@ -194,13 +194,8 @@
public String getCharacterSet() {
if (_characterSet == null) {
readContentTypeHeader();
- if (_characterSet == null) _characterSet = getHeaderField( "Charset" );
- if (_characterSet == null) _characterSet = HttpUnitOptions.getDefaultCharacterSet();
- try {
- "abcd".getBytes( _characterSet );
- } catch (UnsupportedEncodingException e) {
- _characterSet = getDefaultEncoding();
- }
+ if (_characterSet == null) setCharacterSet( getHeaderField( "Charset" ) );
+ if (_characterSet == null) setCharacterSet( HttpUnitOptions.getDefaultCharacterSet() );
}
return _characterSet;
}
@@ -900,12 +895,12 @@
: getHeaderField( "Content-type" );
if (contentHeader == null) {
_contentType = HttpUnitOptions.getDefaultContentType();
- _characterSet = HttpUnitOptions.getDefaultCharacterSet();
+ setCharacterSet( HttpUnitOptions.getDefaultCharacterSet() );
_contentHeader = _contentType + ";charset=" + _characterSet;
} else {
String[] parts = HttpUnitUtils.parseContentTypeHeader( contentHeader );
_contentType = parts[0];
- if (parts[1] != null) _characterSet = parts[1];
+ if (parts[1] != null) setCharacterSet( parts[1] );
}
}
@@ -962,6 +957,18 @@
}
}
return (_defaultEncoding = System.getProperty( "file.encoding" ));
+ }
+
+
+ private void setCharacterSet( String characterSet ) {
+ if (characterSet == null) return;
+
+ try {
+ "abcd".getBytes( characterSet );
+ _characterSet = characterSet;
+ } catch (UnsupportedEncodingException e) {
+ _characterSet = getDefaultEncoding();
+ }
}
|
|
From: Russell G. <rus...@us...> - 2002-11-13 13:36:42
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv3125/test/com/meterware/httpunit/javascript
Modified Files:
ScriptingTest.java
Log Message:
Support location.href
Index: ScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- ScriptingTest.java 3 Nov 2002 06:31:14 -0000 1.43
+++ ScriptingTest.java 13 Nov 2002 13:36:39 -0000 1.44
@@ -369,16 +369,25 @@
public void testLocationProperty() throws Exception {
defineResource( "Target.html", "You made it!" );
- defineResource( "OnCommand.html", "<html><head><title>Amazing!</title></head>" +
- "<body onLoad='alert(\"Window location is \" + window.location);alert(\"Document location is \" + document.location)'>" +
+ defineResource( "location.js", "function show() {" +
+ "alert('Window location is ' + window.location);" +
+ "alert('Document location is ' + document.location);" +
+ "alert('Window location.href is ' + window.location.href);" +
+ "}" );
+ defineResource( "OnCommand.html", "<html><head><title>Amazing!</title>" +
+ "<script language='JavaScript' src='location.js'></script>" +
+ "</head>" +
+ "<body onLoad='show()'>" +
"<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>" +
+ "<a href='#' onMouseOver=\"window.location.href='" + getHostPath() + "/Target.html';\">go</a>" +
"</body>" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
- assertEquals( "Alert message", "Window location is " + getHostPath() + "/OnCommand.html", wc.popNextAlert() );
- assertEquals( "Alert message", "Document location is " + getHostPath() + "/OnCommand.html", wc.popNextAlert() );
+ assertEquals( "Alert message 1", "Window location is " + getHostPath() + "/OnCommand.html", wc.popNextAlert() );
+ assertEquals( "Alert message 2", "Document location is " + getHostPath() + "/OnCommand.html", wc.popNextAlert() );
+ assertEquals( "Alert message 3", "Window location.href is " + getHostPath() + "/OnCommand.html", wc.popNextAlert() );
response.getLinks()[0].mouseOver();
assertEquals( "2nd page URL", getHostPath() + "/Target.html", wc.getCurrentPage().getURL().toExternalForm() );
assertEquals( "2nd page", "You made it!", wc.getCurrentPage().getText() );
@@ -392,6 +401,11 @@
response.getLinks()[2].mouseOver();
assertEquals( "4th page URL", getHostPath() + "/Target.html", wc.getCurrentPage().getURL().toExternalForm() );
assertEquals( "4th page", "You made it!", wc.getCurrentPage().getText() );
+
+ response = wc.getResponse( getHostPath() + "/OnCommand.html" );
+ response.getLinks()[3].mouseOver();
+ assertEquals( "5th page URL", getHostPath() + "/Target.html", wc.getCurrentPage().getURL().toExternalForm() );
+ assertEquals( "5th page", "You made it!", wc.getCurrentPage().getText() );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-13 13:36:42
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv3125/doc Modified Files: Javascript-support.html Log Message: Support location.href Index: Javascript-support.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/Javascript-support.html,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- Javascript-support.html 3 Nov 2002 06:28:36 -0000 1.27 +++ Javascript-support.html 13 Nov 2002 13:36:39 -0000 1.28 @@ -63,6 +63,10 @@ </ul> <h3>Location</h3> +<h4>properties</h4> +<ul> +<li>href - r/w the current window location. Setting this value initiates a new request to the server</li> +</ul> <h4>methods</h4> <ul> <li>replace - replaces the current window by doing a new request to the server</li> |
|
From: Russell G. <rus...@us...> - 2002-11-13 13:36:42
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv3125/src/com/meterware/httpunit/javascript
Modified Files:
JavaScript.java
Log Message:
Support location.href
Index: JavaScript.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- JavaScript.java 3 Nov 2002 06:31:14 -0000 1.37
+++ JavaScript.java 13 Nov 2002 13:36:39 -0000 1.38
@@ -563,6 +563,16 @@
}
+ public String jsGet_href() {
+ return toString();
+ }
+
+
+ public void jsSet_href( String urlString ) throws SAXException, IOException {
+ _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
|
|
From: Russell G. <rus...@us...> - 2002-11-12 13:41:58
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/applet In directory usw-pr-cvs1:/tmp/cvs-serv24350/test/com/meterware/httpunit/applet Added Files: AppletTest.java Log Message: Begin applet support ***** Error reading new file[Errno 2] No such file or directory: 'AppletTest.java' |
|
From: Russell G. <rus...@us...> - 2002-11-12 13:41:58
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv24350/src/com/meterware/httpunit
Modified Files:
HTMLSegment.java ParsedHTML.java WebResponse.java
Added Files:
WebApplet.java
Log Message:
Begin applet support
***** Error reading new file[Errno 2] No such file or directory: 'WebApplet.java'
Index: HTMLSegment.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLSegment.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- HTMLSegment.java 4 Oct 2002 02:16:00 -0000 1.6
+++ HTMLSegment.java 12 Nov 2002 13:41:54 -0000 1.7
@@ -113,6 +113,13 @@
/**
+ * Returns the applets found in the page in the order in which they appear.
+ * @exception SAXException thrown if there is an error parsing the segment.
+ **/
+ public WebApplet[] getApplets() throws SAXException;
+
+
+ /**
* Returns the top-level tables found in this HTML segment in the order in which
* they appear.
* @exception SAXException thrown if there is an error parsing the segment.
Index: ParsedHTML.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ParsedHTML.java 24 Oct 2002 13:28:53 -0000 1.33
+++ ParsedHTML.java 12 Nov 2002 13:41:54 -0000 1.34
@@ -43,6 +43,7 @@
private WebForm[] _forms;
private WebImage[] _images;
private WebLink[] _links;
+ private WebApplet[] _applets;
private WebResponse _response;
@@ -236,6 +237,22 @@
else if (HttpUnitOptions.getMatchesIgnoreCase() && images[i].getAltText().equalsIgnoreCase( altText )) return images[i];
}
return null;
+ }
+
+
+ /**
+ * Returns a proxy for each applet found embedded in this page.
+ */
+ public WebApplet[] getApplets() {
+ if (_applets == null) {
+ NodeList applets = NodeUtils.getElementsByTagName( getRootNode(), "applet" );
+
+ _applets = new WebApplet[ applets.getLength() ];
+ for (int i = 0; i < _applets.length; i++) {
+ _applets[i] = new WebApplet( _response, applets.item( i ), _baseTarget );
+ }
+ }
+ return _applets;
}
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- WebResponse.java 5 Nov 2002 21:45:18 -0000 1.97
+++ WebResponse.java 12 Nov 2002 13:41:54 -0000 1.98
@@ -409,6 +409,11 @@
}
+ public WebApplet[] getApplets() throws SAXException {
+ return getReceivedPage().getApplets();
+ }
+
+
/**
* Returns a copy of the domain object model tree associated with this response.
* If the response is HTML, it will use a special parser which can transform HTML into an XML DOM.
|
|
From: Russell G. <rus...@us...> - 2002-11-12 13:41:57
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit In directory usw-pr-cvs1:/tmp/cvs-serv24350/src/com/meterware/servletunit Modified Files: package.html Log Message: Begin applet support Index: package.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- package.html 3 Dec 2001 15:42:39 -0000 1.1 +++ package.html 12 Nov 2002 13:41:54 -0000 1.2 @@ -15,5 +15,5 @@ A <a href="../../../../tutorial/index.html" target="_top">tutorial</a> is available. -Please direct any questions to <A HREF="mailto:rus...@ac...">Russell Gold</A>. +Please direct any questions to <A HREF="mailto:rus...@ht...">Russell Gold</A>. </BODY></HTML> |
|
From: Russell G. <rus...@us...> - 2002-11-11 23:05:32
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/applet In directory usw-pr-cvs1:/tmp/cvs-serv3315/applet Log Message: Directory /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/applet added to the repository |
|
From: Russell G. <rus...@us...> - 2002-11-11 22:22:24
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/applet In directory usw-pr-cvs1:/tmp/cvs-serv18929a/applet Log Message: Directory /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/applet added to the repository |
|
From: Russell G. <rus...@us...> - 2002-11-09 23:34:30
|
Update of /cvsroot/httpunit/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv4449
Modified Files:
build.xml
Log Message:
Permit build w/o NekoHTML
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- build.xml 8 Nov 2002 01:59:37 -0000 1.54
+++ build.xml 9 Nov 2002 23:34:27 -0000 1.55
@@ -81,6 +81,7 @@
debug="${debug}" deprecation="${deprecation}" optimize="${optimize}">
<classpath refid="base.classpath" />
<exclude name="**/JTidyHTMLParser.java" unless="jtidy.present" />
+ <exclude name="**/ScriptFilter.java" unless="nekoHTML.present" />
<exclude name="**/NekoHTMLParser.java" unless="nekoHTML.present" />
<exclude name="**/servletunit/*" unless="jsdk.present" />
<exclude name="**/javascript/*" unless="rhino.present" />
@@ -157,7 +158,7 @@
<javadoc packagenames="${packages}" sourcepath="${basedir}/${src.dir}"
destdir="${javadoc.dir}" author="true" version="true"
windowtitle="${Name} ${version} API" doctitle="${Name}"
- footer="Copyright &copy; 2000-2002 Russell Gold. See <a href="http://httpunit.sourceforge.net/doc/license.html">license agreement</A> for rights granted." >
+ footer="Copyright &copy; 2000-2002 Russell Gold. See <a href="http://www.httpunit.org/doc/license.html">license agreement</A> for rights granted." >
<classpath refid="base.classpath"/>
</javadoc>
</target>
|