| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| |
| 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; |