Mercurial > hg > rhino-tests
changeset 57:c9ebb01301a7 draft
Added two classes used by ReportGenerator, other minor enhancements
(JavaDoc, Locale, StringBuffer for text concatenations etc.)
author | Pavel Tisnovsky <ptisnovs@redhat.com> |
---|---|
date | Tue, 23 Oct 2012 13:35:27 +0200 |
parents | bff3d4a426f4 |
children | 54e2a2055eec |
files | ChangeLog src/org/RhinoTests/Reporter/CommandLineParameters.java src/org/RhinoTests/Reporter/GraphPagesGenerator.java src/org/RhinoTests/Reporter/LogPagesGenerator.java src/org/RhinoTests/Reporter/Reporter.java src/org/RhinoTests/Reporter/StringUtils.java src/org/RhinoTests/Reporter/TestResult.java src/org/RhinoTests/Reporter/TestStatus.java src/org/RhinoTests/Reporter/TestType.java |
diffstat | 9 files changed, 179 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Oct 18 10:55:40 2012 +0200 +++ b/ChangeLog Tue Oct 23 13:35:27 2012 +0200 @@ -1,3 +1,19 @@ +2012-10-23 Pavel Tisnovsky <ptisnovs@redhat.com> + + * src/org/RhinoTests/Reporter/StringUtils.java: + Added usage of Locale for string operations, other minor enhancements + StringBuffer is used for text concatenations etc. + * src/org/RhinoTests/Reporter/TestStatus.java: + Added, this class will be used by ReportGenerator. + * src/org/RhinoTests/Reporter/TestType.java: + Added, this class will be used by ReportGenerator. + * src/org/RhinoTests/Reporter/CommandLineParameters.java: + * src/org/RhinoTests/Reporter/GraphPagesGenerator.java: + * src/org/RhinoTests/Reporter/LogPagesGenerator.java: + * src/org/RhinoTests/Reporter/Reporter.java: + * src/org/RhinoTests/Reporter/TestResult.java: + Javadoc. + 2012-10-18 Pavel Tisnovsky <ptisnovs@redhat.com> * src/org/RhinoTests/ScriptEngineClassTest.java:
--- a/src/org/RhinoTests/Reporter/CommandLineParameters.java Thu Oct 18 10:55:40 2012 +0200 +++ b/src/org/RhinoTests/Reporter/CommandLineParameters.java Tue Oct 23 13:35:27 2012 +0200 @@ -46,9 +46,8 @@ import java.util.Set; import java.util.TreeSet; - - /** + * Instances of this class are used to store all command line parameters. * * @author Pavel Tisnovsky */ @@ -69,12 +68,24 @@ private String date = null; private Set<String> tests = new TreeSet<String>(); + /** + * Constructor which starts processing all command line parameters. + * + * @param args + * command line parameters stored as a array of Strings + */ public CommandLineParameters(String[] args) { processAllArgs(args); checkAllArgs(); } + /** + * Process all command line parameters. + * + * @param args + * command line parameters stored as a array of Strings + */ private void processAllArgs(String[] args) { for (String arg : args) { @@ -98,6 +109,9 @@ } } + /** + * Basic check if all arguments are correct. + */ private void checkAllArgs() { checkTemplateDir(); checkLogDir();
--- a/src/org/RhinoTests/Reporter/GraphPagesGenerator.java Thu Oct 18 10:55:40 2012 +0200 +++ b/src/org/RhinoTests/Reporter/GraphPagesGenerator.java Tue Oct 23 13:35:27 2012 +0200 @@ -47,7 +47,8 @@ /** - * + * Generator for HTML pages which contains graphs with test results. + * * @author Pavel Tisnovsky */ public class GraphPagesGenerator {
--- a/src/org/RhinoTests/Reporter/LogPagesGenerator.java Thu Oct 18 10:55:40 2012 +0200 +++ b/src/org/RhinoTests/Reporter/LogPagesGenerator.java Tue Oct 23 13:35:27 2012 +0200 @@ -47,7 +47,8 @@ import java.util.Map.Entry; /** - * + * Log pages generator. + * * @author Pavel Tisnovsky */ public class LogPagesGenerator
--- a/src/org/RhinoTests/Reporter/Reporter.java Thu Oct 18 10:55:40 2012 +0200 +++ b/src/org/RhinoTests/Reporter/Reporter.java Tue Oct 23 13:35:27 2012 +0200 @@ -48,7 +48,8 @@ import java.util.TreeSet; /** - * + * Main reporter class. + * * @author Pavel Tisnovsky */ public class Reporter {
--- a/src/org/RhinoTests/Reporter/StringUtils.java Thu Oct 18 10:55:40 2012 +0200 +++ b/src/org/RhinoTests/Reporter/StringUtils.java Tue Oct 23 13:35:27 2012 +0200 @@ -40,6 +40,8 @@ package org.RhinoTests.Reporter; +import java.util.Locale; + /** @@ -90,12 +92,15 @@ * @return camel case variant of the input string */ public static String toCamelCase(String string) { + // all underscores (+character after it) should be replaced by the + // uppercased variant of this character String[] parts = string.split("_"); - String camelCaseString = ""; + StringBuffer camelCaseString = new StringBuffer(); + // properly convert all words (which were separated by underscore) for (String part : parts) { - camelCaseString = camelCaseString + convertToProperCase(part); + camelCaseString.append(convertToProperCase(part)); } - return camelCaseString; + return camelCaseString.toString(); } /** @@ -107,7 +112,7 @@ * @return input string with capitalized first letter */ public static String convertToProperCase(String string) { - return string.substring(0, 1).toUpperCase() + string.substring(1).toLowerCase(); + return string.substring(0, 1).toUpperCase(Locale.ENGLISH) + string.substring(1).toLowerCase(Locale.ENGLISH); } /** @@ -120,7 +125,7 @@ public static String getPlaceholderMethodName(String placeholderName) { String temporaryName = placeholderName.substring(1); temporaryName = temporaryName.substring(1, temporaryName.length() - 1); - temporaryName = "get" + StringUtils.toCamelCase(temporaryName.toLowerCase()); + temporaryName = "get" + StringUtils.toCamelCase(temporaryName.toLowerCase(Locale.ENGLISH)); return temporaryName; }
--- a/src/org/RhinoTests/Reporter/TestResult.java Thu Oct 18 10:55:40 2012 +0200 +++ b/src/org/RhinoTests/Reporter/TestResult.java Tue Oct 23 13:35:27 2012 +0200 @@ -53,7 +53,7 @@ private int passed; private int failed; private int error; - private String date; + private String date; public TestResult() { this.setPassed(0); @@ -126,35 +126,35 @@ } public String getDate() { - return this.date; + return this.date; } public String getOsName() { - return System.getProperty("os.name"); - } + return System.getProperty("os.name"); + } - public String getOsVer() { - return System.getProperty("os.version"); - } + public String getOsVer() { + return System.getProperty("os.version"); + } - public String getOsArch() { - return System.getProperty("os.arch"); - } + public String getOsArch() { + return System.getProperty("os.arch"); + } - public String getJavaVersion() { - return System.getProperty("java.version"); - } + public String getJavaVersion() { + return System.getProperty("java.version"); + } - public String getVmName() { - return System.getProperty("java.vm.version"); - } + public String getVmName() { + return System.getProperty("java.vm.name"); + } - public String getVmVersion() { - return System.getProperty("java.vm.name"); - } + public String getVmVersion() { + return System.getProperty("java.vm.version"); + } - public void setDate(String date) { - this.date = date; - } + public void setDate(String date) { + this.date = date; + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/RhinoTests/Reporter/TestStatus.java Tue Oct 23 13:35:27 2012 +0200 @@ -0,0 +1,55 @@ +/* + Rhino test framework + + Copyright (C) 2012 Red Hat + +This file is part of IcedTea. + +IcedTea 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. + +IcedTea 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 IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. +*/ + + + +package org.RhinoTests.Reporter; + +/** + * Test status. + * + * @author Pavel Tisnovsky + */ +public enum TestStatus +{ + PASSED, + FAILED, + NOT_FOUND +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/RhinoTests/Reporter/TestType.java Tue Oct 23 13:35:27 2012 +0200 @@ -0,0 +1,54 @@ +/* + Rhino test framework + + Copyright (C) 2012 Red Hat + +This file is part of IcedTea. + +IcedTea 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. + +IcedTea 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 IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + + + +package org.RhinoTests.Reporter; + +/** + * Type of tests to use for a graph or a table. + * + * @author Pavel Tisnovsky + */ +public enum TestType +{ + ALL, + FAILED +}