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
25 import org.apache.maven.surefire.util.RunOrder;
26
27 /**
28 * @author Kristian Rosenvold
29 */
30 public class DirectoryScannerParameters
31 {
32 private final File testClassesDirectory;
33
34 private final List includes;
35
36 private final List excludes;
37
38 private final Boolean failIfNoTests;
39
40 private final RunOrder runOrder;
41
42 public DirectoryScannerParameters( File testClassesDirectory, List includes, List excludes, Boolean failIfNoTests,
43 RunOrder runOrder )
44 {
45 this.testClassesDirectory = testClassesDirectory;
46 this.includes = includes;
47 this.excludes = excludes;
48 this.failIfNoTests = failIfNoTests;
49 this.runOrder = runOrder;
50 }
51
52 public DirectoryScannerParameters( File testClassesDirectory, List includes, List excludes, Boolean failIfNoTests,
53 String runOrder )
54 {
55 this( testClassesDirectory, includes, excludes, failIfNoTests, runOrder == null ? RunOrder.FILESYSTEM : RunOrder.valueOf( 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 }