View Javadoc

1   package org.apache.maven.surefire.testset;
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 org.apache.maven.surefire.util.RunOrder;
25  
26  /**
27   * @author Kristian Rosenvold
28   */
29  public class DirectoryScannerParameters
30  {
31      private final File testClassesDirectory;
32  
33      private final List includes;
34  
35      private final List excludes;
36  
37      private final List specificTests;
38  
39      private final Boolean failIfNoTests;
40  
41      private final RunOrder[] runOrder;
42  
43      private DirectoryScannerParameters( File testClassesDirectory, List includes, List excludes, List specificTests,
44                                          Boolean failIfNoTests, RunOrder[] runOrder )
45      {
46          this.testClassesDirectory = testClassesDirectory;
47          this.includes = includes;
48          this.excludes = excludes;
49          this.specificTests = specificTests;
50          this.failIfNoTests = failIfNoTests;
51          this.runOrder = runOrder;
52      }
53  
54      public DirectoryScannerParameters( File testClassesDirectory, List includes, List excludes, List specificTests,
55                                         Boolean failIfNoTests, String runOrder )
56      {
57          this( testClassesDirectory, includes, excludes, specificTests, failIfNoTests,
58                runOrder == null ? RunOrder.DEFAULT : RunOrder.valueOfMulti( runOrder ) );
59      }
60  
61      public List getSpecificTests()
62      {
63          return specificTests;
64      }
65  
66      /**
67       * Returns the directory of the compiled classes, normally ${project.build.testOutputDirectory}
68       *
69       * @return A directory that can be scanned for .class files
70       */
71      public File getTestClassesDirectory()
72      {
73          return testClassesDirectory;
74      }
75  
76      /**
77       * The includes pattern list, as specified on the plugin includes parameter.
78       *
79       * @return A list of patterns. May contain both source file designators and .class extensions.
80       */
81      public List getIncludes()
82      {
83          return includes;
84      }
85  
86      /**
87       * The excludes pattern list, as specified on the plugin includes parameter.
88       *
89       * @return A list of patterns. May contain both source file designators and .class extensions.
90       */
91      public List getExcludes()
92      {
93          return excludes;
94      }
95  
96      /**
97       * Indicates if lack of runable tests should fail the entire build
98       *
99       * @return true if no tests should fail the build
100      */
101     public Boolean isFailIfNoTests()
102     {
103         return failIfNoTests;
104     }
105 
106     public RunOrder[] getRunOrder()
107     {
108         return runOrder;
109     }
110 }