|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| IOutcome.java | - | - | - | - |
|
||||||||||||||
| 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; | |
| 8 | ||
| 9 | import java.io.Serializable; | |
| 10 | import java.util.Date; | |
| 11 | import javax.sql.rowset.serial.SerialArray; | |
| 12 | import jtr.config.ParametersMap; | |
| 13 | import jtr.config.enterprise.EnterpriseConfig; | |
| 14 | import jtr.remote.test.NodeInfo; | |
| 15 | import jtr.runners.AbstractRunner; | |
| 16 | ||
| 17 | /** | |
| 18 | * This interface defines what an <i>outcome</i> is for the JTRunner framework.<br> | |
| 19 | * An outcome is composed by:<br> | |
| 20 | * <br> | |
| 21 | * 1. an epoch<br> | |
| 22 | * 2. a run<br> | |
| 23 | * 3. an enterprise configuration<br> | |
| 24 | * 4. a set of parameters<br> | |
| 25 | * 5. an exception<br> | |
| 26 | * 6. a JTR-node<br> | |
| 27 | * 7. a timestamp | |
| 28 | * 8. a duration | |
| 29 | * <br> | |
| 30 | * What it means is that durig epoch <code>epoch</code> at run | |
| 31 | * <code>run</code>, an <code>IRunner</code> has experienced an exception | |
| 32 | * using the given enterprise configuration and its set of parameters. | |
| 33 | * | |
| 34 | * @author Francesco Russo (frusso@dev.java.net) | |
| 35 | * @version 4.0 | |
| 36 | * @since 1.0 | |
| 37 | * @see jtr.test.IOutcomeFactory | |
| 38 | */ | |
| 39 | public interface IOutcome<T extends AbstractRunner> extends Serializable, Comparable { | |
| 40 | /** | |
| 41 | * Set the epoch when the exception happened. | |
| 42 | * | |
| 43 | * @param epoch | |
| 44 | * The epoch | |
| 45 | */ | |
| 46 | public void setEpoch(Integer epoch); | |
| 47 | ||
| 48 | /** | |
| 49 | * Get the epoch. | |
| 50 | * | |
| 51 | * @return int The epoch of the exception | |
| 52 | */ | |
| 53 | public Integer getEpoch(); | |
| 54 | ||
| 55 | /** | |
| 56 | * Set the run when the exception happened | |
| 57 | * | |
| 58 | * @param run | |
| 59 | * The run | |
| 60 | */ | |
| 61 | public void setRun(Integer run); | |
| 62 | ||
| 63 | /** | |
| 64 | * Get the run | |
| 65 | * | |
| 66 | * @return int The run | |
| 67 | */ | |
| 68 | public Integer getRun(); | |
| 69 | ||
| 70 | /** | |
| 71 | * Set the enterprise configuration active at the moment of the exception | |
| 72 | * | |
| 73 | * @param cfg | |
| 74 | * The enterprise configuration | |
| 75 | */ | |
| 76 | public void setEnterpriseConfig(EnterpriseConfig cfg); | |
| 77 | ||
| 78 | /** | |
| 79 | * Get the enterprise configuration | |
| 80 | * | |
| 81 | * @return EnterpriseConfig | |
| 82 | */ | |
| 83 | public EnterpriseConfig getEnterpriseConfig(); | |
| 84 | ||
| 85 | /** | |
| 86 | * Sets the parameters the <code>IRunner</code> that experiences the | |
| 87 | * excepion was working with | |
| 88 | * | |
| 89 | * @param params | |
| 90 | * The <code>IRunner</code>'s parameters | |
| 91 | */ | |
| 92 | public void setParametersMap(ParametersMap params); | |
| 93 | ||
| 94 | /** | |
| 95 | * Returns the parameters the <code>IRunner</code> was working with at the | |
| 96 | * moment of the exception | |
| 97 | * | |
| 98 | * @return ParametersMap | |
| 99 | */ | |
| 100 | public ParametersMap getParametersMap(); | |
| 101 | ||
| 102 | /** | |
| 103 | * Set the exception | |
| 104 | * | |
| 105 | * @param t | |
| 106 | * The exception | |
| 107 | */ | |
| 108 | public void setException(Throwable t); | |
| 109 | ||
| 110 | /** | |
| 111 | * Get the exception | |
| 112 | * | |
| 113 | * @return Throwable The exception | |
| 114 | */ | |
| 115 | public Throwable getException(); | |
| 116 | ||
| 117 | /** | |
| 118 | * Set the type of the outcome | |
| 119 | */ | |
| 120 | public void setType(OutcomeType type); | |
| 121 | ||
| 122 | /** | |
| 123 | * Get the type of the outcome | |
| 124 | */ | |
| 125 | public OutcomeType getType(); | |
| 126 | ||
| 127 | /** | |
| 128 | * Returs <code>Boolean.TRUE</code> iff the type equals <code>OutcomeType.FAILURE</code>. | |
| 129 | */ | |
| 130 | public boolean isFailure(); | |
| 131 | ||
| 132 | /** | |
| 133 | * Returns the <i>category</i> the runner that produced this outcome belogns to. | |
| 134 | */ | |
| 135 | public Class getRunnerCategory(); | |
| 136 | ||
| 137 | /** | |
| 138 | * Returns the unique ID of the runner that produced this outcome. | |
| 139 | */ | |
| 140 | public String getRunnerId(); | |
| 141 | ||
| 142 | /** | |
| 143 | * Set the <i>category</i> the runner that produced this outcome belogns to. | |
| 144 | */ | |
| 145 | public void setRunnerCategory(Class<T> category); | |
| 146 | ||
| 147 | /** | |
| 148 | * Set the unique ID of the runner that produced this outcome. | |
| 149 | */ | |
| 150 | public void setRunnerId(String id); | |
| 151 | ||
| 152 | /** | |
| 153 | * Return the JTR-node the runner that produced this outcome belongs to. | |
| 154 | */ | |
| 155 | public NodeInfo getNode(); | |
| 156 | ||
| 157 | /** | |
| 158 | * Set the JTR-node the runner that produced this outcome belongs to. | |
| 159 | */ | |
| 160 | public void setNode(NodeInfo node); | |
| 161 | ||
| 162 | /** | |
| 163 | * Set the duration of the described run. | |
| 164 | */ | |
| 165 | public void setRunDuration(Long duration); | |
| 166 | ||
| 167 | /** | |
| 168 | * Get the duration of the described run. | |
| 169 | */ | |
| 170 | public Long getRunDuration(); | |
| 171 | ||
| 172 | /** | |
| 173 | * Set the timestamp indicating when the run has been started. | |
| 174 | */ | |
| 175 | public void setTimeStamp(Date ts); | |
| 176 | ||
| 177 | /** | |
| 178 | * Get the run's timestamp. | |
| 179 | */ | |
| 180 | public Date getTimeStamp(); | |
| 181 | ||
| 182 | /** | |
| 183 | * Set a user-object that can be used to add any user-defined information | |
| 184 | * to the output of the test. Every user-object must have a valid | |
| 185 | * <code>toString</code> method implementation too. | |
| 186 | */ | |
| 187 | public void setUserObject(Serializable obj); | |
| 188 | ||
| 189 | /** | |
| 190 | * Get a user-object that can be used to add any user-defined information | |
| 191 | * to the output of the test. Every user-object must have a valid | |
| 192 | * <code>toString</code> method implementation too. | |
| 193 | */ | |
| 194 | public Serializable getUserObject(); | |
| 195 | ||
| 196 | /** | |
| 197 | * Return a description of the outcome | |
| 198 | * @return String | |
| 199 | */ | |
| 200 | public String toString(); | |
| 201 | ||
| 202 | /** | |
| 203 | * Categorization of the different admitted outcome types. | |
| 204 | * | |
| 205 | * @author frusso | |
| 206 | * @version 4.0 | |
| 207 | * @since 4.0 | |
| 208 | */ | |
| 209 | public enum OutcomeType { | |
| 210 | SUCCESS, | |
| 211 | FAILURE; | |
| 212 | } | |
| 213 | } |
|
||||||||||