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.ConsoleStream;
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 * <br>
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 * <br>
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 @Deprecated
57 DirectoryScanner getDirectoryScanner();
58
59 /**
60 * Provides the result of the directory scan performed in the plugin
61 *
62 * @return The scan result
63 */
64 ScanResult getScanResult();
65
66
67 /**
68 * Provides a service to calculate run order of tests. Applied after directory scanning.
69 *
70 * @return A RunOrderCalculator
71 */
72 RunOrderCalculator getRunOrderCalculator();
73
74 /**
75 * Provides features for creating reporting objects
76 *
77 * @return A ReporterFactory that allows the creation of one or more ReporterManagers
78 */
79 ReporterFactory getReporterFactory();
80
81 /**
82 * Gets a logger intended for console output.
83 * <br>
84 * This output is intended for provider-oriented messages that are not attached to a single test-set
85 * and will normally be written to something console-like immediately.
86 *
87 * @return A console stream logger
88 */
89 ConsoleStream getConsoleLogger();
90
91 /**
92 * The raw parameters used in creating the directory scanner
93 *
94 * @return The parameters
95 * @deprecated Use scanresult instead, as of version 2.12.2. Will be removed in next major version.
96 */
97 @Deprecated
98 DirectoryScannerParameters getDirectoryScannerParameters();
99
100 /**
101 * The raw parameters used in creating the ReporterManagerFactory
102 *
103 * @return The reporter configuration
104 */
105 ReporterConfiguration getReporterConfiguration();
106
107 /**
108 * Contains information about requested test suites or individual tests from the command line.
109 *
110 * @return The testRequest
111 */
112
113 TestRequest getTestRequest();
114
115 /**
116 * The class loader for the tests
117 *
118 * @return the classloader
119 */
120 ClassLoader getTestClassLoader();
121
122 /**
123 * The per-provider specific properties that may come all the way from the plugin's properties setting.
124 *
125 * @return the provider specific properties
126 */
127 Map<String, String> getProviderProperties();
128
129 /**
130 * Artifact info about the artifact used to autodetect provider
131 *
132 * @return The artifactinfo, or null if autodetect was not used.
133 */
134 TestArtifactInfo getTestArtifactInfo();
135
136 List<CommandLineOption> getMainCliOptions();
137
138 /**
139 * @return Defaults to 0. Configured with parameter {@code skipAfterFailureCount} in POM.
140 */
141 int getSkipAfterFailureCount();
142
143 /**
144 * @return {@code true} if test provider appears in forked jvm; Otherwise {@code false} means
145 * in-plugin provider.
146 */
147 boolean isInsideFork();
148
149 Shutdown getShutdown();
150
151 Integer getSystemExitTimeout();
152 }