View Javadoc
1   package org.apache.maven.surefire.booter;
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 java.io.File;
23  import java.util.List;
24  import java.util.Map;
25  
26  import org.apache.maven.surefire.cli.CommandLineOption;
27  import org.apache.maven.surefire.report.ReporterConfiguration;
28  import org.apache.maven.surefire.testset.DirectoryScannerParameters;
29  import org.apache.maven.surefire.testset.RunOrderParameters;
30  import org.apache.maven.surefire.testset.TestArtifactInfo;
31  import org.apache.maven.surefire.testset.TestRequest;
32  
33  /**
34   * Represents the surefire configuration that passes all the way into the provider
35   * classloader and the provider.
36   * <p/>
37   *
38   * @author Jason van Zyl
39   * @author Emmanuel Venisse
40   * @author Kristian Rosenvold
41   */
42  public class ProviderConfiguration
43  {
44      /**
45       * @noinspection UnusedDeclaration
46       */
47      public static final int TESTS_SUCCEEDED_EXIT_CODE = 0;
48  
49      private final DirectoryScannerParameters dirScannerParams;
50  
51      private final ReporterConfiguration reporterConfiguration;
52  
53      private final TestArtifactInfo testArtifact;
54  
55      private final TestRequest testSuiteDefinition;
56  
57      private final RunOrderParameters runOrderParameters;
58  
59      private final Map<String, String> providerProperties;
60  
61      private final boolean failIfNoTests;
62  
63      private final TypeEncodedValue forkTestSet;
64  
65      private final boolean readTestsFromInStream;
66  
67      private final List<CommandLineOption> mainCliOptions;
68  
69      private int skipAfterFailureCount;
70  
71      private Shutdown shutdown;
72  
73      @SuppressWarnings( "checkstyle:parameternumber" )
74      public ProviderConfiguration( DirectoryScannerParameters directoryScannerParameters,
75                                    RunOrderParameters runOrderParameters, boolean failIfNoTests,
76                                    ReporterConfiguration reporterConfiguration, TestArtifactInfo testArtifact,
77                                    TestRequest testSuiteDefinition, Map<String, String> providerProperties,
78                                    TypeEncodedValue typeEncodedTestSet, boolean readTestsFromInStream,
79                                    List<CommandLineOption> mainCliOptions, int skipAfterFailureCount,
80                                    Shutdown shutdown )
81      {
82          this.runOrderParameters = runOrderParameters;
83          this.providerProperties = providerProperties;
84          this.reporterConfiguration = reporterConfiguration;
85          this.testArtifact = testArtifact;
86          this.testSuiteDefinition = testSuiteDefinition;
87          this.dirScannerParams = directoryScannerParameters;
88          this.failIfNoTests = failIfNoTests;
89          this.forkTestSet = typeEncodedTestSet;
90          this.readTestsFromInStream = readTestsFromInStream;
91          this.mainCliOptions = mainCliOptions;
92          this.skipAfterFailureCount = skipAfterFailureCount;
93          this.shutdown = shutdown;
94      }
95  
96      public ReporterConfiguration getReporterConfiguration()
97      {
98          return reporterConfiguration;
99      }
100 
101 
102     public boolean isFailIfNoTests()
103     {
104         return failIfNoTests;
105     }
106 
107     public File getBaseDir()
108     {
109         return dirScannerParams.getTestClassesDirectory();
110     }
111 
112 
113     public DirectoryScannerParameters getDirScannerParams()
114     {
115         return dirScannerParams;
116     }
117 
118     public List getIncludes()
119     {
120         return dirScannerParams.getIncludes();
121     }
122 
123     public List getExcludes()
124     {
125         return dirScannerParams.getExcludes();
126     }
127 
128     public TestArtifactInfo getTestArtifact()
129     {
130         return testArtifact;
131     }
132 
133     public TestRequest getTestSuiteDefinition()
134     {
135         return testSuiteDefinition;
136     }
137 
138     public Map<String, String> getProviderProperties()
139     {
140         return providerProperties;
141     }
142 
143     public TypeEncodedValue getTestForFork()
144     {
145         return forkTestSet;
146     }
147 
148     public RunOrderParameters getRunOrderParameters()
149     {
150         return runOrderParameters;
151     }
152 
153     public boolean isReadTestsFromInStream()
154     {
155         return readTestsFromInStream;
156     }
157 
158     public List<CommandLineOption> getMainCliOptions()
159     {
160         return mainCliOptions;
161     }
162 
163     public int getSkipAfterFailureCount()
164     {
165         return skipAfterFailureCount;
166     }
167 
168     public Shutdown getShutdown()
169     {
170         return shutdown;
171     }
172 }