jakarta-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1179979 - in /jakarta/jmeter/trunk: bin/testfiles/HTMLParserTestFile_2.htm bin/testfiles/HTMLParserTestFile_2.html test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
Date Fri, 07 Oct 2011 11:56:07 GMT
On 7 October 2011 10:27,  <pmouawad@apache.org> wrote:
> Author: pmouawad
> Date: Fri Oct  7 09:27:54 2011
> New Revision: 1179979
>
> URL: http://svn.apache.org/viewvc?rev=1179979&view=rev
> Log:
> Fixed errors in TestCase (6 test failures):
> - Error in baseURL for relative file names (testfiles not needed I think)

Not sure about that - needs further invetigation.

> - FileInputStream not closed

OK

> - Renamed  HTMLParserTestFile_2.htm to HTMLParserTestFile_2.html

I think that was the wrong fix, as you discovered later when the batch
test failed.
But not work reverting now.

> Added:
>    jakarta/jmeter/trunk/bin/testfiles/HTMLParserTestFile_2.html
>      - copied unchanged from r1179973, jakarta/jmeter/trunk/bin/testfiles/HTMLParserTestFile_2.htm
> Removed:
>    jakarta/jmeter/trunk/bin/testfiles/HTMLParserTestFile_2.htm
> Modified:
>    jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
>
> Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
> URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java?rev=1179979&r1=1179978&r2=1179979&view=diff
> ==============================================================================
> --- jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
(original)
> +++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
Fri Oct  7 09:27:54 2011
> @@ -22,6 +22,7 @@ import java.io.BufferedReader;
>  import java.io.File;
>  import java.io.FileInputStream;
>  import java.io.FileReader;
> +import java.io.InputStream;
>  import java.net.URL;
>  import java.util.ArrayList;
>  import java.util.Collection;
> @@ -32,12 +33,14 @@ import java.util.Properties;
>  import java.util.TreeSet;
>  import java.util.Vector;
>
> +import org.apache.commons.io.IOUtils;
>  import org.apache.jmeter.junit.JMeterTestCase;
>  import org.apache.jmeter.util.JMeterUtils;
>  import org.apache.jorphan.logging.LoggingManager;
>  import org.apache.log.Logger;
>
>  import junit.framework.TestSuite;
> +import junit.textui.TestRunner;
>
>  public class TestHTMLParser extends JMeterTestCase {
>     private static final Logger log = LoggingManager.getLoggerForClass();
> @@ -135,7 +138,7 @@ public class TestHTMLParser extends JMet
>                         "testfiles/HTMLParserTestFrames.all"),
>                 // Relative filenames
>                 new TestData("testfiles/HTMLParserTestFile_2.html",
> -                        "file:testfiles/HTMLParserTestFile_2.html",
> +                        "file:HTMLParserTestFile_2.html",
>                         "testfiles/HTMLParserTestFile_2.all",
>                         "testfiles/HTMLParserTestFile_2.all"),
>                          };
> @@ -252,8 +255,14 @@ public class TestHTMLParser extends JMet
>             log.debug("file   " + file);
>             File f = findTestFile(file);
>             byte[] buffer = new byte[(int) f.length()];
> -            int len = new FileInputStream(f).read(buffer);
> -            assertEquals(len, buffer.length);
> +            InputStream is = null;
> +            try {
> +                is = new FileInputStream(f);
> +                int len = is.read(buffer);
> +                assertEquals(len, buffer.length);
> +            } finally {
> +                IOUtils.closeQuietly(is);
> +            }
>             Iterator<URL> result;
>             if (c == null) {
>                 result = p.getEmbeddedResourceURLs(buffer, new URL(url));
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: notifications-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: dev-help@jakarta.apache.org


Mime
View raw message