1 /******************************************************************************* 2 * Copyright (c) 2009, 2018 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 * Evgeny Mandrikov - initial API and implementation 10 * 11 *******************************************************************************/ 12 import java.io.*; 13 import org.codehaus.plexus.util.*; 14 15 String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) ); 16 if ( buildLog.indexOf( "Skipping JaCoCo execution due to missing classes directory." ) < 0 ) { 17 throw new RuntimeException( "Execution should be skipped when target/classes does not exist." ); 18 } 19 20 File dump2 = new File( basedir, "skip-child/target/jacoco.exec" ); 21 if ( dump2.isFile() ) { 22 throw new RuntimeException( "Should not be executed for module 'skip-child', but dump found : " + dump2 ); 23 } 24 25 if ( !buildLog.contains( "argLine set to empty" ) ) { 26 throw new RuntimeException( "Property not set to empty when skipping." ); 27 } 28 29 File file = new File( basedir, "child/target/jacoco.exec" ); 30 if ( !file.isFile() ) 31 { 32 throw new FileNotFoundException( "Could not find generated dump: " + file ); 33 } 34 35 File xmlReport = new File( basedir, "child/target/site/jacoco/jacoco.xml" ); 36 if ( !xmlReport.isFile() ) 37 { 38 throw new FileNotFoundException( "Could not find generated XML report: " + xmlReport ); 39 } 40 41 File csvReport = new File( basedir, "child/target/site/jacoco/jacoco.csv" ); 42 if ( !csvReport.isFile() ) 43 { 44 throw new FileNotFoundException( "Could not find generated CSV report: " + csvReport ); 45 } 46 47 File htmlReport = new File( basedir, "child/target/site/jacoco/index.html" ); 48 if ( !htmlReport.isFile() ) 49 { 50 throw new FileNotFoundException( "Could not find generated HTML report: " + htmlReport ); 51 } 52