1 package csdl.jblanket.ant; 2 3 import java.util.ArrayList ; 4 import java.util.Date ; 5 6 import org.apache.tools.ant.BuildException; 7 8 122 public class JBlanketReportTask extends JBlanketTask { 123 124 125 private String reportFormat; 126 127 private String toDirString; 128 129 130 protected String testedFile; 131 132 protected String untestedFile; 133 134 137 public JBlanketReportTask() { 138 super(); 139 140 this.reportFormat = null; 141 142 this.testedFile = null; 143 this.untestedFile = null; 144 } 145 146 151 public void setReportformat(String format) { 152 this.reportFormat = format; 153 } 154 155 161 public void setToDir(String toDirString) { 162 this.toDirString = toDirString; 163 } 164 165 170 public void setTestfile(String testedFile) { 171 this.testedFile = testedFile; 172 } 173 174 179 public void setUntestfile(String untestedFile) { 180 this.untestedFile = untestedFile; 181 } 182 183 186 public void execute() { 187 188 Date startTime = new Date (); 189 190 if (!super.enable) { 192 193 if (super.verbose) { 194 System.out.println("jblanketreport disabled; no reports created."); 195 } 196 197 return; 198 } 199 200 ArrayList args = new ArrayList (); 202 203 args.add("-verbose"); 205 args.add(new Boolean (super.verbose)); 206 207 if (this.reportFormat != null) { 209 args.add("-reportFormat"); 210 args.add(this.reportFormat); 211 } 212 213 if (this.toDirString != null) { 215 args.add("-toDir"); 216 args.add(this.toDirString); 217 } 218 219 if (super.excludeOneLineMethods) { 221 args.add("-excludeOneLineMethods"); 222 args.add(new Boolean (super.excludeOneLineMethods)); 223 if (super.oneLineFile != null) { 224 args.add("-oneLineFile"); 225 args.add(super.oneLineFile); 226 } 227 } 228 229 if (super.excludeConstructors) { 231 args.add("-excludeConstructors"); 232 args.add(new Boolean (super.excludeConstructors)); 233 if (super.constructorFile != null) { 234 args.add("-constructorFile"); 235 args.add(super.constructorFile); 236 } 237 } 238 239 if (super.excludeIndividualMethods) { 241 args.add("-excludeIndividualMethods"); 242 args.add(new Boolean (super.excludeIndividualMethods)); 243 if (super.excludedIndividualFile != null) { 244 args.add("-excludeIndividualFile"); 245 args.add(super.excludedIndividualFile); 246 } 247 } 248 249 if (super.totalFile != null) { 251 args.add("-totalFile"); 252 args.add(super.totalFile); 253 } 254 255 if (this.testedFile != null) { 257 args.add("-testedFile"); 258 args.add(this.testedFile); 259 } 260 261 if (this.untestedFile != null) { 263 args.add("-untestedFile"); 264 args.add(this.untestedFile); 265 } 266 267 try { 270 csdl.jblanket.report.JBlanketReport.main(args); 271 } 272 catch (Exception e) { 273 e.printStackTrace(); 274 throw new BuildException("Error in JBlanket report."); 275 } 276 277 Date endTime = new Date (); 278 long elapsedTime = (endTime.getTime() - startTime.getTime()) / 1000; 279 System.out.println("JBlanket report task completed " + "(" + elapsedTime + " secs.)"); 280 } 281 } | Popular Tags |