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 * Evgeny Mandrikov - initial API and implementation 11 * 12 *******************************************************************************/ 13import java.io.*; 14import org.codehaus.plexus.util.*; 15 16String agentOptions = "destfile=" + basedir + File.separator + "target" + File.separator + "coverage.exec" 17 + ",append=false" 18 + ",includes=*" 19 + ",excludes=java.*:sun.*" 20 + ",exclclassloader=sun.reflect.DelegatingClassLoader:MyClassLoader" 21 + ",inclbootstrapclasses=true" 22 + ",inclnolocationclasses=true" 23 + ",sessionid=session" 24 + ",dumponexit=true" 25 + ",output=file" 26 + ",address=localhost" 27 + ",port=9999" 28 + ",classdumpdir=" + basedir + File.separator + "target" + File.separator + "classdumps" 29 + ",jmx=true"; 30 31//backslashes will be escaped 32agentOptions = agentOptions.replace("\\","\\\\"); 33String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) ); 34if ( buildLog.indexOf( agentOptions ) < 0 ) { 35 throw new RuntimeException( "Property was not configured, expected " + agentOptions ); 36} 37 38File file = new File( basedir, "target/coverage.exec" ); 39if ( !file.isFile() ) 40{ 41 throw new FileNotFoundException( "Could not find generated dump: " + file ); 42} 43 44File reportDir = new File( basedir, "target/site/jacoco" ); 45if ( !reportDir.isDirectory() ) 46{ 47 throw new RuntimeException( "Could not find generated report" ); 48} 49