From: <fd...@us...> - 2008-11-17 22:55:38
|
Revision: 4708 http://jnode.svn.sourceforge.net/jnode/?rev=4708&view=rev Author: fduminy Date: 2008-11-17 22:55:33 +0000 (Mon, 17 Nov 2008) Log Message: ----------- - integrated jnode contributions into mauve - added binary of latest mauve (jnode's custom test list : testslists, latest list from mauve: testslists.orig) - added sources of latest mauve - removed unecessary jnode plugins related to mauve Modified Paths: -------------- trunk/all/conf/tests-plugin-list.xml trunk/core/descriptors/gnu.mauve.xml trunk/core/lib/mauve-src.jar trunk/core/lib/mauve.jar trunk/core/src/test/org/jnode/test/mauve/PluginTestHarness.java trunk/core/src/test/org/jtestserver/server/commands/MauveTestRunner.java Added Paths: ----------- trunk/core/descriptors/gnu.mauve.plugin.xml Removed Paths: ------------- trunk/core/descriptors/gnu.mauve.core.xml trunk/core/descriptors/gnu.mauve.java.lang.xml trunk/core/descriptors/gnu.mauve.java.util.xml trunk/core/src/test/org/jnode/test/mauve/CheckResult.java trunk/core/src/test/org/jnode/test/mauve/ClassResult.java trunk/core/src/test/org/jnode/test/mauve/HTMLGenerator.java trunk/core/src/test/org/jnode/test/mauve/MauveTestCommand.java trunk/core/src/test/org/jnode/test/mauve/MauveTests.java trunk/core/src/test/org/jnode/test/mauve/PackageResult.java trunk/core/src/test/org/jnode/test/mauve/Result.java trunk/core/src/test/org/jnode/test/mauve/RunResult.java trunk/core/src/test/org/jnode/test/mauve/SingleTestHarness.java trunk/core/src/test/org/jnode/test/mauve/TestResult.java trunk/core/src/test/org/jnode/test/mauve/XMLReportConstants.java trunk/core/src/test/org/jnode/test/mauve/XMLReportParser.java trunk/core/src/test/org/jnode/test/mauve/XMLReportWriter.java trunk/core/src/test/org/jnode/test/mauve/compare/ Modified: trunk/all/conf/tests-plugin-list.xml =================================================================== --- trunk/all/conf/tests-plugin-list.xml 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/all/conf/tests-plugin-list.xml 2008-11-17 22:55:33 UTC (rev 4708) @@ -10,9 +10,7 @@ <plugin id="org.junit"/> <plugin id="gnu.mauve"/> - <plugin id="gnu.mauve.core"/> - <plugin id="gnu.mauve.java.util"/> - <plugin id="gnu.mauve.java.lang"/> + <plugin id="gnu.mauve.plugin"/> <plugin id="org.objectweb.asm"/> <plugin id="net.sf.cglib"/> Deleted: trunk/core/descriptors/gnu.mauve.core.xml =================================================================== --- trunk/core/descriptors/gnu.mauve.core.xml 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/core/descriptors/gnu.mauve.core.xml 2008-11-17 22:55:33 UTC (rev 4708) @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plugin SYSTEM "jnode.dtd"> - -<plugin id="gnu.mauve.core" - name="Mauve java.lang testlets" - version="@VERSION@" - system="false" - provider-name="Mauve" - provider-url="http://sources.redhat.com/mauve/" - license-name="gpl"> - - <runtime> - <library name="mauve.jar"> - <!-- export name="gnu/testlet/*"/ --> - <export name="*"/> - </library> - <library name="jnode-core.jar"> - <export name="org/jnode/test/mauve/*"/> - <export name="org/jnode/test/mauve/compare/*"/> - </library> - </runtime> - - <extension point="org.jnode.shell.aliases"> - <alias name="mauve-plugin" class="org.jnode.test.mauve.PluginTestHarness"/> - <alias name="mauve-simple" class="org.jnode.test.mauve.SingleTestHarness"/> - <alias name="testCommand" class="org.jnode.test.mauve.MauveTestCommand"/> - </extension> - - <extension point="org.jnode.security.permissions"> - <permission class="java.security.AllPermission" /> - </extension> -</plugin> Deleted: trunk/core/descriptors/gnu.mauve.java.lang.xml =================================================================== --- trunk/core/descriptors/gnu.mauve.java.lang.xml 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/core/descriptors/gnu.mauve.java.lang.xml 2008-11-17 22:55:33 UTC (rev 4708) @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plugin SYSTEM "jnode.dtd"> - -<plugin id="gnu.mauve.java.lang" - name="Mauve core classes" - version="@VERSION@" - system="false" - provider-name="Mauve" - provider-url="http://sources.redhat.com/mauve/" - license-name="gpl"> - - <runtime> - <library name="mauve.jar"> - <export name="gnu/testlet/java/lang/**/*"/> - </library> - </runtime> - - <requires> - <import plugin="gnu.mauve.core"/> - </requires> - - <extension point="org.jnode.security.permissions"> - <permission class="java.security.AllPermission" /> - </extension> -</plugin> Deleted: trunk/core/descriptors/gnu.mauve.java.util.xml =================================================================== --- trunk/core/descriptors/gnu.mauve.java.util.xml 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/core/descriptors/gnu.mauve.java.util.xml 2008-11-17 22:55:33 UTC (rev 4708) @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plugin SYSTEM "jnode.dtd"> - -<plugin id="gnu.mauve.java.util" - name="Mauve core classes" - version="@VERSION@" - system="false" - provider-name="Mauve" - provider-url="http://sources.redhat.com/mauve/" - license-name="gpl"> - - <runtime> - <library name="mauve.jar"> - <export name="gnu/testlet/java/util/**/*"/> - </library> - </runtime> - - <requires> - <import plugin="gnu.mauve.core"/> - </requires> - - <extension point="org.jnode.security.permissions"> - <permission class="java.security.AllPermission" /> - </extension> -</plugin> Added: trunk/core/descriptors/gnu.mauve.plugin.xml =================================================================== --- trunk/core/descriptors/gnu.mauve.plugin.xml (rev 0) +++ trunk/core/descriptors/gnu.mauve.plugin.xml 2008-11-17 22:55:33 UTC (rev 4708) @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plugin SYSTEM "jnode.dtd"> + +<fragment id="gnu.mauve.plugin" + name="Mauve extensions for JNode" + version="@VERSION@" + plugin-id="gnu.mauve" + plugin-version="@VERSION@" + provider-name="JNode.org" + provider-url="http://www.jnode.org/" + license-name="gpl"> + + <runtime> + <library name="jnode-core.jar"> + <export name="org/jnode/test/mauve/*"/> + </library> + </runtime> + + <extension point="org.jnode.shell.aliases"> + <alias name="mauve-plugin" class="org.jnode.test.mauve.PluginTestHarness"/> + </extension> + + <extension point="org.jnode.security.permissions"> + <permission class="java.security.AllPermission" /> + </extension> +</fragment> Modified: trunk/core/descriptors/gnu.mauve.xml =================================================================== --- trunk/core/descriptors/gnu.mauve.xml 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/core/descriptors/gnu.mauve.xml 2008-11-17 22:55:33 UTC (rev 4708) @@ -18,6 +18,8 @@ <extension point="org.jnode.shell.aliases"> <alias name="mauve" class="gnu.testlet.runner.Mauve"/> <alias name="mauve-filter" class="gnu.testlet.runner.Filter"/> + <alias name="mauve-compare" class="gnu.testlet.runner.compare.ReportComparator"/> + <alias name="mauve-single" class="gnu.testlet.SingleTestHarness"/> </extension> <extension point="org.jnode.security.permissions"> Modified: trunk/core/lib/mauve-src.jar =================================================================== (Binary files differ) Modified: trunk/core/lib/mauve.jar =================================================================== (Binary files differ) Deleted: trunk/core/src/test/org/jnode/test/mauve/CheckResult.java =================================================================== --- trunk/core/src/test/org/jnode/test/mauve/CheckResult.java 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/core/src/test/org/jnode/test/mauve/CheckResult.java 2008-11-17 22:55:33 UTC (rev 4708) @@ -1,192 +0,0 @@ -// Tags: not-a-test -// Copyright (C) 2004 by Object Refinery Limited -// Written by David Gilbert (dav...@ob...) -// Modified by Levente S\u00e1ntha (ls...@jn...) -// Modified by Peter Barth (pe...@jn...) -// Modified by Fabien DUMINY (fd...@jn...) - -// This file is part of Mauve Reporter. - -// Mauve Reporter is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -// Mauve Reporter is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Mauve Reporter; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package org.jnode.test.mauve; - -/** - * Records the details of a check that is performed by Mauve. - */ -public class CheckResult implements Result { - - /** - * The check number. - */ - private int number; - - /** - * The check point string. - */ - private String checkPoint; - - /** - * A flag that indicates whether or not the check passed. - */ - private boolean passed; - - /** - * The expected result (converted to a string). - */ - private String expected; - - /** - * The actual result (converted to a string). - */ - private String actual; - - /** - * The log output for the check. - */ - private StringBuffer log; - - /** - * Creates a new check. - * - * @param number the check number. - * @param passed a flag that indicates whether or not the check passed. - */ - CheckResult(int number, boolean passed) { - this.number = number; - this.passed = passed; - } - - /** - * Returns the check number. - * - * @return The check number. - */ - public int getNumber() { - return this.number; - } - - /** - * Sets the check number. - * - * @param number the number. - */ - void setNumber(int number) { - this.number = number; - } - - /** - * Returns a flag that indicates whether or not the check passed. - * - * @return A boolean. - */ - public boolean getPassed() { - return passed; - } - - /** - * Sets the flag that indicates whether or not the check passed. - * - * @param passed the flag. - */ - void setPassed(boolean passed) { - this.passed = passed; - } - - /** - * Returns the check point string. - * - * @return The check point string. - */ - public String getCheckPoint() { - return checkPoint; - } - - /** - * Sets the check point string. - * - * @param checkPoint the check point string. - */ - void setCheckPoint(String checkPoint) { - this.checkPoint = checkPoint; - } - - /** - * Returns a string representing the actual value. - * - * @return The actual value. - */ - public String getActual() { - if (actual == null) - return "n/a"; - return actual; - } - - /** - * Sets the actual value. - * - * @param actual the actual value. - */ - void setActual(String actual) { - this.actual = actual; - } - - /** - * Returns the expected value. - * - * @return The expected value. - */ - public String getExpected() { - if (expected == null) - return "n/a"; - return expected; - } - - /** - * Sets the expected value. - * - * @param expected the expected value. - */ - void setExpected(String expected) { - this.expected = expected; - } - - /** - * Returns the log. - * - * @return The log. - */ - public String getLog() { - if (log == null) - return ""; - return log.toString(); - } - - /** - * Appends the specified message to the log. - * - * @param message the message to append. - */ - void appendToLog(String message) { - if (log == null) - log = new StringBuffer(); - log.append(message); - } - - @Override - public String getName() { - return Integer.toString(number); - } -} Deleted: trunk/core/src/test/org/jnode/test/mauve/ClassResult.java =================================================================== --- trunk/core/src/test/org/jnode/test/mauve/ClassResult.java 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/core/src/test/org/jnode/test/mauve/ClassResult.java 2008-11-17 22:55:33 UTC (rev 4708) @@ -1,134 +0,0 @@ -// Tags: not-a-test -// Copyright (C) 2004 by Object Refinery Limited -// Written by David Gilbert (dav...@ob...) -// Modified by Levente S\u00e1ntha (ls...@jn...) -// Modified by Peter Barth (pe...@jn...) -// Modified by Fabien DUMINY (fd...@jn...) - -// This file is part of Mauve Reporter. - -// Mauve Reporter is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -// Mauve Reporter is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Mauve Reporter; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -package org.jnode.test.mauve; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -/** - * Represents the result of running all the tests for a particular class. - */ -public class ClassResult implements Comparable, Result { - - /** - * The name of the test (usually the class name). - */ - private String name; - - /** - * A list containing results for each test applied for the class. - */ - private List testResults; - private boolean sorted = true; - - /** - * Creates a new result, initially empty. - * - * @param name the class name. - */ - ClassResult(String name) { - this.name = name; - testResults = new ArrayList(); - } - - /** - * Returns the test name (this is most often the name of the method - * being tested). - * - * @return The test name. - */ - public String getName() { - return name; - } - - /** - * Sets the test name. - * - * @param name the name. - */ - void setName(String name) { - this.name = name; - } - - /** - * Adds a test result. - * - * @param result the test result. - */ - public void add(TestResult result) { - testResults.add(result); - sorted = false; - } - - /** - * Returns an iterator that provides access to all the tests for - * this class. - * - * @return An iterator. - */ - public Iterator getTestIterator() { - if (!sorted) { - Collections.sort(testResults); - sorted = true; - } - return testResults.iterator(); - } - - /** - * Returns the total number of checks performed for this class. - * - * @return The check count. - */ - public int getCheckCount() { - int result = 0; - Iterator iterator = testResults.iterator(); - while (iterator.hasNext()) { - TestResult test = (TestResult) iterator.next(); - result = result + test.getCheckCount(); - } - return result; - } - - /** - * Returns the number of checks with the specified status. - * - * @param passed the check status. - * @return The number of checks passed or failed. - */ - public int getCheckCount(boolean passed) { - int result = 0; - Iterator iterator = testResults.iterator(); - while (iterator.hasNext()) { - TestResult test = (TestResult) iterator.next(); - result = result + test.getCheckCount(passed); - } - return result; - } - - public int compareTo(Object obj) { - ClassResult that = (ClassResult) obj; - return getName().compareTo(that.getName()); - } -} Deleted: trunk/core/src/test/org/jnode/test/mauve/HTMLGenerator.java =================================================================== --- trunk/core/src/test/org/jnode/test/mauve/HTMLGenerator.java 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/core/src/test/org/jnode/test/mauve/HTMLGenerator.java 2008-11-17 22:55:33 UTC (rev 4708) @@ -1,443 +0,0 @@ -// Copyright (C) 2004 by Object Refinery Limited -// Written by David Gilbert (dav...@ob...) -// Modified by Levente S\u00e1ntha (ls...@jn...) -// Modified by Peter Barth (pe...@jn...) - -// This file is part of Mauve Reporter. - -// Mauve Reporter is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -// Mauve Reporter is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Mauve Reporter; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -package org.jnode.test.mauve; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.Writer; -import java.text.DateFormat; -import java.util.Date; -import java.util.Iterator; - -/** - * Generates a collection of HTML files that summarise the results - * of a Mauve run. This is a quick-and-dirty implementation!! - */ -public class HTMLGenerator { - - /** - * Creates an HTML report in the specified directory. - * - * @param run the Mauve run results. - * @param rootDirectory the root directory. - */ - public static void createReport(RunResult run, File rootDirectory) throws IOException { - // write basic HTML with info about package - File summaryFile = new File(rootDirectory, "index.html"); - Writer out = new OutputStreamWriter(new FileOutputStream(summaryFile), "UTF-8"); - PrintWriter writer = new PrintWriter(out); - writer.println("<HTML>"); - writer.println("<HEAD><TITLE>Mauve Run: " + run.getName() + "</TITLE>"); - writer.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></HEAD>"); - writer.println("<BODY>"); - writer.println("<h1>Mauve Run</h1>"); - writer.println("<h2>Summary:</h2>"); - int checkCount = run.getCheckCount(); - int passed = run.getCheckCount(true); - int failed = checkCount - passed; - writer.println("Run Date: " + - DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(new Date()) + "<br>"); - writer.println("Passed: " + passed + "<br>"); - writer.println("Failed: " + failed + "<p>"); - - writer.println("<h2>Environment:</h2>"); - - writer.println("<table BORDER=\"0\" CELLPADDING=\"0\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"black\" VALIGN=\"TOP\">"); - writer.println("<table BORDER=\"0\" WIDTH=\"100%\" CELLSPACING=\"1\" CELLPADDING=\"3\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"lightGray\">Property:</td>"); - writer.println("<td bgcolor=\"lightGray\">Value:</td>"); - writer.println("</tr>"); - - writePropertyRow("java.version", System.getProperty("java.version"), writer); - writePropertyRow("java.vendor", System.getProperty("java.vendor"), writer); - writePropertyRow("java.vendor.url", System.getProperty("java.vendor.url"), writer); - writePropertyRow("os.name", System.getProperty("os.name"), writer); - writePropertyRow("os.arch", System.getProperty("os.arch"), writer); - writePropertyRow("os.version", System.getProperty("os.version"), writer); - - writePropertyRow("java.vm.specification.version", System.getProperty("java.vm.specification.version"), writer); - writePropertyRow("java.vm.specification.vendor", System.getProperty("java.vm.specification.vendor"), writer); - writePropertyRow("java.vm.specification.name", System.getProperty("java.vm.specification.name"), writer); - writePropertyRow("java.vm.version", System.getProperty("java.vm.version"), writer); - writePropertyRow("java.vm.vendor", System.getProperty("java.vm.vendor"), writer); - writePropertyRow("java.vm.name", System.getProperty("java.vm.name"), writer); - writePropertyRow("java.specification.version", System.getProperty("java.specification.version"), writer); - writePropertyRow("java.specification.vendor", System.getProperty("java.specification.vendor"), writer); - writePropertyRow("java.specification.name", System.getProperty("java.specification.name"), writer); - writePropertyRow("java.class.version", System.getProperty("java.class.version"), writer); - - writer.println("</table>"); - writer.println("</td>"); - writer.println("</tr>"); - writer.println("</table><p>"); - - writer.println("<h2>Results:</h2>"); - - writer.println("<table BORDER=\"0\" width=\"100%\" CELLPADDING=\"0\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"black\" VALIGN=\"TOP\">"); - writer.println("<table BORDER=\"0\" WIDTH=\"100%\" CELLSPACING=\"1\" CELLPADDING=\"3\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"lightGray\">Package:</td>"); - writer.println("<td bgcolor=\"lightGray\">Passed:</td>"); - writer.println("<td bgcolor=\"lightGray\">Failed:</td>"); - writer.println("<td bgcolor=\"lightGray\">Total:</td>"); - writer.println("</tr>"); - - // loop through tests writing test results - String top = null; - Iterator iterator = run.getPackageIterator(); - while (iterator.hasNext()) { - PackageResult packageResult = (PackageResult) iterator.next(); - String packageName = packageResult.getName().replace('.', '/'); - String name; - System.out.println("Generating " + packageName); - if (top != null && packageName.startsWith(top)) - name = " + " + packageName.substring(top.length() + 1); - else { - top = packageName; - name = packageName; - } - // (1) write the summary line for the class HTML file - writer.println("<tr>"); - writer.println( - "<td bgcolor=\"white\"><a href=\"" + packageName + "/package_index.html\"" + ">" + name + "</a></td>"); - writer.println("<td bgcolor=\"white\">" + packageResult.getCheckCount(true) + "</td>"); - writer.println("<td bgcolor=\"white\">" + packageResult.getCheckCount(false) + "</td>"); - writer.println("<td bgcolor=\"white\">" + packageResult.getCheckCount() + "</td>"); - writer.println("</tr>"); - // (2) generate an HTML page for the test and subfiles - // for the tests - try { - HTMLGenerator.createPackageReport(packageResult, rootDirectory); - } catch (Exception e) { - String temp = packageResult.getName().replace('.', '/'); - System.err.println("Couldn't create package report for " + temp); - File tempDir = new File(rootDirectory, packageName); - tempDir.mkdirs(); - File tempFile = new File(tempDir, "package_index.html"); - tempFile.createNewFile(); - } - } - writer.println("</table>"); - writer.println("</td>"); - writer.println("</tr>"); - writer.println("</table>"); - writer.println("<p>"); - Iterator missing = run.getMissingTestsIterator(); - Iterator failures = run.getFaultyTestsIterator(); - if (missing.hasNext() || failures.hasNext()) { - writer.println("<h2>Unrunnable tests:</h2>"); - - writer.println("<table BORDER=\"0\" width=\"100%\" CELLPADDING=\"0\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"black\" VALIGN=\"TOP\">"); - writer.println("<table BORDER=\"0\" WIDTH=\"100%\" CELLSPACING=\"1\" CELLPADDING=\"3\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"lightGray\">name:</td>"); - writer.println("<td bgcolor=\"lightGray\">problem:</td>"); - writer.println("</tr>"); - while (missing.hasNext()) - writer.println("<tr><td bgcolor=\"white\">" + (String) missing.next() + - "</td><td bgcolor=\"white\">Class not found</td></tr>"); - while (failures.hasNext()) { - String[] fail = (String[]) failures.next(); - writer.println("<tr><td bgcolor=\"white\">" + fail[0] + "</td><td bgcolor=\"white\">" + - fail[1] + "</td></tr>"); - } - writer.println("</table>"); - writer.println("</td>"); - writer.println("</tr>"); - writer.println("</table>"); - } - - writer.println("</BODY>"); - writer.println("</HTML>"); - writer.close(); - } - - /** - * Writes a row in a table for a pair of strings. - * - * @param property the property key. - * @param value the property value. - * @param writer the output stream. - */ - private static void writePropertyRow(String property, String value, PrintWriter writer) { - writer.println("<tr>"); - writer.println("<td bgcolor=\"white\">" + property + "</td>"); - writer.println("<td bgcolor=\"white\">" + value + "</td>"); - writer.println("</tr>"); - } - - /** - * Returns the number of directory levels in the specified package name. - * - * @param name the name. - * @return The number of directory levels. - */ - private static int countLevels(String name) { - int result = 1; - for (int i = 0; i < name.length(); i++) { - if (name.charAt(i) == '/') result++; - } - return result; - } - - /** - * Creates an HTML page that summaries a package, and processes all the classes within - * the package. - * - * @param packageResult the package result. - * @param rootDirectory the root directory. - */ - public static void createPackageReport(PackageResult packageResult, File rootDirectory) throws IOException { - // create directory for package - String packageName = packageResult.getName().replace('.', '/'); - String prefix = ""; - int levels = countLevels(packageName); - for (int i = 0; i < levels; i++) - prefix += "../"; - File packageDirectory = new File(rootDirectory, packageName); - packageDirectory.mkdirs(); - - // write basic HTML with info about package - File summaryFile = new File(packageDirectory, "package_index.html"); - OutputStream out = new BufferedOutputStream(new FileOutputStream(summaryFile)); - PrintWriter writer = new PrintWriter(out); - writer.println("<HTML>"); - writer.println("<HEAD><TITLE>Package Summary: " + packageResult.getName() + "</TITLE></HEAD>"); - writer.println("<BODY>"); - writer.println("<h2>Package: " + packageResult.getName() + "</h2>"); - writer.println("<a href=\"" + prefix + "index.html\">Summary page</a><p>"); - int checkCount = packageResult.getCheckCount(); - int passed = packageResult.getCheckCount(true); - int failed = checkCount - passed; - writer.println("Passed: " + passed + "<br>"); - writer.println("Failed: " + failed + "<p>"); - writer.println("<table BORDER=\"0\" width=\"100%\" CELLPADDING=\"0\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"black\" VALIGN=\"TOP\">"); - writer.println("<table BORDER=\"0\" WIDTH=\"100%\" CELLSPACING=\"1\" CELLPADDING=\"3\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"lightGray\">Class:</td>"); - writer.println("<td bgcolor=\"lightGray\">Passed:</td>"); - writer.println("<td bgcolor=\"lightGray\">Failed:</td>"); - writer.println("<td bgcolor=\"lightGray\">Total:</td>"); - writer.println("</tr>"); - - // loop through tests writing test results - Iterator iterator = packageResult.getClassIterator(); - while (iterator.hasNext()) { - ClassResult classResult = (ClassResult) iterator.next(); - // (1) write the summary line for the class HTML file - writer.println("<tr>"); - writer.println("<td bgcolor=\"white\"><a href=\"" + classResult.getName() + "/class_index.html\"" + ">" + - classResult.getName() + "</a></td>"); - writer.println("<td bgcolor=\"white\">" + classResult.getCheckCount(true) + "</td>"); - writer.println("<td bgcolor=\"white\">" + classResult.getCheckCount(false) + "</td>"); - writer.println("<td bgcolor=\"white\">" + classResult.getCheckCount() + "</td>"); - writer.println("</tr>"); - // (2) generate an HTML page for the test and subfiles - // for the tests - HTMLGenerator.createClassReport(classResult, packageResult.getName(), packageDirectory); - } - // close the class file - writer.println("</table>"); - writer.println("</td>"); - writer.println("</tr>"); - writer.println("</table>"); - writer.println("</BODY>"); - writer.println("</HTML>"); - writer.close(); - } - - /** - * Creates an HTML page summarising the results for a class, and processes all the tests for - * the class. - * - * @param classResult the class results. - * @param packageName the package name. - * @param packageDirectory the package directory. - */ - public static void createClassReport(ClassResult classResult, String packageName, File packageDirectory) - throws IOException { - // create directory for class - File classDirectory = new File(packageDirectory, classResult.getName()); - classDirectory.mkdirs(); - - // write basic HTML with info about class - File testFile = new File(classDirectory, "class_index.html"); - OutputStream out = new BufferedOutputStream(new FileOutputStream(testFile)); - PrintWriter writer = new PrintWriter(out); - writer.println("<HTML>"); - writer.println("<HEAD><TITLE>Class Summary: " + packageName + "." + classResult.getName() + "</TITLE></HEAD>"); - writer.println("<BODY>"); - writer.println("<h2>Class: " + "<a href=\"../package_index.html\">" + packageName + "</a>." + - classResult.getName() + "</h2>"); - int checkCount = classResult.getCheckCount(); - int passed = classResult.getCheckCount(true); - int failed = checkCount - passed; - writer.println("Passed: " + passed + "<br>"); - writer.println("Failed: " + failed + "<p>"); - writer.println("<table BORDER=\"0\" width=\"100%\" CELLPADDING=\"0\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"black\" VALIGN=\"TOP\">"); - writer.println("<table BORDER=\"0\" WIDTH=\"100%\" CELLSPACING=\"1\" CELLPADDING=\"3\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"lightGray\">Test:</td>"); - writer.println("<td bgcolor=\"lightGray\">Passed:</td>"); - writer.println("<td bgcolor=\"lightGray\">Failed:</td>"); - writer.println("<td bgcolor=\"lightGray\">Total:</td>"); - writer.println("</tr>"); - - // loop through tests writing test results - Iterator iterator = classResult.getTestIterator(); - while (iterator.hasNext()) { - TestResult testResult = (TestResult) iterator.next(); - // (1) write the summary line for the class HTML file - writer.println("<tr>"); - writer.println("<td bgcolor=\"white\"><a href=\"" + testResult.getName() + ".html\"" + ">" + - testResult.getName() + "</a></td>"); - writer.println("<td bgcolor=\"white\">" + testResult.getCheckCount(true) + "</td>"); - writer.println("<td bgcolor=\"white\">" + testResult.getCheckCount(false) + "</td>"); - writer.println("<td bgcolor=\"white\">" + testResult.getCheckCount() + "</td>"); - writer.println("</tr>"); - // (2) generate an HTML page for the test and subfiles - // for the tests - HTMLGenerator.createTestReport(testResult, classResult.getName(), classDirectory); - } - // close the class file - writer.println("</table>"); - writer.println("</td>"); - writer.println("</tr>"); - writer.println("</table>"); - writer.println("</BODY>"); - writer.println("</HTML>"); - writer.close(); - } - - /** - * Creates an HTML page that summarises a test. - * - * @param testResult the test result. - * @param className the class name. - * @param classDirectory the class directory. - */ - public static void createTestReport(TestResult testResult, String className, File classDirectory) - throws IOException { - - // write basic HTML for test - File testFile = new File(classDirectory, testResult.getName() + ".html"); - Writer out = new OutputStreamWriter(new FileOutputStream(testFile), "UTF-8"); - PrintWriter writer = new PrintWriter(out); - writer.println("<HTML>"); - writer.println("<HEAD><TITLE>Test Summary: " + className + "." + testResult.getName() + "</TITLE>\n"); - writer.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></HEAD>"); - writer.println("<BODY>"); - writer - .println("<h2>Test: <a href=\"class_index.html\">" + className + "</a>." + testResult.getName() + "</h2>"); - int checkCount = testResult.getCheckCount(); - int passed = testResult.getCheckCount(true); - int failed = checkCount - passed; - writer.println("Passed: " + passed + "<br>"); - writer.println("Failed: " + failed + "<p>"); - writer.println("<table BORDER=\"0\" width=\"100%\" CELLPADDING=\"0\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"black\" VALIGN=\"TOP\">"); - writer.println("<table BORDER=\"0\" WIDTH=\"100%\" CELLSPACING=\"1\" CELLPADDING=\"3\">"); - writer.println("<tr>"); - writer.println("<td bgcolor=\"lightGray\">Check Number:</td>"); - writer.println("<td bgcolor=\"lightGray\">Check Point:</td>"); - writer.println("<td bgcolor=\"lightGray\">Passed?:</td>"); - writer.println("<td bgcolor=\"lightGray\">Expected:</td>"); - writer.println("<td bgcolor=\"lightGray\">Actual:</td>"); - writer.println("</tr>"); - - // loop through checks adding a summary line for each check - Iterator iterator = testResult.getCheckIterator(); - while (iterator.hasNext()) { - CheckResult check = (CheckResult) iterator.next(); - // write a summary line (ID, pass/fail, actual, expected); - writer.println("<tr><td bgcolor=\"white\">" + check.getNumber() + - "</td><td bgcolor=\"white\">" + check.getCheckPoint() + - "</td><td bgcolor=\"" + (check.getPassed() ? "white" : "red") + "\">" + - check.getPassed() + "</td><td bgcolor=\"white\">" + check.getExpected() + - "</td><td bgcolor=\"white\">" + check.getActual() + "</td>"); - if (!check.getPassed()) { - try { - createLogReport(check, className, testResult.getName(), classDirectory); - } catch (Exception e) { - System.err.println("Couldn't write report for class " + className); - File temp = new File(classDirectory, testResult.getName() + "_log.html"); - temp.createNewFile(); - } - } - writer.println("</td>"); - writer.println("</tr>"); - } - writer.println("</table>"); - writer.println("</td>"); - writer.println("</tr>"); - writer.println("</table>"); - if (testResult.isFailed()) { - writer.println("<h2>Run aborted due to exception</h2>"); - writer.println("<pre>" + testResult.getFailedMessage() + "</pre>"); - } - writer.println("</BODY>"); - writer.println("</HTML>"); - writer.close(); - } - - /** - * Creates an HTML page that summarises the log for a check. - * - * @param checkResult the test result. - * @param className the class name. - * @param testName the test name. - * @param classDirectory the class directory. - */ - public static void createLogReport(CheckResult checkResult, String className, String testName, File classDirectory) - throws IOException { - - // write basic HTML for test - File logFile = new File(classDirectory, testName + "_log.html"); - OutputStream out = new BufferedOutputStream(new FileOutputStream(logFile)); - PrintWriter writer = new PrintWriter(out); - writer.println("<HTML>"); - writer.println("<HEAD><TITLE>Log: " + testName + "</TITLE>"); - writer.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></HEAD>"); - writer.println("<BODY>"); - writer.println(checkResult.getLog()); - writer.println("</BODY>"); - writer.println("</HTML>"); - - writer.close(); - } -} Deleted: trunk/core/src/test/org/jnode/test/mauve/MauveTestCommand.java =================================================================== --- trunk/core/src/test/org/jnode/test/mauve/MauveTestCommand.java 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/core/src/test/org/jnode/test/mauve/MauveTestCommand.java 2008-11-17 22:55:33 UTC (rev 4708) @@ -1,493 +0,0 @@ -// Copyright (C) 2004, 2005 by Object Refinery Limited -// Copyright (C) 2005 by <za...@kd...> -// Written by David Gilbert (dav...@ob...) -// Written by Thomas Zander <za...@kd...> -// Modified by Levente S\u00e1ntha (ls...@jn...) -// Modified by Peter Barth (pe...@jn...) -// Modified by Fabien DUMINY (fd...@jn...) - -// This file is part of Mauve. - -// Mauve is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2, or (at your option) -// any later version. - -// Mauve is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Mauve; see the file COPYING. If not, write to -// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -// Boston, MA 02110-1301 USA. -package org.jnode.test.mauve; - -import gnu.testlet.ResourceNotFoundException; -import gnu.testlet.TestHarness; -import gnu.testlet.Testlet; -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.LineNumberReader; -import java.io.PrintWriter; -import java.io.Reader; -import java.util.Locale; - -/** - * Modified Mauve Test Suite - * - * @author peda - */ -public class MauveTestCommand extends TestHarness { - - private String lastCheckPoint; - - private int checksSinceLastCheckPoint; - - private ClassResult classResult; - - private TestResult currentTest; - - private CheckResult currentCheck; - - private RunResult result; - - private static int counter = 0; - - /** - * runs tests - * - * @param file the text file containing test class names. - * @param prefix the prefix for each test class (usually 'gnu.testlet'). - * @param output the name of the directory for writing output. - */ - public synchronized void execute(String file, String prefix, String output) { - - // save the default locale, some tests change the default and we want - // to restore it before generating the HTML report... - Locale savedLocale = Locale.getDefault(); - - File out = new File(output); - if (out.exists() && !out.isDirectory()) - throw new IllegalArgumentException("Output should be a directory"); - - if (!out.exists()) - out.mkdirs(); - - result = new RunResult("Mauve Test Run"); - currentCheck = new CheckResult(0, false); - - // initialize - // run tests and collect results - File f = new File(file); - try { - - FileReader testsToRun = new FileReader(f); - LineNumberReader r = new LineNumberReader(testsToRun); - - while (r.ready()) { - - String line = r.readLine(); - - if ("".equals(line)) - continue; - - System.out.println(line); - - // check the line is not commented - // load the listed class - try { - Class c = Class.forName(line); - // strip prefix ('gnu.testlet.') from front of name - String temp = line.substring(prefix.length()); - // suffix is the name for the TestResult - String testName = temp.substring(temp.lastIndexOf('.') + 1); - - temp = temp.substring(0, temp.lastIndexOf('.')); - String className = temp - .substring(temp.lastIndexOf('.') + 1); - if (className.equals("Double") || className.equals("Float") - || className.equals("Key")) { - if (!temp.startsWith("java.lang.")) { - temp = temp.substring(0, temp.lastIndexOf('.')); - className = temp - .substring(temp.lastIndexOf('.') + 1) - + '.' + className; - } - } - - String packageName = "default package"; - int index = temp.lastIndexOf('.'); - if (index >= 0) - packageName = temp.substring(0, temp.lastIndexOf('.')); - - // remaining suffix is name for ClassResult - // rest of text is name for PackageResult - PackageResult pr = result.getPackageResult(packageName); - if (pr == null) - pr = new PackageResult(packageName); - - classResult = pr.getClassResult(className); - if (classResult == null) - classResult = new ClassResult(className); - - Testlet testlet; - try { - testlet = (Testlet) c.newInstance(); - } catch (ClassCastException e) { - System.err.println("Not a test (does not implement Testlet): " + line); - result.addFaultyTest(line, "Does not implement Testlet"); - continue; // not a test - } catch (Throwable t) { // instanciation errors etc.. - t.printStackTrace(System.out); - result.addFaultyTest(line, t.getMessage()); - continue; - } - - currentTest = new TestResult(testName); - checksSinceLastCheckPoint = 0; - lastCheckPoint = "-"; - try { - testlet.test(this); - } catch (Throwable t) { - t.printStackTrace(System.out); - currentTest.failed(t); - } - - classResult.add(currentTest); - if (pr.indexOf(classResult) < 0) - pr.add(classResult); - if (result.indexOf(pr) == -1) - result.add(pr); - } catch (ClassNotFoundException e) { - System.err.println("Could not load test: " + line); - result.addMissingTest(line); - } - - counter++; -// System.out.println("Done " + counter + " tests so far."); -// if ((counter % 20) == 0) { - // System.out.println("next 20 tests done, running gc..."); - // System.gc(); - // } - } - } catch (FileNotFoundException e) { - throw new IllegalArgumentException(e.getMessage()); - } catch (IOException e) { - e.printStackTrace(System.out); - } - - // tests are complete so restore the default locale - Locale.setDefault(savedLocale); - - // write results to HTML - System.out.println("Creating HTML report..."); - try { - HTMLGenerator.createReport(result, out); - } catch (IOException e) { - System.out.println("failed to write HTML due to following error:"); - e.printStackTrace(System.out); - } - - System.out.println("Creating XML report..."); - try { - // new XMLGenerator(result).generate(new File(out, "results.xml")); - - String timestamp = String.valueOf(System.currentTimeMillis()); - File fx = new File(out, "results-" + timestamp + ".xml"); - new XMLReportWriter(true).write(result, fx); - System.out.println("XML file written to " + fx.getAbsolutePath()); - } catch (IOException e) { - System.out.println("failed to write XML due to following error:"); - e.printStackTrace(System.out); - } - - System.out.println("DONE!"); - } - - /** - * Records the result of a boolean check. - * - * @param result the result. - */ - public void check(boolean result) { - currentCheck.setPassed(result); - checkDone(); - } - - /** - * Checks the two objects for equality and records the result of the check. - * - * @param result the actual result. - * @param expected the expected result. - */ - public void check(Object result, Object expected) { - currentCheck.setPassed((result != null) ? result.equals(expected) : (expected == null)); - currentCheck.setActual((result != null) ? result.toString() : "null"); - currentCheck.setExpected((expected != null) ? expected.toString() : "null"); - checkDone(); - } - - /** - * Checks two booleans for equality and records the result of the check. - * - * @param result the actual result. - * @param expected the expected result. - */ - public void check(boolean result, boolean expected) { - currentCheck.setPassed(result == expected); - currentCheck.setActual(String.valueOf(result)); - currentCheck.setExpected(String.valueOf(expected)); - checkDone(); - } - - /** - * Checks two ints for equality and records the result of the check. - * - * @param result the actual result. - * @param expected the expected result. - */ - public void check(int result, int expected) { - currentCheck.setPassed(result == expected); - currentCheck.setActual(String.valueOf(result)); - currentCheck.setExpected(String.valueOf(expected)); - checkDone(); - } - - /** - * Checks two longs for equality and records the result of the check. - * - * @param result the actual result. - * @param expected the expected result. - */ - public void check(long result, long expected) { - currentCheck.setPassed(result == expected); - currentCheck.setActual(String.valueOf(result)); - currentCheck.setExpected(String.valueOf(expected)); - checkDone(); - } - - /** - * Checks two doubles for equality and records the result of the check. - * - * @param result the actual result. - * @param expected the expected result. - */ - public void check(double result, double expected) { - currentCheck.setPassed((result == expected ? (result != 0) || (1 / result == 1 / expected) : (result != result) - && (expected != expected))); - currentCheck.setActual(String.valueOf(result)); - currentCheck.setExpected(String.valueOf(expected)); - checkDone(); - } - - /** - * Records a check point. This can be used to mark a known place in a - * testlet. It is useful if you have a large number of tests -- it makes it - * easier to find a failing test in the source code. - * - * @param name the check point name. - */ - public void checkPoint(String name) { - lastCheckPoint = name; - checksSinceLastCheckPoint = 0; - } - - private void checkDone() { - currentCheck.setNumber(++checksSinceLastCheckPoint); - currentCheck.setCheckPoint(lastCheckPoint); - currentTest.add(currentCheck); - currentCheck = new CheckResult(0, false); - currentCheck.setCheckPoint(lastCheckPoint); - } - - /** - * Writes a message to the debug log along with a newline. - * - * @param message the message. - */ - public void debug(String message) { - debug(message, true); - } - - /** - * Writes a message to the debug log with or without a newline. - * - * @param message the message. - * @param newline a flag to control whether or not a newline is added. - */ - public void debug(String message, boolean newline) { - currentCheck.appendToLog(message); - if (newline) - currentCheck.appendToLog("\n"); - } - - /** - * Writes the contents of an array to the log. - * - * @param o the array of objects. - * @param desc the description. - */ - public void debug(Object[] o, String desc) { - StringBuffer logMessage = new StringBuffer(); - logMessage.append("Object array: "); - logMessage.append(desc); - if (o == null) - logMessage.append("null"); - else - expand(o, logMessage); - currentCheck.appendToLog(logMessage.toString()); - currentCheck.appendToLog("\n"); - } - - // recursive helper method for debug(Object[], String) - private void expand(Object[] array, StringBuffer buf) { - for (int i = 0; i < array.length; i++) { - buf.append("obj[" + i + "]: "); - if (array[i] instanceof Object[]) - expand((Object[]) array[i], buf); - else if (array[i] != null) - buf.append(array[i].toString()); - else - buf.append("null"); - if (i < array.length) - buf.append(", "); - } - } - - /** - * Writes a stack trace for the specified exception to the log for the - * current check. - * - * @param ex the exception. - */ - public void debug(Throwable ex) { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - PrintWriter w = new PrintWriter(out, false); - ex.printStackTrace(w); - w.close(); - try { - out.close(); - debug(out.toString(), true); - } catch (IOException e) { - /* this should never happen.. */ - } - } - - /** - * This will print a message when in verbose mode. - * - * @param message the message. - */ - public void verbose(String message) { - debug(message, true); - } - - public Reader getResourceReader(String name) throws ResourceNotFoundException { - return new BufferedReader( - new InputStreamReader(getResourceStream(name))); - } - - public InputStream getResourceStream(String name) throws ResourceNotFoundException { - // The following code assumes File.separator is a single character. - if (File.separator.length() > 1) - throw new Error("File.separator length is greater than 1"); - String realName = name.replace('#', File.separator.charAt(0)); - try { - return new FileInputStream(getSourceDirectory() + File.separator + realName); - } catch (FileNotFoundException ex) { - throw new ResourceNotFoundException(ex.getLocalizedMessage() + ": " - + getSourceDirectory() + File.separator + realName); - } - } - - public String getSourceDirectory() { - return null; // TODO - } - - public File getResourceFile(String name) throws ResourceNotFoundException { - // The following code assumes File.separator is a single character. - if (File.separator.length() > 1) - throw new Error("File.separator length is greater than 1"); - String realName = name.replace('#', File.separator.charAt(0)); - File f = new File(getSourceDirectory() + File.separator + realName); - if (!f.exists()) { - throw new ResourceNotFoundException("cannot find mauve resource file" + ": " - + getSourceDirectory() + File.separator + realName); - } - return f; - } - - /** - * Provide a directory name for writing temporary files. - * - * @return The temporary directory name. - */ - public String getTempDirectory() { - // TODO - return "/tmp"; - } - - /** - * Runs the application to generate an HTML report for a collection of Mauve - * tests. - * - * @param args the command line arguments. - */ - public static void main(String[] args) { - // -prefix <package-prefix> - // -output <root-directory-for-HTML-output> - String file = "tests"; - String prefix = "gnu.testlet."; - String output = "results"; - for (int i = 0; i < args.length; i++) { - String a = args[i]; - if (a.equals("--prefix") || a.equals("-p")) { - if (i < args.length) { - prefix = args[i + 1]; - i++; - } else { - System.err.println("prefix: value missing"); - return; - } - } else if (a.equals("--output") || a.equals("-o")) { - if (i < args.length) { - output = args[i + 1]; - i++; - } else { - System.err.println("output: value missing"); - return; - } - } else if (a.equals("--help") || a.equals("-h")) { - System.out.println("Usage: Mauve [options] [inputfile]"); - System.out - .println("reads test-class names from inputfile and executes them;"); - System.out - .println("If no inputfile is passed, then tests.txt will be used"); - System.out.println(" options:"); - System.out.println(" --help -h this help"); - System.out - .println(" --output -o the output directory [results]"); - System.out - .println(" --prefix -p package prefix [gnu.testlet]"); - return; - } else - file = a; - } - try { - new MauveTestCommand().execute(file, prefix, output); - } catch (IllegalArgumentException e) { - System.err.println(e.getMessage()); - System.err.println("Try --help for more info"); - } - System.exit(0); - } -} Deleted: trunk/core/src/test/org/jnode/test/mauve/MauveTests.java =================================================================== --- trunk/core/src/test/org/jnode/test/mauve/MauveTests.java 2008-11-17 13:53:52 UTC (rev 4707) +++ trunk/core/src/test/org/jnode/test/mauve/MauveTests.java 2008-11-17 22:55:33 UTC (rev 4708) @@ -1,120 +0,0 @@ -// Copyright (c) 2008 Fabien DUMINY (fd...@jn...) - -// This file is part of Mauve. - -// Mauve is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2, or (at your option) -// any later version. - -// Mauve is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Mauve; see the file COPYING. If not, write to -// the Free Software Foundation, 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. */ - -package org.jnode.test.mauve; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; - -import org.jnode.test.mauve.compare.HTMLComparisonWriter; -import org.jnode.test.mauve.compare.ReportComparator; -import org.jnode.test.mauve.compare.RunComparison; -import org.jnode.test.mauve.compare.TextComparisonWriter; - -/** - * Contains a test program for various functions like xml import/export of mauve results, - * comparison of 2 mauve results with results saved in xml or html format. - * - * @author fabien - * - */ -public class MauveTests { - - public static void main(String[] args) throws IOException { - RunResult runResult = createRunResult(1, 2, 0, 3, 1); - System.out.println("========================="); - - System.out.println("\n--- writing XML file ---"); - File f = File.createTempFile("XMLReport", ".xml"); - f.deleteOnExit(); - new XMLReportWriter().write(runResult, f); - System.out.println("\n--- COMPACT MODE:"); - new XMLReportWriter(true).write(runResult, new PrintWriter(System.out)); - System.out.println("\n--- NORMAL MODE:"); - new XMLReportWriter(false).write(runResult, new PrintWriter(System.out)); - HTMLGenerator.createReport(runResult, f.getParentFile()); - System.out.println("========================"); - - System.out.println("\n--- parsing XML file ---"); - RunResult rr = new XMLReportParser().parse(f); - System.out.println("rr = " + rr); - System.out.println("========================"); - - RunResult runResult2 = createRunResult(2, 2, 1, 3, 0); - System.out.println("========================\n"); - - ReportComparator c = new ReportComparator(runResult, runResult2); - RunComparison comp = c.compare(); - - System.out.println("\n--- comparison result in text ---"); - new TextComp... [truncated message content] |