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   * @version $Id$
40   */
41  public class ProviderConfiguration
42  {
43      /**
44       * @noinspection UnusedDeclaration
45       */
46      public static final int TESTS_SUCCEEDED_EXIT_CODE = 0;
47  
48      public static final int TESTS_FAILED_EXIT_CODE = 255;
49  
50      public static final int NO_TESTS_EXIT_CODE = 254;
51  
52      private final DirectoryScannerParameters dirScannerParams;
53  
54      private final ReporterConfiguration reporterConfiguration;
55  
56      private final TestArtifactInfo testArtifact;
57  
58      private final TestRequest testSuiteDefinition;
59  
60      private final RunOrderParameters runOrderParameters;
61  
62      private final Properties providerProperties;
63  
64      private final boolean failIfNoTests;
65  
66      private final TypeEncodedValue forkTestSet;
67  
68      public ProviderConfiguration( DirectoryScannerParameters directoryScannerParameters,
69                                    RunOrderParameters runOrderParameters, boolean failIfNoTests,
70                                    ReporterConfiguration reporterConfiguration, TestArtifactInfo testArtifact,
71                                    TestRequest testSuiteDefinition, Properties providerProperties,
72                                    TypeEncodedValue typeEncodedTestSet )
73      {
74          this.runOrderParameters = runOrderParameters;
75          this.providerProperties = providerProperties;
76          this.reporterConfiguration = reporterConfiguration;
77          this.testArtifact = testArtifact;
78          this.testSuiteDefinition = testSuiteDefinition;
79          this.dirScannerParams = directoryScannerParameters;
80          this.failIfNoTests = failIfNoTests;
81          this.forkTestSet = typeEncodedTestSet;
82      }
83  
84  
85      public ReporterConfiguration getReporterConfiguration()
86      {
87          return reporterConfiguration;
88      }
89  
90  
91      public Boolean isFailIfNoTests()
92      {
93          return ( failIfNoTests ) ? Boolean.TRUE : Boolean.FALSE;
94      }
95  
96      public File getBaseDir()
97      {
98          return dirScannerParams.getTestClassesDirectory();
99      }
100 
101 
102     public DirectoryScannerParameters getDirScannerParams()
103     {
104         return dirScannerParams;
105     }
106 
107     public List getIncludes()
108     {
109         return dirScannerParams.getIncludes();
110     }
111 
112     public List getExcludes()
113     {
114         return dirScannerParams.getExcludes();
115     }
116 
117     public TestArtifactInfo getTestArtifact()
118     {
119         return testArtifact;
120     }
121 
122     public TestRequest getTestSuiteDefinition()
123     {
124         return testSuiteDefinition;
125     }
126 
127     public Properties getProviderProperties()
128     {
129         return providerProperties;
130     }
131 
132     public TypeEncodedValue getTestForFork()
133     {
134         return forkTestSet;
135     }
136 
137     public RunOrderParameters getRunOrderParameters()
138     {
139         return runOrderParameters;
140     }
141 }