import java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; try { File logFile = new File( basedir, "build.log" ); System.out.println( "Checking for existence of build log: " + logFile ); if ( !logFile.exists() ) { System.out.println( "FAILED!" ); return false; } String log = FileUtils.fileRead( logFile ); System.out.println( "Checking for first build" ); int index = log.indexOf( "Building: project" ); if ( !log.substring( index, index + 18 ).equals( "Building: project3" ) ) { System.out.println( "FAILED!\n" + log.substring( index, index + 18 ) ); return false; } System.out.println( "Checking for duplicate build" ); index = log.indexOf( "Building: project3", index + 1 ); if ( index >= 0 ) { System.out.println( "FAILED!" ); return false; } File reportFile = new File( basedir, "target/invoker-reports/BUILD-project1.xml" ); if ( !reportFile.exists() ) { System.out.println( "reportFile not exists FAILED!" ); return false; } String report = FileUtils.fileRead( reportFile, "UTF-8" ); index = report.indexOf("name=\"Foo\""); if ( index < 0 ) { System.out.println( "name missing in the report FAILED!" ); return false; } index = report.indexOf("description=\"good foo\""); if ( index < 0 ) { System.out.println( "description missing in the report FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true;