1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  package org.apache.maven.surefire.booter;
20  
21  import java.io.File;
22  import java.util.List;
23  import java.util.Map;
24  
25  import org.apache.maven.surefire.api.booter.Shutdown;
26  import org.apache.maven.surefire.api.cli.CommandLineOption;
27  import org.apache.maven.surefire.api.report.ReporterConfiguration;
28  import org.apache.maven.surefire.api.testset.DirectoryScannerParameters;
29  import org.apache.maven.surefire.api.testset.RunOrderParameters;
30  import org.apache.maven.surefire.api.testset.TestArtifactInfo;
31  import org.apache.maven.surefire.api.testset.TestRequest;
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  public class ProviderConfiguration {
43      private final DirectoryScannerParameters dirScannerParams;
44  
45      private final ReporterConfiguration reporterConfiguration;
46  
47      private final TestArtifactInfo testArtifact;
48  
49      private final TestRequest testSuiteDefinition;
50  
51      private final RunOrderParameters runOrderParameters;
52  
53      private final Map<String, String> providerProperties;
54  
55      private final TypeEncodedValue forkTestSet;
56  
57      private final boolean readTestsFromInStream;
58  
59      private final List<CommandLineOption> mainCliOptions;
60  
61      private final int skipAfterFailureCount;
62  
63      private final Shutdown shutdown;
64  
65      private final Integer systemExitTimeout;
66  
67      @SuppressWarnings("checkstyle:parameternumber")
68      public ProviderConfiguration(
69              DirectoryScannerParameters directoryScannerParameters,
70              RunOrderParameters runOrderParameters,
71              ReporterConfiguration reporterConfiguration,
72              TestArtifactInfo testArtifact,
73              TestRequest testSuiteDefinition,
74              Map<String, String> providerProperties,
75              TypeEncodedValue typeEncodedTestSet,
76              boolean readTestsFromInStream,
77              List<CommandLineOption> mainCliOptions,
78              int skipAfterFailureCount,
79              Shutdown shutdown,
80              Integer systemExitTimeout) {
81          this.runOrderParameters = runOrderParameters;
82          this.providerProperties = providerProperties;
83          this.reporterConfiguration = reporterConfiguration;
84          this.testArtifact = testArtifact;
85          this.testSuiteDefinition = testSuiteDefinition;
86          this.dirScannerParams = directoryScannerParameters;
87          this.forkTestSet = typeEncodedTestSet;
88          this.readTestsFromInStream = readTestsFromInStream;
89          this.mainCliOptions = mainCliOptions;
90          this.skipAfterFailureCount = skipAfterFailureCount;
91          this.shutdown = shutdown;
92          this.systemExitTimeout = systemExitTimeout;
93      }
94  
95      public ReporterConfiguration getReporterConfiguration() {
96          return reporterConfiguration;
97      }
98  
99      public File getBaseDir() {
100         return dirScannerParams.getTestClassesDirectory();
101     }
102 
103     public DirectoryScannerParameters getDirScannerParams() {
104         return dirScannerParams;
105     }
106 
107     @Deprecated
108     public List getIncludes() {
109         return dirScannerParams.getIncludes();
110     }
111 
112     @Deprecated
113     public List getExcludes() {
114         return dirScannerParams.getExcludes();
115     }
116 
117     public TestArtifactInfo getTestArtifact() {
118         return testArtifact;
119     }
120 
121     public TestRequest getTestSuiteDefinition() {
122         return testSuiteDefinition;
123     }
124 
125     public Map<String, String> getProviderProperties() {
126         return providerProperties;
127     }
128 
129     public TypeEncodedValue getTestForFork() {
130         return forkTestSet;
131     }
132 
133     public RunOrderParameters getRunOrderParameters() {
134         return runOrderParameters;
135     }
136 
137     public boolean isReadTestsFromInStream() {
138         return readTestsFromInStream;
139     }
140 
141     public List<CommandLineOption> getMainCliOptions() {
142         return mainCliOptions;
143     }
144 
145     public int getSkipAfterFailureCount() {
146         return skipAfterFailureCount;
147     }
148 
149     public Shutdown getShutdown() {
150         return shutdown;
151     }
152 
153     public Integer getSystemExitTimeout() {
154         return systemExitTimeout;
155     }
156 
157     public long systemExitTimeout(long fallback) {
158         return systemExitTimeout == null || systemExitTimeout < 0 ? fallback : systemExitTimeout;
159     }
160 }