1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.surefire.api.provider;
20
21 import java.util.List;
22 import java.util.Map;
23
24 import org.apache.maven.surefire.api.cli.CommandLineOption;
25 import org.apache.maven.surefire.api.report.ReporterConfiguration;
26 import org.apache.maven.surefire.api.report.ReporterFactory;
27 import org.apache.maven.surefire.api.testset.DirectoryScannerParameters;
28 import org.apache.maven.surefire.api.testset.TestArtifactInfo;
29 import org.apache.maven.surefire.api.testset.TestRequest;
30 import org.apache.maven.surefire.api.util.DirectoryScanner;
31 import org.apache.maven.surefire.api.util.RunOrderCalculator;
32 import org.apache.maven.surefire.api.util.ScanResult;
33
34 /**
35 * Injected into the providers upon provider construction. Allows the provider to request services and data it needs.
36 * <br>
37 * NOTE: This class is part of the proposed public api for surefire providers from 2.7 and up. It may
38 * still be subject to changes, even for minor revisions.
39 * <br>
40 * The api covers this interface and all the types reachable from it. And nothing else.
41 *
42 * @author Kristian Rosenvold
43 */
44 public interface ProviderParameters {
45 /**
46 * Provides a directory scanner that enforces the includes/excludes parameters that were passed to surefire.
47 * See #getDirectoryScannerParameters for details
48 *
49 * @return The directory scanner
50 * @deprecated Use scanresult instead, as of version 2.12.2. Will be removed in next major version.
51 */
52 @Deprecated
53 DirectoryScanner getDirectoryScanner();
54
55 /**
56 * Provides the result of the directory scan performed in the plugin
57 *
58 * @return The scan result
59 */
60 ScanResult getScanResult();
61
62 /**
63 * Provides a service to calculate run order of tests. Applied after directory scanning.
64 *
65 * @return A RunOrderCalculator
66 */
67 RunOrderCalculator getRunOrderCalculator();
68
69 /**
70 * Provides features for creating reporting objects
71 *
72 * @return A ReporterFactory that allows the creation of one or more ReporterManagers
73 */
74 ReporterFactory getReporterFactory();
75
76 /**
77 * The raw parameters used in creating the directory scanner
78 *
79 * @return The parameters
80 * @deprecated Use scanresult instead, as of version 2.12.2. Will be removed in next major version.
81 */
82 @Deprecated
83 DirectoryScannerParameters getDirectoryScannerParameters();
84
85 /**
86 * The raw parameters used in creating the ReporterManagerFactory
87 *
88 * @return The reporter configuration
89 */
90 ReporterConfiguration getReporterConfiguration();
91
92 /**
93 * Contains information about requested test suites or individual tests from the command line.
94 *
95 * @return The testRequest
96 */
97 TestRequest getTestRequest();
98
99 /**
100 * The class loader for the tests
101 *
102 * @return the classloader
103 */
104 ClassLoader getTestClassLoader();
105
106 /**
107 * The per-provider specific properties that may come all the way from the plugin's properties setting.
108 *
109 * @return the provider specific properties
110 */
111 Map<String, String> getProviderProperties();
112
113 /**
114 * Artifact info about the artifact used to autodetect provider
115 *
116 * @return The artifactinfo, or null if autodetect was not used.
117 */
118 TestArtifactInfo getTestArtifactInfo();
119
120 List<CommandLineOption> getMainCliOptions();
121
122 /**
123 * @return Defaults to 0. Configured with parameter {@code skipAfterFailureCount} in POM.
124 */
125 int getSkipAfterFailureCount();
126
127 /**
128 * @return {@code true} if test provider appears in forked jvm; Otherwise {@code false} means
129 * in-plugin provider.
130 */
131 boolean isInsideFork();
132
133 Integer getSystemExitTimeout();
134
135 CommandChainReader getCommandReader();
136 }