You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2007/06/01 08:36:18 UTC
svn commit: r543403 - in /harmony/enhanced/buildtest/branches/2.0:
adaptors/struts_test/adaptor.xml
tests/struts_test/resources/showcase/compare.patterns.properties
tests/struts_test/src/org/apache/harmony/struts/test/WebAppTest.java
Author: smishura
Date: Thu May 31 23:36:17 2007
New Revision: 543403
URL: http://svn.apache.org/viewvc?view=rev&rev=543403
Log:
Apply patch from HARMONY-3597 that make testing scenario EOL-insensitive
Modified:
harmony/enhanced/buildtest/branches/2.0/adaptors/struts_test/adaptor.xml
harmony/enhanced/buildtest/branches/2.0/tests/struts_test/resources/showcase/compare.patterns.properties
harmony/enhanced/buildtest/branches/2.0/tests/struts_test/src/org/apache/harmony/struts/test/WebAppTest.java
Modified: harmony/enhanced/buildtest/branches/2.0/adaptors/struts_test/adaptor.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/adaptors/struts_test/adaptor.xml?view=diff&rev=543403&r1=543402&r2=543403
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/adaptors/struts_test/adaptor.xml (original)
+++ harmony/enhanced/buildtest/branches/2.0/adaptors/struts_test/adaptor.xml Thu May 31 23:36:17 2007
@@ -216,11 +216,28 @@
</fileset>
<report format="frames" todir="${tests.results.dir}/html"/>
</junitreport>
+ <move file="${suite.dir}/resources/showcase/showcase.err"
+ todir="${results.dir}/${suite.name}"
+ failonerror="false"/>
+ <condition property="finish-run-required">
+ <or>
+ <isset property="test.not.passed"/>
+ <isset property="test.error"/>
+ </or>
+ </condition>
+ <antcall target="-finish-run-if-failed" />
<fail message="Test failed" if="test.not.passed" />
<fail message="Test execution error" if="test.error" />
</target>
<!-- - - - - - - - - - - - - - - - - -
+ target: -finish-run-if-failed
+ - - - - - - - - - - - - - - - - - -->
+ <target name="-finish-run-if-failed" if="finish-run-required">
+ <antcall target="-finish-run" />
+ </target>
+
+ <!-- - - - - - - - - - - - - - - - - -
target: -set-vmarg-server-port
- - - - - - - - - - - - - - - - - -->
<target name="-set-vmarg-server-port" if="custom-server-port-is-set">
@@ -344,7 +361,7 @@
target: -finish-run
- - - - - - - - - - - - - - - - - -->
<target name="-finish-run">
- <copy file="${req.test.java.home}/lib/boot/bootclasspath.properties.bak"
+ <move file="${req.test.java.home}/lib/boot/bootclasspath.properties.bak"
tofile="${req.test.java.home}/lib/boot/bootclasspath.properties"
overwrite="true"
failonerror="false"
Modified: harmony/enhanced/buildtest/branches/2.0/tests/struts_test/resources/showcase/compare.patterns.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/struts_test/resources/showcase/compare.patterns.properties?view=diff&rev=543403&r1=543402&r2=543403
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/struts_test/resources/showcase/compare.patterns.properties (original)
+++ harmony/enhanced/buildtest/branches/2.0/tests/struts_test/resources/showcase/compare.patterns.properties Thu May 31 23:36:17 2007
@@ -50,4 +50,6 @@
0120.[AP]M</td> :</td>
0130.[A-Z][a-z]{2}\ [A-Z][a-z]{2}\ [0-9]{2}
0140.[A-Z]{4,5}\ [0-9]{4}
-0150.<td>in\ .*\ minutes</td>
+0150.<td>in\ .*\ minute.*</td> :<td></td>
+0160.<td>in\ .*\ hour.*</td> :<td></td>
+0170.<td>in\ .*\ day.*</td> :<td></td>
Modified: harmony/enhanced/buildtest/branches/2.0/tests/struts_test/src/org/apache/harmony/struts/test/WebAppTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/struts_test/src/org/apache/harmony/struts/test/WebAppTest.java?view=diff&rev=543403&r1=543402&r2=543403
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/struts_test/src/org/apache/harmony/struts/test/WebAppTest.java (original)
+++ harmony/enhanced/buildtest/branches/2.0/tests/struts_test/src/org/apache/harmony/struts/test/WebAppTest.java Thu May 31 23:36:17 2007
@@ -153,8 +153,6 @@
*/
public class WebAppTest {
- private static final String SPLIT_PATTERN = "\\r\\n";
-
private static final String ACTION_URL = "URL";
private static final String ACTION_ANCHOR = "ANCHOR";
private static final String ACTION_FORM = "FORM";
@@ -611,8 +609,8 @@
return;
}
// Compare line by line
- String[] localLines = expected.split(SPLIT_PATTERN);
- String[] remoteLines = resp.split(SPLIT_PATTERN);
+ String[] localLines = fixEOL(expected).split("\\n");
+ String[] remoteLines = fixEOL(resp).split("\\n");
String failureMessage = "";
if (localLines.length != remoteLines.length) {
failed = true;
@@ -654,12 +652,26 @@
}
}
// check that there was no lines mismatches
+ if (failed) {
+ System.out.println(failureMessage);
+ }
Assert.assertFalse(failureMessage, failed);
} finally {
if (localStream != null) {
localStream.close();
}
}
+ }
+
+ private String fixEOL(String text) {
+ String fixed = text;
+ if (fixed.indexOf("\r\n") >= 0) {
+ fixed = fixed.replaceAll("\\r\\n", "\n");
+ }
+ if (fixed.indexOf("\r") >= 0) {
+ fixed = fixed.replaceAll("\\r", "\n");
+ }
+ return fixed;
}
/**