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