1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.surefire.extensions;
20
21 import java.io.File;
22 import java.nio.charset.Charset;
23
24 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
25 import org.apache.maven.plugin.surefire.report.ConsoleReporter;
26 import org.apache.maven.plugin.surefire.report.FileReporter;
27 import org.apache.maven.plugin.surefire.report.TestSetStats;
28 import org.apache.maven.plugin.surefire.report.WrappedReportEntry;
29 import org.apache.maven.surefire.api.util.ReflectionUtils;
30 import org.apache.maven.surefire.extensions.StatelessTestsetInfoConsoleReportEventListener;
31 import org.apache.maven.surefire.extensions.StatelessTestsetInfoFileReportEventListener;
32 import org.apache.maven.surefire.extensions.StatelessTestsetInfoReporter;
33
34
35
36
37
38
39
40
41
42
43
44
45 public class SurefireStatelessTestsetInfoReporter
46 extends StatelessTestsetInfoReporter<WrappedReportEntry, TestSetStats> {
47 @Override
48 public StatelessTestsetInfoConsoleReportEventListener<WrappedReportEntry, TestSetStats> createListener(
49 ConsoleLogger logger) {
50 return new ConsoleReporter(logger, false, false);
51 }
52
53 @Override
54 public StatelessTestsetInfoFileReportEventListener<WrappedReportEntry, TestSetStats> createListener(
55 File reportsDirectory, String reportNameSuffix, Charset encoding) {
56 return new FileReporter(reportsDirectory, reportNameSuffix, encoding, false, false, false);
57 }
58
59 @Override
60 public Object clone(ClassLoader target) {
61 try {
62 Class<?> cls = ReflectionUtils.reloadClass(target, this);
63 Object clone = cls.newInstance();
64
65 cls.getMethod("setDisable", boolean.class).invoke(clone, isDisable());
66
67 return clone;
68 } catch (ReflectiveOperationException e) {
69 throw new IllegalStateException(e.getLocalizedMessage());
70 }
71 }
72
73 @Override
74 public String toString() {
75 return "SurefireStatelessTestsetInfoReporter{disable=" + isDisable() + "}";
76 }
77 }