Thread: [Httpunit-commit] SF.net SVN: httpunit: [914] trunk/httpunit
Brought to you by:
russgold
From: <rus...@us...> - 2008-04-06 16:35:15
|
Revision: 914 http://httpunit.svn.sourceforge.net/httpunit/?rev=914&view=rev Author: russgold Date: 2008-04-06 09:35:03 -0700 (Sun, 06 Apr 2008) Log Message: ----------- bug #1110071: javascript cannot increase length of a select control Modified Paths: -------------- trunk/httpunit/build.xml trunk/httpunit/doc/release_notes.txt trunk/httpunit/src/com/meterware/httpunit/controls/SelectionFormControl.java trunk/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-04-06 07:42:13 UTC (rev 913) +++ trunk/httpunit/build.xml 2008-04-06 16:35:03 UTC (rev 914) @@ -98,7 +98,7 @@ <target name="prepare_repository_classpath" depends="check_jars_dir" unless="have.local.jars"> <echo message="using repository classpath"/> <!-- Russell's proxy --> - <setproxy proxyhost="www-proxy.us.oracle.com" proxyport="80"/> + <!--<setproxy proxyhost="www-proxy.us.oracle.com" proxyport="80"/>--> <typedef classpath="${jars.dir}/ant-dependencies.jar" resource="dependencies.properties" /> <dependencies pathId="base.classpath" fileSetId="distributed.jars"> <!-- get from http://www.ibiblio.org/maven/rhino/jars/ --> Modified: trunk/httpunit/doc/release_notes.txt =================================================================== --- trunk/httpunit/doc/release_notes.txt 2008-04-06 07:42:13 UTC (rev 913) +++ trunk/httpunit/doc/release_notes.txt 2008-04-06 16:35:03 UTC (rev 914) @@ -15,6 +15,8 @@ Revision History: ================= +06-Apr-2008 bugfix 1110071: cannot increase length of a select control + for a full subversion log you might want to issue the subversion command: svn log https://httpunit.svn.sourceforge.net/svnroot/httpunit 02-Apr-2008: Modified: trunk/httpunit/src/com/meterware/httpunit/controls/SelectionFormControl.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/controls/SelectionFormControl.java 2008-04-06 07:42:13 UTC (rev 913) +++ trunk/httpunit/src/com/meterware/httpunit/controls/SelectionFormControl.java 2008-04-06 16:35:03 UTC (rev 914) @@ -185,7 +185,7 @@ public static class Option extends ScriptableDelegate implements SelectionOption { - private String _text; + private String _text =""; private String _value; private boolean _defaultSelected; private boolean _selected; @@ -385,21 +385,16 @@ * Bug corrected : The length can be greater than the original length */ public void setLength( int length ) { - if (length < 0) return; - Option[] newArray = new Option[length ]; - if (length <= _options.length) { - System.arraycopy( _options, 0, - newArray, 0, length ); - } else { - System.arraycopy( _options, 0, newArray, 0, _options.length ); - for (int i = _options.length; i < length; i++) { - newArray[i] = new Option(); - newArray[i].setIndex(this, i); - } - } - _options = newArray; + if (length < 0) return; + Option[] newArray = new Option[ length ]; + System.arraycopy( _options, 0, newArray, 0, Math.min( length, _options.length ) ); + for (int i = _options.length; i < length; i++) { + newArray[i] = new Option(); + } + _options = newArray; } + public void put( int i, SelectionOption option ) { if (i < 0) return; Modified: trunk/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java 2008-04-06 07:42:13 UTC (rev 913) +++ trunk/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java 2008-04-06 16:35:03 UTC (rev 914) @@ -1154,6 +1154,8 @@ response.getLinks()[0].mouseOver(); assertEquals( "after change message", "selected #0", wc.popNextAlert() ); } + + /** * test that in case of an Index out of bounds problem an exception is thrown * with a meaningful message (not nullpointer exception) @@ -1601,6 +1603,43 @@ } /** + * Verifies that it is possible to increase the size of a select control. + * @throws Exception on any unexpected error + */ + public void testIncreaseSelectLength() throws Exception { + defineWebPage("Default", "<script language=JavaScript>\n" + + "function extend()\n"+ + "{\n"+ + "document.myForm.jobRoleID.options.length=2;\n" + + "document.myForm.jobRoleID.options[1].text='here';" + + "return true;\n" + + "}\n" + + "function viewSelect( choice ) {\n" + + " alert ('select has ' + choice.options.length + ' options' );\n" + + " alert ('last option is ' + choice.options[choice.options.length-1].text );\n" + + "}\n" + + "</script>" + + "<form name=myForm method=POST>" + + " <select name=\"jobRoleID\">" + + " <option value=\"0\" selected=\"selected\">Select Job Role</option>" + + " </select>" + + " <input type=\"text\" name=\"last_name\" value=\"Bloggs\">" + + "</form>" + + "<a href='#' onClick='viewSelect(document.myForm.jobRoleID); return false;'>a</href>\n" + + "<a href='#' onClick='extend(); return false;'>a</href>\n"); + WebConversation wc = new WebConversation(); + WebResponse wr = wc.getResponse( getHostPath() + "/Default.html" ); + wr.getLinks()[ 0 ].click(); + assertEquals( "1st message", "select has 1 options", wc.popNextAlert() ); + assertEquals( "2nd message", "last option is Select Job Role", wc.popNextAlert() ); + wr.getLinks()[ 1 ].click(); + wr.getLinks()[ 0 ].click(); + assertEquals( "3rd message", "select has 2 options", wc.popNextAlert() ); + assertEquals( "4th message", "last option is here", wc.popNextAlert() ); + } + + + /** * Test that the JavaScript 'value' and 'defaultValue' properties of a text input are distinct. * 'defaultValue' should represent the 'value' attribute of the input element. * 'value' should initially match 'defaultValue', but setting it should not affect the 'defaultValue'. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2008-04-14 19:39:56
|
Revision: 915 http://httpunit.svn.sourceforge.net/httpunit/?rev=915&view=rev Author: russgold Date: 2008-04-14 12:39:44 -0700 (Mon, 14 Apr 2008) Log Message: ----------- Parse chunk lengths as hex Modified Paths: -------------- trunk/httpunit/doc/release_notes.txt trunk/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java trunk/httpunit/src/com/meterware/pseudoserver/ReceivedHttpMessage.java trunk/httpunit/test/com/meterware/pseudoserver/PseudoServerTest.java Modified: trunk/httpunit/doc/release_notes.txt =================================================================== --- trunk/httpunit/doc/release_notes.txt 2008-04-06 16:35:03 UTC (rev 914) +++ trunk/httpunit/doc/release_notes.txt 2008-04-14 19:39:44 UTC (rev 915) @@ -15,6 +15,8 @@ Revision History: ================= +14-Apr-2008 PseudoServer was incorrectly parsing chunk lengths as decimal rather than hexadecimal + 06-Apr-2008 bugfix 1110071: cannot increase length of a select control for a full subversion log you might want to issue the subversion command: Modified: trunk/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java 2008-04-06 16:35:03 UTC (rev 914) +++ trunk/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java 2008-04-14 19:39:44 UTC (rev 915) @@ -42,9 +42,12 @@ public static final String ORIGINAL_SCRIPTING_ENGINE_FACTORY = "com.meterware.httpunit.javascript.JavaScriptEngineFactory"; private static final String NEW_SCRIPTING_ENGINE_FACTORY = "com.meterware.httpunit.dom.DomBasedScriptingEngineFactory"; - // comment out the scripting engine not to be used + // comment out the scripting engine not to be used by allowing the appropriate number of asterisks in the comment on the next line (1 or 2) + /**/ final static public String DEFAULT_SCRIPT_ENGINE_FACTORY = ORIGINAL_SCRIPTING_ENGINE_FACTORY; - //final static public String DEFAULT_SCRIPT_ENGINE_FACTORY = NEW_SCRIPTING_ENGINE_FACTORY; + /*/ + final static public String DEFAULT_SCRIPT_ENGINE_FACTORY = NEW_SCRIPTING_ENGINE_FACTORY; + /*/ /** Modified: trunk/httpunit/src/com/meterware/pseudoserver/ReceivedHttpMessage.java =================================================================== --- trunk/httpunit/src/com/meterware/pseudoserver/ReceivedHttpMessage.java 2008-04-06 16:35:03 UTC (rev 914) +++ trunk/httpunit/src/com/meterware/pseudoserver/ReceivedHttpMessage.java 2008-04-14 19:39:44 UTC (rev 915) @@ -133,7 +133,7 @@ private int getNextChunkLength( InputStream inputStream ) throws IOException { try { - return Integer.parseInt( readHeaderLine( inputStream ) ); + return Integer.parseInt( readHeaderLine( inputStream ), 16 ); } catch (NumberFormatException e) { throw new IOException( "Unabled to read chunk length: " + e ); } Modified: trunk/httpunit/test/com/meterware/pseudoserver/PseudoServerTest.java =================================================================== --- trunk/httpunit/test/com/meterware/pseudoserver/PseudoServerTest.java 2008-04-06 16:35:03 UTC (rev 914) +++ trunk/httpunit/test/com/meterware/pseudoserver/PseudoServerTest.java 2008-04-14 19:39:44 UTC (rev 915) @@ -282,10 +282,10 @@ conn.startChunkedResponse( "POST", "/chunkedServlet" ); conn.sendChunk( "This " ); conn.sendChunk( "is " ); - conn.sendChunk( "also " ); + conn.sendChunk( "also (and with a greater size) " ); conn.sendChunk( "chunked."); SocketConnection.SocketResponse response2 = conn.getResponse(); - assertEquals( "retrieved body", "This is also chunked.", new String( response2.getBody() ) ); + assertEquals( "retrieved body", "This is also (and with a greater size) chunked.", new String( response2.getBody() ) ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-15 17:51:26
|
Revision: 918 http://httpunit.svn.sourceforge.net/httpunit/?rev=918&view=rev Author: wolfgang_fahl Date: 2008-04-15 10:51:21 -0700 (Tue, 15 Apr 2008) Log Message: ----------- fix for Bug report 1212204 by Brian Bonner Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/UncheckedParameterHolder.java trunk/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java Modified: trunk/httpunit/src/com/meterware/httpunit/UncheckedParameterHolder.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/UncheckedParameterHolder.java 2008-04-15 17:37:31 UTC (rev 917) +++ trunk/httpunit/src/com/meterware/httpunit/UncheckedParameterHolder.java 2008-04-15 17:51:21 UTC (rev 918) @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * - * Copyright (c) 2002-2003, 2007, Russell Gold + * Copyright (c) 2002-2003, 2007-2008 Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -105,7 +105,7 @@ String name = (String) e.nextElement(); Object[] values = (Object[]) _parameters.get( name ); for (int i = 0; i < values.length; i++) { - if (values[i] instanceof String) { + if (values[i] instanceof String || values[i] == null) { processor.addParameter( name, (String) values[i], _characterSet ); } else if (values[i] instanceof UploadFileSpec) { processor.addFile( name, (UploadFileSpec) values[i] ); Modified: trunk/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java =================================================================== --- trunk/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java 2008-04-15 17:37:31 UTC (rev 917) +++ trunk/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java 2008-04-15 17:51:21 UTC (rev 918) @@ -209,6 +209,34 @@ } + /** + * test Bug report 1212204 + * by Brian Bonner + * @throws Exception + */ + public void testBug1212204() throws Exception { + WebRequest request = new + GetMethodWebRequest("http://localhost/pathinfo?queryString"); + //assertEquals("queryString", request.getQueryString()); + request = new + GetMethodWebRequest("http://localhost/pathinfo?queryString"); + request.setParameter("queryString",""); + assertEquals("queryString=", request.getQueryString()); + request = new + GetMethodWebRequest("http://localhost/pathinfo?queryString"); + request.setParameter("queryString",(String)null); + assertEquals("queryString", request.getQueryString()); + WebRequest wr = new + GetMethodWebRequest("http://localhost?wsdl"); + wr.setParameter("abc","def"); + wr.setParameter("def",""); + wr.setParameter("test",(String)null); + wr.setParameter("wsdl", (String)null); + + assertEquals("wsdl&abc=def&def=&test",wr.getQueryString()); + } + + public void testInlineSingleValuedParameter() throws Exception { WebRequest wr = new GetMethodWebRequest( "http://localhost/simple?color=red&color=blue&age=12" ); HttpServletRequest request = new ServletUnitHttpRequest( NULL_SERVLET_REQUEST, wr, _context, new Hashtable(), NO_MESSAGE_BODY ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-19 11:32:13
|
Revision: 929 http://httpunit.svn.sourceforge.net/httpunit/?rev=929&view=rev Author: wolfgang_fahl Date: 2008-04-19 04:32:11 -0700 (Sat, 19 Apr 2008) Log Message: ----------- test case for bug report [ 1376739 ] iframe tag not recognized if Javascript code contains '<' by Nathan Jakubiak added The supplied patch unfortunately does not work and is therefore only added as a comment Modified Paths: -------------- trunk/httpunit/doc/release_notes.html trunk/httpunit/src/com/meterware/httpunit/WebResponse.java trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-04-19 10:46:48 UTC (rev 928) +++ trunk/httpunit/doc/release_notes.html 2008-04-19 11:32:11 UTC (rev 929) @@ -395,6 +395,17 @@ <li>improved (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=921">r921</a>) </li> +<ol> + <li>formatted extraction of subversion log with links + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=922">r922</a>) + </li> + <li>PATCH proposal [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1592532&group_id=6550&atid=106550">1592532</a> ] Invalid ServletUnitServletContext#getResource(String path)<br />by Timo Westk\xE4mper<br />add as comment while waiting for a JUnit testcase to be supplied + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=927">r927</a>) + </li> + <li>test for bug report<br />[ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1232591&group_id=6550&atid=106550">1232591</a> ] getTarget() gives "_top" even if target is not present by Rifi added - no change yet + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=928">r928</a>) + </li> +</ol> </ol> <pre> 5-Jul-2007: Modified: trunk/httpunit/src/com/meterware/httpunit/WebResponse.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebResponse.java 2008-04-19 10:46:48 UTC (rev 928) +++ trunk/httpunit/src/com/meterware/httpunit/WebResponse.java 2008-04-19 11:32:11 UTC (rev 929) @@ -1435,13 +1435,22 @@ ByteTag getNextTag() throws UnsupportedEncodingException { - ByteTag byteTag; + ByteTag byteTag=null; do { - int start = _end + 1; - while (start < _buffer.length && _buffer[ start ] != '<') start++; - for (_end =start +1; _end < _buffer.length && _buffer[ _end ] != '>'; _end++); - if (_end >= _buffer.length || _end < start) return null; - byteTag = new ByteTag( _buffer, start +1, _end-start -1 ); + int _start = _end + 1; + while (_start < _buffer.length && _buffer[ _start ] != '<') _start++; + // proposed patch for bug report + // [ 1376739 ] iframe tag not recognized if Javascript code contains '<' + // by Nathan Jakubiak + // uncommented since it doesn't seem to fix the test in WebFrameTest.java + // if (_scriptDepth > 0 && _start+1 < _buffer.length && + // _buffer[ _start+1 ] != '/') { + // _end = _start+1; + // continue; + //} + for (_end =_start +1; _end < _buffer.length && _buffer[ _end ] != '>'; _end++); + if (_end >= _buffer.length || _end < _start) return null; + byteTag = new ByteTag( _buffer, _start +1, _end-_start -1 ); if (byteTag.getName().equalsIgnoreCase("script")) { _scriptDepth++; return byteTag; Modified: trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java 2008-04-19 10:46:48 UTC (rev 928) +++ trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java 2008-04-19 11:32:11 UTC (rev 929) @@ -427,6 +427,26 @@ assertNotNull( "Contents not found", contents ); assertEquals( "Number of links in iframe", 1, _wc.getFrameContents( "center" ).getLinks().length ); } + + /** + * test bug report [ 1376739 ] iframe tag not recognized if Javascript code contains '<' + * by Nathan Jakubiak + * @throws Exception + */ + public void testIFrameBug() throws Exception { + String html="\"<SCRIPT LANGUAGE=\"JavaScript\">\n"+ + "var b = 0 < 1;\n"+ + "</SCRIPT>\n"+ + "<iframe name=\"iframe_after_lessthan_in_javascript\"\n"+ + "src=\"c.html\"></iframe>"; + defineWebPage( "iframe", html); + try { + WebResponse response = _wc.getFrameContents("iframe_after_lessthan_in_javascript"); + assertTrue(response!=null); + } catch (Throwable th) { + this.warnDisabled("testIFrameBug", "patch needed for '"+th.getMessage()+"'"); + } + } /** * test I Frame with a Form according to mail to mailinglist of 2008-03-25 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-19 12:28:57
|
Revision: 933 http://httpunit.svn.sourceforge.net/httpunit/?rev=933&view=rev Author: wolfgang_fahl Date: 2008-04-19 05:28:56 -0700 (Sat, 19 Apr 2008) Log Message: ----------- test case for bug report [ 1390695 ] bad error message by Martin Olsson added and fixed to FormParameter now to throw a NoSuchParameterException instead of an UnusedUploadFileException: Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/FormParameter.java trunk/httpunit/src/com/meterware/httpunit/WebForm.java trunk/httpunit/svnlog2releasenotes.ksh trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java Modified: trunk/httpunit/src/com/meterware/httpunit/FormParameter.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-04-19 12:28:12 UTC (rev 932) +++ trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-04-19 12:28:56 UTC (rev 933) @@ -281,6 +281,12 @@ class UnusedUploadFileException extends IllegalRequestParameterException { + /** + * construct a new UnusedUploadFileException exception base on the parameter Name the number of files expected and supplied + * @param parameterName + * @param numFilesExpected + * @param numFilesSupplied + */ UnusedUploadFileException( String parameterName, int numFilesExpected, int numFilesSupplied ) { _parameterName = parameterName; _numExpected = numFilesExpected; @@ -288,6 +294,9 @@ } + /** + * get the message for this exception + */ public String getMessage() { StringBuffer sb = new StringBuffer( HttpUnitUtils.DEFAULT_TEXT_BUFFER_SIZE ); sb.append( "Attempted to upload " ).append( _numSupplied ).append( " files using parameter '" ).append( _parameterName ); Modified: trunk/httpunit/src/com/meterware/httpunit/WebForm.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-04-19 12:28:12 UTC (rev 932) +++ trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-04-19 12:28:56 UTC (rev 933) @@ -638,8 +638,9 @@ **/ public void setParameter( String name, UploadFileSpec[] files ) { FormParameter parameter = getParameter( name ); - if (parameter == null) throw new NoSuchParameterException( name ); - parameter.setFiles( files ); + if ((parameter == null) || (!parameter.isFileParameter())) + throw new NoSuchParameterException( name ); + parameter.setFiles( files ); } Modified: trunk/httpunit/svnlog2releasenotes.ksh =================================================================== --- trunk/httpunit/svnlog2releasenotes.ksh 2008-04-19 12:28:12 UTC (rev 932) +++ trunk/httpunit/svnlog2releasenotes.ksh 2008-04-19 12:28:56 UTC (rev 933) @@ -89,8 +89,9 @@ print "<ol>" repositorylink="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=" baselink="http://sourceforge.net/tracker/index.php?func=detail" - buglink ="&group_id=6550&atid=106550" - patchlink="&group_id=6550&atid=306550" + buglink ="&group_id=6550&atid=106550" + supportlink="&group_id=6550&atid=206550" + patchlink ="&group_id=6550&atid=306550" for (rev in text) { current=text[rev] # look for bug report or patch number - must have 6 digits + @@ -102,10 +103,12 @@ # patch or bug? if (match(current,"[p|P]atch")) { postfix=patchlink - # replace number with link to sourceforge tracker + } else if (match(current,"SR")) { + postfix=supportlink } else { postfix=buglink } + # replace number with link to sourceforge tracker link=sprintf("<a href=%s%s&aid=%s%s%s>%s</a>",quote,baselink,linkno,postfix,quote,linkno); current=substr(current,1,rs-1) link substr(current,rs+rl,length(current)) } Modified: trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java 2008-04-19 12:28:12 UTC (rev 932) +++ trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java 2008-04-19 12:28:56 UTC (rev 933) @@ -24,6 +24,8 @@ import java.io.File; +import com.meterware.httpunit.FormParameter.UnusedUploadFileException; +import com.meterware.httpunit.WebForm.NoSuchParameterException; import com.meterware.httpunit.controls.IllegalParameterValueException; import com.meterware.httpunit.protocol.UploadFileSpec; @@ -571,6 +573,33 @@ assertEquals( "File from unvalidated request", file.getAbsolutePath(), wr.getParameterValues( "File" )[0] ); } + /** + * test for bug report [ 1390695 ] bad error message + * by Martin Olsson + */ + public void testUnusedUploadFileException() throws Exception { + defineWebPage( "Default", "<form method=POST action='/ask'>" + + "<Input type=file name=correct_field_name>" + + "<Input type=submit value=Upload></form>" ); + WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); + WebForm form = page.getForms()[0]; + try { + // purposely try to set a non existing file name + form.setParameter("wrong_field_name", new File("exists.txt")); + fail("There should have been an exception"); + } catch (NoSuchParameterException npe) { + String msg=npe.getMessage(); + String expected="No parameter named 'wrong_field_name' is defined in the form"; + assertTrue(msg.equals(expected)); + } catch (UnusedUploadFileException ufe) { + String msg=ufe.getMessage(); + // this is the pre 1.7 behaviour + String expected="Attempted to upload 1 files using parameter 'null' which is not a file parameter."; + assertTrue(msg.equals(expected)); + System.err.println(msg); + fail("in 1.7 bug 1390695 should be fixed"); + } + } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-19 15:11:33
|
Revision: 937 http://httpunit.svn.sourceforge.net/httpunit/?rev=937&view=rev Author: wolfgang_fahl Date: 2008-04-19 08:11:31 -0700 (Sat, 19 Apr 2008) Log Message: ----------- added test case for bug report [ 1510582 ] setParameter fails with <input type="file"> by Julien Henry and changed the behaviour of setparameter that a more developer friendly exception with a hopefully better understandable message is thrown to point out that file parameters need a parameter of type java.io.File when being set Modified Paths: -------------- trunk/httpunit/doc/release_notes.html trunk/httpunit/src/com/meterware/httpunit/FormControl.java trunk/httpunit/src/com/meterware/httpunit/FormParameter.java trunk/httpunit/src/com/meterware/httpunit/WebForm.java trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-04-19 14:26:50 UTC (rev 936) +++ trunk/httpunit/doc/release_notes.html 2008-04-19 15:11:31 UTC (rev 937) @@ -1,5 +1,5 @@ <html> -<head></head> +<head><title>httpunit 1.7 release notes</title></head> <body> <pre> HttpUnit release notes Modified: trunk/httpunit/src/com/meterware/httpunit/FormControl.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-04-19 14:26:50 UTC (rev 936) +++ trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-04-19 15:11:31 UTC (rev 937) @@ -891,8 +891,15 @@ } +/** + * a control for File submit + */ class FileSubmitFormControl extends FormControl { + /** + * accessor for the type + * @return the constant FILE_TYPE + */ public String getType() { return FILE_TYPE; } Modified: trunk/httpunit/src/com/meterware/httpunit/FormParameter.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-04-19 14:26:50 UTC (rev 936) +++ trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-04-19 15:11:31 UTC (rev 937) @@ -250,15 +250,25 @@ /** * This exception is thrown on an attempt to set a parameter to a value not permitted to it by the form. **/ - class UnusedParameterValueException extends IllegalRequestParameterException { + public class UnusedParameterValueException extends IllegalRequestParameterException { - + + /** + * construct an exception for an unused parameter with the given name + * and the value that is bad + * @param parameterName + * @param badValue + */ UnusedParameterValueException( String parameterName, String badValue ) { _parameterName = parameterName; _badValue = badValue; } - + + /** + * get the message for this exception + * @return the message + */ public String getMessage() { StringBuffer sb = new StringBuffer(HttpUnitUtils.DEFAULT_TEXT_BUFFER_SIZE); sb.append( "Attempted to assign to parameter '" ).append( _parameterName ); Modified: trunk/httpunit/src/com/meterware/httpunit/WebForm.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-04-19 14:26:50 UTC (rev 936) +++ trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-04-19 15:11:31 UTC (rev 937) @@ -610,15 +610,17 @@ * Removes a parameter name from this collection. **/ public void removeParameter( String name ) { - setParameter( name, NO_VALUES ); + setParameter( name, NO_VALUES ); } /** * Sets the value of a parameter in this form. + * @param name - the name of the parameter + * @param value - the value of the parameter **/ public void setParameter( String name, String value ) { - setParameter( name, new String[] { value } ); + setParameter( name, new String[] { value } ); } @@ -627,8 +629,11 @@ * controls with the same name in the form. */ public void setParameter( String name, final String[] values ) { - FormParameter parameter = getParameter( name ); + FormParameter parameter = getParameter( name ); if (parameter == UNKNOWN_PARAMETER) throw new NoSuchParameterException( name ); + if (parameter.isFileParameter()) { + throw new InvalidFileParameterException(name,values); + } parameter.setValues( values ); } @@ -954,7 +959,42 @@ //===========================---===== exception class NoSuchParameterException ========================================= + /** + * This exception is thrown on an attempt to set a file parameter to a non file type + **/ + class InvalidFileParameterException extends IllegalRequestParameterException { + + /** + * construct a new InvalidFileParameterException for the given parameter name and value list + * @param parameterName + * @param values + */ + InvalidFileParameterException( String parameterName, String[] values ) { + _parameterName = parameterName; + _values=values; + } + + + /** + * get the message for this exception + */ + public String getMessage() { + String valueList=""; + String delim=""; + for (int i=0;i<_values.length;i++) { + valueList+=delim+"'"+_values[i]+"'"; + delim=", "; + } + String msg="The file parameter with the name '"+_parameterName+"' must have type File but the string values "+valueList+" where supplied"; + return msg; + } + + + private String _parameterName; + private String[] _values; + } + /** * This exception is thrown on an attempt to set a parameter to a value not permitted to it by the form. **/ Modified: trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java 2008-04-19 14:26:50 UTC (rev 936) +++ trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java 2008-04-19 15:11:31 UTC (rev 937) @@ -24,7 +24,9 @@ import java.io.File; +import com.meterware.httpunit.FormParameter.UnusedParameterValueException; import com.meterware.httpunit.FormParameter.UnusedUploadFileException; +import com.meterware.httpunit.WebForm.InvalidFileParameterException; import com.meterware.httpunit.WebForm.NoSuchParameterException; import com.meterware.httpunit.controls.IllegalParameterValueException; import com.meterware.httpunit.protocol.UploadFileSpec; @@ -623,8 +625,40 @@ assertTrue(foundURL.equals(expected)); } } - /** + * test for bug report + * [ 1510582 ] setParameter fails with <input type="file"> + * by Julien HENRY + */ + public void testUnusedParameterExceptionForFileParamWithStringValue() throws Exception { + defineWebPage( "Default", "<form method=POST action='/ask'>" + + "<Input type=file name=\"file1\">" + + "<Input type=file name=\"file2\">" + + "<Input type=submit value=Upload></form>" ); + WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); + WebForm form = page.getForms()[0]; + try { + // this works with no exception + form.setParameter("file1", new File("/tmp/test.txt")); + // this doesn't + form.setParameter("file2", "/tmp/test.txt"); + fail("There should have been an exception"); + } catch (UnusedParameterValueException upe) { + String msg=upe.getMessage(); + // this is the pre 1.7 behaviour + String expected="Attempted to assign to parameter 'file2' the extraneous value '/tmp/test.txt'."; + System.err.println(msg); + assertTrue("exception message is not as expected",msg.equals(expected)); + fail("in 1.7 bug 1510582 should be fixed"); + } catch (InvalidFileParameterException ipe) { + String msg=ipe.getMessage(); + String expected="The file parameter with the name 'file2' must have type File but the string values '/tmp/test.txt' where supplied"; + // System.err.println(msg); + assertTrue("InvalidFileParameterException message is not as expected",msg.equals(expected)); + } + + } + /** * test for bug report [ 1390695 ] bad error message * by Martin Olsson */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-23 05:43:22
|
Revision: 942 http://httpunit.svn.sourceforge.net/httpunit/?rev=942&view=rev Author: wolfgang_fahl Date: 2008-04-22 22:43:20 -0700 (Tue, 22 Apr 2008) Log Message: ----------- jars added to subversion repository Modified Paths: -------------- trunk/httpunit/build.xml Added Paths: ----------- trunk/httpunit/lib/ trunk/httpunit/lib/httpunit.jar Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-04-23 05:41:41 UTC (rev 941) +++ trunk/httpunit/build.xml 2008-04-23 05:43:20 UTC (rev 942) @@ -69,8 +69,6 @@ </path> - - <!-- =================================================================== --> <!-- Prepares the build directory --> <!-- =================================================================== --> @@ -260,10 +258,16 @@ Build-Time: ${TSTAMP} Revision: ${revision} </echo> + <!-- compressed default jar file --> <jar jarfile="${lib.dir}/${name}.jar" manifest="${build.dir}/info.txt"> <fileset dir="${build.classes}" includes="com/**"/> <fileset dir="META-INF" includes="*.dtd"/> </jar> + <!-- non compressed default jar file --> + <jar jarfile="${lib.dir}/${name}_uncompressed.jar" manifest="${build.dir}/info.txt" compress="false" > + <fileset dir="${build.classes}" includes="com/**"/> + <fileset dir="META-INF" includes="*.dtd"/> + </jar> </target> Added: trunk/httpunit/lib/httpunit.jar =================================================================== (Binary files differ) Property changes on: trunk/httpunit/lib/httpunit.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-30 05:49:12
|
Revision: 946 http://httpunit.svn.sourceforge.net/httpunit/?rev=946&view=rev Author: wolfgang_fahl Date: 2008-04-29 22:49:08 -0700 (Tue, 29 Apr 2008) Log Message: ----------- bug report [ 1283878 ] FileNotFoundException using Sun JDK 1.5 on empty error pages by Roger Lindsj?\195?\182 checked with his test case and fixed with his patch proposal Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/HttpWebResponse.java trunk/httpunit/test/com/meterware/httpunit/WebClientTest.java Modified: trunk/httpunit/src/com/meterware/httpunit/HttpWebResponse.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HttpWebResponse.java 2008-04-29 17:44:37 UTC (rev 945) +++ trunk/httpunit/src/com/meterware/httpunit/HttpWebResponse.java 2008-04-30 05:49:08 UTC (rev 946) @@ -20,6 +20,7 @@ * *******************************************************************************************************************/ import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -70,15 +71,53 @@ + /** + * get the input stream for the given connection + * @param connection + * @return + * @throws IOException + */ private InputStream getInputStream( URLConnection connection ) throws IOException { - return isResponseOnErrorStream( connection ) - ? ((HttpURLConnection) connection).getErrorStream() - : connection.getInputStream(); + InputStream result=null; + // check whether there is an error stream + if (isResponseOnErrorStream( connection )) { + result=((HttpURLConnection) connection).getErrorStream(); + } else { + // if there is no error stream it depends on the response code + try { + result=connection.getInputStream(); + } catch (java.io.FileNotFoundException fnfe) { + // as of JDK 1.5 a null inputstream might have been returned here + // see bug report [ 1283878 ] FileNotFoundException using Sun JDK 1.5 on empty error pages + // by Roger Lindsj\xF6 + if (isErrorResponse(connection)) { + // fake an empty error stream + result=new ByteArrayInputStream(new byte[0]); + } else { + throw fnfe; + } + } + } + return result; } + /** + * check whether a response code >=400 was received + * @param connection + * @return + */ + private boolean isErrorResponse(URLConnection connection ) { + return _responseCode >= HttpURLConnection.HTTP_BAD_REQUEST; + } + + /** + * check whether the response is on the error stream + * @param connection + * @return + */ private boolean isResponseOnErrorStream( URLConnection connection ) { - return _responseCode >= HttpURLConnection.HTTP_BAD_REQUEST && ((HttpURLConnection) connection).getErrorStream() != null; + return isErrorResponse(connection) && ((HttpURLConnection) connection).getErrorStream() != null; } Modified: trunk/httpunit/test/com/meterware/httpunit/WebClientTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebClientTest.java 2008-04-29 17:44:37 UTC (rev 945) +++ trunk/httpunit/test/com/meterware/httpunit/WebClientTest.java 2008-04-30 05:49:08 UTC (rev 946) @@ -738,6 +738,31 @@ } } + /** + * test for bug report [ 1283878 ] FileNotFoundException using Sun JDK 1.5 on empty error pages + * by Roger Lindsj\xF6 + * @throws Exception + */ + public void testEmptyErrorPage() throws Exception { + boolean originalState = + HttpUnitOptions.getExceptionsThrownOnErrorStatus(); + HttpUnitOptions.setExceptionsThrownOnErrorStatus( false ); + + try { + WebConversation wc = new WebConversation(); + defineResource( "emptyError", "", 404); + WebRequest request = new GetMethodWebRequest( getHostPath() +"/emptyError" ); + WebResponse response = wc.getResponse( request ); + assertEquals( 404, response.getResponseCode() ); + assertEquals( 0, response.getContentLength() ); + } catch (java.io.FileNotFoundException fnfe) { + fnfe.printStackTrace(); + assertTrue("There should be not file not found exception '"+fnfe.getMessage()+"'",false); + } finally { + // Restore exceptions state + HttpUnitOptions.setExceptionsThrownOnErrorStatus(originalState ); + } + } /** * test GZIP begin disabled This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-04-30 13:47:01
|
Revision: 948 http://httpunit.svn.sourceforge.net/httpunit/?rev=948&view=rev Author: wolfgang_fahl Date: 2008-04-30 06:46:58 -0700 (Wed, 30 Apr 2008) Log Message: ----------- for bug report [ 1156972 ] isWebLink doesn't recognize all anchor tags by fregienj it's decided to later implement getAnchors - testcase changed to mirror this decision and comments adapted Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java Modified: trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java 2008-04-30 05:54:54 UTC (rev 947) +++ trunk/httpunit/src/com/meterware/httpunit/ParsedHTML.java 2008-04-30 13:46:58 UTC (rev 948) @@ -809,13 +809,15 @@ /* * Bug report [ 1156972 ] isWebLink doesn't recognize all anchor tags * by fregienj claims this be changed to check whether the case-insensitive node name is "A" + * -> should be isAnchor method and getAnchor */ boolean result=false; String tagName = ((Element) node).getTagName(); if (!tagName.equalsIgnoreCase( "area" ) && !tagName.equalsIgnoreCase( "a")) { } else { - // pre 1.7 code - result=(node.getAttributes().getNamedItem( "href" ) != null); + // pre 1.7 code - still active + result=(node.getAttributes().getNamedItem( "href" ) != null); + // proposed patch - not activated // result=true; } return result; Modified: trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java 2008-04-30 05:54:54 UTC (rev 947) +++ trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java 2008-04-30 13:46:58 UTC (rev 948) @@ -83,12 +83,15 @@ WebConversation wc = new WebConversation(); WebResponse response=wc.getResponse( getHostPath() + "/NonHref.html" ); WebLink[] links = response.getLinks(); + // TODO implement and test this + // WebLink[] links = response.getAnchors(); assertNotNull( links ); - this.warnDisabled("testFindNonHrefLinks()","pending decision for bug report [ 1156972 ] -> does an <a> node to have href to be considered a link?"); - boolean decided=false; + boolean decided=true; if (decided) { - assertEquals( 1, links.length ); - } + assertEquals( 0, links.length ); + } else { + this.warnDisabled("testFindNonHrefLinks()","pending decision for bug report [ 1156972 ] -> does an <a> node to have href to be considered a link?"); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-02 16:01:37
|
Revision: 952 http://httpunit.svn.sourceforge.net/httpunit/?rev=952&view=rev Author: wolfgang_fahl Date: 2008-05-02 09:01:23 -0700 (Fri, 02 May 2008) Log Message: ----------- new Example using GoogleMaps Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/FormControl.java trunk/httpunit/src/com/meterware/httpunit/FormParameter.java trunk/httpunit/src/com/meterware/httpunit/WebForm.java Added Paths: ----------- trunk/httpunit/examples/GoogleMapsExample.java Added: trunk/httpunit/examples/GoogleMapsExample.java =================================================================== --- trunk/httpunit/examples/GoogleMapsExample.java (rev 0) +++ trunk/httpunit/examples/GoogleMapsExample.java 2008-05-02 16:01:23 UTC (rev 952) @@ -0,0 +1,245 @@ +/******************************************************************************************************************** + * $Id: Cookie.java 859 2008-03-31 10:17:30Z wolfgang_fahl $ + * + * Copyright (c) 2008, Wolfgang Fahl, BITPlan GmbH (http://www.bitplan.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.StringReader; +import java.io.Writer; +import java.util.StringTokenizer; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.apache.xml.serialize.DOMSerializer; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.XMLSerializer; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +import com.meterware.httpunit.*; +/** + * get a Route from Google Maps and convert it as a GPX file + * useable by Garmin tracking devices - can be imported in MapSource software then ... + * + */ +public class GoogleMapsExample { + + /** + * shall we show debug information? + */ + private boolean DEBUG=true; + + /** + * get a Route description as a Garmin compatible GPX file + * @param startPoint + * @param destPoint + */ + public void getRouteAsGPX(String startPoint,String destPoint, String filename,boolean withDisplay) throws Exception { + String kml=getRouteFromGoogleMaps(startPoint,destPoint,withDisplay); + if (DEBUG) { + System.out.println(kml); + } + // http://wiki.openstreetmap.org/index.php/JOSM + // here is a so called open source kml to gpx converter + // http://www.fish-track.com/?page_id=3 + Document gpxdoc=convertKMLtoGPX(kml); + // output the result + xmlSerialize(gpxdoc,filename); + } + + /** + * create the xml output for the given document + * @param document + * @param filename + * @throws Exception + */ + public void xmlSerialize(Document document,String filename) throws Exception { + OutputFormat outputOptions = new OutputFormat(); + // outputOptions.setOmitXMLDeclaration(true); + outputOptions.setIndent( 4 ); + outputOptions.setMethod( "xml" ); + //if (System.getProperty("os.name").startsWith("Windows")) { + outputOptions.setEncoding("ISO-8859-1"); + Writer writer = new BufferedWriter(new FileWriter(new File(filename))); + DOMSerializer serializer = new XMLSerializer( writer,outputOptions ); + serializer.serialize( document ); + writer.close(); + } + + /** + * get the subnode with the given tagname + * @param parent + * @param tagName + * @return + */ + public Element getSubNode(Element parent,String tagName, boolean throwException) { + NodeList subNodes=parent.getElementsByTagName(tagName); + if (subNodes.getLength()!=1) { + if (throwException) + throw new RuntimeException("getSubNode failed for "+parent+" expected 1 child with tag name '"+tagName+"' but got "+subNodes.getLength()); + else + return null; + } + return (Element)subNodes.item(0); + } + + /** + * get the latitude and longitude from a route point + * @param kmlRoutePoint + * @return + */ + public String[] extractCoordinates(Element kmlRoutePoint) { + String[] result=new String[2]; + Element point=getSubNode(kmlRoutePoint,"Point",false); + if (point==null) + return null; + Element coordNode=getSubNode(point,"coordinates",true); + String coords=coordNode.getTextContent(); + StringTokenizer coordSplitter=new StringTokenizer(coords,",",false); + if (coordSplitter.countTokens()<=2) { + throw new RuntimeException("extract coordinates failed for "+kmlRoutePoint+" expected at least two coordinates but got "+coordSplitter.countTokens()+" '"+coords+"'"); + } + result[0]=coordSplitter.nextToken(); + result[1]=coordSplitter.nextToken(); + return result; + } + + /** + * convert the given kml file to gpx format + * @param kml - the kml version of the file + * @return + */ + public Document convertKMLtoGPX(String kml) throws Exception { + DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); + DocumentBuilder builder= factory.newDocumentBuilder(); + Document kmldoc = builder.parse(new InputSource(new StringReader(kml)) ); + Document gpxdoc = builder.newDocument(); + String comment="Converted by httpunit GoogleMapsExample"; + gpxdoc.appendChild(gpxdoc.createComment(comment)); + + org.w3c.dom.Element root = gpxdoc.createElement("gpx"); + root.setAttribute("xmlns", "http://www.topografix.com/GPX/1/1"); + root.setAttribute("creator","KML2GPX Example by BITPlan"); + root.setAttribute("version","1.1"); + gpxdoc.appendChild(root); + + org.w3c.dom.Element metadata = gpxdoc.createElement("metadata"); + org.w3c.dom.Element metadatalink = gpxdoc.createElement("link"); + metadatalink.setAttribute("href","http://www.bitplan.com"); + metadata.appendChild(metadatalink); + org.w3c.dom.Element metadatatext = gpxdoc.createElement("text"); + metadatatext.setTextContent("BITPlan GmbH, Willich, Germany"); + metadatalink.appendChild(metadatatext); + root.appendChild(metadata); + + org.w3c.dom.Element route = gpxdoc.createElement("rte"); + root.appendChild(route); + NodeList routePoints=kmldoc.getElementsByTagName("Placemark"); + for (int i=0;i<routePoints.getLength();i++) { + Element kmlRoutePoint=(Element)routePoints.item(i); + String name=getSubNode(kmlRoutePoint,"name",true).getTextContent(); + if (DEBUG) + System.out.println("found route point "+i+": "+name); + + String coords[]=extractCoordinates(kmlRoutePoint); + if (coords!=null) { + org.w3c.dom.Element routePoint = gpxdoc.createElement("rtept"); + routePoint.setAttribute("lon", coords[0] ); + routePoint.setAttribute("lat", coords[1] ); + org.w3c.dom.Element routePointName=gpxdoc.createElement("name"); + routePointName.setTextContent(name); + routePoint.appendChild(routePointName); + route.appendChild(routePoint); + } + } + return gpxdoc; + } + + /** + * get a route from google maps with the given start and destination points + * @param startPoint + * @param destPoint + * @param withDisplay + */ + public String getRouteFromGoogleMaps(String startPoint,String destPoint, boolean withDisplay) throws Exception { + // direct call first + String url="http://maps.google.com/maps"; + // and now indirectly + // create the conversation object which will maintain state for us + WebConversation wc = new WebConversation(); + + // Obtain the main page on the meterware web site + WebRequest request = new GetMethodWebRequest( url); + request.setParameter("output", "html"); + WebResponse response = wc.getResponse( request ); + if (withDisplay && DEBUG) + BrowserDisplayer.showResponseInBrowser(response); + + // find the link which contains the string "HttpUnit" and click it + WebLink httpunitLink = response.getFirstMatchingLink( WebLink.MATCH_CONTAINED_TEXT, "directions" ); + response = httpunitLink.click(); + if (withDisplay && DEBUG) + BrowserDisplayer.showResponseInBrowser(response); + WebForm lookupForm = response.getFormWithID("d_form"); + request = lookupForm.getRequest(); + request.setParameter( "saddr", startPoint ); + request.setParameter( "daddr", destPoint ); + response = wc.getResponse( request ); + if (withDisplay) + BrowserDisplayer.showResponseInBrowser(response); + // request.setParameter("output", "kml"); + FormParameter parameter = lookupForm.getParameter( "output" ); + FormControl outputControl=parameter.getControl(); + outputControl.setAttribute("value", "kml"); + response = wc.getResponse( request ); + if (withDisplay && DEBUG) + BrowserDisplayer.showResponseInBrowser(response); + return (response.getText()); + } + + /** + * Start the Route as GPX converter with the given command line parameters + * display usage with and example if no parameters are given + * @param params + */ + public static void main( String[] params ) { + try { + if (params.length < 3) { + System.out.println( "Usage: java RouteAsGPX [from] [to] [filename] [nodisplay]" ); + System.out.println( ""); + String[] defaultParams={"sfo","94526","sfoexample.gpx"}; + params=defaultParams; + System.out.println( "will demonstrate usage with the route "+defaultParams[0]+" - "+defaultParams[1]+" and store to "+defaultParams[2]); + } + GoogleMapsExample routeAsGPX=new GoogleMapsExample(); + boolean withDisplay=true; + if (params.length>=4) + withDisplay=false; + routeAsGPX.getRouteAsGPX(params[0], params[1], params[2],withDisplay); + + } catch (Exception e) { + System.err.println( "Exception: " + e ); + e.printStackTrace(); + } + } +} Modified: trunk/httpunit/src/com/meterware/httpunit/FormControl.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-05-02 10:11:40 UTC (rev 951) +++ trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-05-02 16:01:23 UTC (rev 952) @@ -162,7 +162,7 @@ /** * Returns true if this control is hidden. **/ - boolean isHidden() { + public boolean isHidden() { return false; } @@ -365,6 +365,12 @@ } + /** + * return the FormControl for the given parameter node in a form + * @param form - the form in which the parameter is defined + * @param node - the node in which the parameter is defined + * @return the form control + */ static FormControl newFormParameter( WebForm form, Node node ) { if (node.getNodeType() != Node.ELEMENT_NODE) { return null; @@ -834,6 +840,9 @@ } } +/** + * a hidden text field + */ class HiddenFieldFormControl extends TextFieldFormControl { public String getType() { @@ -854,7 +863,7 @@ } - boolean isHidden() { + public boolean isHidden() { return true; } } Modified: trunk/httpunit/src/com/meterware/httpunit/FormParameter.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-05-02 10:11:40 UTC (rev 951) +++ trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-05-02 16:01:23 UTC (rev 952) @@ -33,7 +33,7 @@ * * @author <a href="mailto:rus...@ht...">Russell Gold</a> **/ -class FormParameter { +public class FormParameter { private FormControl[] _controls; @@ -54,10 +54,27 @@ } - private FormControl[] getControls() { + /** + * get the controls for this form Parameter + * @return + */ + public FormControl[] getControls() { if (_controls == null) _controls = (FormControl[]) _controlList.toArray( new FormControl[ _controlList.size() ] ); return _controls; } + + /** + * get the control for this form Parameter (assuming it + * has only one as for a text control + * @return + */ + public FormControl getControl() { + FormControl[] controls=getControls(); + if (controls.length!=1) { + throw new RuntimeException("getControl can only be called if the number of controls is 1 but it is "+controls.length+" you might want to use getControls instead"); + } + return controls[0]; + } Object getScriptableObject() { @@ -225,7 +242,7 @@ return true; } - + public boolean isHiddenParameter() { FormControl[] controls = getControls(); for (int i = 0; i < controls.length; i++) { Modified: trunk/httpunit/src/com/meterware/httpunit/WebForm.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-05-02 10:11:40 UTC (rev 951) +++ trunk/httpunit/src/com/meterware/httpunit/WebForm.java 2008-05-02 16:01:23 UTC (rev 952) @@ -916,7 +916,12 @@ } - private FormParameter getParameter( String name ) { + /** + * get the form parameter with the given name + * @param name + * @return the form parameter with this name + */ + public FormParameter getParameter( String name ) { final FormParameter parameter = ((FormParameter) getFormParameters().get( name )); return parameter != null ? parameter : UNKNOWN_PARAMETER; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 08:58:30
|
Revision: 956 http://httpunit.svn.sourceforge.net/httpunit/?rev=956&view=rev Author: wolfgang_fahl Date: 2008-05-13 01:58:23 -0700 (Tue, 13 May 2008) Log Message: ----------- bug report [ 1954311 ] WebForm.setParameter throws NullPointerException on textarea by Matthew O. Smith fixed Modified Paths: -------------- trunk/httpunit/src/com/meterware/httpunit/FormControl.java trunk/httpunit/test/com/meterware/httpunit/WebFormTest.java Modified: trunk/httpunit/src/com/meterware/httpunit/FormControl.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-05-12 17:15:05 UTC (rev 955) +++ trunk/httpunit/src/com/meterware/httpunit/FormControl.java 2008-05-13 08:58:23 UTC (rev 956) @@ -760,7 +760,10 @@ setValue( (String) values.get(0) ); values.remove(0); } - if (!(oldValue.equals( getValue() ))) sendOnChangeEvent(); + boolean same=oldValue==null && getValue()==null; + if (oldValue!=null) + same=oldValue.equals( getValue()); + if (!same) sendOnChangeEvent(); } Modified: trunk/httpunit/test/com/meterware/httpunit/WebFormTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebFormTest.java 2008-05-12 17:15:05 UTC (rev 955) +++ trunk/httpunit/test/com/meterware/httpunit/WebFormTest.java 2008-05-13 08:58:23 UTC (rev 956) @@ -302,7 +302,36 @@ assertEquals( "", request.getParameter( "typeless" ) ); } + /** + * [ httpunit-Bugs-1954311 ] Set the value of a text area. Currently fails + * if the textarea is empty to begin with. + * by m0smith + * + * @throws Exception on failure + */ + public void testTextArea() throws Exception { + String fieldName = "comments"; + String comment = "My what a lovely dress that is"; + // Setting defaultValue to something other than an empty string makes + // this test case pass. + String defaultValue = ""; + defineWebPage("Default", "<form method=POST action = \"/servlet/Login\">" + "<textarea name='" + fieldName + + "' row='10' cols='20'>" + defaultValue + "</textarea>" + + "<br><Input type=submit value = \"Submit\">" + + "</form>"); + + WebResponse page = _wc.getResponse(getHostPath() +"/Default.html"); + WebForm form = page.getForms()[0]; + form.setParameter(fieldName, comment); // THIS LINE FAILS + + assertEquals(1, form.getParameterNames().length); + + WebRequest request = form.getRequest(); + assertEquals(comment, request.getParameter(fieldName)); + + } + public void testTableForm() throws Exception { defineWebPage( "Default", "<form method=POST action = \"/servlet/Login\">" + "<table summary=\"\"><tr><td>" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 09:06:23
|
Revision: 957 http://httpunit.svn.sourceforge.net/httpunit/?rev=957&view=rev Author: wolfgang_fahl Date: 2008-05-13 02:06:21 -0700 (Tue, 13 May 2008) Log Message: ----------- not for release notes: jar rebuild and release notes update Modified Paths: -------------- trunk/httpunit/doc/release_notes.html trunk/httpunit/lib/httpunit.jar trunk/httpunit/lib/httpunit_uncompressed.jar Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-05-13 08:58:23 UTC (rev 956) +++ trunk/httpunit/doc/release_notes.html 2008-05-13 09:06:21 UTC (rev 957) @@ -116,6 +116,9 @@ The following list of changes has been extracted from this subversion log with patch and subversion repository links being inserted. <ol> + <li>bug report [ <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1954311&group_id=6550&atid=106550">1954311</a> ] WebForm.setParameter throws NullPointerException on textarea by Matthew O. Smith fixed + (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=956">r956</a>) + </li> <li>patch <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=884146&group_id=6550&atid=306550">884146</a> + refactoring around handling events (<a href="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=839">r839</a>) </li> Modified: trunk/httpunit/lib/httpunit.jar =================================================================== (Binary files differ) Modified: trunk/httpunit/lib/httpunit_uncompressed.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 09:33:30
|
Revision: 960 http://httpunit.svn.sourceforge.net/httpunit/?rev=960&view=rev Author: wolfgang_fahl Date: 2008-05-13 02:33:27 -0700 (Tue, 13 May 2008) Log Message: ----------- Feature Request [1956293 ] Add getClient to WebResponse by Matthew O. Smith Modified Paths: -------------- trunk/httpunit/lib/httpunit.jar trunk/httpunit/lib/httpunit_uncompressed.jar trunk/httpunit/src/com/meterware/httpunit/FormParameter.java trunk/httpunit/src/com/meterware/httpunit/WebResponse.java Modified: trunk/httpunit/lib/httpunit.jar =================================================================== (Binary files differ) Modified: trunk/httpunit/lib/httpunit_uncompressed.jar =================================================================== (Binary files differ) Modified: trunk/httpunit/src/com/meterware/httpunit/FormParameter.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-05-13 09:28:41 UTC (rev 959) +++ trunk/httpunit/src/com/meterware/httpunit/FormParameter.java 2008-05-13 09:33:27 UTC (rev 960) @@ -56,7 +56,7 @@ /** * get the controls for this form Parameter - * @return + * @return the controls */ public FormControl[] getControls() { if (_controls == null) _controls = (FormControl[]) _controlList.toArray( new FormControl[ _controlList.size() ] ); @@ -66,7 +66,7 @@ /** * get the control for this form Parameter (assuming it * has only one as for a text control - * @return + * @return the controls */ public FormControl getControl() { FormControl[] controls=getControls(); Modified: trunk/httpunit/src/com/meterware/httpunit/WebResponse.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebResponse.java 2008-05-13 09:28:41 UTC (rev 959) +++ trunk/httpunit/src/com/meterware/httpunit/WebResponse.java 2008-05-13 09:33:27 UTC (rev 960) @@ -1061,6 +1061,14 @@ private final URL _pageURL; private final WebClient _client; + /** + * getter for the WebClient + * @since 1.7 + * @return the web client for this WebResponse (if any) + */ + public WebClient getClient() { + return _client; + } private ScriptingHandler _scriptingHandler; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-13 10:02:41
|
Revision: 961 http://httpunit.svn.sourceforge.net/httpunit/?rev=961&view=rev Author: wolfgang_fahl Date: 2008-05-13 03:02:39 -0700 (Tue, 13 May 2008) Log Message: ----------- Test for bug report [ 1286018 ] EcmaError in seemingly valid function by Stephane Mikaty Modified Paths: -------------- trunk/httpunit/build.xml trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-05-13 09:33:27 UTC (rev 960) +++ trunk/httpunit/build.xml 2008-05-13 10:02:39 UTC (rev 961) @@ -213,6 +213,11 @@ <exclude name="**/javascript/*" unless="rhino.present" /> <exclude name="**/JUnitServletTest.java" unless="junit.present" /> </javac> + <copy todir="${test.classes}"> + <fileset dir="${tstsrc.dir}"> + <include name="**/*.html"/> + </fileset> + </copy> </target> Modified: trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java 2008-05-13 09:33:27 UTC (rev 960) +++ trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java 2008-05-13 10:02:39 UTC (rev 961) @@ -21,12 +21,20 @@ *******************************************************************************************************************/ import com.meterware.httpunit.*; +import junit.framework.Assert; import junit.framework.TestSuite; import junit.textui.TestRunner; +import java.net.URL; +import java.net.URLConnection; import java.util.ArrayList; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + + /** * @author <a href="mailto:rus...@ht...">Russell Gold</a> * @author Wolfgang Fahl - for compiling patches from the Source Forge web site 2008-03 @@ -1386,6 +1394,76 @@ HttpUnitOptions.reset(); } // for optimizationLevel } + /** + * bug report [ 1286018 ] EcmaError in seemingly valid function + * by Stephane Mikaty + * @throws Exception + */ + public void testArgumentsProperty() throws Exception { + if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { + warnDisabled("testArgumentsProperty","not fixed for old javascript engine"); + return; + } + new ScriptingTestHelper("../html/testArgumentsProperty.html").run(); + } + + /** + * Helper class to define a whole scripting test in a single html file. + * This avoids the need to create a large Java escaped string, which + * obfuscates the purpose of the test. + * + * The test if given the name of an HTML resource at construction time. + * The resource is expected to be in the same package as {@link ScriptingTest}. + * Inside the HTML resource, two div elements are required: + * <ol> + * <li>a div with id "expected" + * <li>a div with id "actual" + * <ol> + * The test is expected to have run by the time the document is loaded, and + * passes if the actual div and the expected div have the same content. + * + * The simplest to achieve this is to ensure that the HTML resource contains + * an onload instruction that exercises the functionality under test. + */ + public class ScriptingTestHelper extends Assert { + + /** + * Name of the HTML resource containing the test in this package. + */ + private final String htmlResource; + + /** + * constructor for this helper test + * @param anHtmlResource + */ + ScriptingTestHelper(String anHtmlResource) { + this.htmlResource = anHtmlResource; + } + + /** + * run this Assertion + * @throws Exception + */ + void run() throws Exception { + URL url = getClass().getResource(htmlResource); + URLConnection conn = url.openConnection(); + String contentType = conn.getContentType(); + byte[] data = new byte[conn.getContentLength()]; + conn.getInputStream().read(data); + defineResource( "OnCommand.html", data, contentType ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + Document doc=response.getDOM(); + Node expected=doc.getElementById("expected").getFirstChild(); + Node actual =doc.getElementById("actual").getFirstChild(); + assertNotNull("node expected should not be null",expected); + assertNotNull("node actual should not be null",actual); + String expectedText = expected.getNodeValue(); + String actualText = actual.getNodeValue(); + assertEquals(expectedText, actualText); + } + + } + - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-15 13:53:52
|
Revision: 974 http://httpunit.svn.sourceforge.net/httpunit/?rev=974&view=rev Author: wolfgang_fahl Date: 2008-05-15 06:53:47 -0700 (Thu, 15 May 2008) Log Message: ----------- not for release notes: format for non - active test display changed Modified Paths: -------------- trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java trunk/httpunit/test/com/meterware/httpunit/HttpUnitSuite.java trunk/httpunit/test/com/meterware/httpunit/HttpUnitTest.java trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java trunk/httpunit/test/com/meterware/httpunit/javascript/DocumentScriptingTest.java trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java trunk/httpunit/test/com/meterware/servletunit/FormTableTest.java trunk/httpunit/test/com/meterware/servletunit/HttpServletResponseTest.java Removed Paths: ------------- trunk/httpunit/httpunit.pom Deleted: trunk/httpunit/httpunit.pom =================================================================== --- trunk/httpunit/httpunit.pom 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/httpunit.pom 2008-05-15 13:53:47 UTC (rev 974) @@ -1,186 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--- - $Id$ - This file is a contribution by Matt Smith as of 2008-05-14: - - I have created and attached a POM for building httpunit using Maven2. - It also runs FindBugs and cobertura, a code coverage tool, as well. - It uses the current project structure. It excludes the following tests: - EventAwareTestCase - WebClientTest - WebPageTest - -Also, if you run out of memory on the FindBugs, try upping the memory thusly -export MAVEN_OPTS=-Xmx384M ---> -<project> - <modelVersion>4.0.0</modelVersion> - <groupId>httpunit</groupId> - <artifactId>httpunit</artifactId> - <version>1.7-SNAPSHOT</version> - <description></description> - <build> - <sourceDirectory>src</sourceDirectory> - <testSourceDirectory>test</testSourceDirectory> - <testResources> - <testResource> - <directory>META-INF</directory> - </testResource> - </testResources> - <resources> - <resource> - <directory>META-INF</directory> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>cobertura-maven-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <executions> - <execution> - <id>attach-sources</id> - <phase>package</phase> - <goals> - <goal>jar</goal> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>1.0</version> - <executions> - <execution> - <id>add-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>src-1.4</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <forkMode>never</forkMode> - <!-- Assertions diasabled due to a bug in xmlbeans - https://issues.apache.org/jira/browse/XMLBEANS-317 --> - <enableAssertions>false</enableAssertions> - <excludes> - <exclude>**/TestSuite$1.class</exclude> - <exclude>**/EventAwareTestCase.class</exclude> - <exclude>**/WebClientTest.class</exclude> - <exclude>**/WebPageTest.class</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - - </build> - <reporting> - <plugins> - <plugin> - <artifactId>maven-javadoc-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-surefire-report-plugin</artifactId> - <configuration> - <additionalClasspathElements> - <additionalClasspathElement> - META-INF - </additionalClasspathElement> - </additionalClasspathElements> - </configuration> - </plugin> - <plugin> - <artifactId>maven-jxr-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>findbugs-maven-plugin</artifactId> - <configuration> - <threshold>Normal</threshold> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>cobertura-maven-plugin</artifactId> - </plugin> - </plugins> - - </reporting> - - <dependencies> - <dependency> - <groupId>rhino</groupId> - <artifactId>js</artifactId> - <version>1.6R5</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - </dependency> - <dependency> - <groupId>nekohtml</groupId> - <artifactId>nekohtml</artifactId> - <version>1.9.6</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> - </dependency> - <dependency> - <groupId>jtidy</groupId> - <artifactId>jtidy</artifactId> - <version>4aug2000r7-dev</version> - </dependency> - <dependency> - <groupId>xerces</groupId> - <artifactId>xercesImpl</artifactId> - <version>2.6.1</version> - </dependency> - <dependency> - <groupId>xerces</groupId> - <artifactId>xmlParserAPIs</artifactId> - <version>2.6.1</version> - </dependency> - <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - <version>1.4</version> - <scope>test</scope> - </dependency> - </dependencies> - - <pluginRepositories> - <pluginRepository> - <id>repo1</id> - <url>http://repo1.maven.org/maven2/</url> - <snapshots> - <enabled>true</enabled> - </snapshots> - <releases> - <enabled>true</enabled> - </releases> - </pluginRepository> - </pluginRepositories> -</project> Modified: trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java 2008-05-15 13:53:47 UTC (rev 974) @@ -619,7 +619,7 @@ String foundURL=resp.getURL().toString(); boolean disabled=true; if (disabled) { - this.warnDisabled("testParamReplacement", "bug 1393144 pending - waiting for patch"); + this.warnDisabled("testParamReplacement","A",2, "bug 1393144 pending - waiting for patch"); } else { // System.out.println("url: " + foundURL); assertTrue(foundURL.equals(expected)); Modified: trunk/httpunit/test/com/meterware/httpunit/HttpUnitSuite.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/HttpUnitSuite.java 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/test/com/meterware/httpunit/HttpUnitSuite.java 2008-05-15 13:53:47 UTC (rev 974) @@ -27,6 +27,9 @@ import com.meterware.httpunit.ssl.HttpsProtocolSupportTest; import com.meterware.httpunit.dom.DomTestSuite; +import junit.framework.AssertionFailedError; +import junit.framework.TestListener; +import junit.framework.TestResult; import junit.framework.TestSuite; import junit.framework.Test; @@ -35,14 +38,15 @@ * Tests for the httpunit package. **/ public class HttpUnitSuite extends ConditionalTestSuite { - + /** * entry point to run suite from command line * @param args - command line arguments */ public static void main( String[] args ) { try { - junit.textui.TestRunner.run( suite() ); + HttpUnitTest.warnDelim="\n"; + TestResult result=junit.textui.TestRunner.run(suite()); } catch (Exception e) { e.printStackTrace(); //To change body of catch statement use Options | File Templates. } Modified: trunk/httpunit/test/com/meterware/httpunit/HttpUnitTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/HttpUnitTest.java 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/test/com/meterware/httpunit/HttpUnitTest.java 2008-05-15 13:53:47 UTC (rev 974) @@ -102,23 +102,28 @@ } return result; } + public static String warnDelim=""; + + /** * show a warning for disabled Tests * @param testName * @param comment */ - public static void warnDisabled(String testName,String comment) { + public static void warnDisabled(String testName,String priority,int urgency,String comment) { if (WARN_DISABLED) { - String delim=""; - //delim="\n"; if (firstWarn) { firstWarn=false; - System.err.println("\n The following tests are not active:"); - System.err.println(" # | testname | reason "); - System.err.println("----+-------------------------------+--------------------------------------------"); + System.err.println("\n The following tests are not active - the features tested are not part of the current release:"); + System.err.println(" # | testname | priority | urgency | reason "); + System.err.println("----+-------------------------------+----------+---------+----------------------------------------"); } disabledIndex++; - System.err.println(delim+padLeft(""+disabledIndex,3)+" | "+padLeft(testName,29)+" | "+comment); + System.err.println(warnDelim+padLeft(""+disabledIndex,3)+ + " | "+padLeft(testName,29)+ + " | "+padLeft(priority, 8)+ + " | "+padLeft(""+urgency, 7)+ + " | "+comment); } } Modified: trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java 2008-05-15 13:53:47 UTC (rev 974) @@ -528,7 +528,7 @@ WebResponse response = _wc.getFrameContents("iframe_after_lessthan_in_javascript"); assertTrue(response!=null); } catch (Throwable th) { - this.warnDisabled("testIFrameBug", "patch needed for '"+th.getMessage()+"'"); + this.warnDisabled("testIFrameBug", "B",2,"patch needed for '"+th.getMessage()+"'"); } } Modified: trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java 2008-05-15 13:53:47 UTC (rev 974) @@ -90,7 +90,7 @@ if (decided) { assertEquals( 0, links.length ); } else { - this.warnDisabled("testFindNonHrefLinks()","pending decision for bug report [ 1156972 ] -> does an <a> node to have href to be considered a link?"); + this.warnDisabled("testFindNonHrefLinks()","C",2,"pending decision for bug report [ 1156972 ] -> does an <a> node to have href to be considered a link?"); } } Modified: trunk/httpunit/test/com/meterware/httpunit/javascript/DocumentScriptingTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/javascript/DocumentScriptingTest.java 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/test/com/meterware/httpunit/javascript/DocumentScriptingTest.java 2008-05-15 13:53:47 UTC (rev 974) @@ -336,7 +336,7 @@ assertEquals( "Alert message", "hellothere", wc.popNextAlert() ); } catch (ScriptException se) { if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { - this.warnDisabled("testCreateElement", "not fixed for old scripting engine"); + this.warnDisabled("testCreateElement","B",3, "not fixed for old scripting engine"); } else { throw se; } Modified: trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java 2008-05-15 13:53:47 UTC (rev 974) @@ -186,7 +186,7 @@ */ public void testCloneNode() throws Exception { if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { - warnDisabled("testCloneNode","not fixed for old javascript engine"); + warnDisabled("testCloneNode","B",3,"not fixed for old javascript engine"); return; } WebConversation wc=doTestJavaScript( @@ -1079,7 +1079,7 @@ assertEquals( "Result page ", "Javascript is enabled!", response.getText() ); boolean nekoHtmlBugFixed = false; // waiting for response to http://sourceforge.net/tracker/index.php?func=detail&aid=1932445&group_id=195122&atid=952178 if (!nekoHtmlBugFixed) { - this.warnDisabled("testJavascriptDetectionTrick", "waiting for nekoHtml bug #1932445" ); + this.warnDisabled("testJavascriptDetectionTrick","A",2,"waiting for nekoHtml bug #1932445" ); } else { HttpUnitOptions.setScriptingEnabled( false ); response = wc.getResponse( getHostPath() + "/Start.html" ); @@ -1162,7 +1162,7 @@ */ public void testDOM() throws Exception { if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { - warnDisabled("testDOM","not fixed for old javascript engine"); + warnDisabled("testDOM","B",3,"not fixed for old javascript engine"); return; } defineResource( "testSelect.html", "<html><head><script type='text/javascript'>\n" + @@ -1275,7 +1275,7 @@ } catch (Exception ex ) { if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { // TODO change this expected result if fixed - warnDisabled("testModifySelectLength","not fixed for old javascript engine"); + warnDisabled("testModifySelectLength","B",3,"not fixed for old javascript engine"); assertTrue(ex instanceof java.lang.RuntimeException); assertTrue(ex.getMessage().indexOf("Not implemented yet")>=0); } else { @@ -1363,13 +1363,13 @@ // alert(var25500);}' failed: java.lang.IllegalArgumentException: out of range index // for 50000 lines and opt level 0 if ((optimizationLevel>=0) && (lines>=50000)) { - this.warnDisabled("testLargeJavaScript","fails with runtime Exception for "+lines+" lines at optimizationLevel "+optimizationLevel+" the default is level -1 so we only warn"); + this.warnDisabled("testLargeJavaScript","C",2,"fails with runtime Exception for "+lines+" lines at optimizationLevel "+optimizationLevel+" the default is level -1 so we only warn"); } else { throw re; } } catch (java.lang.OutOfMemoryError ome) { if (lines>=expectMemoryExceededForLinesOver) { - this.warnDisabled("testLargeJavaScript","fails with out of memory error for "+lines+" lines at optimizationLevel "+optimizationLevel+" we expect this for more than "+expectMemoryExceededForLinesOver+" lines"); + this.warnDisabled("testLargeJavaScript","C",3,"fails with out of memory error for "+lines+" lines at optimizationLevel "+optimizationLevel+" we expect this for more than "+expectMemoryExceededForLinesOver+" lines"); break; } else { throw ome; @@ -1377,7 +1377,7 @@ } catch (java.lang.ClassFormatError cfe) { // java.lang.ClassFormatError: Invalid method Code length 223990 in class file org/mozilla/javascript/gen/c1 if (optimizationLevel>=0) - this.warnDisabled("testLargeJavaScript","fails with class format error for "+lines+" lines at optimizationLevel "+optimizationLevel+" the default is level -1 so we only warn"); + this.warnDisabled("testLargeJavaScript","C",2,"fails with class format error for "+lines+" lines at optimizationLevel "+optimizationLevel+" the default is level -1 so we only warn"); else throw cfe; } // try @@ -1401,7 +1401,7 @@ */ public void testArgumentsProperty() throws Exception { if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { - warnDisabled("testArgumentsProperty","not fixed for old javascript engine"); + warnDisabled("testArgumentsProperty","B",3,"not fixed for old javascript engine"); return; } new ScriptingTestHelper("../html/testArgumentsProperty.html").run(); Modified: trunk/httpunit/test/com/meterware/servletunit/FormTableTest.java =================================================================== --- trunk/httpunit/test/com/meterware/servletunit/FormTableTest.java 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/test/com/meterware/servletunit/FormTableTest.java 2008-05-15 13:53:47 UTC (rev 974) @@ -74,7 +74,7 @@ boolean bug1043368Pending=true; if (bug1043368Pending) { - this.warnDisabled("testFormTable", "for pending bug 1043368"); + this.warnDisabled("testFormTable","A",2, "for pending bug 1043368"); } else { System.out.println( table.toString() ); assertFalse( "wrong table", Modified: trunk/httpunit/test/com/meterware/servletunit/HttpServletResponseTest.java =================================================================== --- trunk/httpunit/test/com/meterware/servletunit/HttpServletResponseTest.java 2008-05-15 11:07:45 UTC (rev 973) +++ trunk/httpunit/test/com/meterware/servletunit/HttpServletResponseTest.java 2008-05-15 13:53:47 UTC (rev 974) @@ -226,7 +226,7 @@ WebResponse response = sr.getResponse( request ); boolean isPending=true; if (isPending) { - HttpUnitTest.warnDisabled("testIsCommitted", "bug report 1534234 is pending - waiting for testcase/improved patch"); + HttpUnitTest.warnDisabled("testIsCommitted","B",2,"bug report 1534234 is pending - waiting for testcase/improved patch"); } else { assertTrue("The response should be committed",CheckIsCommittedServlet.isCommitted); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2008-05-16 19:45:10
|
Revision: 975 http://httpunit.svn.sourceforge.net/httpunit/?rev=975&view=rev Author: russgold Date: 2008-05-16 12:44:48 -0700 (Fri, 16 May 2008) Log Message: ----------- moved all pending tests to new pending-tests directory Modified Paths: -------------- trunk/httpunit/build.xml trunk/httpunit/doc/release_notes.html trunk/httpunit/src/com/meterware/httpunit/WebTable.java trunk/httpunit/src/com/meterware/httpunit/controls/SelectionFormControl.java trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java trunk/httpunit/test/com/meterware/httpunit/HtmlTablesTest.java trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java trunk/httpunit/test/com/meterware/httpunit/javascript/DocumentScriptingTest.java trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java trunk/httpunit/test/com/meterware/servletunit/HttpServletResponseTest.java trunk/httpunit/test/com/meterware/servletunit/ServletUnitSuite.java Added Paths: ----------- trunk/httpunit/pending-tests/ trunk/httpunit/pending-tests/com/ trunk/httpunit/pending-tests/com/meterware/ trunk/httpunit/pending-tests/com/meterware/httpunit/ trunk/httpunit/pending-tests/com/meterware/httpunit/NewParsingTests.java trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/ trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingEngineTests.java trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingTests.java trunk/httpunit/pending-tests/com/meterware/httpunit/servletunit/ trunk/httpunit/pending-tests/com/meterware/httpunit/servletunit/NewServletUnitTests.java trunk/httpunit/test/com/meterware/httpunit/javascript/AbstractJavaScriptTest.java Removed Paths: ------------- trunk/httpunit/test/com/meterware/servletunit/FormTableTest.java Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/build.xml 2008-05-16 19:44:48 UTC (rev 975) @@ -105,7 +105,7 @@ < dependency group="rhino" artifact="rhino" version="1.5R4.1" website="http://www.mozilla.org/rhino/download.html" /> --> <dependency group="junit" version="3.8.1" /> - <dependency group="nekohtml" version="1.9.6" unless="use.jtidy"/> + <dependency group="nekohtml" version="0.9.5" unless="use.jtidy"/> <dependency group="servletapi" version="2.4" /> <dependency group="jtidy" version="4aug2000r7-dev"/> <dependency group="xerces" version="2.6.1" artifact="xercesImpl"/> Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/doc/release_notes.html 2008-05-16 19:44:48 UTC (rev 975) @@ -45,7 +45,7 @@ <h4>Notes:</h4> <ol> - <li>Upgraded NekoHTML to 1.9.6</li> + <li>Upgraded NekoHTML to 0.9.5</li> <li>Upgraded Xerces to 2.6.1</li> <li>Upgraded Rhino to 1.6R5</li> <li>The PostMethodWebRequest.setMimeEncoded method has been removed. Mime encoding, if desired, should now be @@ -61,6 +61,7 @@ keeping the dependent jars in cvs. </li> <li>When using the nekoHtml parser, tag and attribute names now default to lower case, rather than upper case as before</li> + <li>Empty cells from tables are no longer automatically purged when searching for a table by its first non-blank cell</li> </ol> <h4>Problems fixed:</h4> <h5>Content and Parsing:</h5> Added: trunk/httpunit/pending-tests/com/meterware/httpunit/NewParsingTests.java =================================================================== --- trunk/httpunit/pending-tests/com/meterware/httpunit/NewParsingTests.java (rev 0) +++ trunk/httpunit/pending-tests/com/meterware/httpunit/NewParsingTests.java 2008-05-16 19:44:48 UTC (rev 975) @@ -0,0 +1,133 @@ +package com.meterware.httpunit; +/******************************************************************************************************************** +* $Id$ +* +* Copyright (c) 2007-2008, Russell Gold +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +* documentation files (the "Software"), to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and +* to permit persons to whom the Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or substantial portions +* of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +*******************************************************************************************************************/ +import junit.framework.Test; +import junit.framework.TestSuite; + +public class NewParsingTests extends HttpUnitTest { + + private WebClient _wc; + + + public static void main(String args[]) { + junit.textui.TestRunner.run( suite() ); + } + + + public static Test suite() { + return new TestSuite( NewParsingTests.class ); + } + + + public NewParsingTests( String name ) { + super( name ); + } + + + public void setUp() throws Exception { + super.setUp(); + _wc = new WebConversation(); + } + + + + /** + * test a link that has a line break included + * @throws Exception on an unexpected exception - requires nekohtml 1.9.6 to pass + */ + public void testLinkUrlAcrossLineBreaks() throws Exception { + WebConversation wc = new WebConversation(); + defineWebPage( "Initial", "<a id='midbreak' href='http://loc\nalhost/somewhere'</a>" + + "<a id='endbreak' href='http://localhost/somewhere\n'</a>" ); + + WebResponse response = wc.getResponse( getHostPath() + "/Initial.html" ); + String endbreak=response.getLinkWithID( "endbreak" ).getRequest().getURL().toExternalForm() ; + assertEquals( "URL with break at end", endbreak,"http://localhost/somewhere"); + //System.err.println("endbreak='"+endbreak+"'"); + String midbreak=response.getLinkWithID( "midbreak" ).getRequest().getURL().toExternalForm() ; + //System.err.println("midbreak='"+midbreak+"'"); + assertEquals( "URL across linebreak", midbreak,"http://loc\nalhost/somewhere"); + } + + + /** + * test for bug report [ 1393144 ] URL args in form action are sent for GET forms + * by Nathan Jakubiak + * @throws Exception on an uncaught error + */ + public void testParamReplacement() throws Exception { + String expected = "/cgi-bin/bar?foo=a"; + String nogood = "/cgi-bin/bar?arg=replaced&foo=a"; + defineResource( nogood, "not good" ); + defineResource( expected, "excellent" ); + String html = + "<FORM NAME=Bethsheba METHOD=GET ACTION=/cgi-bin/bar?arg=replaced>" + + "<INPUT TYPE=TEXT NAME=foo>" + + "<INPUT TYPE=SUBMIT>" + + "</FORM>" + + "<br>" + + "<!--JavaScript submit:" + + "<a href=\"javascript:document.Bethsheba.submit()\">go</a>" + + "-->"; + defineWebPage( "test", html ); + WebResponse resp = _wc.getResponse( getHostPath() + "/test.html" ); + WebForm form = resp.getFormWithName( "Bethsheba" ); + form.setParameter( "foo", "a" ); + resp = form.submit(); + String foundURL = resp.getURL().toString(); + assertTrue( foundURL.equals( expected ) ); + } + + + /** + * test bug report [ 1376739 ] iframe tag not recognized if Javascript code contains '<' + * by Nathan Jakubiak + * @throws Exception on an uncaught error + */ + public void testIFrameBug() throws Exception { + String html = "\"<SCRIPT LANGUAGE=\"JavaScript\">\n" + + "var b = 0 < 1;\n" + + "</SCRIPT>\n" + + "<iframe name=\"iframe_after_lessthan_in_javascript\"\n" + + "src=\"c.html\"></iframe>"; + defineWebPage( "iframe", html ); + WebResponse response = _wc.getFrameContents( "iframe_after_lessthan_in_javascript" ); + assertNotNull( "Iframe was not recognized", response ); + } + + + /** + * test for bug report [ 1156972 ] isWebLink doesn't recognize all anchor tags + * by fregienj + * @throws Exception on anuncaught error + */ + public void testFindNonHrefLinks() throws Exception { + defineResource( "NonHref.html", "<html><head><title>NonHref Links</title></head><body>\n" + + "<a onclick='javascript:followlink()'>I am a clickable link after all</a>\n" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/NonHref.html" ); + WebLink[] links = response.getLinks(); + assertNotNull( links ); + assertEquals( "number of non-href anchor tags", 1, links.length ); + } + +} Property changes on: trunk/httpunit/pending-tests/com/meterware/httpunit/NewParsingTests.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Added: trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingEngineTests.java =================================================================== --- trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingEngineTests.java (rev 0) +++ trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingEngineTests.java 2008-05-16 19:44:48 UTC (rev 975) @@ -0,0 +1,120 @@ +package com.meterware.httpunit.javascript; +/******************************************************************************************************************** + * $Id$ + * + * Copyright (c) 2007-2008, Russell Gold + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *******************************************************************************************************************/ +import com.meterware.httpunit.*; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +/** + * New features promised for scripting, but only implemented for new scripting engine. + */ +public class NewScriptingEngineTests extends AbstractJavaScriptTest { + + public static void main( String args[] ) { + TestRunner.run( suite() ); + } + + + public static TestSuite suite() { + return new TestSuite( NewScriptingEngineTests.class ); + } + + + public NewScriptingEngineTests( String name ) { + super( name ); + } + + + /** + * test jsFunction_createElement() - supplied by Mark Childerson + * also for bug report [ 1430378 ] createElement not found in JavaScript by Saliya Jinadasa + * @since 2008-03-26 + * @throws Exception on uncaught problem + */ + public void testCreateElement() throws Exception { + defineResource( "OnCommand.html", + "<html><head><title>Amazing!</title></head>" + + "<body onLoad='var elem=document.createElement(\"input\");elem.id=\"hellothere\";alert(elem.id);'></body>" ); + WebConversation wc = new WebConversation(); + boolean oldDebug = HttpUnitUtils.setEXCEPTION_DEBUG( false ); + try { + wc.getResponse( getHostPath() + "/OnCommand.html" ); + // used to throw: + // com.meterware.httpunit.ScriptException: Event 'var elem=document.createElement("input");elem.id="hellothere";alert(elem.id);' failed: org.mozilla.javascript.EcmaError: TypeError: Cannot find function createElement. + assertEquals( "Alert message", "hellothere", wc.popNextAlert() ); + } finally { + HttpUnitUtils.setEXCEPTION_DEBUG( oldDebug ); + } + } + + /** + * test for cloneNode feature (asked for by Mark Childeson on 2008-04-01) + * @throws Exception on any uncaught problem + */ + public void testCloneNode() throws Exception { + doTestJavaScript( + "dolly1=document.getElementById('Dolly');\n" + + "dolly2=dolly1.cloneNode(true);\n" + + "dolly1.firstChild.nodeValue += dolly2.firstChild.nodeValue;\n" + + "alert(dolly1.firsthChild.nodeValue);\n", + "<div id='Dolly'>Dolly </div>" ); + } + + + /** + * test for bug report [ 1396877 ] Javascript:properties parentNode,firstChild, .. returns null + * by gklopp 2006-01-04 15:15 + * @throws Exception on any uncaught problem + */ + public void testDOM() throws Exception { + defineResource( "testSelect.html", "<html><head><script type='text/javascript'>\n" + + "<!--\n" + + "function testDOM() {\n" + + " var sel = document.getElementById('the_select');\n" + + " var p = sel.parentNode;\n" + + " var child = p.firstChild;\n" + + " alert('Parent : ' + p.nodeName);\n" + + " alert('First child : ' + child.nodeName);\n" + + "}\n" + + "-->\n" + + "</script></head>" + + "<body>" + + "<form name='the_form'>" + + " <table>" + + " <tr>" + + " <td>Selection :</td>" + + " <td>" + + " <select name='the_select'>" + + " <option value='option1Value'>option1</option>" + + " </select>" + + " </td>" + + " </tr>" + + " </table>" + + "</form>" + + "<script type='text/javascript'>testDOM();</script>" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + wc.getResponse( getHostPath() + "/testSelect.html" ); + assertEquals( "Message 1", "TD", wc.popNextAlert().toUpperCase() ); + assertEquals( "Message 2", "SELECT", wc.popNextAlert().toUpperCase() ); + } + +} Property changes on: trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingEngineTests.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Added: trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingTests.java =================================================================== --- trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingTests.java (rev 0) +++ trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingTests.java 2008-05-16 19:44:48 UTC (rev 975) @@ -0,0 +1,190 @@ +package com.meterware.httpunit.javascript; +/******************************************************************************************************************** + * $Id$ + * + * Copyright (c) 2007-2008, Russell Gold + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *******************************************************************************************************************/ + +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.HttpUnitOptions; +import junit.textui.TestRunner; +import junit.framework.TestSuite; + +/** + * Tests designed to track promised new features. + */ +public class NewScriptingTests extends AbstractJavaScriptTest { + + + public static void main( String args[] ) { + TestRunner.run( suite() ); + } + + + public static TestSuite suite() { + return new TestSuite( NewScriptingTests.class ); + } + + + public NewScriptingTests( String name ) { + super( name ); + } + + + /** + * bug report [ 1286018 ] EcmaError in seemingly valid function + * by Stephane Mikaty + * + * @throws Exception on uncaught error + */ + public void testArgumentsProperty() throws Exception { + String html = "<html><head><script language='JavaScript'> " + + " function dumpargs() { " + + " var args=dumpargs.arguments; " + + " var argdump=args.length; " + + " alert( args.length + ' arguments') " + + " for (i=0; i<args.length; i+=1) { " + + " alert( i + ': ' + args[i]') " + + " } " + + " } " + + "</script> " + + "<body onload=\"dumpargs('a','b')\"> " + + "</body></html> "; + + defineResource( "OnCommand.html", html ); + WebConversation wc = new WebConversation(); + wc.getResponse( getHostPath() + "/OnCommand.html" ); + assertEquals( "alert message 1", "2 arguments", wc.popNextAlert() ); + assertEquals( "alert message 2", "0: a", wc.popNextAlert() ); + assertEquals( "alert message 3", "1: b", wc.popNextAlert() ); + } + + + /** + * test for bug report [ 1216567 ] Exception for large javascripts + * by Grzegorz Lukasik + * and bug report [ 1572117 ] ClassFormatError + * by Walter Meier + * + * @author Wolfgang Fahl 2008-04-05 + */ + public void testLargeJavaScript() throws Exception { + // create at least 64 KByte worth of Java script of the form + // var1000=1000; + // let's check the length; + // 1 + // 12345678901234 + // var1000=1000+1; + // so that is 14 chars avg per line - we'll do that many times for good measure ... + // you might want to adjust the numbers to your environment + // we do tests with 1000,10000,100000,1000000 lines in a logarithmic manner + // we do the optimization levels according to rhino docs: + // + // -2: with continuation + // -1: interpret + // 0: compile to Java bytecode, don't optimize + // 1..9: compile to Java bytecode, optimize + // + // set quicktest to false to get the full extent of the test + // the quick version only runs 1000 and 1000 lines for the levels -2 to 1 + boolean quicktest = true; + boolean showProgress = false; + int linesToTest[] = {1000, 10000, 100000, 1000000}; + int numTests = linesToTest.length; + int minOptLevel = -2; + int maxOptLevel = 9; + // when to expect a memory error + int expectMemoryExceededForLinesOver = 100000; + if (quicktest) { + numTests = 2; + minOptLevel = -1; + maxOptLevel = 1; + showProgress = false; + } else { + showProgress = true; + } + for (int optimizationLevel = minOptLevel; optimizationLevel <= maxOptLevel; optimizationLevel++) { + HttpUnitOptions.setJavaScriptOptimizationLevel( optimizationLevel ); + // allow for different number of lines + for (int i = 1; i < numTests; i++) { + int fromj = 1; + int toj = linesToTest[i] + 1; + int lines = toj - fromj; + String testDesc = "test " + i + " for " + lines + " Lines (" + fromj + "-" + toj + ") at optlevel " + optimizationLevel; + if (showProgress) + System.out.println( testDesc ); + int midj = (fromj + toj) / 2; + WebConversation wc = null; + StringBuffer prepareScript = new StringBuffer(); + try { + // prepare code lines like + // var1000=1000+1; + // with the var<j>=<j>+1;\n pattern ... + // should be fun for the optimizer to remove all that unused code :-) + // we'll only use one variable later ... + for (int j = fromj; j < toj; j++) { + prepareScript.append( "var" ); + prepareScript.append( j ); + prepareScript.append( "=" ); + prepareScript.append( j ); + prepareScript.append( "+1;\n" ); + } + prepareScript.append( "alert(var" + midj + ");" ); + // off we go ... see what happens ... + wc = this.doTestJavaScript( prepareScript.toString() ); + } catch (RuntimeException re) { + // currently we get: + // alert(var25500);}' failed: java.lang.IllegalArgumentException: out of range index + // for 50000 lines and opt level 0 + if ((optimizationLevel >= 0) && (lines >= 50000)) { + this.warnDisabled( "testLargeJavaScript", + "fails with runtime Exception for " + lines + " lines at optimizationLevel " + optimizationLevel + " the default is level -1 so we only warn" ); + } else { + throw re; + } + } catch (java.lang.OutOfMemoryError ome) { + if (lines >= expectMemoryExceededForLinesOver) { + this.warnDisabled( "testLargeJavaScript", + "fails with out of memory error for " + lines + " lines at optimizationLevel " + optimizationLevel + " we expect this for more than " + expectMemoryExceededForLinesOver + " lines" ); + break; + } else { + throw ome; + } + } catch (java.lang.ClassFormatError cfe) { + // java.lang.ClassFormatError: Invalid method Code length 223990 in class file org/mozilla/javascript/gen/c1 + if (optimizationLevel >= 0) + this.warnDisabled( "testLargeJavaScript", + "fails with class format error for " + lines + " lines at optimizationLevel " + optimizationLevel + " the default is level -1 so we only warn" ); + else + throw cfe; + } // try + + if (wc != null) { + String expected = "" + (midj + 1); + expected = expected.trim(); + // if we get here the big javascript was actually executed + // e.g. interpreted and compiled and the alert message at it's end + // was fired to show the content of a variable in the far middle of the script + assertEquals( testDesc, expected, wc.popNextAlert() ); + } + } // for + HttpUnitOptions.reset(); + } // for optimizationLevel + } + +} Property changes on: trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingTests.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Added: trunk/httpunit/pending-tests/com/meterware/httpunit/servletunit/NewServletUnitTests.java =================================================================== --- trunk/httpunit/pending-tests/com/meterware/httpunit/servletunit/NewServletUnitTests.java (rev 0) +++ trunk/httpunit/pending-tests/com/meterware/httpunit/servletunit/NewServletUnitTests.java 2008-05-16 19:44:48 UTC (rev 975) @@ -0,0 +1,92 @@ +package com.meterware.httpunit.servletunit; +/******************************************************************************************************************** + * $Id$ + * + * Copyright (c) 2007-2008, Russell Gold + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *******************************************************************************************************************/ +import com.meterware.httpunit.HttpUnitTest; +import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.GetMethodWebRequest; +import com.meterware.httpunit.WebResponse; +import com.meterware.servletunit.ServletRunner; +import com.meterware.servletunit.StatelessTest; + +import junit.framework.TestSuite; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.ServletException; +import java.io.IOException; +import java.io.PrintWriter; + +/** + * Tests for features pending addition to ServletUnit. + */ +public class NewServletUnitTests extends HttpUnitTest { + + public static void main( String args[] ) { + junit.textui.TestRunner.run( suite() ); + } + + + public static TestSuite suite() { + return new TestSuite( NewServletUnitTests.class ); + } + + + public NewServletUnitTests( String name ) { + super( name ); + } + + + /** + * test bug report [ 1534234 ] HttpServletResponse.isCommitted() always false? (+patch) + * by Olaf Klischat? + * @throws Exception on unexpected error + */ + public void testIsCommitted() throws Exception { + ServletRunner sr = new ServletRunner(); + + WebRequest request = new GetMethodWebRequest( + "http://localhost/servlet/" + CheckIsCommittedServlet.class.getName() ); + WebResponse response = sr.getResponse( request ); + assertTrue( "The response should be committed", CheckIsCommittedServlet.isCommitted ); + } + + + /** + * helper Servlet for bug report 1534234 + */ + public static class CheckIsCommittedServlet extends HttpServlet { + + public static boolean isCommitted; + + + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { + resp.setContentType( "text/html" ); + + PrintWriter pw = resp.getWriter(); + pw.println( "anything" ); + pw.flush(); + pw.close(); + isCommitted = resp.isCommitted(); + } + } + +} Property changes on: trunk/httpunit/pending-tests/com/meterware/httpunit/servletunit/NewServletUnitTests.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/httpunit/src/com/meterware/httpunit/WebTable.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebTable.java 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/src/com/meterware/httpunit/WebTable.java 2008-05-16 19:44:48 UTC (rev 975) @@ -336,23 +336,29 @@ static { - MATCH_FIRST_NONBLANK_CELL = new HTMLElementPredicate() { // XXX find a way to do this w/o purging the table cells + MATCH_FIRST_NONBLANK_CELL = new HTMLElementPredicate() { public boolean matchesCriteria( Object htmlElement, Object criteria ) { WebTable table = ((WebTable) htmlElement); - table.purgeEmptyCells(); - return table.getRowCount() > 0 && - HttpUnitUtils.matches( table.getCellAsText(0,0).trim(), (String) criteria ); - }; + for (int row = 0; row < table.getRowCount(); row++) { + for (int col = 0; col < table.getColumnCount(); col++) { + if (HttpUnitUtils.matches( table.getCellAsText( row, col ).trim(), (String) criteria)) return true; + } + } + return false; + } }; MATCH_FIRST_NONBLANK_CELL_PREFIX = new HTMLElementPredicate() { // XXX find a way to do this w/o purging the table cells public boolean matchesCriteria( Object htmlElement, Object criteria ) { WebTable table = ((WebTable) htmlElement); - table.purgeEmptyCells(); - return table.getRowCount() > 0 && - HttpUnitUtils.hasPrefix( table.getCellAsText(0,0).toUpperCase().trim(), (String) criteria ); - }; + for (int row = 0; row < table.getRowCount(); row++) { + for (int col = 0; col < table.getColumnCount(); col++) { + if (HttpUnitUtils.hasPrefix( table.getCellAsText( row, col ).trim(), (String) criteria)) return true; + } + } + return false; + } }; Modified: trunk/httpunit/src/com/meterware/httpunit/controls/SelectionFormControl.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/controls/SelectionFormControl.java 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/src/com/meterware/httpunit/controls/SelectionFormControl.java 2008-05-16 19:44:48 UTC (rev 975) @@ -144,9 +144,7 @@ if (!(value instanceof Number)) throw new RuntimeException( "selectedIndex must be set to an integer" ); _selectionOptions.setSelectedIndex( ((Number) value).intValue() ); } else if (propertyName.equalsIgnoreCase( "length" )) { - // [ 1396896 ] Javascript: length property of a select element not writable - // what now? - throw new RuntimeException( "Options.setLength Not implemented yet" ); + _selectionOptions.setLength( ((Number) value).intValue() ); } else { super.set( propertyName, value ); } Modified: trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/test/com/meterware/httpunit/FormParametersTest.java 2008-05-16 19:44:48 UTC (rev 975) @@ -592,40 +592,9 @@ String paramValue=form.getParameterValue("submitButton"); assertTrue("the parameter value should be buttonLabel",paramValue.equals("buttonLabel")); } + /** - * test for bug report [ 1393144 ] URL args in form action are sent for GET forms - * by Nathan Jakubiak - */ - public void testParamReplacement() throws Exception { - String expected="/cgi-bin/bar?foo=a"; - String nogood ="/cgi-bin/bar?arg=replaced&foo=a"; - defineResource( nogood , "not good" ); - defineResource( expected, "excellent" ); - String html= - "<FORM NAME=Bethsheba METHOD=GET ACTION=/cgi-bin/bar?arg=replaced>"+ - "<INPUT TYPE=TEXT NAME=foo>"+ - "<INPUT TYPE=SUBMIT>"+ - "</FORM>"+ - "<br>"+ - "<!--JavaScript submit:"+ - "<a href=\"javascript:document.Bethsheba.submit()\">go</a>"+ - "-->"; - defineWebPage( "test", html); - WebResponse resp= _wc.getResponse( getHostPath() + "/test.html" ); - WebForm form = resp.getFormWithName("Bethsheba"); - form.setParameter("foo", "a"); - resp = form.submit(); - String foundURL=resp.getURL().toString(); - boolean disabled=true; - if (disabled) { - this.warnDisabled("testParamReplacement","A",2, "bug 1393144 pending - waiting for patch"); - } else { - // System.out.println("url: " + foundURL); - assertTrue(foundURL.equals(expected)); - } - } - /** * test for bug report * [ 1510582 ] setParameter fails with <input type="file"> * by Julien HENRY Modified: trunk/httpunit/test/com/meterware/httpunit/HtmlTablesTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/HtmlTablesTest.java 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/test/com/meterware/httpunit/HtmlTablesTest.java 2008-05-16 19:44:48 UTC (rev 975) @@ -19,9 +19,6 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import com.meterware.servletunit.ServletRunner; -import com.meterware.servletunit.FormTableTest.FormTableServlet; - import junit.framework.TestSuite; @@ -261,19 +258,13 @@ "</head>\n<body>\n"+ "<FORM METHOD=\"POST\" ACTION=\"/some/action\">\n"+ "<TABLE>\n"+ - "<TR><TD colspan=\"4\">Test Form:</TD></TR>\n\n"+ - "<TR>\n"+ - "<TD>*Contact Name:</TD>\n"+ - "<TD>"+ - "<input type=\"text\" size=\"21\" " + - "name=\"CONTACT_NAME\" value=\"TIMOTHY O'LEARY\">"+ - "</TD>\n"+ - "<TD>Building Number:</TD>\n"+ - "<TD>"+ - "<input type=\"text\" size=\"7\" " + - "name=\"BUILDING_NUMBER\" value=\"355\">"+ - "</TD>\n"+ - "</TR>\n"+ + " <TR><TD colspan=\"4\">Test Form:</TD></TR>\n\n"+ + " <TR>\n"+ + " <TD>*Contact Name:</TD>\n"+ + " <TD><input type=\"text\" size=\"21\" name=\"CONTACT_NAME\" value=\"TIMOTHY O'LEARY\"></TD>\n"+ + " <TD>Building Number:</TD>\n"+ + " <TD><input type=\"text\" size=\"7\" name=\"BUILDING_NUMBER\" value=\"355\"></TD>\n"+ + " </TR>\n"+ "</TABLE>\n"+ "</FORM>"; @@ -282,13 +273,13 @@ * by AutoTest */ public void testColumnNumberInTable() throws Exception { - defineWebPage( "Default",htmlForBug1043368); - WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); - WebTable table = page.getTables()[0]; - assertNotNull( "didn't find table", table ); - // System.out.println( table.toString() ); - assertFalse( "wrong table",table.getCellAsText( 1, 0 ).indexOf("Contact Name") == -1 ); - assertEquals( "wrong column count", 4, table.getColumnCount()); + defineWebPage( "Default", htmlForBug1043368 ); + WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); + WebTable table = page.getTableStartingWithPrefix( "Test Form" ); + assertNotNull( "didn't find table", table ); + // System.out.println( table.toString() ); + assertFalse( "wrong table", table.getCellAsText( 1, 0 ).indexOf( "Contact Name" ) == -1 ); + assertEquals( "wrong column count", 4, table.getColumnCount() ); } @@ -341,6 +332,7 @@ WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); WebTable wt = page.getTableStartingWith( "Red" ); assertNotNull( "Did not find table starting with 'Red'", wt ); + wt.purgeEmptyCells(); String[][] cells = wt.asText(); assertEquals( "Non-blank rows", 2, cells.length ); assertEquals( "Non-blank columns", 2, cells[0].length ); @@ -378,7 +370,9 @@ "</table>" ); WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); - String[][] cells = page.getTableStartingWith( "Title" ).asText(); + WebTable table = page.getTableStartingWith( "Title" ); + table.purgeEmptyCells(); + String[][] cells = table.asText(); assertEquals( "Non-blank rows", 3, cells.length ); assertEquals( "Non-blank columns", 2, cells[0].length ); assertEquals( "cell at 1,1", "Value", cells[1][1] ); @@ -394,7 +388,9 @@ "</table>" ); WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" ); - String[][] cells = page.getTableStartingWith( "Title" ).asText(); + WebTable table = page.getTableStartingWith( "Title" ); + table.purgeEmptyCells(); + String[][] cells = table.asText(); assertEquals( "Non-blank rows", 3, cells.length ); assertEquals( "Non-blank columns", 2, cells[0].length ); assertEquals( "cell at 1,1", "Value", cells[1][1] ); Modified: trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/test/com/meterware/httpunit/WebFrameTest.java 2008-05-16 19:44:48 UTC (rev 975) @@ -512,25 +512,6 @@ assertEquals( "Number of links in iframe", 1, _wc.getFrameContents( "center" ).getLinks().length ); } - /** - * test bug report [ 1376739 ] iframe tag not recognized if Javascript code contains '<' - * by Nathan Jakubiak - * @throws Exception - */ - public void testIFrameBug() throws Exception { - String html="\"<SCRIPT LANGUAGE=\"JavaScript\">\n"+ - "var b = 0 < 1;\n"+ - "</SCRIPT>\n"+ - "<iframe name=\"iframe_after_lessthan_in_javascript\"\n"+ - "src=\"c.html\"></iframe>"; - defineWebPage( "iframe", html); - try { - WebResponse response = _wc.getFrameContents("iframe_after_lessthan_in_javascript"); - assertTrue(response!=null); - } catch (Throwable th) { - this.warnDisabled("testIFrameBug", "B",2,"patch needed for '"+th.getMessage()+"'"); - } - } /** * test I Frame with a Form according to mail to mailinglist of 2008-03-25 Modified: trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/test/com/meterware/httpunit/WebLinkTest.java 2008-05-16 19:44:48 UTC (rev 975) @@ -72,29 +72,6 @@ /** - * test for bug report [ 1156972 ] isWebLink doesn't recognize all anchor tags - * by fregienj - * @throws Exception - */ - public void testFindNonHrefLinks() throws Exception { - defineResource( "NonHref.html", "<html><head><title>NonHref Links</title></head><body>\n"+ - "<a onclick='javascript:followlink()'>I am a clickable link after all</a>\n"+ - "</body></html>" ); - WebConversation wc = new WebConversation(); - WebResponse response=wc.getResponse( getHostPath() + "/NonHref.html" ); - WebLink[] links = response.getLinks(); - // TODO implement and test this - // WebLink[] links = response.getAnchors(); - assertNotNull( links ); - boolean decided=true; - if (decided) { - assertEquals( 0, links.length ); - } else { - this.warnDisabled("testFindNonHrefLinks()","C",2,"pending decision for bug report [ 1156972 ] -> does an <a> node to have href to be considered a link?"); - } - } - - /** * test for Bug report 1908117 by firebird74 * http://www.w3.org/Addressing/URL/url-spec.html * says @@ -159,25 +136,6 @@ } - /** - * test a link that has a line break included - * @throws Exception - */ - public void testLinkUrlAcrossLineBreaks() throws Exception { - WebConversation wc = new WebConversation(); - defineWebPage( "Initial", "<a id='midbreak' href='http://loc\nalhost/somewhere'</a>" + - "<a id='endbreak' href='http://localhost/somewhere\n'</a>" ); - - WebResponse response = wc.getResponse( getHostPath() + "/Initial.html" ); - String endbreak=response.getLinkWithID( "endbreak" ).getRequest().getURL().toExternalForm() ; - assertEquals( "URL with break at end", endbreak,"http://localhost/somewhere"); - //System.err.println("endbreak='"+endbreak+"'"); - String midbreak=response.getLinkWithID( "midbreak" ).getRequest().getURL().toExternalForm() ; - //System.err.println("midbreak='"+midbreak+"'"); - assertEquals( "URL across linebreak", midbreak,"http://loc\nalhost/somewhere"); - } - - public void testLinkReference() throws Exception { WebLink link = _simplePage.getLinks()[0]; assertEquals( "URLString", "/other.html", link.getURLString() ); Added: trunk/httpunit/test/com/meterware/httpunit/javascript/AbstractJavaScriptTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/javascript/AbstractJavaScriptTest.java (rev 0) +++ trunk/httpunit/test/com/meterware/httpunit/javascript/AbstractJavaScriptTest.java 2008-05-16 19:44:48 UTC (rev 975) @@ -0,0 +1,60 @@ +package com.meterware.httpunit.javascript; + +import com.meterware.httpunit.HttpUnitTest; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebResponse; + +/** + * Created by IntelliJ IDEA. + * User: russgold + * Date: May 16, 2008 + * Time: 3:20:40 PM + * To change this template use File | Settings | File Templates. + */ +public class AbstractJavaScriptTest extends HttpUnitTest {// set to true to get the static HTML Code on System.err +public static boolean debugHTML=false; + + + public AbstractJavaScriptTest( String name ) { + super( name ); + } + + + /** + * test the given javaScript code by putting it into a function and calling it + * as a prerequisite make the html code snippet available in the body of the page + * @param script - some javascript code to be called in a function + * @param html - a html code snippet + * @return + * @throws Exception + */ + public WebConversation doTestJavaScript(String script,String html) throws Exception { + defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>\n" + + "function javaScriptFunction() {\n"+ + script+ + "}\n"+ + "</script></head>" + + "<body>" + + html+"\n"+ + "<a href=\"javascript:javaScriptFunction()\">go</a>" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + if (debugHTML) { + System.err.println(response.getText()+"\n"); + } + response.getLinkWith( "go" ).click(); + return wc; + } + + + /** + * test the given javaScript code by putting it into a function + * and calling it + * @param script the script to test + * @return the web client on which the test was run + */ + public WebConversation doTestJavaScript(String script) throws Exception { + return doTestJavaScript(script,""); + } +} Property changes on: trunk/httpunit/test/com/meterware/httpunit/javascript/AbstractJavaScriptTest.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/httpunit/test/com/meterware/httpunit/javascript/DocumentScriptingTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/javascript/DocumentScriptingTest.java 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/test/com/meterware/httpunit/javascript/DocumentScriptingTest.java 2008-05-16 19:44:48 UTC (rev 975) @@ -315,35 +315,6 @@ assertEquals( "changed image source", "new.jpg", image.getSource() ); } - /** - * test jsFunction_createElement() - * @author Mark Childerson - * also for bug report [ 1430378 ] createElement not found in JavaScript - * by Saliya Jinadasa - * @since 2008-03-26 - * @throws Exception - */ - public void testCreateElement() throws Exception { - defineResource("OnCommand.html", - "<html><head><title>Amazing!</title></head>"+ - "<body onLoad='var elem=document.createElement(\"input\");elem.id=\"hellothere\";alert(elem.id);'></body>"); - WebConversation wc = new WebConversation(); - boolean oldDebug= HttpUnitUtils.setEXCEPTION_DEBUG(false); - try { - wc.getResponse( getHostPath() + "/OnCommand.html" ); - // used to throw: - // com.meterware.httpunit.ScriptException: Event 'var elem=document.createElement("input");elem.id="hellothere";alert(elem.id);' failed: org.mozilla.javascript.EcmaError: TypeError: Cannot find function createElement. - assertEquals( "Alert message", "hellothere", wc.popNextAlert() ); - } catch (ScriptException se) { - if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { - this.warnDisabled("testCreateElement","B",3, "not fixed for old scripting engine"); - } else { - throw se; - } - } finally { - HttpUnitUtils.setEXCEPTION_DEBUG(oldDebug); - } - } public void testWriteToNewDocument() throws Exception { Modified: trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java 2008-05-15 13:53:47 UTC (rev 974) +++ trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java 2008-05-16 19:44:48 UTC (rev 975) @@ -39,7 +39,7 @@ * @author <a href="mailto:rus...@ht...">Russell Gold</a> * @author Wolfgang Fahl - for compiling patches from the Source Forge web site 2008-03 **/ -public class ScriptingTest extends HttpUnitTest { +public class ScriptingTest extends AbstractJavaScriptTest { public static void main( String args[] ) { TestRunner.run( suite() ); @@ -120,46 +120,9 @@ response.getLinks()[0].click(); assertEquals( "New page", "You made it!", wc.getCurrentPage().getText() ); } - // set to true to get the static HTML Code on System.err - public static boolean debugHTML=false; + /** - * test the given javaScript code by putting it into a function and calling it - * as a prerequisite make the html code snippet available in the body of the page - * @param script - some javascript code to be called in a function - * @param html - a html code snippet - * @return - * @throws Exception - */ - public WebConversation doTestJavaScript(String script,String html) throws Exception { - defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>\n" + - "function javaScriptFunction() {\n"+ - script+ - "}\n"+ - "</script></head>" + - "<body>" + - html+"\n"+ - "<a href=\"javascript:javaScriptFunction()\">go</a>" + - "</body></html>" ); - WebConversation wc = new WebConversation(); - WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); - if (debugHTML) { - System.err.println(response.getText()+"\n"); - } - response.getLinkWith( "go" ).click(); - return wc; - } - - /** - * test the given javaScript code by putting it into a function - * and calling it - * @param script - */ - public WebConversation doTestJavaScript(String script) throws Exception { - return doTestJavaScript(script,""); - } - - /** * test for bug report [ 1508516 ] Javascript method: "undefined" is not supported * @throws Exception */ @@ -181,23 +144,6 @@ } /** - * test for cloneNode feature (asked for by Mark Childeson on 2008-04-01) - * @throws Exception - */ - public void testCloneNode() throws Exception { - if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { - warnDisabled("testCloneNode","B",3,"not fixed for old javascript engine"); - return; - } - WebConversation wc=doTestJavaScript( - "dolly1=document.getElementById('Dolly');\n"+ - "dolly2=dolly1.cloneNode(true);\n"+ - "dolly1.firstChild.nodeValue += dolly2.firstChild.nodeValue;\n"+ - "alert(dolly1.firsthChild.nodeValue);\n", - "<div id='Dolly'>Dolly </div>"); - } - - /** * test javascript call to an included function * @throws Exception */ @@ -1066,9 +1012,9 @@ defineResource( "NoScript.html", "No javascript here" ); defineResource( "HasScript.html", "Javascript is enabled!" ); defineResource( "Start.html", "<html><head>" + -// " <noscript>" + -// " <meta http-equiv='refresh' content='0;url=NoScript.html'>" + -// " </noscript>" + + " <noscript>" + + " <meta http-equiv='refresh' content='0;url=NoScript.html'>" + + " </noscript>" + "</head>" + "<body onload='document.form.submit()'>" + "<form name='form' action='HasScript.html'></form>" + @@ -1077,59 +1023,54 @@ wc.getClientProperties().setAutoRefresh( true ); WebResponse response = wc.getResponse( getHostPath() + "/Start.html" ); assertEquals( "Result page ", "Javascript is enabled!", response.getText() ); - boolean nekoHtmlBugFixed = false; // waiting for response to http://sourceforge.net/tracker/index.php?func=detail&aid=1932445&group_id=195122&atid=952178 - if (!nekoHtmlBugFixed) { - this.warnDisabled("testJavascriptDetectionTrick","A",2,"waiting for nekoHtml bug #1932445" ); - } else { - HttpUnitOptions.setScriptingEnabled( false ); - response = wc.getResponse( getHostPath() + "/Start.html" ); - assertEquals( "Result page", "No javascript here", response.getText() ); - } + HttpUnitOptions.setScriptingEnabled( false ); + response = wc.getResponse( getHostPath() + "/Start.html" ); + assertEquals( "Result page", "No javascript here", response.getText() ); } /** - * @see https://sourceforge.net/forum/forum.php?thread_id=1808696&forum_id=20294 + * https://sourceforge.net/forum/forum.php?thread_id=1808696&forum_id=20294 * by kauffman81 */ public void testJavaScriptConfirmPopUp() throws Exception { - String target="<html><body>After click we want to see this!</body></html>"; - defineResource( "Target.html", target); - defineResource( "Popup.html","<html><head><script language='JavaScript'>"+ - "// This is the javascript that handles the onclick event\n"+ - "function verify_onBorrar(form){\n"+ - " alert(form.id);\n"+ - /* TODO check this javascript code - * if uncommented it will throw - com.meterware.httpunit.ScriptException: Event 'verify_onBorrar(this.form)' failed: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "0" from undefined (httpunit#3) - " for(var i = 0;i<form.selection[i].length;i++){\n"+ - " if(form.selection[i].checked){\n"+ - " if(confirm('blablabla')){\n"+ - " form.action = 'Target.html';\n"+ - " form.submit(); \n"+ - " } // if\n"+ - " } // if\n"+ - " } // for\n"+ - */ - "} // verify_onBorrar\n"+ - "</script></head>\n"+ - "<body>\n"+ - " <form id='someform' name='someform'>"+ - " <input type='button' id='button1' class='button' value='say hi' onclick=\"alert('hi')\"/>"+ - " <input type='button' id='delete' class='button' value='delete' onclick='verify_onBorrar(this.form)'/></form>\n"+ - " </form>\n"+ - "</body></html>"); - WebConversation wc = new WebConversation(); - WebResponse response = wc.getResponse( getHostPath() + "/Popup.html" ); - Button button1 = (Button) response.getElementWithID( "button1" ); - button1.click(); - String alert1=wc.popNextAlert(); - assertEquals("hi",alert1); - Button button2 = (Button) response.getElementWithID( "delete" ); - button2.click(); - String alert2=wc.popNextAlert(); - // TODO activate this check - // System.err.println("alert 2 is "+alert2); - // assertEquals("someform",alert2); + String target = "<html><body>After click we want to see this!</body></html>"; + defineResource( "Target.html", target ); + defineResource( "Popup.html", "<html><head><script language='JavaScript'>" + + "// This is the javascript that handles the onclick event\n" + + "function verify_onBorrar(form){\n" + + " alert(form.id);\n" + + /* TODO check this javascript code + * if uncommented it will throw + com.meterware.httpunit.ScriptException: Event 'verify_onBorrar(this.form)' failed: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "0" from undefined (httpunit#3) + " for(var i = 0;i<form.selection[i].length;i++){\n"+ + " if(form.selection[i].checked){\n"+ + " if(confirm('blablabla')){\n"+ + " form.action = 'Target.html';\n"+ + " form.submit(); \n"+ + " } // if\n"+ + " } // if\n"+ + " } // for\n"+ + */ + "} // verify_onBorrar\n" + + "</script></head>\n" + + "<body>\n" + + " <form id='someform' name='someform'>" + + " <input type='button' id='button1' class='button' value='say hi' onclick=\"alert('hi')\"/>" + + " <input type='button' id='delete' class='button' value='delete' onclick='verify_onBorrar(this.form)'/></form>\n" + + " </form>\n" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/Popup.html" ); + Button button1 = (Button) response.getElementWithID( "button1" ); + button1.click(); + String alert1 = wc.popNextAlert(); + assertEquals( "hi", alert1 ); + Button button2 = (Button) response.getElementWithID( "delete" ); + button2.click(); + String alert2 = wc.popNextAlert(); + // TODO activate this check + // System.err.println("alert 2 is "+alert2); + // assertEquals("someform",alert2); } /** @@ -1154,49 +1095,6 @@ String alert1=wc.popNextAlert(); assertEquals("somefunction called",alert1); } - - /** - * test for bug report [ 1396877 ] Javascript:properties parentNode,firstChild, .. returns null - * by gklopp 2006-01-04 15:15 - * @throws Exception - */ - public void testDOM() throws Exception { - if (HttpUnitOptions.DEFAULT_SCRIPT_ENGINE_FACTORY.equals(HttpUnitOptions.ORIGINAL_SCRIPTING_ENGINE_FACTORY)) { - warnDisabled("testDOM","B",3,"not fixed for old javascript engine"); - return; - } - defineResource( "testSelect.html", "<html><head><script type='text/javascript'>\n" + - "<!--\n" + - "function testDOM() {\n" + - " var sel = document.getElementById('the_select');\n" + - " var p = sel.parentNode;\n" + - " var child = p.firstChild;\n" + - " alert('Parent : ' + p.nodeName);\n" + - " alert('First child : ' + child.nodeName);\n" + - "}\n" + - "-->\n" + - "</script></head>" + - "<body>" + - "<form name='the_form'>" + - " <table>" + - " <tr>" + - " <td>Selection :</td>" + - " <td>" + - " <select name='the_select'>" + - " <option value='option1Value'>option1</option>" + - " </select>" + - " </td>" + - " </tr>" + - " </table>" + - "</form>" + - "<script type='text/javascript'>testDOM();</script>" + - "</body></html>"); - WebConversation wc = new WebConversation(); - WebResponse response = wc.getRespo... [truncated message content] |
From: <wol...@us...> - 2008-05-16 20:43:20
|
Revision: 976 http://httpunit.svn.sourceforge.net/httpunit/?rev=976&view=rev Author: wolfgang_fahl Date: 2008-05-16 13:43:00 -0700 (Fri, 16 May 2008) Log Message: ----------- Eclipse configuration files added Added Paths: ----------- trunk/httpunit/.classpath trunk/httpunit/.project Added: trunk/httpunit/.classpath =================================================================== --- trunk/httpunit/.classpath (rev 0) +++ trunk/httpunit/.classpath 2008-05-16 20:43:00 UTC (rev 976) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="test"/> + <classpathentry kind="src" path="pending-tests"/> + <classpathentry kind="src" path="examples"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="jars/activation.jar"/> + <classpathentry kind="lib" path="jars/ant-dependencies.jar"/> + <classpathentry kind="lib" path="jars/mailapi.jar"/> + <classpathentry kind="lib" path="jars/quicksite.jar"/> + <classpathentry kind="var" path="MAVEN_REPOSITORY/jtidy/jars/jtidy-4aug2000r7_dev.jar"/> + <classpathentry kind="var" path="MAVEN_REPOSITORY/junit/jars/junit-3.8.1.jar"/> + <classpathentry kind="var" path="MAVEN_REPOSITORY/nekohtml/jars/nekohtml-1.9.6.jar"/> + <classpathentry kind="var" path="MAVEN_REPOSITORY/rhino/jars/js-1.6R5.jar" sourcepath="/pub/2008/rhino1_6R5.zip"/> + <classpathentry kind="var" path="MAVEN_REPOSITORY/servletapi/jars/servletapi-2.4.jar"/> + <classpathentry kind="var" path="MAVEN_REPOSITORY/xerces/jars/xercesImpl-2.6.1.jar" sourcepath="/pub/2008/Xerces-J-src.2.6.1.zip"/> + <classpathentry kind="var" path="MAVEN_REPOSITORY/xerces/jars/xmlParserAPIs-2.6.1.jar"/> + <classpathentry kind="lib" path="F:/pub/2008/Xerces-J-src.2.6.1.zip" sourcepath="F:/pub/2008/Xerces-J-src.2.6.1.zip"/> + <classpathentry kind="lib" path="META-INF"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/httpunit/.project =================================================================== --- trunk/httpunit/.project (rev 0) +++ trunk/httpunit/.project 2008-05-16 20:43:00 UTC (rev 976) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>httpunit</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-05-16 20:59:34
|
Revision: 977 http://httpunit.svn.sourceforge.net/httpunit/?rev=977&view=rev Author: wolfgang_fahl Date: 2008-05-16 13:59:33 -0700 (Fri, 16 May 2008) Log Message: ----------- not for relase notes - fixed missing imports and changed .classpath for Eclipse Modified Paths: -------------- trunk/httpunit/.classpath trunk/httpunit/pending-tests/com/meterware/httpunit/NewParsingTests.java trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingEngineTests.java trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingTests.java Modified: trunk/httpunit/.classpath =================================================================== --- trunk/httpunit/.classpath 2008-05-16 20:43:00 UTC (rev 976) +++ trunk/httpunit/.classpath 2008-05-16 20:59:33 UTC (rev 977) @@ -9,14 +9,24 @@ <classpathentry kind="lib" path="jars/ant-dependencies.jar"/> <classpathentry kind="lib" path="jars/mailapi.jar"/> <classpathentry kind="lib" path="jars/quicksite.jar"/> +<!-- you might want to create a class path variable MAVEN_REPOSITORY + that points to + e.g. C:/Dokumente und Einstellungen/<your username>/.maven/repository +--> <classpathentry kind="var" path="MAVEN_REPOSITORY/jtidy/jars/jtidy-4aug2000r7_dev.jar"/> <classpathentry kind="var" path="MAVEN_REPOSITORY/junit/jars/junit-3.8.1.jar"/> +<!-- you might want to decide which nekohtml to use <classpathentry kind="var" path="MAVEN_REPOSITORY/nekohtml/jars/nekohtml-1.9.6.jar"/> +--> + <classpathentry kind="var" path="MAVEN_REPOSITORY/nekohtml/jars/nekohtml-0.9.5.jar"/> <classpathentry kind="var" path="MAVEN_REPOSITORY/rhino/jars/js-1.6R5.jar" sourcepath="/pub/2008/rhino1_6R5.zip"/> <classpathentry kind="var" path="MAVEN_REPOSITORY/servletapi/jars/servletapi-2.4.jar"/> <classpathentry kind="var" path="MAVEN_REPOSITORY/xerces/jars/xercesImpl-2.6.1.jar" sourcepath="/pub/2008/Xerces-J-src.2.6.1.zip"/> <classpathentry kind="var" path="MAVEN_REPOSITORY/xerces/jars/xmlParserAPIs-2.6.1.jar"/> +<!-- + this is how you could debug with a local Xerces <classpathentry kind="lib" path="F:/pub/2008/Xerces-J-src.2.6.1.zip" sourcepath="F:/pub/2008/Xerces-J-src.2.6.1.zip"/> +--> <classpathentry kind="lib" path="META-INF"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: trunk/httpunit/pending-tests/com/meterware/httpunit/NewParsingTests.java =================================================================== --- trunk/httpunit/pending-tests/com/meterware/httpunit/NewParsingTests.java 2008-05-16 20:43:00 UTC (rev 976) +++ trunk/httpunit/pending-tests/com/meterware/httpunit/NewParsingTests.java 2008-05-16 20:59:33 UTC (rev 977) @@ -19,6 +19,13 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ +import com.meterware.httpunit.HttpUnitTest; +import com.meterware.httpunit.WebClient; +import com.meterware.httpunit.WebConversation; +import com.meterware.httpunit.WebForm; +import com.meterware.httpunit.WebLink; +import com.meterware.httpunit.WebResponse; + import junit.framework.Test; import junit.framework.TestSuite; Modified: trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingEngineTests.java =================================================================== --- trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingEngineTests.java 2008-05-16 20:43:00 UTC (rev 976) +++ trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingEngineTests.java 2008-05-16 20:59:33 UTC (rev 977) @@ -20,6 +20,8 @@ * *******************************************************************************************************************/ import com.meterware.httpunit.*; +import com.meterware.httpunit.javascript.AbstractJavaScriptTest; + import junit.framework.TestSuite; import junit.textui.TestRunner; Modified: trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingTests.java =================================================================== --- trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingTests.java 2008-05-16 20:43:00 UTC (rev 976) +++ trunk/httpunit/pending-tests/com/meterware/httpunit/javascript/NewScriptingTests.java 2008-05-16 20:59:33 UTC (rev 977) @@ -22,6 +22,8 @@ import com.meterware.httpunit.WebConversation; import com.meterware.httpunit.HttpUnitOptions; +import com.meterware.httpunit.javascript.AbstractJavaScriptTest; + import junit.textui.TestRunner; import junit.framework.TestSuite; @@ -152,14 +154,14 @@ // alert(var25500);}' failed: java.lang.IllegalArgumentException: out of range index // for 50000 lines and opt level 0 if ((optimizationLevel >= 0) && (lines >= 50000)) { - this.warnDisabled( "testLargeJavaScript", + this.warnDisabled( "testLargeJavaScript","C",2, "fails with runtime Exception for " + lines + " lines at optimizationLevel " + optimizationLevel + " the default is level -1 so we only warn" ); } else { throw re; } } catch (java.lang.OutOfMemoryError ome) { if (lines >= expectMemoryExceededForLinesOver) { - this.warnDisabled( "testLargeJavaScript", + this.warnDisabled( "testLargeJavaScript","C",2, "fails with out of memory error for " + lines + " lines at optimizationLevel " + optimizationLevel + " we expect this for more than " + expectMemoryExceededForLinesOver + " lines" ); break; } else { @@ -168,7 +170,7 @@ } catch (java.lang.ClassFormatError cfe) { // java.lang.ClassFormatError: Invalid method Code length 223990 in class file org/mozilla/javascript/gen/c1 if (optimizationLevel >= 0) - this.warnDisabled( "testLargeJavaScript", + this.warnDisabled( "testLargeJavaScript","C",2, "fails with class format error for " + lines + " lines at optimizationLevel " + optimizationLevel + " the default is level -1 so we only warn" ); else throw cfe; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2008-05-19 16:54:52
|
Revision: 979 http://httpunit.svn.sourceforge.net/httpunit/?rev=979&view=rev Author: russgold Date: 2008-05-19 09:54:31 -0700 (Mon, 19 May 2008) Log Message: ----------- switch httpunit to use maven ant tasks Modified Paths: -------------- trunk/httpunit/build.xml trunk/httpunit/doc/release_notes.html Added Paths: ----------- trunk/httpunit/jars/maven-ant-tasks-2.0.9.jar Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-05-19 14:22:02 UTC (rev 978) +++ trunk/httpunit/build.xml 2008-05-19 16:54:31 UTC (rev 979) @@ -24,7 +24,7 @@ <!-- ======================================================================= --> <!-- httpunit build file --> <!-- ======================================================================= --> -<project name="httpunit" default="jar" basedir="."> +<project name="httpunit" default="jar" basedir="." xmlns:artifact="urn:maven-artifact-ant"> <property name="name" value="httpunit" /> <property name="Name" value="HttpUnit" /> <property name="version" value="development" /> @@ -92,25 +92,18 @@ </path> </target> - <!-- use ant-dependencies special ant-task to optionally download missing parts from maven repository --> + <!-- use maven ant-task to optionally download missing parts from maven repository --> <target name="prepare_repository_classpath" depends="check_jars_dir" unless="have.local.jars"> <echo message="using repository classpath"/> - <!-- Russell's proxy --> - <setproxy proxyhost="www-proxy.us.oracle.com" proxyport="80"/> - <typedef classpath="${jars.dir}/ant-dependencies.jar" resource="dependencies.properties" /> - <dependencies pathId="base.classpath" fileSetId="distributed.jars"> - <!-- get from http://www.ibiblio.org/maven/rhino/jars/ --> - <dependency group="rhino" artifact="js" version="1.6R5" website="http://www.mozilla.org/rhino/download.html" /> - <!-- older version - < dependency group="rhino" artifact="rhino" version="1.5R4.1" website="http://www.mozilla.org/rhino/download.html" /> - --> - <dependency group="junit" version="3.8.1" /> - <dependency group="nekohtml" version="0.9.5" unless="use.jtidy"/> - <dependency group="servletapi" version="2.4" /> - <dependency group="jtidy" version="4aug2000r7-dev"/> - <dependency group="xerces" version="2.6.1" artifact="xercesImpl"/> - <dependency group="xerces" version="2.6.1" artifact="xmlParserAPIs"/> - </dependencies> + + <typedef classpath="${jars.dir}/maven-ant-tasks-2.0.9.jar" resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" /> + <artifact:dependencies pathId="base.classpath" fileSetId="distributed.jars"> + <dependency groupId="rhino" artifactId="js" version="1.6R5" /> + <dependency groupId="junit" artifactId="junit" version="3.8.1" /> + <dependency groupId="nekohtml" artifactId="nekohtml" version="0.9.5"/> + <dependency groupId="javax.servlet" artifactId="servlet-api" version="2.4" /> + <dependency groupId="jtidy" artifactId="jtidy" version="4aug2000r7-dev"/> + </artifact:dependencies> </target> <target name="prepare" depends="prepare_local_classpath,prepare_repository_classpath"> Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-05-19 14:22:02 UTC (rev 978) +++ trunk/httpunit/doc/release_notes.html 2008-05-19 16:54:31 UTC (rev 979) @@ -57,7 +57,7 @@ <li> HttpUnit configuration management has been moved from CVS to subversion at http://httpunit.svn.sourceforge.net/svnroot/httpunit/trunk/httpunit </li> - <li>The build now uses the ant-dependencies task (see http://www.httpunit.org/doc/dependencies.html) rather than + <li>The build now uses the Maven dependencies task (see http://maven.apache.org/ant-tasks.html) rather than keeping the dependent jars in cvs. </li> <li>When using the nekoHtml parser, tag and attribute names now default to lower case, rather than upper case as before</li> Added: trunk/httpunit/jars/maven-ant-tasks-2.0.9.jar =================================================================== (Binary files differ) Property changes on: trunk/httpunit/jars/maven-ant-tasks-2.0.9.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2008-05-19 17:08:52
|
Revision: 980 http://httpunit.svn.sourceforge.net/httpunit/?rev=980&view=rev Author: russgold Date: 2008-05-19 10:08:44 -0700 (Mon, 19 May 2008) Log Message: ----------- Use pom.xml as the source for dependencies Modified Paths: -------------- trunk/httpunit/build.xml trunk/httpunit/pom.xml Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-05-19 16:54:31 UTC (rev 979) +++ trunk/httpunit/build.xml 2008-05-19 17:08:44 UTC (rev 980) @@ -97,12 +97,9 @@ <echo message="using repository classpath"/> <typedef classpath="${jars.dir}/maven-ant-tasks-2.0.9.jar" resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" /> + <artifact:pom file="pom.xml" id="maven.project"/> <artifact:dependencies pathId="base.classpath" fileSetId="distributed.jars"> - <dependency groupId="rhino" artifactId="js" version="1.6R5" /> - <dependency groupId="junit" artifactId="junit" version="3.8.1" /> - <dependency groupId="nekohtml" artifactId="nekohtml" version="0.9.5"/> - <dependency groupId="javax.servlet" artifactId="servlet-api" version="2.4" /> - <dependency groupId="jtidy" artifactId="jtidy" version="4aug2000r7-dev"/> + <pom refid="maven.project"/> </artifact:dependencies> </target> Modified: trunk/httpunit/pom.xml =================================================================== --- trunk/httpunit/pom.xml 2008-05-19 16:54:31 UTC (rev 979) +++ trunk/httpunit/pom.xml 2008-05-19 17:08:44 UTC (rev 980) @@ -18,7 +18,7 @@ <groupId>httpunit</groupId> <artifactId>httpunit</artifactId> <version>1.7-SNAPSHOT</version> - <description></description> + <description>A library for testing websites programmatically</description> <build> <sourceDirectory>src</sourceDirectory> <testSourceDirectory>test</testSourceDirectory> @@ -141,7 +141,7 @@ <dependency> <groupId>nekohtml</groupId> <artifactId>nekohtml</artifactId> - <version>1.9.6</version> + <version>0.9.5</version> </dependency> <dependency> <groupId>javax.servlet</groupId> @@ -154,16 +154,6 @@ <version>4aug2000r7-dev</version> </dependency> <dependency> - <groupId>xerces</groupId> - <artifactId>xercesImpl</artifactId> - <version>2.6.1</version> - </dependency> - <dependency> - <groupId>xerces</groupId> - <artifactId>xmlParserAPIs</artifactId> - <version>2.6.1</version> - </dependency> - <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4</version> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2008-05-19 17:56:41
|
Revision: 981 http://httpunit.svn.sourceforge.net/httpunit/?rev=981&view=rev Author: russgold Date: 2008-05-19 10:56:38 -0700 (Mon, 19 May 2008) Log Message: ----------- remove now-superfluous jars Modified Paths: -------------- trunk/httpunit/build.xml Removed Paths: ------------- trunk/httpunit/jars/activation.jar trunk/httpunit/jars/ant-dependencies.jar trunk/httpunit/jars/jars.txt trunk/httpunit/jars/mailapi.jar trunk/httpunit/jars/rhino-patch.txt Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-05-19 17:08:44 UTC (rev 980) +++ trunk/httpunit/build.xml 2008-05-19 17:56:38 UTC (rev 981) @@ -1,25 +1,26 @@ <?xml version="1.0" ?> -<!-- - * http://sourceforge.net/projects/httpunit/ - * Copyright (c) 2002-2008 Russell Gold - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and - * to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO - * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - $Header$ - $Id$ - $Log$ ---> +<!-- **************************************************************************************************************** +* +* $Id$ +* +* http://httpunit.org/ +* Copyright (c) 2002-2008 Russell Gold +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +* documentation files (the "Software"), to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and +* to permit persons to whom the Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or substantial portions +* of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +**************************************************************************************************************** --> <!-- ======================================================================= --> <!-- httpunit build file --> @@ -58,17 +59,6 @@ <property name="test.class" value="com.meterware.httpunit.HttpUnitSuite" /> <property name="servlet.test.class" value="com.meterware.servletunit.ServletUnitSuite" /> -<!-- =================================================================== --> -<!-- Defines the classpath used for testing. --> -<!-- =================================================================== --> -<path id="test.classpath"> - <fileset dir="${jars.dir}"> - <include name="activation.jar"/> - <include name="mailapi.jar" /> - </fileset> -</path> - - <!-- =================================================================== --> <!-- Prepares the build directory --> <!-- =================================================================== --> @@ -97,9 +87,8 @@ <echo message="using repository classpath"/> <typedef classpath="${jars.dir}/maven-ant-tasks-2.0.9.jar" resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" /> - <artifact:pom file="pom.xml" id="maven.project"/> <artifact:dependencies pathId="base.classpath" fileSetId="distributed.jars"> - <pom refid="maven.project"/> + <pom file="pom.xml"/> </artifact:dependencies> </target> @@ -116,7 +105,7 @@ <available property="jsdk.present" classname="javax.servlet.http.HttpServlet" classpathref="base.classpath" /> <available property="javamail.present" classname="javax.mail.internet.MimeMultipart" - classpathref="test.classpath" /> + classpathref="base.classpath" /> <available property="jaxp.present" classname="javax.xml.parsers.DocumentBuilderFactory" classpathref="base.classpath" /> <available property="rhino.present" classname="org.mozilla.javascript.Context" @@ -195,7 +184,6 @@ debug="on" deprecation="off" optimize="off"> <classpath> <path refid="base.classpath" /> - <path refid="test.classpath" /> <pathelement location="${build.classes}" /> </classpath> <exclude name="**/servletunit/*" unless="jsdk.present" /> @@ -219,7 +207,6 @@ <java classname="${test.class}" fork="yes" > <classpath> <path refid="base.classpath" /> - <path refid="test.classpath" /> <pathelement location="${build.classes}" /> <pathelement location="META-INF" /> <pathelement location="${test.classes}" /> Deleted: trunk/httpunit/jars/activation.jar =================================================================== (Binary files differ) Deleted: trunk/httpunit/jars/ant-dependencies.jar =================================================================== (Binary files differ) Deleted: trunk/httpunit/jars/jars.txt =================================================================== --- trunk/httpunit/jars/jars.txt 2008-05-19 17:08:44 UTC (rev 980) +++ trunk/httpunit/jars/jars.txt 2008-05-19 17:56:38 UTC (rev 981) @@ -1,5 +0,0 @@ -Jars used: - -(for testing HttpUnit only) -mail (javamail 1.2) -activation (jaf 1.0.1) Deleted: trunk/httpunit/jars/mailapi.jar =================================================================== (Binary files differ) Deleted: trunk/httpunit/jars/rhino-patch.txt =================================================================== --- trunk/httpunit/jars/rhino-patch.txt 2008-05-19 17:08:44 UTC (rev 980) +++ trunk/httpunit/jars/rhino-patch.txt 2008-05-19 17:56:38 UTC (rev 981) @@ -1,24 +0,0 @@ -Index: js/rhino/src/org/mozilla/javascript/Interpreter.java -=================================================================== -RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Interpreter.java,v -retrieving revision 1.130 -diff -u -r1.130 Interpreter.java ---- js/rhino/src/org/mozilla/javascript/Interpreter.java 17 Feb 2003 08:50:55 -0000 1.130 -+++ js/rhino/src/org/mozilla/javascript/Interpreter.java 17 Feb 2003 15:43:53 -0000 -@@ -2032,6 +2032,16 @@ - --stackTop; - Object lhs = stack[stackTop]; - if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); -+ else if (lhs == undefined) { -+ // special code for better error message for get property from undefined -+ int j = pc-6; -+ while (j > 0 && iCode[j] != 0) j--; -+ int i = getShort(iCode, j); -+ if (i >= 0 && i < strings.length) { -+ lhs=strings[i]; -+ throw NativeGlobal.typeError1( "msg.is.not.defined", ScriptRuntime.toString(lhs),scope ); -+ } -+ } - stack[stackTop] = ScriptRuntime.getProp(lhs, name, scope); - break; - } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2008-05-20 19:47:49
|
Revision: 982 http://httpunit.svn.sourceforge.net/httpunit/?rev=982&view=rev Author: russgold Date: 2008-05-20 12:47:44 -0700 (Tue, 20 May 2008) Log Message: ----------- prepare for 1.7 release Modified Paths: -------------- trunk/httpunit/doc/release_notes.html trunk/httpunit/pom.xml trunk/httpunit/sitedocs/news.xml trunk/httpunit/sitedocs/site.xml trunk/httpunit/src/com/meterware/httpunit/cookies/Cookie.java trunk/httpunit/src/com/meterware/servletunit/ServletUnitServletContext.java trunk/httpunit/test/com/meterware/httpunit/cookies/CookieTest.java Modified: trunk/httpunit/doc/release_notes.html =================================================================== --- trunk/httpunit/doc/release_notes.html 2008-05-19 17:56:38 UTC (rev 981) +++ trunk/httpunit/doc/release_notes.html 2008-05-20 19:47:44 UTC (rev 982) @@ -20,7 +20,7 @@ <h2>Revision History:</h2> -<h3>Version 1.7 Released 2008-05-14</h3> +<h3>Version 1.7 Released 2008-05-20</h3> <h4>Acknowledgements:</h4> This project would almost certainly have remained dormant without the extraordinary contributions of our new committer, Wolfgang Fahl. Wolfgang has been extremely active over the past few months, erasing the backlog in bug, patches, and enhancement requests, @@ -40,7 +40,7 @@ <li>Hugh Winkler for fixing getPathInfo decoding</li> <li>David D. Kilzer for supporting direct invocation ot javascript events</li> <li>Fabrizio Giustina for enabling html parsing of xml responses</li> - <li>Roger Lindsj\xF6 for adding handling of empty error pages under JDK 1.5</li> + <li>Roger Lindsj for adding handling of empty error pages under JDK 1.5</li> </ul> <h4>Notes:</h4> @@ -58,7 +58,7 @@ http://httpunit.svn.sourceforge.net/svnroot/httpunit/trunk/httpunit </li> <li>The build now uses the Maven dependencies task (see http://maven.apache.org/ant-tasks.html) rather than - keeping the dependent jars in cvs. + keeping the dependent jars in the repository. </li> <li>When using the nekoHtml parser, tag and attribute names now default to lower case, rather than upper case as before</li> <li>Empty cells from tables are no longer automatically purged when searching for a table by its first non-blank cell</li> Modified: trunk/httpunit/pom.xml =================================================================== --- trunk/httpunit/pom.xml 2008-05-19 17:56:38 UTC (rev 981) +++ trunk/httpunit/pom.xml 2008-05-20 19:47:44 UTC (rev 982) @@ -17,7 +17,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>httpunit</groupId> <artifactId>httpunit</artifactId> - <version>1.7-SNAPSHOT</version> + <version>1.7</version> <description>A library for testing websites programmatically</description> <build> <sourceDirectory>src</sourceDirectory> @@ -153,6 +153,16 @@ <artifactId>jtidy</artifactId> <version>4aug2000r7-dev</version> </dependency> + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <version>2.6.1</version> + </dependency> + <dependency> + <groupId>xerces</groupId> + <artifactId>xmlParserAPIs</artifactId> + <version>2.6.1</version> + </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> Modified: trunk/httpunit/sitedocs/news.xml =================================================================== --- trunk/httpunit/sitedocs/news.xml 2008-05-19 17:56:38 UTC (rev 981) +++ trunk/httpunit/sitedocs/news.xml 2008-05-20 19:47:44 UTC (rev 982) @@ -1,5 +1,6 @@ <?xml version='1.0' ?> <news> + <item date="20-May-2008">HttpUnit 1.7 released</item> <item date="02-Apr-2008">Open Tracker items patches/bug incorporated</item> <item date="26-Nov-2006">Switched to subversion repository</item> <item date="27-Mar-2006">HttpUnit 1.6.2 released</item> Modified: trunk/httpunit/sitedocs/site.xml =================================================================== --- trunk/httpunit/sitedocs/site.xml 2008-05-19 17:56:38 UTC (rev 981) +++ trunk/httpunit/sitedocs/site.xml 2008-05-20 19:47:44 UTC (rev 982) @@ -11,7 +11,7 @@ <fragment source="sitedocs/doc/license.html"/> </page> - <external location="http://prdownloads.sourceforge.net/httpunit/httpunit-1.6.2.zip?download" item="Download 1.6.2"/> + <external location="http://prdownloads.sourceforge.net/httpunit/httpunit-1.7.zip?download" item="Download 1.7"/> <space/> <page location="doc/cookbook.html" title="Cookbook"> Modified: trunk/httpunit/src/com/meterware/httpunit/cookies/Cookie.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/cookies/Cookie.java 2008-05-19 17:56:38 UTC (rev 981) +++ trunk/httpunit/src/com/meterware/httpunit/cookies/Cookie.java 2008-05-20 19:47:44 UTC (rev 982) @@ -44,15 +44,17 @@ private String _domain; private long _expiredTime; - - /** - * @return the _expiredTime in milliseconds - */ - public long getExpiredTime() { - return _expiredTime; - } - + + /** + * @return the _expiredTime in milliseconds + */ + public long getExpiredTime() { + return _expiredTime; + } + + + /** * DateFormat to be used to format original Netscape cookies */ private final static DateFormat originalCookieFormat = Modified: trunk/httpunit/src/com/meterware/servletunit/ServletUnitServletContext.java =================================================================== --- trunk/httpunit/src/com/meterware/servletunit/ServletUnitServletContext.java 2008-05-19 17:56:38 UTC (rev 981) +++ trunk/httpunit/src/com/meterware/servletunit/ServletUnitServletContext.java 2008-05-20 19:47:44 UTC (rev 982) @@ -359,6 +359,13 @@ return _application.getDisplayName(); } +//-------------------------------------- servlet-api 2.5 additions ----------------------------------------------- + + public String getContextPath() { + return null; + } + + //------------------------------------------- package members ---------------------------------------------------- Modified: trunk/httpunit/test/com/meterware/httpunit/cookies/CookieTest.java =================================================================== --- trunk/httpunit/test/com/meterware/httpunit/cookies/CookieTest.java 2008-05-19 17:56:38 UTC (rev 981) +++ trunk/httpunit/test/com/meterware/httpunit/cookies/CookieTest.java 2008-05-20 19:47:44 UTC (rev 982) @@ -172,37 +172,38 @@ * test cookie age and expiration handling * see also Friday Fun: I Hate Cookies * http://www.mnot.net/blog/2006/10/27/cookie_fun - * @throws Exception + * @throws Exception when an unexpected error occurs */ public void testCookieAge() throws Exception { - String ages[]= {"max-age=5000", - "Max-Age=3000", - "expires=Tue, 29-Mar-2005 19:30:42 GMT; Max-Age=2592000", - "Max-Age=2592000;expires=Tue, 29-Mar-2005 19:30:42 GMT", - "expires=Tue, 29-Mar-2005 19:30:42 GMT", - "Expires=Wednesday, 01-Jan-1970 0:0:00 GMT" - }; - long expectedMilliSeconds[]={System.currentTimeMillis()+5000*1000, - System.currentTimeMillis()+3000*1000, - 1112124642000l, - 1112124642000l, - 1112124642000l, - 0}; - for (int i=0;i<ages.length;i++) { - String index=""+i; - String cookieName="cookie"+index.trim(); - String header=cookieName+"=cookievalue;"+ages[i]; - TestSource source=new TestSource(new URL("http://www.somedomain.com/somepath/"),header); - CookieJar jar = new CookieJar(source); - Cookie cookie=jar.getCookie(cookieName); - assertTrue(cookieName+" not null",cookie!=null); - if (cookie!=null) { - long expiredTime=cookie.getExpiredTime(); - assertEquals(cookieName+" expiration",expiredTime,expectedMilliSeconds[i]); - } - } + String ages[] = {"max-age=5000", + "Max-Age=3000", + "expires=Tue, 29-Mar-2005 19:30:42 GMT; Max-Age=2592000", + "Max-Age=2592000;expires=Tue, 29-Mar-2005 19:30:42 GMT", + "expires=Tue, 29-Mar-2005 19:30:42 GMT", + "Expires=Wednesday, 01-Jan-1970 0:0:00 GMT" + }; + long expectedMilliSeconds[] = {System.currentTimeMillis() + 5000 * 1000, + System.currentTimeMillis() + 3000 * 1000, + 1112124642000l, + 1112124642000l, + 1112124642000l, + 0}; + + for (int i = 0; i < ages.length; i++) { + String index = "" + i; + String cookieName = "cookie" + index.trim(); + String header = cookieName + "=cookievalue;" + ages[i]; + TestSource source = new TestSource( new URL( "http://www.somedomain.com/somepath/" ), header ); + CookieJar jar = new CookieJar( source ); + Cookie cookie = jar.getCookie( cookieName ); + assertNotNull( cookieName + " not null", cookie ); + + long expiredTime = cookie.getExpiredTime(); + assertEquals( cookieName + " expiration", expiredTime, expectedMilliSeconds[i] ); + } } + public void testHeaderGeneration() throws Exception { CookieJar jar = new CookieJar(); jar.putCookie( "zero", "nil" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2008-05-20 20:26:23
|
Revision: 984 http://httpunit.svn.sourceforge.net/httpunit/?rev=984&view=rev Author: russgold Date: 2008-05-20 13:26:21 -0700 (Tue, 20 May 2008) Log Message: ----------- cleanup for 1.7 Modified Paths: -------------- trunk/httpunit/build.xml trunk/httpunit/sitedocs/doc/developers.xml trunk/httpunit/sitedocs/news.xml trunk/httpunit/src/com/meterware/httpunit/BlockElement.java trunk/httpunit/src/com/meterware/httpunit/Button.java trunk/httpunit/src/com/meterware/httpunit/HTMLElementBase.java trunk/httpunit/src/com/meterware/httpunit/HTMLElementScriptable.java trunk/httpunit/src/com/meterware/httpunit/WebRequestSource.java trunk/httpunit/src/com/meterware/httpunit/scripting/ScriptableDelegate.java Removed Paths: ------------- trunk/httpunit/lib/ Modified: trunk/httpunit/build.xml =================================================================== --- trunk/httpunit/build.xml 2008-05-20 19:57:25 UTC (rev 983) +++ trunk/httpunit/build.xml 2008-05-20 20:26:21 UTC (rev 984) @@ -28,7 +28,7 @@ <project name="httpunit" default="jar" basedir="." xmlns:artifact="urn:maven-artifact-ant"> <property name="name" value="httpunit" /> <property name="Name" value="HttpUnit" /> - <property name="version" value="development" /> + <property name="version" value="1.7" /> <property name="revision" value="$Rev$" /> <property name="debug" value="on" /> @@ -239,18 +239,11 @@ HttpUnit-Version: ${version} Build-Date: ${TODAY} Build-Time: ${TSTAMP} -Revision: ${revision} </echo> - <!-- compressed default jar file --> <jar jarfile="${lib.dir}/${name}.jar" manifest="${build.dir}/info.txt"> <fileset dir="${build.classes}" includes="com/**"/> <fileset dir="META-INF" includes="*.dtd"/> </jar> - <!-- non compressed default jar file --> - <jar jarfile="${lib.dir}/${name}_uncompressed.jar" manifest="${build.dir}/info.txt" compress="false" > - <fileset dir="${build.classes}" includes="com/**"/> - <fileset dir="META-INF" includes="*.dtd"/> - </jar> </target> Modified: trunk/httpunit/sitedocs/doc/developers.xml =================================================================== --- trunk/httpunit/sitedocs/doc/developers.xml 2008-05-20 19:57:25 UTC (rev 983) +++ trunk/httpunit/sitedocs/doc/developers.xml 2008-05-20 20:26:21 UTC (rev 984) @@ -2,7 +2,7 @@ <developers> <group type="Maintainers"> <developer username="russgold" name="Russell Gold" email="rus...@ht..."> - The author and maintainer of HttpUnit, Russell has been developing software for over 25 years, and has been + The author and maintainer of HttpUnit, Russell has been developing software for over 30 years, and has been programming in Java since 1996. He is currently working for Oracle in Moorestown, NJ on the OC4J application server. </developer> @@ -10,12 +10,12 @@ <group type="Committers"> <developer username="wolfgang_fahl" name="Wolfgang Fahl" email="wf...@bi..."> Wolfgang has been using httpunit for testing his UML2PHP project result since 2004. He started - being a committer in 2007. Wolfgang works with computers since 1979 when he was 16 years old. + being a committer in 2007. Wolfgang has worked with computers since 1979 when he was 16 years old. He studied computer science at RWTH Aachen, germany. He is a specialist in software engineering since 1991 and trainer for software architects since 2003. He learned Java the same year as Russell: 1996. Test first software development is a key concept of Wolfgang's work since the same year. He is currently founder and CEO of BITPlan GmbH, Düsseldorf. - <developer> + </developer> </group> <group type="Contributors (partial list)"> <developer name="Artashes Aghajanyan" email="Art...@ly..."/> @@ -41,28 +41,28 @@ <developer name="Troy Waldrep" email="twa...@da..."/> <developer name="Ron Webster" email="ron...@ge..."/> <developer name="Bernhard Wagner" email="bw...@xm..."/> - <developer name="ahansen"/> - <developer name="Alexey Bulat"/> - <developer name="Christoph"/> - <developer name="Dan Allen"/> - <developer name="David D Kilzer"/> - <developer name="fabrizio giustina"/> - <developer name="Glen Stampoultzis"/> - <developer name="gklopp"/> - <developer name="Hugh Winkler"/> - <developer name="James Abley"/> - <developer name="Jord Sonneveld"/> - <developer name="kauffmann81"/> - <developer name="Mark Childerson"/> - <developer name="Matt"/> - <developer name="Peter Phillips"/> - <developer name="Rafal Krzewski"/> - <developer name="Richard Lee"/> - <developer name="Satish Kolli"/> - <developer name="Serguei Khramtchenko"/> - <developer name="Seth Ladd"/> - <developer name="Tim"/> - <developer name="Ville Skytt"/> - <developer name="Yu Chen"/> + <developer name="ahansen"/> + <developer name="Alexey Bulat"/> + <developer name="Christoph"/> + <developer name="Dan Allen"/> + <developer name="David D Kilzer"/> + <developer name="fabrizio giustina"/> + <developer name="Glen Stampoultzis"/> + <developer name="gklopp"/> + <developer name="Hugh Winkler"/> + <developer name="James Abley"/> + <developer name="Jord Sonneveld"/> + <developer name="kauffmann81"/> + <developer name="Mark Childerson"/> + <developer name="Matt"/> + <developer name="Peter Phillips"/> + <developer name="Rafal Krzewski"/> + <developer name="Richard Lee"/> + <developer name="Satish Kolli"/> + <developer name="Serguei Khramtchenko"/> + <developer name="Seth Ladd"/> + <developer name="Tim"/> + <developer name="Ville Skytt"/> + <developer name="Yu Chen"/> </group> </developers> Modified: trunk/httpunit/sitedocs/news.xml =================================================================== --- trunk/httpunit/sitedocs/news.xml 2008-05-20 19:57:25 UTC (rev 983) +++ trunk/httpunit/sitedocs/news.xml 2008-05-20 20:26:21 UTC (rev 984) @@ -1,6 +1,6 @@ <?xml version='1.0' ?> <news> - <item date="20-May-2008">HttpUnit 1.7 released</item> + <item date="20-May-2008" url="doc/release_notes.html">HttpUnit 1.7 released</item> <item date="02-Apr-2008">Open Tracker items patches/bug incorporated</item> <item date="26-Nov-2006">Switched to subversion repository</item> <item date="27-Mar-2006">HttpUnit 1.6.2 released</item> Modified: trunk/httpunit/src/com/meterware/httpunit/BlockElement.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/BlockElement.java 2008-05-20 19:57:25 UTC (rev 983) +++ trunk/httpunit/src/com/meterware/httpunit/BlockElement.java 2008-05-20 20:26:21 UTC (rev 984) @@ -134,12 +134,7 @@ return this.getScriptingHandler().doEventScript(eventScript); } - /** - * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup - * execute the script if it's assigned by calling doEvent for the script - * @param eventName - * @return true if the event with the given name was handled - */ + public boolean handleEvent(String eventName) { return this.getScriptingHandler().handleEvent(eventName); } Modified: trunk/httpunit/src/com/meterware/httpunit/Button.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/Button.java 2008-05-20 19:57:25 UTC (rev 983) +++ trunk/httpunit/src/com/meterware/httpunit/Button.java 2008-05-20 20:26:21 UTC (rev 984) @@ -82,9 +82,7 @@ /** * the onClickSequence for this button - * @param x - the x position - * @param y - the y position - * @return if the onClickSequence was handled + * @return true if the even was handled */ protected boolean doOnClickSequence(int x,int y) throws IOException, SAXException { verifyButtonEnabled(); @@ -104,13 +102,8 @@ doOnClickSequence(0,0); } - /** - * return the last result of verifyButtonEnabled or the - * initial enabled state derived from !isDisabled as originally setDisabled - * needed to fix bug report [ 1289151 ] Order of events in button.click() is wrong - * @return whether the button was originally enabled - */ - public boolean wasEnabled() { + + boolean wasEnabled() { return _wasEnabled; } Modified: trunk/httpunit/src/com/meterware/httpunit/HTMLElementBase.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HTMLElementBase.java 2008-05-20 19:57:25 UTC (rev 983) +++ trunk/httpunit/src/com/meterware/httpunit/HTMLElementBase.java 2008-05-20 20:26:21 UTC (rev 984) @@ -84,19 +84,12 @@ /** * optional do the event if it's defined - * @param eventScript - * @return true if the event script was run */ public boolean doEventScript(String eventScript) { return this.getScriptingHandler().doEventScript(eventScript); } - /** - * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup - * execute the script if it's assigned by calling doEvent for the script - * @param eventName - * @return whether the event was handled - */ + public boolean handleEvent(String eventName) { return this.getScriptingHandler().handleEvent(eventName); } Modified: trunk/httpunit/src/com/meterware/httpunit/HTMLElementScriptable.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/HTMLElementScriptable.java 2008-05-20 19:57:25 UTC (rev 983) +++ trunk/httpunit/src/com/meterware/httpunit/HTMLElementScriptable.java 2008-05-20 20:26:21 UTC (rev 984) @@ -86,23 +86,17 @@ _element.removeAttribute( attributeName ); } - /** - * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup - * execute the script if it's assigned by calling doEvent for the script - * @param eventName - * @return whether the event with the givne name was handled - */ public boolean handleEvent(String eventName) { - // check whether onclick is activated - if (eventName.toLowerCase().equals("onclick")) { - handleEvent("onmousedown"); - } - String eventScript = getAttribute( eventName ); - boolean result=doEventScript(eventScript); - if (eventName.toLowerCase().equals("onclick")) { - handleEvent("onmouseup"); - } - return result; + // check whether onclick is activated + if (eventName.toLowerCase().equals( "onclick" )) { + handleEvent( "onmousedown" ); + } + String eventScript = getAttribute( eventName ); + boolean result = doEventScript( eventScript ); + if (eventName.toLowerCase().equals( "onclick" )) { + handleEvent( "onmouseup" ); + } + return result; } /** Modified: trunk/httpunit/src/com/meterware/httpunit/WebRequestSource.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/WebRequestSource.java 2008-05-20 19:57:25 UTC (rev 983) +++ trunk/httpunit/src/com/meterware/httpunit/WebRequestSource.java 2008-05-20 20:26:21 UTC (rev 984) @@ -274,12 +274,7 @@ return this.getScriptingHandler().doEventScript(eventScript); } - /** - * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup - * execute the script if it's assigned by calling doEvent for the script - * @param eventName - * @return whether the event with the given name was handled - */ + public boolean handleEvent(String eventName) { return this.getScriptingHandler().handleEvent(eventName); } Modified: trunk/httpunit/src/com/meterware/httpunit/scripting/ScriptableDelegate.java =================================================================== --- trunk/httpunit/src/com/meterware/httpunit/scripting/ScriptableDelegate.java 2008-05-20 19:57:25 UTC (rev 983) +++ trunk/httpunit/src/com/meterware/httpunit/scripting/ScriptableDelegate.java 2008-05-20 20:26:21 UTC (rev 984) @@ -64,21 +64,20 @@ /** * Executes the specified scripted event. * @param eventScript - the eventScript to execute + * @return true if the event has been handled. **/ public boolean doEventScript( String eventScript ) { - if (eventScript.length() == 0) return true; - return getScriptEngine().doEventScript( eventScript ); + return eventScript.length() == 0 || getScriptEngine().doEventScript( eventScript ); } /** - * get the event Handler script for the event e.g. onchange, onmousedown, onclick, onmouseup - * execute the script if it's assigned by calling doEvent for the script - * @param eventName + * Executes the event Handler script for the specified event (such as onchange, onmousedown, onclick, onmouseup) if it is defined. + * @param eventName the name of the event for which a handler should be run. * @return whether the event with the given name was handled */ public boolean handleEvent(String eventName) { - String eventScript=(String)get(eventName); - return doEventScript(eventScript); + String eventScript = (String) get(eventName); + return doEventScript( eventScript ); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wol...@us...> - 2008-06-05 18:40:35
|
Revision: 988 http://httpunit.svn.sourceforge.net/httpunit/?rev=988&view=rev Author: wolfgang_fahl Date: 2008-06-05 11:40:32 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Eclipse settings added Added Paths: ----------- trunk/httpunit/.settings/ trunk/httpunit/.settings/org.eclipse.jdt.core.prefs Added: trunk/httpunit/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/httpunit/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/httpunit/.settings/org.eclipse.jdt.core.prefs 2008-06-05 18:40:32 UTC (rev 988) @@ -0,0 +1,12 @@ +#Thu Jun 05 20:38:34 CEST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |