You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ar...@locus.apache.org on 2000/01/27 19:52:08 UTC
cvs commit: jakarta-tools/moo/src/share/org/apache/tools/moo/jsp PositiveJspCheckTest.java
arun 00/01/27 10:52:08
Modified: moo/src/share/org/apache/tools/moo/jsp
PositiveJspCheckTest.java
Log:
Chanes made to support Golden file lookup on the client side instead
of previous server side.
Revision Changes Path
1.4 +15 -28 jakarta-tools/moo/src/share/org/apache/tools/moo/jsp/PositiveJspCheckTest.java
Index: PositiveJspCheckTest.java
===================================================================
RCS file: /home/cvs/jakarta-tools/moo/src/share/org/apache/tools/moo/jsp/PositiveJspCheckTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PositiveJspCheckTest.java 1999/11/05 04:30:14 1.3
+++ PositiveJspCheckTest.java 2000/01/27 18:52:08 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tools/moo/src/share/org/apache/tools/moo/jsp/PositiveJspCheckTest.java,v 1.3 1999/11/05 04:30:14 vanitha Exp $
- * $Date: 1999/11/05 04:30:14 $
- * $Revision: 1.3 $
+ * $Header: /home/cvs/jakarta-tools/moo/src/share/org/apache/tools/moo/jsp/PositiveJspCheckTest.java,v 1.4 2000/01/27 18:52:08 arun Exp $
+ * $Date: 2000/01/27 18:52:08 $
+ * $Revision: 1.4 $
*
* The Apache Software License, Version 1.1
*
@@ -135,21 +135,18 @@
result.append(" " + token);
}
-
}
-
-
// Get the expected result from the "golden" file.
StringBuffer expResult = getExpectedResult (getGoldenFileName());
// Compare the results and set the status
- String diff = null;
- boolean status = compare(result.toString(), expResult.toString(), diff);
+ boolean status = compare(result.toString(), expResult.toString());
testResult.setStatus(status);
// Set the message (Check with SCheck.
- testResult.setMessage(diff);
+ if (status == false)
+ testResult.setMessage("COMPARISION_FAILED");
// Now free the connection.
connection.disconnect();
@@ -163,38 +160,30 @@
public StringBuffer getExpectedResult(String goldenFile)
throws IOException{
- URL url;
- HttpURLConnection con;
StringBuffer expResult = new StringBuffer();
- String mapResource = this.getClass().getName();
-
+ BufferedReader in = null;
try {
-
- String gfURL = mapManager.getGoldenfilePrefix(mapResource, goldenFile);
- url = URLHelper.getURL(gfURL);
- out.println("url = " + url.toString());
+ String golden = goldenFile.substring(goldenFile.lastIndexOf("/") + 1,
+ goldenFile.length());
- con = (HttpURLConnection) url.openConnection();
- con.setUseCaches(false);
+ in = new BufferedReader
+ (new InputStreamReader(
+ this.getClass().getResourceAsStream(golden)));
- BufferedReader in = new BufferedReader
- (new InputStreamReader(con.getInputStream()));
-
String line = null;
-
while ((line = in.readLine()) != null ) {
StringTokenizer tok = new StringTokenizer(line);
while (tok.hasMoreTokens()) {
String token = tok.nextToken();
expResult.append(" " + token);
}
-
-
}
} catch (Exception ex) {
out.println (ex.getMessage());
+ } finally {
+ in.close();
}
return expResult;
@@ -202,7 +191,7 @@
// Compare the actual result and the expected result.
// Should employ a more sophasticated mechanism for comparison.
- public boolean compare(String str1, String str2, String diff) {
+ public boolean compare(String str1, String str2) {
StringTokenizer st1=new StringTokenizer(str1);
StringTokenizer st2=new StringTokenizer(str2);
@@ -219,13 +208,11 @@
// eat the exception.
}
- diff = "COMPARISON_FAIL";
return false;
}
}
if (st1.hasMoreTokens() || st2.hasMoreTokens()) {
- diff = "COMPARISON_FAIL";
return false;
} else {
return true;