View Javadoc
1   package org.apache.maven.surefire.providerapi;
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.booter.ForkedChannelEncoder;
23  import org.apache.maven.surefire.booter.Shutdown;
24  import org.apache.maven.surefire.cli.CommandLineOption;
25  import org.apache.maven.surefire.report.ConsoleStream;
26  import org.apache.maven.surefire.report.ReporterConfiguration;
27  import org.apache.maven.surefire.report.ReporterFactory;
28  import org.apache.maven.surefire.testset.DirectoryScannerParameters;
29  import org.apache.maven.surefire.testset.TestArtifactInfo;
30  import org.apache.maven.surefire.testset.TestRequest;
31  import org.apache.maven.surefire.util.DirectoryScanner;
32  import org.apache.maven.surefire.util.RunOrderCalculator;
33  import org.apache.maven.surefire.util.ScanResult;
34  
35  import java.util.List;
36  import java.util.Map;
37  
38  /**
39   * Injected into the providers upon provider construction. Allows the provider to request services and data it needs.
40   * <br>
41   * NOTE: This class is part of the proposed public api for surefire providers from 2.7 and up. It may
42   * still be subject to changes, even for minor revisions.
43   * <br>
44   * The api covers this interface and all the types reachable from it. And nothing else.
45   *
46   * @author Kristian Rosenvold
47   */
48  public interface ProviderParameters
49  {
50      /**
51       * Provides a directory scanner that enforces the includes/excludes parameters that were passed to surefire.
52       * See #getDirectoryScannerParameters for details
53       *
54       * @return The directory scanner
55       * @deprecated Use scanresult instead, as of version 2.12.2. Will be removed in next major version.
56       */
57      @Deprecated
58      DirectoryScanner getDirectoryScanner();
59  
60      /**
61       * Provides the result of the directory scan performed in the plugin
62       *
63       * @return The scan result
64       */
65      ScanResult getScanResult();
66  
67  
68      /**
69       * Provides a service to calculate run order of tests. Applied after directory scanning.
70       *
71       * @return A RunOrderCalculator
72       */
73      RunOrderCalculator getRunOrderCalculator();
74  
75      /**
76       * Provides features for creating reporting objects
77       *
78       * @return A ReporterFactory that allows the creation of one or more ReporterManagers
79       */
80      ReporterFactory getReporterFactory();
81  
82      /**
83       * Gets a logger intended for console output.
84       * <br>
85       * This output is intended for provider-oriented messages that are not attached to a single test-set
86       * and will normally be written to something console-like immediately.
87       *
88       * @return A console stream logger
89       */
90      ConsoleStream getConsoleLogger();
91  
92      /**
93       * The raw parameters used in creating the directory scanner
94       *
95       * @return The parameters
96       * @deprecated Use scanresult instead, as of version 2.12.2. Will be removed in next major version.
97       */
98      @Deprecated
99      DirectoryScannerParameters getDirectoryScannerParameters();
100 
101     /**
102      * The raw parameters used in creating the ReporterManagerFactory
103      *
104      * @return The reporter configuration
105      */
106     ReporterConfiguration getReporterConfiguration();
107 
108     /**
109      * Contains information about requested test suites or individual tests from the command line.
110      *
111      * @return The testRequest
112      */
113 
114     TestRequest getTestRequest();
115 
116     /**
117      * The class loader for the tests
118      *
119      * @return the classloader
120      */
121     ClassLoader getTestClassLoader();
122 
123     /**
124      * The per-provider specific properties that may come all the way from the plugin's properties setting.
125      *
126      * @return the provider specific properties
127      */
128     Map<String, String> getProviderProperties();
129 
130     /**
131      * Artifact info about the artifact used to autodetect provider
132      *
133      * @return The artifactinfo, or null if autodetect was not used.
134      */
135     TestArtifactInfo getTestArtifactInfo();
136 
137     List<CommandLineOption> getMainCliOptions();
138 
139     /**
140      * @return Defaults to 0. Configured with parameter {@code skipAfterFailureCount} in POM.
141      */
142     int getSkipAfterFailureCount();
143 
144     /**
145      * @return {@code true} if test provider appears in forked jvm; Otherwise {@code false} means
146      * in-plugin provider.
147      */
148     boolean isInsideFork();
149 
150     Shutdown getShutdown();
151 
152     Integer getSystemExitTimeout();
153 
154     ForkedChannelEncoder getForkedChannelEncoder();
155 }