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      public ProviderConfiguration( DirectoryScannerParameters directoryScannerParameters,
66                                    RunOrderParameters runOrderParameters, boolean failIfNoTests,
67                                    ReporterConfiguration reporterConfiguration, TestArtifactInfo testArtifact,
68                                    TestRequest testSuiteDefinition, Properties providerProperties,
69                                    TypeEncodedValue typeEncodedTestSet, boolean readTestsFromInStream )
70      {
71          this.runOrderParameters = runOrderParameters;
72          this.providerProperties = providerProperties;
73          this.reporterConfiguration = reporterConfiguration;
74          this.testArtifact = testArtifact;
75          this.testSuiteDefinition = testSuiteDefinition;
76          this.dirScannerParams = directoryScannerParameters;
77          this.failIfNoTests = failIfNoTests;
78          this.forkTestSet = typeEncodedTestSet;
79          this.readTestsFromInStream = readTestsFromInStream;
80      }
81  
82  
83      public ReporterConfiguration getReporterConfiguration()
84      {
85          return reporterConfiguration;
86      }
87  
88  
89      public Boolean isFailIfNoTests()
90      {
91          return ( failIfNoTests ) ? Boolean.TRUE : Boolean.FALSE;
92      }
93  
94      public File getBaseDir()
95      {
96          return dirScannerParams.getTestClassesDirectory();
97      }
98  
99  
100     public DirectoryScannerParameters getDirScannerParams()
101     {
102         return dirScannerParams;
103     }
104 
105     public List getIncludes()
106     {
107         return dirScannerParams.getIncludes();
108     }
109 
110     public List getExcludes()
111     {
112         return dirScannerParams.getExcludes();
113     }
114 
115     public TestArtifactInfo getTestArtifact()
116     {
117         return testArtifact;
118     }
119 
120     public TestRequest getTestSuiteDefinition()
121     {
122         return testSuiteDefinition;
123     }
124 
125     public Properties getProviderProperties()
126     {
127         return providerProperties;
128     }
129 
130     public TypeEncodedValue getTestForFork()
131     {
132         return forkTestSet;
133     }
134 
135     public RunOrderParameters getRunOrderParameters()
136     {
137         return runOrderParameters;
138     }
139 
140 
141     public boolean isReadTestsFromInStream()
142     {
143         return readTestsFromInStream;
144     }
145 }