Clover coverage report -
Coverage timestamp: Sat Jul 7 2007 16:41:13 CEST
file stats: LOC: 242   Methods: 28
NCLOC: 128   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DefaultOutcome.java 70% 83.7% 85.7% 82.7%
coverage coverage
 1    /**
 2    * JTRunner is free software; you can redistribute it and/or modify it under the
 3    * terms of the GNU General Public License as published by the Free Software
 4    * Foundation; either version 2, or (at your option) any later version.
 5    */
 6   
 7    package jtr.test.impl;
 8   
 9    import java.io.Serializable;
 10    import java.util.Date;
 11    import jtr.config.ParametersMap;
 12    import jtr.config.enterprise.EnterpriseConfig;
 13    import jtr.remote.test.NodeInfo;
 14    import jtr.runners.AbstractRunner;
 15    import jtr.test.*;
 16   
 17    /**
 18    * This is the default implementation provided for the <code>IOutcome</code>
 19    * interface.
 20    *
 21    * @author Francesco Russo (frusso@dev.java.net)
 22    * @version 4.0
 23    * @since 1.0
 24    * @see jtr.test.IOutcome
 25    * @see jtr.test.IOutcomeFactory
 26    */
 27    public class DefaultOutcome implements IOutcome<AbstractRunner>, Serializable {
 28    /**
 29    * Default constructor.
 30    */
 31  44397 public DefaultOutcome() {
 32    }
 33   
 34    /**
 35    * Set the epoch when the exception happened.
 36    *
 37    * @param epoch
 38    * The epoch
 39    */
 40  44396 public void setEpoch(Integer epoch) {
 41  44399 this.epoch = epoch;
 42    }
 43   
 44    /**
 45    * Get the epoch.
 46    *
 47    * @return int The epoch of the exception
 48    */
 49  728162 public Integer getEpoch() {
 50  728162 return epoch;
 51    }
 52   
 53    /**
 54    * Set the run when the exception happened
 55    *
 56    * @param run
 57    * The run
 58    */
 59  44400 public void setRun(Integer run) {
 60  44400 this.run = run;
 61    }
 62   
 63    /**
 64    * Get the run
 65    *
 66    * @return int The run
 67    */
 68  249600 public Integer getRun() {
 69  249600 return run;
 70    }
 71   
 72    /**
 73    * Set the enterprise configuration active at the moment of the exception
 74    *
 75    * @param cfg
 76    * The enterprise configuration
 77    */
 78  44390 public void setEnterpriseConfig(EnterpriseConfig cfg) {
 79  44399 enterpriseConfig = cfg;
 80    }
 81   
 82    /**
 83    * Get the enterprise configuration
 84    *
 85    * @return EnterpriseConfig
 86    */
 87  0 public EnterpriseConfig getEnterpriseConfig() {
 88  0 return enterpriseConfig;
 89    }
 90   
 91    /**
 92    * Sets the parameters the <code>IRunner</code> that experiences the
 93    * excepion was working with
 94    *
 95    * @param params
 96    * The <code>IRunner</code>'s parameters
 97    */
 98  44400 public void setParametersMap(ParametersMap params) {
 99  44397 parametersMap = params;
 100    }
 101   
 102    /**
 103    * Returns the parameters the <code>IRunner</code> was working with at the
 104    * moment of the exception
 105    *
 106    * @return ParametersMap
 107    */
 108  0 public ParametersMap getParametersMap() {
 109  0 return parametersMap;
 110    }
 111   
 112    /**
 113    * Set the exception
 114    *
 115    * @param t
 116    * The exception
 117    */
 118  11995 public void setException(Throwable t) {
 119  11997 exception = t;
 120    }
 121   
 122    /**
 123    * Get the exception
 124    *
 125    * @return Throwable The exception
 126    */
 127  9100 public Throwable getException() {
 128  9100 return exception;
 129    }
 130   
 131  44399 public void setType(IOutcome.OutcomeType type) {
 132  44399 this.type = type;
 133    }
 134   
 135  9100 public IOutcome.OutcomeType getType() {
 136  9100 return type;
 137    }
 138   
 139  177600 public boolean isFailure() {
 140  177600 return OutcomeType.FAILURE.equals(type);
 141    }
 142   
 143  44410 public Class getRunnerCategory() {
 144  44410 return runnerCategory;
 145    }
 146   
 147  44486 public String getRunnerId() {
 148  44486 return runnerId;
 149    }
 150   
 151  44399 public void setRunnerCategory(Class<AbstractRunner> category) {
 152  44400 runnerCategory = category;
 153    }
 154   
 155  44398 public void setRunnerId(String id) {
 156  44399 runnerId = id;
 157    }
 158   
 159  0 public NodeInfo getNode() {
 160  0 return node;
 161    }
 162   
 163  44400 public void setNode(NodeInfo node) {
 164  44400 this.node = node;
 165    }
 166   
 167  44399 public void setRunDuration(Long duration) {
 168  44400 runDuration = duration;
 169    }
 170   
 171  62600 public Long getRunDuration() {
 172  62600 return runDuration;
 173    }
 174   
 175  44400 public void setTimeStamp(Date ts) {
 176  44400 timeStamp = ts;
 177    }
 178   
 179  53500 public Date getTimeStamp() {
 180  53500 return timeStamp;
 181    }
 182   
 183  44394 public void setUserObject(Serializable obj) {
 184  44381 userObject = obj;
 185    }
 186   
 187  9100 public Serializable getUserObject() {
 188  9100 return userObject;
 189    }
 190   
 191  391385 public int compareTo(Object o) {
 192  391385 int LESS_THAN = -1;
 193  391385 int EQUAL_TO = 0;
 194  391385 int GREATER_THAN = 1;
 195   
 196  391385 int res = 0;
 197  391385 IOutcome other = (IOutcome)o;
 198  391385 if(epoch<other.getEpoch())
 199  152508 res = LESS_THAN;
 200    else {
 201  238877 if(epoch>other.getEpoch())
 202  138067 res = GREATER_THAN;
 203    else {
 204  100810 if(run<other.getRun())
 205  49920 res = LESS_THAN;
 206    else {
 207  50890 if(run>other.getRun())
 208  50890 res = GREATER_THAN;
 209    else
 210  0 res = EQUAL_TO;
 211    }
 212    }
 213    }
 214  391385 return res;
 215    }
 216   
 217    /**
 218    * A <code>String</code> representation of the current
 219    * <code>IOutcome</code> instance
 220    *
 221    * @return String
 222    */
 223  0 public String toString() {
 224  0 if(exception!=null)
 225  0 return "Outcome: Epoch/Run = " + epoch + "/" + run + "\n" + "Exception = " + exception.toString();
 226    else
 227  0 return "Outcome: Epoch/Run = " + epoch + "/" + run;
 228    }
 229   
 230    private Integer epoch;
 231    private Integer run;
 232    private EnterpriseConfig enterpriseConfig;
 233    private ParametersMap parametersMap;
 234    private Throwable exception;
 235    private OutcomeType type;
 236    private Class runnerCategory;
 237    private String runnerId;
 238    private NodeInfo node;
 239    private Long runDuration;
 240    private Serializable userObject;
 241    private Date timeStamp;
 242    }