1 package org.apache.maven.surefire.junitcore;
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.report.ReporterConfiguration;
23 import org.apache.maven.surefire.report.ReporterFactory;
24 import org.apache.maven.surefire.testset.TestSetFailedException;
25
26 import java.util.Map;
27
28
29
30
31 public class MethodsParallelRunListener
32 extends ConcurrentReporterManager
33 {
34 private volatile TestSet lastStarted;
35
36 private final Object lock = new Object();
37
38 public MethodsParallelRunListener( Map<String, TestSet> classMethodCounts, ReporterFactory reporterFactory,
39 ReporterConfiguration reporterConfiguration, boolean reportImmediately )
40 throws TestSetFailedException
41 {
42 super( reporterFactory, reportImmediately, reporterConfiguration, classMethodCounts );
43 }
44
45 @Override
46 public void checkIfTestSetCanBeReported( TestSet testSetForTest )
47 {
48 synchronized ( lock )
49 {
50 if ( testSetForTest != lastStarted )
51 {
52 if ( lastStarted != null )
53 {
54 lastStarted.setAllScheduled( getReporterManager() );
55 }
56 lastStarted = testSetForTest;
57 }
58 }
59 }
60 }