001 /* 002 * Copyright (C) Christian Schulte, 2005-206 003 * All rights reserved. 004 * 005 * Redistribution and use in source and binary forms, with or without 006 * modification, are permitted provided that the following conditions 007 * are met: 008 * 009 * o Redistributions of source code must retain the above copyright 010 * notice, this list of conditions and the following disclaimer. 011 * 012 * o Redistributions in binary form must reproduce the above copyright 013 * notice, this list of conditions and the following disclaimer in 014 * the documentation and/or other materials provided with the 015 * distribution. 016 * 017 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 018 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 019 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 020 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, 021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 022 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 023 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 024 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 025 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 026 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 027 * 028 * $JOMC: AntExecutionResult.java 3838 2011-10-08 20:15:41Z schulte2005 $ 029 * 030 */ 031 package org.jomc.ant.test.support; 032 033 import java.util.LinkedList; 034 import java.util.List; 035 import org.apache.tools.ant.BuildEvent; 036 037 /** 038 * Result of an execution of an Ant target. 039 * 040 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 041 * @version $JOMC: AntExecutionResult.java 3838 2011-10-08 20:15:41Z schulte2005 $ 042 */ 043 public class AntExecutionResult 044 { 045 046 /** The characters written to the system output stream during execution of the target. */ 047 private String systemOutput; 048 049 /** The characters written to the system error stream during execution of the target. */ 050 private String systemError; 051 052 /** List of {@code buildStarted} events fired during execution of the target. */ 053 private List<BuildEvent> buildStartedEvents; 054 055 /** List of {@code buildFinished} events fired during execution of the target. */ 056 private List<BuildEvent> buildFinishedEvents; 057 058 /** List of {@code targetStarted} events fired during execution of the target. */ 059 private List<BuildEvent> targetStartedEvents; 060 061 /** List of {@code targetFinished} events fired during execution of the target. */ 062 private List<BuildEvent> targetFinishedEvents; 063 064 /** List of {@code taskStarted} events fired during execution of the target. */ 065 private List<BuildEvent> taskStartedEvents; 066 067 /** List of {@code taskFinished} events fired during execution of the target. */ 068 private List<BuildEvent> taskFinishedEvents; 069 070 /** List of {@code messageLogged} events fired during execution of the target. */ 071 private List<BuildEvent> messageLoggedEvents; 072 073 /** The throwable thrown by the execution of the target. */ 074 private Throwable throwable; 075 076 /** Creates a new {@code AntExecutionResult}. */ 077 public AntExecutionResult() 078 { 079 super(); 080 } 081 082 /** 083 * Gets the characters written to the system output stream during execution of the target. 084 * 085 * @return The characters written to the system output stream during execution of the target or {@code null}. 086 */ 087 public final String getSystemOutput() 088 { 089 return this.systemOutput; 090 } 091 092 /** 093 * Set the characters written to the system output stream during execution of the target. 094 * 095 * @param value The new characters written to the system output stream during execution of the target or 096 * {@code null}. 097 */ 098 public final void setSystemOutput( final String value ) 099 { 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 }