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