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