Coverage Report - net.objectlab.qalab.exporter.ConsoleExporter
 
Classes in this File Line Coverage Branch Coverage Complexity
ConsoleExporter
47%
8/17
N/A
1
 
 1  
 ////////////////////////////////////////////////////////////////////////////////
 2  
 //
 3  
 //                  ObjectLab is sponsoring QALab
 4  
 // 
 5  
 // Based in London, we are world leaders in the design and development 
 6  
 // of bespoke applications for the Securities Financing markets.
 7  
 // 
 8  
 // <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
 9  
 //           ___  _     _           _   _          _
 10  
 //          / _ \| |__ (_) ___  ___| |_| |    __ _| |__
 11  
 //         | | | | '_ \| |/ _ \/ __| __| |   / _` | '_ \
 12  
 //         | |_| | |_) | |  __/ (__| |_| |__| (_| | |_) |
 13  
 //          \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
 14  
 //                   |__/
 15  
 //
 16  
 //                   http://www.ObjectLab.co.uk
 17  
 // ---------------------------------------------------------------------------
 18  
 //
 19  
 //QALab is released under the GNU General Public License.
 20  
 //
 21  
 //QALab: Collects QA Statistics from your build over time.
 22  
 //2005+, ObjectLab Ltd
 23  
 //
 24  
 //This library is free software; you can redistribute it and/or
 25  
 //modify it under the terms of the GNU General Public
 26  
 //License as published by the Free Software Foundation; either
 27  
 //version 2.1 of the License, or (at your option) any later version.
 28  
 //
 29  
 //This library is distributed in the hope that it will be useful,
 30  
 //but WITHOUT ANY WARRANTY; without even the implied warranty of
 31  
 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 32  
 //General Public License for more details.
 33  
 //
 34  
 //You should have received a copy of the GNU General Public
 35  
 //License along with this library; if not, write to the Free Software
 36  
 //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 37  
 //
 38  
 ////////////////////////////////////////////////////////////////////////////////
 39  
 package net.objectlab.qalab.exporter;
 40  
 
 41  
 import net.objectlab.qalab.interfaces.QALabExporter;
 42  
 import net.objectlab.qalab.util.ConsoleLogger;
 43  
 import net.objectlab.qalab.util.TaskLogger;
 44  
 
 45  
 import java.io.IOException;
 46  
 
 47  
 import java.util.Properties;
 48  
 
 49  
 /**
 50  
  * This is a basic exporter for debugging (it simply shows the exports on
 51  
  * ConsoleLogger.
 52  
  * @author Benoit Xhenseval
 53  
  * @version $Revision$
 54  
  */
 55  21
 public class ConsoleExporter implements QALabExporter {
 56  
     /** given implementation for the logger. **/
 57  21
     private TaskLogger taskLogger = new ConsoleLogger();
 58  
 
 59  
     /** if true, no debug information is logged. **/
 60  21
     private boolean quiet = true;
 61  
 
 62  
     /**
 63  
      * For instance for the XML Exporter.
 64  
      * <ul>
 65  
      * <li>qalab.outputfile = the output file name and path.</li>
 66  
      * <li>qalab.classname = alternatively, the XML could be a
 67  
      * resource for this class</li>
 68  
      * <li>qalab.resourcename = the resource name for
 69  
      * the qalab.classname given</li>
 70  
      * </ul>
 71  
      * @param properties the properties.
 72  
      * @see net.objectlab.qalab.interfaces.
 73  
      * QALabExporter#configure(java.util.Properties)
 74  
      */
 75  
     public final void configure(final Properties properties) {
 76  0
         getTaskLogger().log("Configure:" + properties);
 77  0
     }
 78  
 
 79  
     /**
 80  
      * Add summary details for this merger of statistics for this type.
 81  
      * @param violationCount total number of violations for this type
 82  
      * @param fileCount total number of files affected by this type.
 83  
      * @see net.objectlab.qalab.interfaces.QALabExporter#addSummary(
 84  
      * java.util.Date, int, int, java.lang.String)
 85  
      */
 86  
     public final void addSummary(final int violationCount,
 87  
             final int fileCount) {
 88  21
         getTaskLogger().log("AddSummary:"
 89  
             + " violations:" + violationCount + " files:" + fileCount);
 90  21
     }
 91  
 
 92  
     /**
 93  
      * Add a result entry for a given file name and type.
 94  
      * @param violationCount total number of violations for this type and file.
 95  
      * @param fileName file name
 96  
      * @see net.objectlab.qalab.interfaces.QALabExporter#addFileResult(
 97  
      * java.util.Date, int, java.lang.String, java.lang.String)
 98  
      */
 99  
     public final void addFileResult(final int violationCount,
 100  
             final String fileName) {
 101  165
         getTaskLogger().log("AddFileResult:"
 102  
             + " violations:" + violationCount + " file:" + fileName);
 103  165
     }
 104  
 
 105  
     /**
 106  
      * Save the stats (called when the parsing of input statistics is
 107  
      * completed).
 108  
      * @see net.objectlab.qalab.interfaces.QALabExporter#save()
 109  
      */
 110  
     public final void save() throws IOException {
 111  0
         getTaskLogger().log("save");
 112  0
     }
 113  
 
 114  
     /**
 115  
      * @return logger to use if not quiet.
 116  
      */
 117  
     protected final TaskLogger getTaskLogger() {
 118  186
         return taskLogger;
 119  
     }
 120  
 
 121  
     /**
 122  
      * set the task logger, ie mechanism to log issues & debug info.
 123  
      * @param task the logger to use
 124  
      */
 125  
     public final void setTaskLogger(final TaskLogger task) {
 126  0
         taskLogger = task;
 127  0
     }
 128  
 
 129  
     /**
 130  
      * @return true means that no debug info is logged.
 131  
      */
 132  
     public final boolean isQuiet() {
 133  0
         return quiet;
 134  
     }
 135  
 
 136  
     /**
 137  
      * @param noLog true if no log required.
 138  
      */
 139  
     public final void setQuiet(final boolean noLog) {
 140  0
         this.quiet = noLog;
 141  0
     }
 142  
 }
 143  
 /*
 144  
  *                   ObjectLab is sponsoring QALab
 145  
  * 
 146  
  * Based in London, we are world leaders in the design and development 
 147  
  * of bespoke applications for the securities financing markets.
 148  
  * 
 149  
  * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
 150  
  *           ___  _     _           _   _          _
 151  
  *          / _ \| |__ (_) ___  ___| |_| |    __ _| |__
 152  
  *         | | | | '_ \| |/ _ \/ __| __| |   / _` | '_ \
 153  
  *         | |_| | |_) | |  __/ (__| |_| |__| (_| | |_) |
 154  
  *          \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
 155  
  *                   |__/
 156  
  *
 157  
  *                     www.ObjectLab.co.uk
 158  
  */