Index: tests/JettyScenario/src/JettyScenario.java =================================================================== --- tests/JettyScenario/src/JettyScenario.java (revision 549032) +++ tests/JettyScenario/src/JettyScenario.java (working copy) @@ -15,6 +15,8 @@ * limitations under the License. */ +package org.apache.harmony.test.jetty; + import com.gargoylesoftware.htmlunit.*; import com.gargoylesoftware.htmlunit.html.*; Index: tests/JettyScenario/src/JettyTestCase.java =================================================================== --- tests/JettyScenario/src/JettyTestCase.java (revision 549032) +++ tests/JettyScenario/src/JettyTestCase.java (working copy) @@ -15,6 +15,8 @@ * limitations under the License. */ +package org.apache.harmony.test.jetty; + import com.gargoylesoftware.htmlunit.*; import java.io.File; @@ -28,6 +30,8 @@ import java.net.MalformedURLException; import java.net.URL; +import java.util.Vector; + import junit.framework.TestCase; public class JettyTestCase extends TestCase { @@ -101,20 +105,18 @@ String cs = null; String fs = null; + Vector cv = new Vector(); + Vector fv = new Vector(); + Vector sv = new Vector(); try { cs = creader.readLine(); fs = freader.readLine(); while (cs != null && fs != null) { if (!compareLines(cs, fs)) { - LOG_OUT.println("Lines:"); - LOG_OUT.println("--content-----------------------------------------------------------------------"); - LOG_OUT.println("(" + creader.getLineNumber() + ") " + cs); - LOG_OUT.println("--etalon------------------------------------------------------------------------"); - LOG_OUT.println("(" + freader.getLineNumber() + ") " + fs); - LOG_OUT.println("--------------------------------------------------------------------------------"); - LOG_OUT.println("do not match each other."); - return false; + cv.add(cs); + sv.add(fs); } + fv.add(fs); cs = creader.readLine(); fs = freader.readLine(); } @@ -125,10 +127,17 @@ } if (cs != null || fs != null) { - LOG_OUT.println("Files have different number of lines."); + LOG_OUT.println("Page have different number of lines than etalon."); return false; } + if (cv.size() != 0 || fv.size() != 0) { + if (!compareRegardlessOrder(cv, sv, fv)) { + LOG_OUT.println("Page differs from etalon (even if lines order is not checked)."); + return false; + } + } + try { creader.close(); freader.close(); @@ -141,6 +150,34 @@ return true; } + protected boolean compareRegardlessOrder(Vector first, Vector second, Vector third) { + for (int i = 0; i < first.size(); i++) { + boolean ok = false; + for (int j = 0; j < third.size(); j++) { + if (compareLines((String)first.elementAt(i), (String)third.elementAt(j))) { + ok = true; + } + } + if (!ok) { + LOG_OUT.println("Lines:"); + int linesCount = (first.size() > 20) ? 20 : first.size(); + for (int j = 0; j < linesCount; j++) { + LOG_OUT.println("--content-----------------------------------------------------------------------"); + LOG_OUT.println((String)first.elementAt(j)); + LOG_OUT.println("--etalon------------------------------------------------------------------------"); + LOG_OUT.println((String)second.elementAt(j)); + } + LOG_OUT.println("--------------------------------------------------------------------------------"); + if (first.size() > 20) { + LOG_OUT.println("and " + (first.size() - 20) + " lines more"); + } + LOG_OUT.println("do not match each other."); + return false; + } + } + return true; + } + protected boolean compareLines(String first, String second) { if (second.startsWith("$$$")) { return first.matches(second.substring(3)); Index: adaptors/JettyScenario/parameters.xml =================================================================== --- adaptors/JettyScenario/parameters.xml (revision 545082) +++ adaptors/JettyScenario/parameters.xml (working copy) @@ -28,6 +28,9 @@ + @@ -66,8 +69,8 @@ - + - + Index: adaptors/JettyScenario/adaptor.xml =================================================================== --- adaptors/JettyScenario/adaptor.xml (revision 545082) +++ adaptors/JettyScenario/adaptor.xml (working copy) @@ -25,6 +25,10 @@ + + + + @@ -77,6 +81,7 @@ + + + + + + + + + + + + + + @@ -100,7 +119,7 @@ - + @@ -124,6 +143,7 @@ haltonfailure="false" printsummary="on" failureproperty="scenario.failed"> + @@ -139,16 +159,18 @@ - + - + + + - + @@ -171,33 +193,14 @@ + + - - - - - - - - - - - - - - - - - @@ -221,7 +224,7 @@ message="${ls}================================================================================${ls}Scenario results:${ls}${ls}"/> - + - - - - - - - - - - - Sending notification - - -