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