Home | History | Annotate | Download | only in it-report-aggregate
      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  *    Marc R. Hoffmann, Jan Wloka - initial API and implementation
     10  *
     11  *******************************************************************************/
     12 import org.codehaus.plexus.util.*;
     13 import java.util.regex.*;
     14 
     15 String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
     16 
     17 if ( !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 
     21 if ( !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 
     25 if ( !Pattern.compile( "Loading execution data file \\S*child2.target.jacoco.exec").matcher( buildLog ).find() ) {
     26     throw new RuntimeException( "Execution data from child2 was not loaded." );
     27 }
     28 
     29 if ( !Pattern.compile( "Loading execution data file \\S*report.target.jacoco.exec").matcher( buildLog ).find() ) {
     30     throw new RuntimeException( "Execution data from report was not loaded." );
     31 }
     32 
     33 File reportChild1 = new File( basedir, "report/target/site/jacoco-aggregate/child1/index.html" );
     34 if ( !reportChild1.isFile() ) {
     35     throw new RuntimeException( "Report for child1 was not created." );
     36 }
     37 
     38 File reportChild1test = new File( basedir, "report/target/site/jacoco-aggregate/child1-test/index.html" );
     39 if ( reportChild1test.isFile() ) {
     40     throw new RuntimeException( "Report for child1-test should not be created." );
     41 }
     42 
     43 File reportChild2 = new File( basedir, "report/target/site/jacoco-aggregate/child2/index.html" );
     44 if ( !reportChild2.isFile() ) {
     45     throw new RuntimeException( "Report for child2 was not created." );
     46 }
     47