1/*******************************************************************************
2 * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *    Marc R. Hoffmann, Jan Wloka - initial API and implementation
10 *
11 *******************************************************************************/
12import org.codehaus.plexus.util.*;
13import java.util.regex.*;
14
15String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
16
17if ( !Pattern.compile( "Loading execution data file \\S*child1.target.jacoco.exec").matcher( buildLog ).find() ) {
18    throw new RuntimeException( "Execution data from child1 was not loaded." );
19}
20
21if ( !Pattern.compile( "Loading execution data file \\S*child1-test.target.jacoco.exec").matcher( buildLog ).find() ) {
22    throw new RuntimeException( "Execution data from child1-test was not loaded." );
23}
24
25if ( !new File( basedir, "child2/target/jacoco.exec" ).isFile()) {
26    throw new RuntimeException( "No execution data in child2." );
27}
28if ( Pattern.compile( "Loading execution data file \\S*child2.target.jacoco.exec").matcher( buildLog ).find() ) {
29    throw new RuntimeException( "Execution data from child2 was loaded, whereas range should exclude it." );
30}
31if ( !Pattern.compile( "Loading execution data file \\S*child2v2.target.jacoco.exec").matcher( buildLog ).find() ) {
32    throw new RuntimeException( "Execution data from child2v2 was not loaded." );
33}
34
35if ( !Pattern.compile( "Loading execution data file \\S*report.target.jacoco.exec").matcher( buildLog ).find() ) {
36    throw new RuntimeException( "Execution data from report was not loaded." );
37}
38
39File reportChild1 = new File( basedir, "report/target/site/jacoco-aggregate/child1/index.html" );
40if ( !reportChild1.isFile() ) {
41    throw new RuntimeException( "Report for child1 was not created." );
42}
43
44File reportChild1test = new File( basedir, "report/target/site/jacoco-aggregate/child1-test/index.html" );
45if ( reportChild1test.isFile() ) {
46    throw new RuntimeException( "Report for child1-test should not be created." );
47}
48
49File reportChild2 = new File( basedir, "report/target/site/jacoco-aggregate/child2/index.html" );
50if ( !reportChild2.isFile() ) {
51    throw new RuntimeException( "Report for child2 was not created." );
52}
53