curcuru 00/12/01 14:18:25
Modified: test/java/src/org/apache/qetest CheckService.java
ConsoleLogger.java Logger.java
SimpleFileCheckService.java XMLFileLogger.java
Log:
Add duplicate check*() methods with optional 'String id' param
Revision Changes Path
1.2 +17 -2
xml-xalan/test/java/src/org/apache/qetest/CheckService.java
Index: CheckService.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/CheckService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CheckService.java 2000/11/01 23:30:51 1.1
+++ CheckService.java 2000/12/01 22:18:20 1.2
@@ -67,7 +67,7 @@
* Implementers provide their own algorithims for determining
* equivalence.
* @author [EMAIL PROTECTED]
- * @version $Id: CheckService.java,v 1.1 2000/11/01 23:30:51 curcuru Exp $
+ * @version $Id: CheckService.java,v 1.2 2000/12/01 22:18:20 curcuru Exp $
*/
public interface CheckService
{
@@ -90,12 +90,27 @@
* @param actual (current) Object to check
* @param reference (gold, or expected) Object to check against
* @param description of what you're checking
- * NEEDSDOC @param msg
+ * @param msg comment to log out with this test point
* @return Reporter.*_RESULT code denoting status; each method may define
* it's own meanings for pass, fail, ambiguous, etc.
*/
public abstract int check(Reporter reporter, Object actual,
Object reference, String msg);
+
+ /**
+ * Compare two objects for equivalence, and return appropriate result.
+ *
+ * @param reporter to dump any output messages to
+ * @param actual (current) Object to check
+ * @param reference (gold, or expected) Object to check against
+ * @param description of what you're checking
+ * @param msg comment to log out with this test point
+ * @param id ID tag to log out with this test point
+ * @return Reporter.*_RESULT code denoting status; each method may define
+ * it's own meanings for pass, fail, ambiguous, etc.
+ */
+ public abstract int check(Reporter reporter, Object actual,
+ Object reference, String msg, String id);
/**
* Description of algorithim used to check equivalence.
1.2 +52 -1
xml-xalan/test/java/src/org/apache/qetest/ConsoleLogger.java
Index: ConsoleLogger.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/ConsoleLogger.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConsoleLogger.java 2000/11/01 23:30:51 1.1
+++ ConsoleLogger.java 2000/12/01 22:18:21 1.2
@@ -71,7 +71,7 @@
/**
* Logger that prints human-readable output to System.out.
* @author [EMAIL PROTECTED]
- * @version $Id: ConsoleLogger.java,v 1.1 2000/11/01 23:30:51 curcuru Exp $
+ * @version $Id: ConsoleLogger.java,v 1.2 2000/12/01 22:18:21 curcuru Exp $
*/
public class ConsoleLogger implements Logger
{
@@ -450,6 +450,57 @@
public void checkErr(String comment)
{
outStream.println(sIndent + "ERROR " + comment);
+ }
+
+ /* EXPERIMENTAL: have duplicate set of check*() methods
+ that all output some form of ID as well as comment.
+ Leave the non-ID taking forms for both simplicity to the
+ end user who doesn't care about IDs as well as for
+ backwards compatibility.
+ */
+
+ /**
+ * Writes out a Pass record with comment and ID.
+ * @author [EMAIL PROTECTED]
+ * @param comment comment to log with the pass record.
+ * @param ID token to log with the pass record.
+ */
+ public void checkPass(String comment, String id)
+ {
+ outStream.println(sIndent + "PASS! (" + id + ") " + comment);
+ }
+
+ /**
+ * Writes out an ambiguous record with comment and ID.
+ * @author [EMAIL PROTECTED]
+ * @param comment to log with the ambg record.
+ * @param ID token to log with the pass record.
+ */
+ public void checkAmbiguous(String comment, String id)
+ {
+ outStream.println(sIndent + "AMBG (" + id + ") " + comment);
+ }
+
+ /**
+ * Writes out a Fail record with comment and ID.
+ * @author [EMAIL PROTECTED]
+ * @param comment comment to log with the fail record.
+ * @param ID token to log with the pass record.
+ */
+ public void checkFail(String comment, String id)
+ {
+ outStream.println(sIndent + "FAIL! (" + id + ") " + comment);
+ }
+
+ /**
+ * Writes out an Error record with comment and ID.
+ * @author [EMAIL PROTECTED]
+ * @param comment comment to log with the error record.
+ * @param ID token to log with the pass record.
+ */
+ public void checkErr(String comment, String id)
+ {
+ outStream.println(sIndent + "ERROR (" + id + ") " + comment);
}
} // end of class ConsoleLogger
1.2 +44 -2 xml-xalan/test/java/src/org/apache/qetest/Logger.java
Index: Logger.java
===================================================================
RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/Logger.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Logger.java 2000/11/01 23:30:51 1.1
+++ Logger.java 2000/12/01 22:18:21 1.2
@@ -87,7 +87,7 @@
* (i.e. number of tests passed/failed, graphs of results, etc.)</li>
* </ul>
* @author [EMAIL PROTECTED]
- * @version $Id: Logger.java,v 1.1 2000/11/01 23:30:51 curcuru Exp $
+ * @version $Id: Logger.java,v 1.2 2000/12/01 22:18:21 curcuru Exp $
* @todo maybe add set/getOutput methods? Would allow most
* types of loggers to get output streams, etc. externally
*/
@@ -354,7 +354,9 @@
* <p>Note this may have slightly different meanings for various
* types of Loggers (file-based, network-based, etc.) or for
* Reporters (which may still be able to function if only one
- * of their Loggers has an error)
+ * of their Loggers has an error)</p>
+ * <p>Note: we should consider renaming this to avoid possible
+ * confusion with the checkErr(String) method.</p>
* @author [EMAIL PROTECTED]
* @return status - true if an error has occoured, false if it's OK
*/
@@ -518,5 +520,45 @@
* @param comment comment to log with the error record.
*/
public abstract void checkErr(String comment);
+
+
+ /* EXPERIMENTAL: have duplicate set of check*() methods
+ that all output some form of ID as well as comment.
+ Leave the non-ID taking forms for both simplicity to the
+ end user who doesn't care about IDs as well as for
+ backwards compatibility.
+ */
+
+ /**
+ * Writes out a Pass record with comment and ID.
+ * @author [EMAIL PROTECTED]
+ * @param comment comment to log with the pass record.
+ * @param ID token to log with the pass record.
+ */
+ public abstract void checkPass(String comment, String id);
+
+ /**
+ * Writes out an ambiguous record with comment and ID.
+ * @author [EMAIL PROTECTED]
+ * @param comment to log with the ambg record.
+ * @param ID token to log with the pass record.
+ */
+ public abstract void checkAmbiguous(String comment, String id);
+
+ /**
+ * Writes out a Fail record with comment and ID.
+ * @author [EMAIL PROTECTED]
+ * @param comment comment to log with the fail record.
+ * @param ID token to log with the pass record.
+ */
+ public abstract void checkFail(String comment, String id);
+
+ /**
+ * Writes out an Error record with comment and ID.
+ * @author [EMAIL PROTECTED]
+ * @param comment comment to log with the error record.
+ * @param ID token to log with the pass record.
+ */
+ public abstract void checkErr(String comment, String id);
} // end of class Logger
1.2 +26 -8
xml-xalan/test/java/src/org/apache/qetest/SimpleFileCheckService.java
Index: SimpleFileCheckService.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/SimpleFileCheckService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SimpleFileCheckService.java 2000/11/01 23:30:51 1.1
+++ SimpleFileCheckService.java 2000/12/01 22:18:22 1.2
@@ -69,7 +69,7 @@
/**
* Simply does .readLine of each file into string buffers and then
String.equals().
* @author [EMAIL PROTECTED]
- * @version $Id: SimpleFileCheckService.java,v 1.1 2000/11/01 23:30:51
curcuru Exp $
+ * @version $Id: SimpleFileCheckService.java,v 1.2 2000/12/01 22:18:22
curcuru Exp $
*/
public class SimpleFileCheckService implements CheckService
{
@@ -93,12 +93,13 @@
* @param actual (current) File to check
* @param reference (gold, or expected) File to check against
* @param description of what you're checking
- * NEEDSDOC @param msg
+ * @param msg comment to log out with this test point
+ * @param id ID tag to log out with this test point
* @return Reporter.*_RESULT code denoting status; each method may define
* it's own meanings for pass, fail, ambiguous, etc.
*/
public int check(Reporter reporter, Object actual, Object reference,
- String msg)
+ String msg, String id)
{
if (!((actual instanceof File) & (reference instanceof File)))
@@ -106,7 +107,7 @@
// Must have File objects to continue
reporter.checkErr(
- "SimpleFileCheckService only takes files, with: " + msg);
+ "SimpleFileCheckService only takes files, with: " + msg, id);
return reporter.ERRR_RESULT;
}
@@ -116,7 +117,7 @@
// Fail if Actual file doesn't exist
if (fVal1 == null)
{
- reporter.checkFail(msg);
+ reporter.checkFail(msg, id);
return Reporter.FAIL_RESULT;
}
@@ -126,7 +127,7 @@
// Ambiguous if gold or reference file doesn't exist
if (fVal2 == null)
{
- reporter.checkAmbiguous(msg);
+ reporter.checkAmbiguous(msg, id);
return Reporter.AMBG_RESULT;
}
@@ -134,16 +135,33 @@
// Pass if they're equal, fail otherwise
if (fVal1.equals(fVal2))
{
- reporter.checkPass(msg);
+ reporter.checkPass(msg, id);
return Reporter.PASS_RESULT;
}
else
{
- reporter.checkFail(msg);
+ reporter.checkFail(msg, id);
return Reporter.FAIL_RESULT;
}
+ }
+
+ /**
+ * Compare two objects for equivalence, and return appropriate result.
+ *
+ * @param reporter to dump any output messages to
+ * @param actual (current) File to check
+ * @param reference (gold, or expected) File to check against
+ * @param description of what you're checking
+ * @param msg comment to log out with this test point
+ * @return Reporter.*_RESULT code denoting status; each method may define
+ * it's own meanings for pass, fail, ambiguous, etc.
+ */
+ public int check(Reporter reporter, Object actual, Object reference,
+ String msg)
+ {
+ return check(reporter, actual, reference, msg, null);
}
/**
1.3 +90 -1
xml-xalan/test/java/src/org/apache/qetest/XMLFileLogger.java
Index: XMLFileLogger.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/XMLFileLogger.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLFileLogger.java 2000/11/03 22:07:56 1.2
+++ XMLFileLogger.java 2000/12/01 22:18:22 1.3
@@ -76,7 +76,7 @@
* Logger that saves output to a simple XML-format file.
* @todo improve escapeString so it's more rigorous about escaping
* @author [EMAIL PROTECTED]
- * @version $Id: XMLFileLogger.java,v 1.2 2000/11/03 22:07:56 curcuru Exp $
+ * @version $Id: XMLFileLogger.java,v 1.3 2000/12/01 22:18:22 curcuru Exp $
*/
public class XMLFileLogger implements Logger
{
@@ -839,6 +839,95 @@
{
reportPrinter.println(CHECKERRR_HDR + escapeString(comment)
+ "\"/>");
+ }
+ }
+
+ /* EXPERIMENTAL: have duplicate set of check*() methods
+ that all output some form of ID as well as comment.
+ Leave the non-ID taking forms for both simplicity to the
+ end user who doesn't care about IDs as well as for
+ backwards compatibility.
+ */
+
+ /** ID_ATTR optimization for extra ID attribute. */
+ private static final String ATTR_ID = "\" id=\"";
+ /**
+ * Writes out a Pass record with comment.
+ * Record format: <pre><checkresult result="PASS"
desc="comment"/></pre>
+ * @param comment comment to log with the pass record.
+ * @param ID token to log with the pass record.
+ */
+ public void checkPass(String comment, String id)
+ {
+
+ if (isReady())
+ {
+ StringBuffer tmp = new StringBuffer(CHECKPASS_HDR +
escapeString(comment));
+ if (id != null)
+ tmp.append(ATTR_ID + escapeString(id));
+
+ tmp.append("\"/>");
+ reportPrinter.println(tmp);
+ }
+ }
+
+ /**
+ * Writes out an ambiguous record with comment.
+ * Record format: <pre><checkresult result="AMBG"
desc="comment"/></pre>
+ * @param comment comment to log with the ambg record.
+ * @param ID token to log with the pass record.
+ */
+ public void checkAmbiguous(String comment, String id)
+ {
+
+ if (isReady())
+ {
+ StringBuffer tmp = new StringBuffer(CHECKAMBG_HDR +
escapeString(comment));
+ if (id != null)
+ tmp.append(ATTR_ID + escapeString(id));
+
+ tmp.append("\"/>");
+ reportPrinter.println(tmp);
+ }
+ }
+
+ /**
+ * Writes out a Fail record with comment.
+ * Record format: <pre><checkresult result="FAIL"
desc="comment"/></pre>
+ * @param comment comment to log with the fail record.
+ * @param ID token to log with the pass record.
+ */
+ public void checkFail(String comment, String id)
+ {
+
+ if (isReady())
+ {
+ StringBuffer tmp = new StringBuffer(CHECKFAIL_HDR +
escapeString(comment));
+ if (id != null)
+ tmp.append(ATTR_ID + escapeString(id));
+
+ tmp.append("\"/>");
+ reportPrinter.println(tmp);
+ }
+ }
+
+ /**
+ * Writes out a Error record with comment.
+ * Record format: <pre><checkresult result="ERRR"
desc="comment"/></pre>
+ * @param comment comment to log with the error record.
+ * @param ID token to log with the pass record.
+ */
+ public void checkErr(String comment, String id)
+ {
+
+ if (isReady())
+ {
+ StringBuffer tmp = new StringBuffer(CHECKERRR_HDR +
escapeString(comment));
+ if (id != null)
+ tmp.append(ATTR_ID + escapeString(id));
+
+ tmp.append("\"/>");
+ reportPrinter.println(tmp);
}
}