1 package org.apache.maven.surefire.extensions; 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 org.apache.maven.surefire.report.TestSetReportEntry; 23 24 import static org.apache.maven.surefire.util.internal.StringUtils.isBlank; 25 26 /** 27 * Extension for stateless reporter. 28 * Signatures can be changed between major, minor versions or milestones. 29 * 30 * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a> 31 * @since 3.0.0-M4 32 * @param <R> report entry type, see <em>WrappedReportEntry</em> from module the <em>maven-surefire-common</em> 33 * @param <S> test-set statistics, see <em>TestSetStats</em> from module the <em>maven-surefire-common</em> 34 * @param <C> mojo config, see <em>DefaultStatelessReportMojoConfiguration</em> from <em>maven-surefire-common</em> 35 */ 36 public abstract class StatelessReporter<R extends TestSetReportEntry, S, C extends StatelessReportMojoConfiguration> 37 { 38 /** 39 * {@code false} by default 40 */ 41 //todo remove isDisableXmlReport() in AbstractSurefireMojo and use this param instead 42 private boolean disable; 43 44 /** 45 * Version of reporter. It is version <em>3.0</em> used by default in XML reporter. 46 */ 47 private String version; 48 49 /** 50 * Creates reporter. 51 * 52 * @return reporter object 53 */ 54 public abstract StatelessReportEventListener<R, S> createListener( C configuration ); 55 56 public abstract Object clone( ClassLoader target ); 57 58 public boolean isDisable() 59 { 60 return disable; 61 } 62 63 public void setDisable( boolean disable ) 64 { 65 this.disable = disable; 66 } 67 68 public String getVersion() 69 { 70 return isBlank( version ) ? "3.0" : version; 71 } 72 73 public void setVersion( String version ) 74 { 75 this.version = version; 76 } 77 78 @Override 79 public String toString() 80 { 81 return getClass().getSimpleName() 82 + "{" 83 + "version=" + getVersion() 84 + ", disable=" + isDisable() 85 + '}'; 86 } 87 }