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