1
package org.apache.maven.surefire.testset;
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
12
* http://www.apache.org/licenses/LICENSE-2.0
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
23
import java.util.ArrayList;
24
import java.util.List;
27
* Information about the requested test.
29
* @author Kristian Rosenvold
31
public class TestRequest
33
private final List suiteXmlFiles;
35
private final File testSourceDirectory;
37
private final String requestedTest;
42
private final String requestedTestMethod;
44
public TestRequest( List suiteXmlFiles, File testSourceDirectory, String requestedTest )
46
this( suiteXmlFiles, testSourceDirectory, requestedTest, null );
52
public TestRequest( List suiteXmlFiles, File testSourceDirectory, String requestedTest, String requestedTestMethod )
54
this.suiteXmlFiles = createFiles( suiteXmlFiles );
55
this.testSourceDirectory = testSourceDirectory;
56
this.requestedTest = requestedTest;
57
this.requestedTestMethod = requestedTestMethod;
61
* Represents suitexmlfiles that define the test-run request
62
* @return A list of java.io.File objects.
64
public List getSuiteXmlFiles()
70
* Test source directory, normally ${project.build.testSourceDirectory}
71
* @return A file pointing to test sources
73
public File getTestSourceDirectory()
75
return testSourceDirectory;
79
* A specific test request issued with -Dtest= from the command line.
80
* @return The string specified at the command line
82
public String getRequestedTest()
88
* A specific test request method issued with -Dtest=class#method from the command line.
89
* @return The string specified at the command line
92
public String getRequestedTestMethod()
94
return requestedTestMethod;
97
private static List createFiles( List suiteXmlFiles )
99
if ( suiteXmlFiles != null )
101
List files = new ArrayList();
103
for ( int i = 0; i < suiteXmlFiles.size(); i++ )
105
element = suiteXmlFiles.get( i );
106
files.add( element instanceof String ? new File( (String) element ) : (File) element );