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