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