1 | |
package org.apache.maven.surefire.report; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
public class ThreadLocalRunListener implements RunListener |
27 | |
{ |
28 | 0 | private final InheritableThreadLocal target = new InheritableThreadLocal(); |
29 | |
|
30 | |
private final ReporterFactory reporterFactory; |
31 | |
|
32 | |
|
33 | |
public RunListener getTarget() |
34 | |
{ |
35 | 0 | Object o = target.get(); |
36 | 0 | if (o == null){ |
37 | 0 | o = reporterFactory.createReporter(); |
38 | 0 | target.set(o); |
39 | |
} |
40 | 0 | return (RunListener) o; |
41 | |
} |
42 | |
|
43 | |
public ThreadLocalRunListener(ReporterFactory reporterFactory) |
44 | 0 | { |
45 | 0 | this.reporterFactory = reporterFactory; |
46 | 0 | } |
47 | |
|
48 | |
public void testSetStarting( ReportEntry report ) |
49 | |
{ |
50 | 0 | getTarget().testSetStarting( report ); |
51 | 0 | } |
52 | |
|
53 | |
public void testSetCompleted( ReportEntry report ) |
54 | |
{ |
55 | 0 | getTarget().testSetCompleted( report ); |
56 | 0 | } |
57 | |
|
58 | |
public void testStarting( ReportEntry report ) |
59 | |
{ |
60 | 0 | getTarget().testStarting( report ); |
61 | 0 | } |
62 | |
|
63 | |
public void testSucceeded( ReportEntry report ) |
64 | |
{ |
65 | 0 | getTarget().testSucceeded( report ); |
66 | 0 | } |
67 | |
|
68 | |
public void testAssumptionFailure( ReportEntry report ) |
69 | |
{ |
70 | 0 | getTarget().testAssumptionFailure( report ); |
71 | 0 | } |
72 | |
|
73 | |
public void testError( ReportEntry report ) |
74 | |
{ |
75 | 0 | getTarget().testError( report ); |
76 | 0 | } |
77 | |
|
78 | |
public void testFailed( ReportEntry report ) |
79 | |
{ |
80 | 0 | getTarget().testFailed( report ); |
81 | 0 | } |
82 | |
|
83 | |
public void testSkipped( ReportEntry report ) |
84 | |
{ |
85 | 0 | getTarget().testSkipped( report ); |
86 | 0 | } |
87 | |
|
88 | |
} |