1 /* 2 * Copyright (C) Christian Schulte, 2005-206 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * o Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * o Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in 14 * the documentation and/or other materials provided with the 15 * distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 19 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $JOMC: AntExecutionResult.java 3838 2011-10-08 20:15:41Z schulte2005 $ 29 * 30 */ 31 package org.jomc.ant.test.support; 32 33 import java.util.LinkedList; 34 import java.util.List; 35 import org.apache.tools.ant.BuildEvent; 36 37 /** 38 * Result of an execution of an Ant target. 39 * 40 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 41 * @version $JOMC: AntExecutionResult.java 3838 2011-10-08 20:15:41Z schulte2005 $ 42 */ 43 public class AntExecutionResult 44 { 45 46 /** The characters written to the system output stream during execution of the target. */ 47 private String systemOutput; 48 49 /** The characters written to the system error stream during execution of the target. */ 50 private String systemError; 51 52 /** List of {@code buildStarted} events fired during execution of the target. */ 53 private List<BuildEvent> buildStartedEvents; 54 55 /** List of {@code buildFinished} events fired during execution of the target. */ 56 private List<BuildEvent> buildFinishedEvents; 57 58 /** List of {@code targetStarted} events fired during execution of the target. */ 59 private List<BuildEvent> targetStartedEvents; 60 61 /** List of {@code targetFinished} events fired during execution of the target. */ 62 private List<BuildEvent> targetFinishedEvents; 63 64 /** List of {@code taskStarted} events fired during execution of the target. */ 65 private List<BuildEvent> taskStartedEvents; 66 67 /** List of {@code taskFinished} events fired during execution of the target. */ 68 private List<BuildEvent> taskFinishedEvents; 69 70 /** List of {@code messageLogged} events fired during execution of the target. */ 71 private List<BuildEvent> messageLoggedEvents; 72 73 /** The throwable thrown by the execution of the target. */ 74 private Throwable throwable; 75 76 /** Creates a new {@code AntExecutionResult}. */ 77 public AntExecutionResult() 78 { 79 super(); 80 } 81 82 /** 83 * Gets the characters written to the system output stream during execution of the target. 84 * 85 * @return The characters written to the system output stream during execution of the target or {@code null}. 86 */ 87 public final String getSystemOutput() 88 { 89 return this.systemOutput; 90 } 91 92 /** 93 * Set the characters written to the system output stream during execution of the target. 94 * 95 * @param value The new characters written to the system output stream during execution of the target or 96 * {@code null}. 97 */ 98 public final void setSystemOutput( final String value ) 99 { 100 this.systemOutput = value; 101 } 102 103 /** 104 * Gets the characters written to the system error stream during execution of the target. 105 * 106 * @return The characters written to the system error stream during execution of the target or {@code null}. 107 */ 108 public final String getSystemError() 109 { 110 return this.systemError; 111 } 112 113 /** 114 * Set the characters written to the system error stream during execution of the target. 115 * 116 * @param value The new characters written to the system error stream during execution of the target or 117 * {@code null}. 118 */ 119 public final void setSystemError( final String value ) 120 { 121 this.systemError = value; 122 } 123 124 /** 125 * Gets the throwable thrown by the execution of the target. 126 * 127 * @return The throwable thrown by the execution of the target or {@code null}. 128 */ 129 public final Throwable getThrowable() 130 { 131 return this.throwable; 132 } 133 134 /** 135 * Sets the throwable thrown by the execution of the target. 136 * 137 * @param value The new throwable thrown by the execution of the target or {@code null}. 138 */ 139 public final void setThrowable( final Throwable value ) 140 { 141 this.throwable = value; 142 } 143 144 /** 145 * Gets the list of {@code buildStarted} events fired during execution of the target. 146 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 147 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 148 * build started events property.</p> 149 * 150 * @return The list of {@code buildStarted} events fired during execution of the target. 151 */ 152 public final List<BuildEvent> getBuildStartedEvents() 153 { 154 if ( this.buildStartedEvents == null ) 155 { 156 this.buildStartedEvents = new LinkedList<BuildEvent>(); 157 } 158 159 return this.buildStartedEvents; 160 } 161 162 /** 163 * Gets the list of {@code buildFinished} events fired during execution of the target. 164 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 165 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 166 * build finished events property.</p> 167 * 168 * @return The list of {@code buildFinished} events fired during execution of the target. 169 */ 170 public final List<BuildEvent> getBuildFinishedEvents() 171 { 172 if ( this.buildFinishedEvents == null ) 173 { 174 this.buildFinishedEvents = new LinkedList<BuildEvent>(); 175 } 176 177 return this.buildFinishedEvents; 178 } 179 180 /** 181 * Gets the list of {@code targetStarted} events fired during execution of the target. 182 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 183 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 184 * target started events property.</p> 185 * 186 * @return The list of {@code targetStarted} events fired during execution of the target. 187 */ 188 public final List<BuildEvent> getTargetStartedEvents() 189 { 190 if ( this.targetStartedEvents == null ) 191 { 192 this.targetStartedEvents = new LinkedList<BuildEvent>(); 193 } 194 195 return this.targetStartedEvents; 196 } 197 198 /** 199 * Gets the list of {@code targetFinished} events fired during execution of the target. 200 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 201 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 202 * target finished events property.</p> 203 * 204 * @return The list of {@code targetFinished} events fired during execution of the target. 205 */ 206 public final List<BuildEvent> getTargetFinishedEvents() 207 { 208 if ( this.targetFinishedEvents == null ) 209 { 210 this.targetFinishedEvents = new LinkedList<BuildEvent>(); 211 } 212 213 return this.targetFinishedEvents; 214 } 215 216 /** 217 * Gets the list of {@code taskStarted} events fired during execution of the target. 218 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 219 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 220 * task started events property.</p> 221 * 222 * @return The list of {@code taskStarted} events fired during execution of the target. 223 */ 224 public final List<BuildEvent> getTaskStartedEvents() 225 { 226 if ( this.taskStartedEvents == null ) 227 { 228 this.taskStartedEvents = new LinkedList<BuildEvent>(); 229 } 230 231 return this.taskStartedEvents; 232 } 233 234 /** 235 * Gets the list of {@code taskFinished} events fired during execution of the target. 236 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 237 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 238 * task finished events property.</p> 239 * 240 * @return The list of {@code taskFinished} events fired during execution of the target. 241 */ 242 public final List<BuildEvent> getTaskFinishedEvents() 243 { 244 if ( this.taskFinishedEvents == null ) 245 { 246 this.taskFinishedEvents = new LinkedList<BuildEvent>(); 247 } 248 249 return this.taskFinishedEvents; 250 } 251 252 /** 253 * Gets the list of {@code messageLogged} events fired during execution of the target. 254 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make 255 * to the returned list will be present inside the object. This is why there is no {@code set} method for the 256 * message logged events property.</p> 257 * 258 * @return The list of {@code messageLogger} events fired during execution of the target. 259 */ 260 public final List<BuildEvent> getMessageLoggedEvents() 261 { 262 if ( this.messageLoggedEvents == null ) 263 { 264 this.messageLoggedEvents = new LinkedList<BuildEvent>(); 265 } 266 267 return this.messageLoggedEvents; 268 } 269 270 }