1 package org.apache.maven.surefire.testset;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.ArrayList;
24 import java.util.List;
25
26
27
28
29
30
31 public class TestRequest
32 {
33 private final List<File> suiteXmlFiles;
34
35 private final File testSourceDirectory;
36
37 private final String requestedTest;
38
39 private final int rerunFailingTestsCount;
40
41
42
43
44 private final String requestedTestMethod;
45
46 public TestRequest( List suiteXmlFiles, File testSourceDirectory, String requestedTest )
47 {
48 this( suiteXmlFiles, testSourceDirectory, requestedTest, null );
49 }
50
51
52
53
54 public TestRequest( List suiteXmlFiles, File testSourceDirectory, String requestedTest, String requestedTestMethod )
55 {
56 this( createFiles( suiteXmlFiles ), testSourceDirectory, requestedTest, requestedTestMethod, 0 );
57 }
58
59 public TestRequest( List suiteXmlFiles, File testSourceDirectory, String requestedTest, String requestedTestMethod,
60 int rerunFailingTestsCount )
61 {
62 this.suiteXmlFiles = createFiles( suiteXmlFiles );
63 this.testSourceDirectory = testSourceDirectory;
64 this.requestedTest = requestedTest;
65 this.requestedTestMethod = requestedTestMethod;
66 this.rerunFailingTestsCount = rerunFailingTestsCount;
67 }
68
69
70
71
72
73
74 public List<File> getSuiteXmlFiles()
75 {
76 return suiteXmlFiles;
77 }
78
79
80
81
82
83
84 public File getTestSourceDirectory()
85 {
86 return testSourceDirectory;
87 }
88
89
90
91
92
93
94 public String getRequestedTest()
95 {
96 return requestedTest;
97 }
98
99
100
101
102
103
104
105 public String getRequestedTestMethod()
106 {
107 return requestedTestMethod;
108 }
109
110
111
112
113
114
115 public int getRerunFailingTestsCount()
116 {
117 return this.rerunFailingTestsCount;
118 }
119
120 private static List<File> createFiles( List suiteXmlFiles )
121 {
122 if ( suiteXmlFiles != null )
123 {
124 List<File> files = new ArrayList<File>();
125 Object element;
126 for ( Object suiteXmlFile : suiteXmlFiles )
127 {
128 element = suiteXmlFile;
129 files.add( element instanceof String ? new File( (String) element ) : (File) element );
130 }
131 return files;
132 }
133 return null;
134 }
135
136 }