1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.surefire.junit;
20
21 import org.apache.maven.surefire.api.report.OutputReportEntry;
22 import org.apache.maven.surefire.api.report.ReportEntry;
23 import org.apache.maven.surefire.api.report.RunListener;
24 import org.apache.maven.surefire.api.report.RunMode;
25 import org.apache.maven.surefire.api.report.TestOutputReceiver;
26 import org.apache.maven.surefire.api.report.TestOutputReportEntry;
27 import org.apache.maven.surefire.api.report.TestReportListener;
28 import org.apache.maven.surefire.api.report.TestSetReportEntry;
29 import org.apache.maven.surefire.report.ClassMethodIndexer;
30 import org.apache.maven.surefire.report.RunModeSetter;
31
32
33
34
35
36
37
38 final class JUnit3Reporter implements RunListener, TestOutputReceiver<OutputReportEntry>, RunModeSetter {
39 private final ClassMethodIndexer classMethodIndexer = new ClassMethodIndexer();
40 private final TestReportListener<TestOutputReportEntry> reporter;
41 private volatile RunMode runMode;
42
43 JUnit3Reporter(TestReportListener<TestOutputReportEntry> reporter) {
44 this.reporter = reporter;
45 }
46
47 ClassMethodIndexer getClassMethodIndexer() {
48 return classMethodIndexer;
49 }
50
51 @Override
52 public void setRunMode(RunMode runMode) {
53 this.runMode = runMode;
54 }
55
56 @Override
57 public void testSetStarting(TestSetReportEntry report) {
58 reporter.testSetStarting(report);
59 }
60
61 @Override
62 public void testSetCompleted(TestSetReportEntry report) {
63 reporter.testSetCompleted(report);
64 }
65
66 @Override
67 public void testStarting(ReportEntry report) {
68 reporter.testStarting(report);
69 }
70
71 @Override
72 public void testSucceeded(ReportEntry report) {
73 reporter.testSucceeded(report);
74 }
75
76 @Override
77 public void testAssumptionFailure(ReportEntry report) {
78 reporter.testAssumptionFailure(report);
79 }
80
81 @Override
82 public void testError(ReportEntry report) {
83 reporter.testError(report);
84 }
85
86 @Override
87 public void testFailed(ReportEntry report) {
88 reporter.testFailed(report);
89 }
90
91 @Override
92 public void testSkipped(ReportEntry report) {
93 reporter.testSkipped(report);
94 }
95
96 @Override
97 public void testExecutionSkippedByUser() {
98 reporter.testExecutionSkippedByUser();
99 }
100
101 @Override
102 public void writeTestOutput(OutputReportEntry reportEntry) {
103 Long testRunId = classMethodIndexer.getLocalIndex();
104 reporter.writeTestOutput(new TestOutputReportEntry(reportEntry, runMode, testRunId));
105 }
106 }