1 | |
package org.apache.maven.surefire.booter; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.surefire.providerapi.ProviderParameters; |
23 | |
import org.apache.maven.surefire.report.ReporterConfiguration; |
24 | |
import org.apache.maven.surefire.report.ReporterFactory; |
25 | |
import org.apache.maven.surefire.report.ReporterManagerFactory; |
26 | |
import org.apache.maven.surefire.testset.DirectoryScannerParameters; |
27 | |
import org.apache.maven.surefire.testset.TestArtifactInfo; |
28 | |
import org.apache.maven.surefire.testset.TestRequest; |
29 | |
import org.apache.maven.surefire.util.DefaultDirectoryScanner; |
30 | |
import org.apache.maven.surefire.util.DirectoryScanner; |
31 | |
|
32 | |
import java.util.Properties; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | 0 | public class BaseProviderFactory |
38 | |
implements DirectoryScannerParametersAware, ReporterConfigurationAware, SurefireClassLoadersAware, TestRequestAware, |
39 | |
ProviderPropertiesAware, ProviderParameters, TestArtifactInfoAware |
40 | |
{ |
41 | |
private Properties providerProperties; |
42 | |
|
43 | |
private DirectoryScannerParameters directoryScannerParameters; |
44 | |
|
45 | |
private ReporterConfiguration reporterConfiguration; |
46 | |
|
47 | |
private ClassLoader testClassLoader; |
48 | |
|
49 | |
private ClassLoader surefireClassLoader; |
50 | |
|
51 | |
private TestRequest testRequest; |
52 | |
|
53 | |
private TestArtifactInfo testArtifactInfo; |
54 | |
|
55 | |
|
56 | |
public DirectoryScanner getDirectoryScanner() |
57 | |
{ |
58 | 0 | if ( directoryScannerParameters == null ) |
59 | |
{ |
60 | 0 | return null; |
61 | |
} |
62 | 0 | return new DefaultDirectoryScanner( directoryScannerParameters.getTestClassesDirectory(), |
63 | |
directoryScannerParameters.getIncludes(), |
64 | |
directoryScannerParameters.getExcludes(), |
65 | |
directoryScannerParameters.getRunOrder()); |
66 | |
} |
67 | |
|
68 | |
public ReporterFactory getReporterFactory() |
69 | |
{ |
70 | 0 | ReporterFactory reporterManagerFactory = |
71 | |
new ReporterManagerFactory( surefireClassLoader, reporterConfiguration ); |
72 | 0 | if ( providerProperties != null ) |
73 | |
{ |
74 | 0 | reporterManagerFactory.getGlobalRunStatistics().initResultsFromProperties( providerProperties ); |
75 | |
} |
76 | 0 | return reporterManagerFactory; |
77 | |
} |
78 | |
|
79 | |
public void setDirectoryScannerParameters( DirectoryScannerParameters directoryScannerParameters ) |
80 | |
{ |
81 | 0 | this.directoryScannerParameters = directoryScannerParameters; |
82 | 0 | } |
83 | |
|
84 | |
public void setReporterConfiguration( ReporterConfiguration reporterConfiguration ) |
85 | |
{ |
86 | 0 | this.reporterConfiguration = reporterConfiguration; |
87 | 0 | } |
88 | |
|
89 | |
public void setClassLoaders( ClassLoader surefireClassLoader, ClassLoader testClassLoader ) |
90 | |
{ |
91 | 0 | this.surefireClassLoader = surefireClassLoader; |
92 | 0 | this.testClassLoader = testClassLoader; |
93 | 0 | } |
94 | |
|
95 | |
public void setTestRequest( TestRequest testRequest ) |
96 | |
{ |
97 | 0 | this.testRequest = testRequest; |
98 | 0 | } |
99 | |
|
100 | |
public DirectoryScannerParameters getDirectoryScannerParameters() |
101 | |
{ |
102 | 0 | return directoryScannerParameters; |
103 | |
} |
104 | |
|
105 | |
public ReporterConfiguration getReporterConfiguration() |
106 | |
{ |
107 | 0 | return reporterConfiguration; |
108 | |
} |
109 | |
|
110 | |
public TestRequest getTestRequest() |
111 | |
{ |
112 | 0 | return testRequest; |
113 | |
} |
114 | |
|
115 | |
public ClassLoader getTestClassLoader() |
116 | |
{ |
117 | 0 | return testClassLoader; |
118 | |
} |
119 | |
|
120 | |
public void setProviderProperties( Properties providerProperties ) |
121 | |
{ |
122 | 0 | this.providerProperties = providerProperties; |
123 | 0 | } |
124 | |
|
125 | |
public Properties getProviderProperties() |
126 | |
{ |
127 | 0 | return providerProperties; |
128 | |
} |
129 | |
|
130 | |
public TestArtifactInfo getTestArtifactInfo() |
131 | |
{ |
132 | 0 | return testArtifactInfo; |
133 | |
} |
134 | |
|
135 | |
public void setTestArtifactInfo( TestArtifactInfo testArtifactInfo ) |
136 | |
{ |
137 | 0 | this.testArtifactInfo = testArtifactInfo; |
138 | 0 | } |
139 | |
} |