import java.io.*;
import java.util.*;
import java.util.regex.*;
import org.codehaus.plexus.util.*;
try
{
File pomFile = new File( basedir, "target/it/project/pom.xml" );
System.out.println( "Checking for existence of original IT POM: " + pomFile );
if ( !pomFile.exists() )
{
System.out.println( "FAILED!" );
return false;
}
pomFile = new File( basedir, "target/it/project/target/classes/pom.xml" );
System.out.println( "Checking for existence of interpolated IT POM: " + pomFile );
if ( !pomFile.exists() )
{
System.out.println( "FAILED!" );
return false;
}
String xml = FileUtils.fileRead( pomFile, "UTF-8" );
String[] values = {
"${project.version}",
"1.0-SNAPSHOT",
"PROPERTY-FROM-PLUGIN-CONFIG",
"PROPERTY-FROM-PROPERTIES-SECTION",
"PASSED",
"PASSED",
"PASSED",
"PASSED",
"PASSED",
"file:///",
"file:///",
};
for ( String value : values )
{
System.out.println( "Checking for occurrence of: " + value );
if ( xml.indexOf( value ) < 0 )
{
System.out.println( "FAILED!" );
return false;
}
}
String[] badValues = {
"@basedir@",
"FAILED",
"@baseurl@",
"FAILED",
"@localRepository@",
"@localRepositoryUrl@",
};
for ( String value : badValues )
{
System.out.println( "Checking for absence of: " + value );
if ( xml.indexOf( value ) >= 0 )
{
System.out.println( "FAILED!" );
return false;
}
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}
return true;