1 package org.apache.maven.surefire.report; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import java.io.File; 23 import java.io.PrintStream; 24 25 /** 26 * Bits and pieces of reporting configuration that seem to be necessary on the provider side. 27 * <p/> 28 * Todo: Consider moving these fields elsewhere, this concept does not smell too good 29 * 30 * @author Kristian Rosenvold 31 */ 32 public class ReporterConfiguration 33 { 34 private final File reportsDirectory; 35 36 private final PrintStream originalSystemOut; 37 38 /** 39 * A non-null Boolean value 40 */ 41 private final Boolean trimStackTrace; 42 43 public ReporterConfiguration( File reportsDirectory, Boolean trimStackTrace ) 44 { 45 this.reportsDirectory = reportsDirectory; 46 this.trimStackTrace = trimStackTrace; 47 48 /* 49 * While this may seem slightly odd, when this object is constructed no user code has been run 50 * (including classloading), and we can be guaranteed that no-one has modified System.out/System.err. 51 * As soon as we start loading user code, all h*ll breaks loose in this respect. 52 */ 53 this.originalSystemOut = System.out; 54 } 55 56 /** 57 * The directory where reports will be created, normally ${project.build.directory}/surefire-reports 58 * 59 * @return A file pointing at the specified directory 60 */ 61 public File getReportsDirectory() 62 { 63 return reportsDirectory; 64 } 65 66 /** 67 * Indicates if reporting should trim the stack traces. 68 * 69 * @return true if stacktraces should be trimmed in reporting 70 */ 71 public Boolean isTrimStackTrace() 72 { 73 return trimStackTrace; 74 } 75 76 /** 77 * The original system out belonging to the (possibly forked) surefire process. 78 * Note that users of Reporter/ReporterFactory should normally not be using this. 79 * 80 * @return A printstream. 81 */ 82 public PrintStream getOriginalSystemOut() 83 { 84 return originalSystemOut; 85 } 86 }