aboutsummaryrefslogtreecommitdiffstats
path: root/jacoco-maven-plugin.test/it/it-report-aggregate/verify.bsh
blob: 9c2d6c9dce557a2a4c24a0a779bc4b5d9cd71892 (plain)
1
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*******************************************************************************
 * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Marc R. Hoffmann, Jan Wloka - initial API and implementation
 *
 *******************************************************************************/
import org.codehaus.plexus.util.*;
import java.util.regex.*;

String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );

if ( !Pattern.compile( "Loading execution data file \\S*child1.target.jacoco.exec").matcher( buildLog ).find() ) {
    throw new RuntimeException( "Execution data from child1 was not loaded." );
}

if ( !Pattern.compile( "Loading execution data file \\S*child1-test.target.jacoco.exec").matcher( buildLog ).find() ) {
    throw new RuntimeException( "Execution data from child1-test was not loaded." );
}

if ( !new File( basedir, "child2/target/jacoco.exec" ).isFile()) {
    throw new RuntimeException( "No execution data in child2." );
}
if ( Pattern.compile( "Loading execution data file \\S*child2.target.jacoco.exec").matcher( buildLog ).find() ) {
    throw new RuntimeException( "Execution data from child2 was loaded, whereas range should exclude it." );
}
if ( !Pattern.compile( "Loading execution data file \\S*child2v2.target.jacoco.exec").matcher( buildLog ).find() ) {
    throw new RuntimeException( "Execution data from child2v2 was not loaded." );
}

if ( !Pattern.compile( "Loading execution data file \\S*report.target.jacoco.exec").matcher( buildLog ).find() ) {
    throw new RuntimeException( "Execution data from report was not loaded." );
}

File reportChild1 = new File( basedir, "report/target/site/jacoco-aggregate/child1/index.html" );
if ( !reportChild1.isFile() ) {
    throw new RuntimeException( "Report for child1 was not created." );
}

File reportChild1test = new File( basedir, "report/target/site/jacoco-aggregate/child1-test/index.html" );
if ( reportChild1test.isFile() ) {
    throw new RuntimeException( "Report for child1-test should not be created." );
}

File reportChild2 = new File( basedir, "report/target/site/jacoco-aggregate/child2/index.html" );
if ( !reportChild2.isFile() ) {
    throw new RuntimeException( "Report for child2 was not created." );
}