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