You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2007/01/20 02:55:20 UTC
svn commit: r498042 [1/2] - in
/maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier:
AbstractVerifier.java CommandLineVerifier.java Verifier.java VerifierCli.java
Author: carlos
Date: Fri Jan 19 17:55:20 2007
New Revision: 498042
URL: http://svn.apache.org/viewvc?view=rev&rev=498042
Log:
Created hierarchy for Vallidator implementations
Added:
maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/CommandLineVerifier.java
- copied, changed from r498038, maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java
maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/Verifier.java (with props)
maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/VerifierCli.java
- copied, changed from r498038, maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java
Modified:
maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java
Modified: maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java?view=diff&rev=498042&r1=498041&r2=498042
==============================================================================
--- maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java (original)
+++ maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java Fri Jan 19 17:55:20 2007
@@ -33,8 +33,6 @@
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -51,9 +49,7 @@
import junit.framework.Assert;
import org.apache.maven.it.VerificationException;
-import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.FileUtils;
-import org.apache.maven.it.util.StringUtils;
import org.apache.maven.it.util.cli.CommandLineException;
import org.apache.maven.it.util.cli.CommandLineUtils;
import org.apache.maven.it.util.cli.Commandline;
@@ -65,16 +61,20 @@
import org.xml.sax.helpers.DefaultHandler;
/**
+ * Common {@link Verifier} functionality
+ *
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
* @version $Id$
* @noinspection UseOfSystemOutOrSystemErr,RefusedBequest
*/
public abstract class AbstractVerifier
+ implements Verifier
{
- private static final String LOG_FILENAME = "log.txt";
+ static final String LOG_FILENAME = "log.txt";
- public String localRepo;
+ private String localRepo;
private final String basedir;
@@ -415,7 +415,7 @@
throw new IllegalStateException( "Unknown layout: " + localRepoLayout );
}
- return localRepo + "/" + repositoryPath;
+ return getLocalRepo() + "/" + repositoryPath;
}
public List getArtifactFileNameList( String org, String name, String version, String ext )
@@ -554,7 +554,7 @@
}
}
- private static String retrieveLocalRepo( String settingsXmlPath )
+ static String retrieveLocalRepo( String settingsXmlPath )
throws VerificationException
{
UserModelReader userModelReader = new UserModelReader();
@@ -905,7 +905,7 @@
{
// Note: Make sure that the repo is surrounded by quotes as it can possibly have
// spaces in its path.
- cli.createArgument().setLine( "-Dmaven.repo.local=" + "\"" + localRepo + "\"" );
+ cli.createArgument().setLine( "-Dmaven.repo.local=" + "\"" + getLocalRepo() + "\"" );
}
for ( Iterator i = allGoals.iterator(); i.hasNext(); )
@@ -968,30 +968,7 @@
return result;
}
- private static List discoverIntegrationTests( String directory )
- throws VerificationException
- {
- try
- {
- ArrayList tests = new ArrayList();
-
- List subTests = FileUtils.getFiles( new File( directory ), "**/goals.txt", null );
-
- for ( Iterator i = subTests.iterator(); i.hasNext(); )
- {
- File testCase = (File) i.next();
- tests.add( testCase.getParent() );
- }
-
- return tests;
- }
- catch ( IOException e )
- {
- throw new VerificationException( directory + " is not a valid test case container", e );
- }
- }
-
- private void displayLogFile()
+ public void displayLogFile()
{
System.out.println( "Log file contents:" );
try
@@ -1019,235 +996,31 @@
//
// ----------------------------------------------------------------------
- public static void main( String args[] )
+ public void findLocalRepo( String settingsFile )
throws VerificationException
{
- String basedir = System.getProperty( "user.dir" );
-
- List tests = null;
-
- List argsList = new ArrayList();
-
- String settingsFile = null;
-
- // skip options
- for ( int i = 0; i < args.length; i++ )
+ if ( getLocalRepo() == null )
{
- if ( args[i].startsWith( "-D" ) )
- {
- int index = args[i].indexOf( "=" );
- if ( index >= 0 )
- {
- System.setProperty( args[i].substring( 2, index ), args[i].substring( index + 1 ) );
- }
- else
- {
- System.setProperty( args[i].substring( 2 ), "true" );
- }
- }
- else if ( "-s".equals( args[i] ) || "--settings".equals( args[i] ) )
- {
- if ( i == args.length - 1 )
- {
- // should have been detected before
- throw new IllegalStateException( "missing argument to -s" );
- }
- i += 1;
-
- settingsFile = args[i];
- }
- else if ( args[i].startsWith( "-" ) )
- {
- System.out.println( "skipping unrecognised argument: " + args[i] );
- }
- else
- {
- argsList.add( args[i] );
- }
+ setLocalRepo( System.getProperty( "maven.repo.local" ) );
}
- if ( argsList.size() == 0 )
+ if ( getLocalRepo() == null )
{
- if ( FileUtils.fileExists( basedir + File.separator + "integration-tests.txt" ) )
- {
- try
- {
- tests = FileUtils.loadFile( new File( basedir, "integration-tests.txt" ) );
- }
- catch ( IOException e )
- {
- System.err.println( "Unable to load integration tests file" );
-
- System.err.println( e.getMessage() );
-
- System.exit( 2 );
- }
- }
- else
- {
- tests = discoverIntegrationTests( "." );
- }
+ setLocalRepo( retrieveLocalRepo( settingsFile ) );
}
- else
- {
- tests = new ArrayList( argsList.size() );
- NumberFormat fmt = new DecimalFormat( "0000" );
- for ( int i = 0; i < argsList.size(); i++ )
- {
- String test = (String) argsList.get( i );
- if ( test.endsWith( "," ) )
- {
- test = test.substring( 0, test.length() - 1 );
- }
-
- if ( StringUtils.isNumeric( test ) )
- {
- test = "it" + fmt.format( Integer.valueOf( test ) );
- test.trim();
- tests.add( test );
- }
- else if ( "it".startsWith( test ) )
- {
- test = test.trim();
- if ( test.length() > 0 )
- {
- tests.add( test );
- }
- }
- else if ( FileUtils.fileExists( test ) && new File( test ).isDirectory() )
- {
- tests.addAll( discoverIntegrationTests( test ) );
- }
- else
- {
- System.err.println(
- "[WARNING] rejecting " + test + " as an invalid test or test source directory" );
- }
- }
- }
-
- if ( tests.size() == 0 )
- {
- System.out.println( "No tests to run" );
- }
-
- int exitCode = 0;
-
- List failed = new ArrayList();
- for ( Iterator i = tests.iterator(); i.hasNext(); )
- {
- String test = (String) i.next();
-
- System.out.print( test + "... " );
-
- String dir = basedir + "/" + test;
-
- if ( !new File( dir, "goals.txt" ).exists() )
- {
- System.err.println( "Test " + test + " in " + dir + " does not exist" );
-
- System.exit( 2 );
- }
-
- Verifier verifier = new Verifier( dir );
- verifier.findLocalRepo( settingsFile );
-
- System.out.println( "Using default local repository: " + verifier.localRepo );
-
- try
- {
- runIntegrationTest( verifier );
- }
- catch ( Throwable e )
- {
- verifier.resetStreams();
-
- System.out.println( "FAILED" );
-
- verifier.displayStreamBuffers();
-
- System.out.println( ">>>>>> Error Stacktrace:" );
- e.printStackTrace( System.out );
- System.out.println( "<<<<<< Error Stacktrace" );
-
- verifier.displayLogFile();
-
- exitCode = 1;
-
- failed.add( test );
- }
- }
-
- System.out.println( tests.size() - failed.size() + "/" + tests.size() + " passed" );
- if ( !failed.isEmpty() )
- {
- System.out.println( "Failed tests: " + failed );
- }
-
- System.exit( exitCode );
- }
-
- private void findLocalRepo( String settingsFile )
- throws VerificationException
- {
- if ( localRepo == null )
- {
- localRepo = System.getProperty( "maven.repo.local" );
- }
-
- if ( localRepo == null )
- {
- localRepo = retrieveLocalRepo( settingsFile );
- }
-
- if ( localRepo == null )
+ if ( getLocalRepo() == null )
{
- localRepo = System.getProperty( "user.home" ) + "/.m2/repository";
+ setLocalRepo( System.getProperty( "user.home" ) + "/.m2/repository" );
}
- File repoDir = new File( localRepo );
+ File repoDir = new File( getLocalRepo() );
if ( !repoDir.exists() )
{
repoDir.mkdirs();
}
}
- private static void runIntegrationTest( Verifier verifier )
- throws VerificationException
- {
- verifier.executeHook( "prebuild-hook.txt" );
-
- Properties properties = verifier.loadProperties( "system.properties" );
-
- Properties controlProperties = verifier.loadProperties( "verifier.properties" );
-
- boolean chokeOnErrorOutput =
- Boolean.valueOf( controlProperties.getProperty( "failOnErrorOutput", "true" ) ).booleanValue();
-
- List goals = verifier.loadFile( verifier.getBasedir(), "goals.txt", false );
-
- List cliOptions = verifier.loadFile( verifier.getBasedir(), "cli-options.txt", false );
-
- verifier.setCliOptions( cliOptions );
-
- verifier.setSystemProperties( properties );
-
- verifier.setVerifierProperties( controlProperties );
-
- verifier.executeGoals( goals );
-
- verifier.executeHook( "postbuild-hook.txt" );
-
- System.out.println( "*** Verifying: fail when [ERROR] detected? " + chokeOnErrorOutput + " ***" );
-
- verifier.verify( chokeOnErrorOutput );
-
- verifier.resetStreams();
-
- System.out.println( "OK" );
- }
-
public void assertArtifactContents( String org, String artifact, String version, String type, String contents )
throws IOException
{
@@ -1389,6 +1162,16 @@
public String getBasedir()
{
return basedir;
+ }
+
+ public void setLocalRepo( String localRepo )
+ {
+ this.localRepo = localRepo;
+ }
+
+ public String getLocalRepo()
+ {
+ return localRepo;
}
}
Copied: maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/CommandLineVerifier.java (from r498038, maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java)
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/CommandLineVerifier.java?view=diff&rev=498042&p1=maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java&r1=498038&p2=maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/CommandLineVerifier.java&r2=498042
==============================================================================
--- maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/AbstractVerifier.java (original)
+++ maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/CommandLineVerifier.java Fri Jan 19 17:55:20 2007
@@ -19,65 +19,41 @@
* under the License.
*/
-import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.FileWriter;
-import java.io.FilenameFilter;
import java.io.IOException;
-import java.io.InputStream;
import java.io.PrintStream;
import java.io.Writer;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.StringTokenizer;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import junit.framework.Assert;
import org.apache.maven.it.VerificationException;
-import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.FileUtils;
-import org.apache.maven.it.util.StringUtils;
import org.apache.maven.it.util.cli.CommandLineException;
import org.apache.maven.it.util.cli.CommandLineUtils;
import org.apache.maven.it.util.cli.Commandline;
import org.apache.maven.it.util.cli.StreamConsumer;
import org.apache.maven.it.util.cli.WriterStreamConsumer;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
/**
+ * {@link Verifier} for command line invocation of Maven.
+ *
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
* @version $Id$
* @noinspection UseOfSystemOutOrSystemErr,RefusedBequest
*/
-public abstract class AbstractVerifier
+public class CommandLineVerifier
+ extends AbstractVerifier
+ implements Verifier
{
private static final String LOG_FILENAME = "log.txt";
- public String localRepo;
-
- private final String basedir;
-
private final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
private final ByteArrayOutputStream errStream = new ByteArrayOutputStream();
@@ -92,45 +68,27 @@
private Properties verifierProperties = new Properties();
- // TODO: needs to be configurable
- private static String localRepoLayout = "default";
-
private boolean debug;
- public AbstractVerifier( String basedir, String settingsFile )
+ public CommandLineVerifier( String basedir, String settingsFile )
throws VerificationException
{
this( basedir, settingsFile, false );
}
- public AbstractVerifier( String basedir, String settingsFile, boolean debug )
+ public CommandLineVerifier( String basedir, String settingsFile, boolean debug )
throws VerificationException
{
- this.basedir = basedir;
-
- this.debug = debug;
-
- if ( !debug )
- {
- originalOut = System.out;
-
- System.setOut( new PrintStream( outStream ) );
-
- originalErr = System.err;
-
- System.setErr( new PrintStream( errStream ) );
- }
-
- findLocalRepo( settingsFile );
+ super( basedir, settingsFile, debug );
}
- public AbstractVerifier( String basedir )
+ public CommandLineVerifier( String basedir )
throws VerificationException
{
this( basedir, null );
}
- public AbstractVerifier( String basedir, boolean debug )
+ public CommandLineVerifier( String basedir, boolean debug )
throws VerificationException
{
this( basedir, null, debug );
@@ -171,24 +129,6 @@
//
// ----------------------------------------------------------------------
- public void verify( boolean chokeOnErrorOutput )
- throws VerificationException
- {
- List lines = loadFile( getBasedir(), "expected-results.txt", false );
-
- for ( Iterator i = lines.iterator(); i.hasNext(); )
- {
- String line = (String) i.next();
-
- verifyExpectedResult( line );
- }
-
- if ( chokeOnErrorOutput )
- {
- verifyErrorFreeLog();
- }
- }
-
public void verifyErrorFreeLog()
throws VerificationException
{
@@ -207,325 +147,115 @@
}
}
- public Properties loadProperties( String filename )
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public void executeGoals( List goals, Map envVars )
throws VerificationException
{
- Properties properties = new Properties();
+ String mavenHome = System.getProperty( "maven.home" );
- FileInputStream fis;
- try
- {
- File propertiesFile = new File( getBasedir(), filename );
- if ( propertiesFile.exists() )
- {
- fis = new FileInputStream( propertiesFile );
- properties.load( fis );
- }
- }
- catch ( FileNotFoundException e )
- {
- throw new VerificationException( "Error reading properties file", e );
- }
- catch ( IOException e )
+ if ( goals.size() == 0 )
{
- throw new VerificationException( "Error reading properties file", e );
+ throw new VerificationException( "No goals specified" );
}
- return properties;
- }
+ List allGoals = new ArrayList();
- public List loadFile( String basedir, String filename, boolean hasCommand )
- throws VerificationException
- {
- return loadFile( new File( basedir, filename ), hasCommand );
- }
+ allGoals.add( "clean:clean" );
- public List loadFile( File file, boolean hasCommand )
- throws VerificationException
- {
- List lines = new ArrayList();
+ allGoals.addAll( goals );
- if ( file.exists() )
+ int ret;
+
+ File logFile = new File( getBasedir(), LOG_FILENAME );
+ try
{
- try
+ Commandline cli = new Commandline();
+
+ for ( Iterator i = envVars.keySet().iterator(); i.hasNext(); )
{
- BufferedReader reader = new BufferedReader( new FileReader( file ) );
+ String key = (String) i.next();
- String line = reader.readLine();
+ cli.addEnvironment( key, (String) envVars.get( key ) );
- while ( line != null )
+ try
{
- line = line.trim();
-
- if ( !line.startsWith( "#" ) && line.length() != 0 )
- {
- lines.addAll( replaceArtifacts( line, hasCommand ) );
- }
- line = reader.readLine();
+ FileUtils.fileWrite( "/tmp/foo.txt", "setting envar[ " + key + " = " + envVars.get( key ) );
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
- reader.close();
- }
- catch ( FileNotFoundException e )
- {
- throw new VerificationException( e );
- }
- catch ( IOException e )
- {
- throw new VerificationException( e );
- }
- }
-
- return lines;
- }
-
- private List replaceArtifacts( String line, boolean hasCommand )
- {
- String MARKER = "${artifact:";
- int index = line.indexOf( MARKER );
- if ( index >= 0 )
- {
- String newLine = line.substring( 0, index );
- index = line.indexOf( "}", index );
- if ( index < 0 )
- {
- throw new IllegalArgumentException( "line does not contain ending artifact marker: '" + line + "'" );
+ System.out.println();
}
- String artifact = line.substring( newLine.length() + MARKER.length(), index );
- newLine += getArtifactPath( artifact );
- newLine += line.substring( index + 1 );
+ cli.setWorkingDirectory( getBasedir() );
- List l = new ArrayList();
- l.add( newLine );
+ String executable;
- int endIndex = newLine.lastIndexOf( '/' );
+ // Use a strategy for finding the maven executable, John has a simple method like this
+ // but a little strategy + chain of command would be nicer.
- String command = null;
- String filespec;
- if ( hasCommand )
+ if ( mavenHome != null )
{
- int startIndex = newLine.indexOf( ' ' );
-
- command = newLine.substring( 0, startIndex );
-
- filespec = newLine.substring( startIndex + 1, endIndex );
+ executable = mavenHome + "/bin/mvn";
}
else
{
- filespec = newLine;
- }
-
- File dir = new File( filespec );
- addMetadataToList( dir, hasCommand, l, command );
- addMetadataToList( dir.getParentFile(), hasCommand, l, command );
-
- return l;
- }
- else
- {
- return Collections.singletonList( line );
- }
- }
-
- private static void addMetadataToList( File dir, boolean hasCommand, List l, String command )
- {
- if ( dir.exists() && dir.isDirectory() )
- {
- String[] files = dir.list( new FilenameFilter()
- {
- public boolean accept( File dir, String name )
- {
- return name.startsWith( "maven-metadata" ) && name.endsWith( ".xml" );
-
- }
- } );
+ File f = new File( System.getProperty( "user.home" ), "m2/bin/mvn" );
- for ( int i = 0; i < files.length; i++ )
- {
- if ( hasCommand )
+ if ( f.exists() )
{
- l.add( command + " " + new File( dir, files[i] ).getPath() );
+ executable = f.getAbsolutePath();
}
else
{
- l.add( new File( dir, files[i] ).getPath() );
+ executable = "mvn";
}
}
- }
- }
-
- private String getArtifactPath( String artifact )
- {
- StringTokenizer tok = new StringTokenizer( artifact, ":" );
- if ( tok.countTokens() != 4 )
- {
- throw new IllegalArgumentException( "Artifact must have 4 tokens: '" + artifact + "'" );
- }
-
- String[] a = new String[4];
- for ( int i = 0; i < 4; i++ )
- {
- a[i] = tok.nextToken();
- }
-
- String org = a[0];
- String name = a[1];
- String version = a[2];
- String ext = a[3];
- return getArtifactPath( org, name, version, ext );
- }
- public String getArtifactPath( String org, String name, String version, String ext )
- {
- if ( "maven-plugin".equals( ext ) )
- {
- ext = "jar";
- }
- String classifier = null;
- if ( "coreit-artifact".equals( ext ) )
- {
- ext = "jar";
- classifier = "it";
- }
- if ( "test-jar".equals( ext ) )
- {
- ext = "jar";
- classifier = "tests";
- }
+ cli.setExecutable( executable );
- String repositoryPath;
- if ( "legacy".equals( localRepoLayout ) )
- {
- repositoryPath = org + "/" + ext + "s/" + name + "-" + version + "." + ext;
- }
- else if ( "default".equals( localRepoLayout ) )
- {
- repositoryPath = org.replace( '.', '/' );
- repositoryPath = repositoryPath + "/" + name + "/" + version;
- repositoryPath = repositoryPath + "/" + name + "-" + version;
- if ( classifier != null )
+ for ( Iterator it = cliOptions.iterator(); it.hasNext(); )
{
- repositoryPath = repositoryPath + "-" + classifier;
- }
- repositoryPath = repositoryPath + "." + ext;
- }
- else
- {
- throw new IllegalStateException( "Unknown layout: " + localRepoLayout );
- }
+ String key = (String) it.next();
- return localRepo + "/" + repositoryPath;
- }
+ String resolvedArg = resolveCommandLineArg( key );
- public List getArtifactFileNameList( String org, String name, String version, String ext )
- {
- List files = new ArrayList();
- String artifactPath = getArtifactPath( org, name, version, ext );
- File dir = new File( artifactPath );
- files.add( artifactPath );
- addMetadataToList( dir, false, files, null );
- addMetadataToList( dir.getParentFile(), false, files, null );
- return files;
- }
+ cli.createArgument().setLine( resolvedArg );
+ }
- public void executeHook( String filename )
- throws VerificationException
- {
- try
- {
- File f = new File( getBasedir(), filename );
+ cli.createArgument().setValue( "-e" );
- if ( !f.exists() )
- {
- return;
- }
+ cli.createArgument().setValue( "--no-plugin-registry" );
- List lines = loadFile( f, true );
+ cli.createArgument().setValue( "--batch-mode" );
- for ( Iterator i = lines.iterator(); i.hasNext(); )
+ for ( Iterator i = systemProperties.keySet().iterator(); i.hasNext(); )
{
- String line = resolveCommandLineArg( (String) i.next() );
-
- executeCommand( line );
+ String key = (String) i.next();
+ cli.createArgument().setLine( "-D" + key + "=" + systemProperties.getProperty( key ) );
}
- }
- catch ( VerificationException e )
- {
- throw e;
- }
- catch ( Exception e )
- {
- throw new VerificationException( e );
- }
- }
-
- private void executeCommand( String line )
- throws VerificationException
- {
- int index = line.indexOf( " " );
-
- String cmd;
-
- String args = null;
-
- if ( index >= 0 )
- {
- cmd = line.substring( 0, index );
-
- args = line.substring( index + 1 );
- }
- else
- {
- cmd = line;
- }
-
- if ( "rm".equals( cmd ) )
- {
- System.out.println( "Removing file: " + args );
- File f = new File( args );
+ boolean useMavenRepoLocal =
+ Boolean.valueOf( verifierProperties.getProperty( "use.mavenRepoLocal", "true" ) ).booleanValue();
- if ( f.exists() && !f.delete() )
+ if ( useMavenRepoLocal )
{
- throw new VerificationException( "Error removing file - delete failed" );
+ // Note: Make sure that the repo is surrounded by quotes as it can possibly have
+ // spaces in its path.
+ cli.createArgument().setLine( "-Dmaven.repo.local=" + "\"" + getLocalRepo() + "\"" );
}
- }
- else if ( "rmdir".equals( cmd ) )
- {
- System.out.println( "Removing directory: " + args );
-
- try
- {
- File f = new File( args );
- FileUtils.deleteDirectory( f );
- }
- catch ( IOException e )
+ for ( Iterator i = allGoals.iterator(); i.hasNext(); )
{
- throw new VerificationException( "Error removing directory - delete failed" );
+ cli.createArgument().setValue( (String) i.next() );
}
- }
- else if ( "svn".equals( cmd ) )
- {
- launchSubversion( line, getBasedir() );
- }
- else
- {
- throw new VerificationException( "unknown command: " + cmd );
- }
- }
-
- public static void launchSubversion( String line, String basedir )
- throws VerificationException
- {
- try
- {
- Commandline cli = new Commandline( line );
- cli.setWorkingDirectory( basedir );
-
- Writer logWriter = new FileWriter( new File( basedir, LOG_FILENAME ) );
+ Writer logWriter = new FileWriter( logFile );
StreamConsumer out = new WriterStreamConsumer( logWriter );
@@ -533,16 +263,9 @@
System.out.println( "Command: " + Commandline.toString( cli.getCommandline() ) );
- int ret = CommandLineUtils.executeCommandLine( cli, out, err );
+ ret = CommandLineUtils.executeCommandLine( cli, out, err );
logWriter.close();
-
- if ( ret > 0 )
- {
- System.err.println( "Exit code: " + ret );
-
- throw new VerificationException();
- }
}
catch ( CommandLineException e )
{
@@ -552,844 +275,39 @@
{
throw new VerificationException( e );
}
- }
-
- private static String retrieveLocalRepo( String settingsXmlPath )
- throws VerificationException
- {
- UserModelReader userModelReader = new UserModelReader();
-
- String userHome = System.getProperty( "user.home" );
-
- File userXml;
-
- String repo = null;
-
- if ( settingsXmlPath != null )
- {
- System.out.println( "Using settings from " + settingsXmlPath );
- userXml = new File( settingsXmlPath );
- }
- else
- {
- userXml = new File( userHome, ".m2/settings.xml" );
- }
-
- if ( userXml.exists() )
- {
- userModelReader.parse( userXml );
-
- String localRepository = userModelReader.getLocalRepository();
- if ( localRepository != null )
- {
- repo = new File( localRepository ).getAbsolutePath();
- }
- }
-
- return repo;
- }
- public void deleteArtifact( String org, String name, String version, String ext )
- throws IOException
- {
- List files = getArtifactFileNameList( org, name, version, ext );
- for ( Iterator i = files.iterator(); i.hasNext(); )
+ if ( ret > 0 )
{
- String fileName = (String) i.next();
- FileUtils.forceDelete( new File( fileName ) );
- }
- }
+ System.err.println( "Exit code: " + ret );
- public void assertFilePresent( String file )
- {
- try
- {
- verifyExpectedResult( file, true );
- }
- catch ( VerificationException e )
- {
- Assert.fail( e.getMessage() );
+ throw new VerificationException(
+ "Exit code was non-zero: " + ret + "; log = \n" + getLogContents( logFile ) );
}
}
- public void assertFileNotPresent( String file )
+ private static String getLogContents( File logFile )
{
try
{
- verifyExpectedResult( file, false );
+ return FileUtils.fileRead( logFile );
}
- catch ( VerificationException e )
+ catch ( IOException e )
{
- Assert.fail( e.getMessage() );
+ // ignore
+ return "(Error reading log contents: " + e.getMessage() + ")";
}
}
- private void verifyArtifactPresence( boolean wanted, String org, String name, String version, String ext )
+ private String resolveCommandLineArg( String key )
{
- List files = getArtifactFileNameList( org, name, version, ext );
- for ( Iterator i = files.iterator(); i.hasNext(); )
+ String result = key.replaceAll( "\\$\\{basedir\\}", getBasedir() );
+ if ( result.indexOf( "\\\\" ) >= 0 )
{
- String fileName = (String) i.next();
- try
- {
- verifyExpectedResult( fileName, wanted );
- }
- catch ( VerificationException e )
- {
- Assert.fail( e.getMessage() );
- }
+ result = result.replaceAll( "\\\\", "\\" );
}
- }
+ result = result.replaceAll( "\\/\\/", "\\/" );
- public void assertArtifactPresent( String org, String name, String version, String ext )
- {
- verifyArtifactPresence( true, org, name, version, ext );
+ return result;
}
-
- public void assertArtifactNotPresent( String org, String name, String version, String ext )
- {
- verifyArtifactPresence( false, org, name, version, ext );
- }
-
- private void verifyExpectedResult( String line )
- throws VerificationException
- {
- boolean wanted = true;
- if ( line.startsWith( "!" ) )
- {
- line = line.substring( 1 );
- wanted = false;
- }
-
- verifyExpectedResult( line, wanted );
- }
-
- private void verifyExpectedResult( String line, boolean wanted )
- throws VerificationException
- {
- if ( line.indexOf( "!/" ) > 0 )
- {
- String urlString = "jar:file:" + getBasedir() + "/" + line;
-
- InputStream is = null;
- try
- {
- URL url = new URL( urlString );
-
- is = url.openStream();
-
- if ( is == null )
- {
- if ( wanted )
- {
- throw new VerificationException( "Expected JAR resource was not found: " + line );
- }
- }
- else
- {
- if ( !wanted )
- {
- throw new VerificationException( "Unwanted JAR resource was found: " + line );
- }
- }
- }
- catch ( MalformedURLException e )
- {
- throw new VerificationException( "Error looking for JAR resource", e );
- }
- catch ( IOException e )
- {
- throw new VerificationException( "Error looking for JAR resource", e );
- }
- finally
- {
- if ( is != null )
- {
- try
- {
- is.close();
- }
- catch ( IOException e )
- {
- System.err.println( "WARN: error closing stream: " + e );
- }
- }
- }
- }
- else
- {
- File expectedFile = new File( line );
-
- if ( !expectedFile.isAbsolute() && !line.startsWith( "/" ) )
- {
- expectedFile = new File( getBasedir(), line );
- }
-
- if ( line.indexOf( '*' ) > -1 )
- {
- File parent = expectedFile.getParentFile();
-
- if ( !parent.exists() )
- {
- if ( wanted )
- {
- throw new VerificationException( "Expected file was not found: " + expectedFile.getPath() );
- }
- }
- else
- {
- String shortNamePattern = expectedFile.getName().replaceAll( "\\*", ".*" );
-
- String[] candidates = parent.list();
-
- boolean found = false;
-
- if ( candidates != null )
- {
- for ( int i = 0; i < candidates.length; i++ )
- {
- if ( candidates[i].matches( shortNamePattern ) )
- {
- found = true;
- break;
- }
- }
- }
-
- if ( !found && wanted )
- {
- throw new VerificationException(
- "Expected file pattern was not found: " + expectedFile.getPath() );
- }
- else if ( found && !wanted )
- {
- throw new VerificationException( "Unwanted file pattern was found: " + expectedFile.getPath() );
- }
- }
- }
- else
- {
- if ( !expectedFile.exists() )
- {
- if ( wanted )
- {
- throw new VerificationException( "Expected file was not found: " + expectedFile.getPath() );
- }
- }
- else
- {
- if ( !wanted )
- {
- throw new VerificationException( "Unwanted file was found: " + expectedFile.getPath() );
- }
- }
- }
- }
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public void executeGoal( String goal )
- throws VerificationException
- {
- executeGoal( goal, Collections.EMPTY_MAP );
- }
-
- public void executeGoal( String goal, Map envVars )
- throws VerificationException
- {
- executeGoals( Arrays.asList( new String[]{goal} ), envVars );
- }
-
- public void executeGoals( List goals )
- throws VerificationException
- {
- executeGoals( goals, Collections.EMPTY_MAP );
- }
-
- public void executeGoals( List goals, Map envVars )
- throws VerificationException
- {
- String mavenHome = System.getProperty( "maven.home" );
-
- if ( goals.size() == 0 )
- {
- throw new VerificationException( "No goals specified" );
- }
-
- List allGoals = new ArrayList();
-
- allGoals.add( "clean:clean" );
-
- allGoals.addAll( goals );
-
- int ret;
-
- File logFile = new File( getBasedir(), LOG_FILENAME );
- try
- {
- Commandline cli = new Commandline();
-
- for ( Iterator i = envVars.keySet().iterator(); i.hasNext(); )
- {
- String key = (String) i.next();
-
- cli.addEnvironment( key, (String) envVars.get( key ) );
-
- try
- {
- FileUtils.fileWrite( "/tmp/foo.txt", "setting envar[ " + key + " = " + envVars.get( key ) );
- }
- catch ( IOException e )
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
-
- System.out.println();
- }
-
- cli.setWorkingDirectory( getBasedir() );
-
- String executable;
-
- // Use a strategy for finding the maven executable, John has a simple method like this
- // but a little strategy + chain of command would be nicer.
-
- if ( mavenHome != null )
- {
- executable = mavenHome + "/bin/mvn";
- }
- else
- {
- File f = new File( System.getProperty( "user.home" ), "m2/bin/mvn" );
-
- if ( f.exists() )
- {
- executable = f.getAbsolutePath();
- }
- else
- {
- executable = "mvn";
- }
- }
-
- cli.setExecutable( executable );
-
- for ( Iterator it = cliOptions.iterator(); it.hasNext(); )
- {
- String key = (String) it.next();
-
- String resolvedArg = resolveCommandLineArg( key );
-
- cli.createArgument().setLine( resolvedArg );
- }
-
- cli.createArgument().setValue( "-e" );
-
- cli.createArgument().setValue( "--no-plugin-registry" );
-
- cli.createArgument().setValue( "--batch-mode" );
-
- for ( Iterator i = systemProperties.keySet().iterator(); i.hasNext(); )
- {
- String key = (String) i.next();
- cli.createArgument().setLine( "-D" + key + "=" + systemProperties.getProperty( key ) );
- }
-
- boolean useMavenRepoLocal =
- Boolean.valueOf( verifierProperties.getProperty( "use.mavenRepoLocal", "true" ) ).booleanValue();
-
- if ( useMavenRepoLocal )
- {
- // Note: Make sure that the repo is surrounded by quotes as it can possibly have
- // spaces in its path.
- cli.createArgument().setLine( "-Dmaven.repo.local=" + "\"" + localRepo + "\"" );
- }
-
- for ( Iterator i = allGoals.iterator(); i.hasNext(); )
- {
- cli.createArgument().setValue( (String) i.next() );
- }
-
- Writer logWriter = new FileWriter( logFile );
-
- StreamConsumer out = new WriterStreamConsumer( logWriter );
-
- StreamConsumer err = new WriterStreamConsumer( logWriter );
-
- System.out.println( "Command: " + Commandline.toString( cli.getCommandline() ) );
-
- ret = CommandLineUtils.executeCommandLine( cli, out, err );
-
- logWriter.close();
- }
- catch ( CommandLineException e )
- {
- throw new VerificationException( e );
- }
- catch ( IOException e )
- {
- throw new VerificationException( e );
- }
-
- if ( ret > 0 )
- {
- System.err.println( "Exit code: " + ret );
-
- throw new VerificationException(
- "Exit code was non-zero: " + ret + "; log = \n" + getLogContents( logFile ) );
- }
- }
-
- private static String getLogContents( File logFile )
- {
- try
- {
- return FileUtils.fileRead( logFile );
- }
- catch ( IOException e )
- {
- // ignore
- return "(Error reading log contents: " + e.getMessage() + ")";
- }
- }
-
- private String resolveCommandLineArg( String key )
- {
- String result = key.replaceAll( "\\$\\{basedir\\}", getBasedir() );
- if ( result.indexOf( "\\\\" ) >= 0 )
- {
- result = result.replaceAll( "\\\\", "\\" );
- }
- result = result.replaceAll( "\\/\\/", "\\/" );
-
- return result;
- }
-
- private static List discoverIntegrationTests( String directory )
- throws VerificationException
- {
- try
- {
- ArrayList tests = new ArrayList();
-
- List subTests = FileUtils.getFiles( new File( directory ), "**/goals.txt", null );
-
- for ( Iterator i = subTests.iterator(); i.hasNext(); )
- {
- File testCase = (File) i.next();
- tests.add( testCase.getParent() );
- }
-
- return tests;
- }
- catch ( IOException e )
- {
- throw new VerificationException( directory + " is not a valid test case container", e );
- }
- }
-
- private void displayLogFile()
- {
- System.out.println( "Log file contents:" );
- try
- {
- BufferedReader reader = new BufferedReader( new FileReader( new File( getBasedir(), LOG_FILENAME ) ) );
- String line = reader.readLine();
- while ( line != null )
- {
- System.out.println( line );
- line = reader.readLine();
- }
- reader.close();
- }
- catch ( FileNotFoundException e )
- {
- System.err.println( "Error: " + e );
- }
- catch ( IOException e )
- {
- System.err.println( "Error: " + e );
- }
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public static void main( String args[] )
- throws VerificationException
- {
- String basedir = System.getProperty( "user.dir" );
-
- List tests = null;
-
- List argsList = new ArrayList();
-
- String settingsFile = null;
-
- // skip options
- for ( int i = 0; i < args.length; i++ )
- {
- if ( args[i].startsWith( "-D" ) )
- {
- int index = args[i].indexOf( "=" );
- if ( index >= 0 )
- {
- System.setProperty( args[i].substring( 2, index ), args[i].substring( index + 1 ) );
- }
- else
- {
- System.setProperty( args[i].substring( 2 ), "true" );
- }
- }
- else if ( "-s".equals( args[i] ) || "--settings".equals( args[i] ) )
- {
- if ( i == args.length - 1 )
- {
- // should have been detected before
- throw new IllegalStateException( "missing argument to -s" );
- }
- i += 1;
-
- settingsFile = args[i];
- }
- else if ( args[i].startsWith( "-" ) )
- {
- System.out.println( "skipping unrecognised argument: " + args[i] );
- }
- else
- {
- argsList.add( args[i] );
- }
- }
-
- if ( argsList.size() == 0 )
- {
- if ( FileUtils.fileExists( basedir + File.separator + "integration-tests.txt" ) )
- {
- try
- {
- tests = FileUtils.loadFile( new File( basedir, "integration-tests.txt" ) );
- }
- catch ( IOException e )
- {
- System.err.println( "Unable to load integration tests file" );
-
- System.err.println( e.getMessage() );
-
- System.exit( 2 );
- }
- }
- else
- {
- tests = discoverIntegrationTests( "." );
- }
- }
- else
- {
- tests = new ArrayList( argsList.size() );
- NumberFormat fmt = new DecimalFormat( "0000" );
- for ( int i = 0; i < argsList.size(); i++ )
- {
- String test = (String) argsList.get( i );
- if ( test.endsWith( "," ) )
- {
- test = test.substring( 0, test.length() - 1 );
- }
-
- if ( StringUtils.isNumeric( test ) )
- {
-
- test = "it" + fmt.format( Integer.valueOf( test ) );
- test.trim();
- tests.add( test );
- }
- else if ( "it".startsWith( test ) )
- {
- test = test.trim();
- if ( test.length() > 0 )
- {
- tests.add( test );
- }
- }
- else if ( FileUtils.fileExists( test ) && new File( test ).isDirectory() )
- {
- tests.addAll( discoverIntegrationTests( test ) );
- }
- else
- {
- System.err.println(
- "[WARNING] rejecting " + test + " as an invalid test or test source directory" );
- }
- }
- }
-
- if ( tests.size() == 0 )
- {
- System.out.println( "No tests to run" );
- }
-
- int exitCode = 0;
-
- List failed = new ArrayList();
- for ( Iterator i = tests.iterator(); i.hasNext(); )
- {
- String test = (String) i.next();
-
- System.out.print( test + "... " );
-
- String dir = basedir + "/" + test;
-
- if ( !new File( dir, "goals.txt" ).exists() )
- {
- System.err.println( "Test " + test + " in " + dir + " does not exist" );
-
- System.exit( 2 );
- }
-
- Verifier verifier = new Verifier( dir );
- verifier.findLocalRepo( settingsFile );
-
- System.out.println( "Using default local repository: " + verifier.localRepo );
-
- try
- {
- runIntegrationTest( verifier );
- }
- catch ( Throwable e )
- {
- verifier.resetStreams();
-
- System.out.println( "FAILED" );
-
- verifier.displayStreamBuffers();
-
- System.out.println( ">>>>>> Error Stacktrace:" );
- e.printStackTrace( System.out );
- System.out.println( "<<<<<< Error Stacktrace" );
-
- verifier.displayLogFile();
-
- exitCode = 1;
-
- failed.add( test );
- }
- }
-
- System.out.println( tests.size() - failed.size() + "/" + tests.size() + " passed" );
- if ( !failed.isEmpty() )
- {
- System.out.println( "Failed tests: " + failed );
- }
-
- System.exit( exitCode );
- }
-
- private void findLocalRepo( String settingsFile )
- throws VerificationException
- {
- if ( localRepo == null )
- {
- localRepo = System.getProperty( "maven.repo.local" );
- }
-
- if ( localRepo == null )
- {
- localRepo = retrieveLocalRepo( settingsFile );
- }
-
- if ( localRepo == null )
- {
- localRepo = System.getProperty( "user.home" ) + "/.m2/repository";
- }
-
- File repoDir = new File( localRepo );
- if ( !repoDir.exists() )
- {
- repoDir.mkdirs();
- }
- }
-
- private static void runIntegrationTest( Verifier verifier )
- throws VerificationException
- {
- verifier.executeHook( "prebuild-hook.txt" );
-
- Properties properties = verifier.loadProperties( "system.properties" );
-
- Properties controlProperties = verifier.loadProperties( "verifier.properties" );
-
- boolean chokeOnErrorOutput =
- Boolean.valueOf( controlProperties.getProperty( "failOnErrorOutput", "true" ) ).booleanValue();
-
- List goals = verifier.loadFile( verifier.getBasedir(), "goals.txt", false );
-
- List cliOptions = verifier.loadFile( verifier.getBasedir(), "cli-options.txt", false );
-
- verifier.setCliOptions( cliOptions );
-
- verifier.setSystemProperties( properties );
-
- verifier.setVerifierProperties( controlProperties );
-
- verifier.executeGoals( goals );
-
- verifier.executeHook( "postbuild-hook.txt" );
-
- System.out.println( "*** Verifying: fail when [ERROR] detected? " + chokeOnErrorOutput + " ***" );
-
- verifier.verify( chokeOnErrorOutput );
-
- verifier.resetStreams();
-
- System.out.println( "OK" );
- }
-
- public void assertArtifactContents( String org, String artifact, String version, String type, String contents )
- throws IOException
- {
- String fileName = getArtifactPath( org, artifact, version, type );
- Assert.assertEquals( contents, FileUtils.fileRead( fileName ) );
- }
-
- static class UserModelReader
- extends DefaultHandler
- {
- private String localRepository;
-
- private StringBuffer currentBody = new StringBuffer();
-
- public void parse( File file )
- throws VerificationException
- {
- try
- {
- SAXParserFactory saxFactory = SAXParserFactory.newInstance();
-
- SAXParser parser = saxFactory.newSAXParser();
-
- InputSource is = new InputSource( new FileInputStream( file ) );
-
- parser.parse( is, this );
- }
- catch ( FileNotFoundException e )
- {
- throw new VerificationException( e );
- }
- catch ( IOException e )
- {
- throw new VerificationException( e );
- }
- catch ( ParserConfigurationException e )
- {
- throw new VerificationException( e );
- }
- catch ( SAXException e )
- {
- throw new VerificationException( e );
- }
- }
-
- public void warning( SAXParseException spe )
- {
- printParseError( "Warning", spe );
- }
-
- public void error( SAXParseException spe )
- {
- printParseError( "Error", spe );
- }
-
- public void fatalError( SAXParseException spe )
- {
- printParseError( "Fatal Error", spe );
- }
-
- private final void printParseError( String type, SAXParseException spe )
- {
- System.err.println(
- type + " [line " + spe.getLineNumber() + ", row " + spe.getColumnNumber() + "]: " + spe.getMessage() );
- }
-
- public String getLocalRepository()
- {
- return localRepository;
- }
-
- public void characters( char[] ch, int start, int length )
- throws SAXException
- {
- currentBody.append( ch, start, length );
- }
-
- public void endElement( String uri, String localName, String rawName )
- throws SAXException
- {
- if ( "localRepository".equals( rawName ) )
- {
- if ( notEmpty( currentBody.toString() ) )
- {
- localRepository = currentBody.toString().trim();
- }
- else
- {
- throw new SAXException(
- "Invalid mavenProfile entry. Missing one or more " + "fields: {localRepository}." );
- }
- }
-
- currentBody = new StringBuffer();
- }
-
- private boolean notEmpty( String test )
- {
- return test != null && test.trim().length() > 0;
- }
-
- public void reset()
- {
- this.currentBody = null;
- this.localRepository = null;
- }
- }
-
- public List getCliOptions()
- {
- return cliOptions;
- }
-
- public void setCliOptions( List cliOptions )
- {
- this.cliOptions = cliOptions;
- }
-
- public Properties getSystemProperties()
- {
- return systemProperties;
- }
-
- public void setSystemProperties( Properties systemProperties )
- {
- this.systemProperties = systemProperties;
- }
-
- public Properties getVerifierProperties()
- {
- return verifierProperties;
- }
-
- public void setVerifierProperties( Properties verifierProperties )
- {
- this.verifierProperties = verifierProperties;
- }
-
- public String getBasedir()
- {
- return basedir;
- }
-
}
Added: maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/Verifier.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/Verifier.java?view=auto&rev=498042
==============================================================================
--- maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/Verifier.java (added)
+++ maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/Verifier.java Fri Jan 19 17:55:20 2007
@@ -0,0 +1,111 @@
+package org.apache.maven.it.verifier;
+
+/*
+ * 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.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.it.VerificationException;
+
+/**
+ * Interface for Maven intergration tests verifiers
+ *
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
+ * @version $Id$
+ */
+public interface Verifier
+{
+
+ void resetStreams();
+
+ void displayStreamBuffers();
+
+ void verify( boolean chokeOnErrorOutput )
+ throws VerificationException;
+
+ void verifyErrorFreeLog()
+ throws VerificationException;
+
+ Properties loadProperties( String filename )
+ throws VerificationException;
+
+ List loadFile( String basedir, String filename, boolean hasCommand )
+ throws VerificationException;
+
+ List loadFile( File file, boolean hasCommand )
+ throws VerificationException;
+
+ String getArtifactPath( String org, String name, String version, String ext );
+
+ List getArtifactFileNameList( String org, String name, String version, String ext );
+
+ void executeHook( String filename )
+ throws VerificationException;
+
+ void deleteArtifact( String org, String name, String version, String ext )
+ throws IOException;
+
+ void assertFilePresent( String file );
+
+ void assertFileNotPresent( String file );
+
+ void assertArtifactPresent( String org, String name, String version, String ext );
+
+ void assertArtifactNotPresent( String org, String name, String version, String ext );
+
+ void executeGoal( String goal )
+ throws VerificationException;
+
+ void executeGoal( String goal, Map envVars )
+ throws VerificationException;
+
+ void executeGoals( List goals )
+ throws VerificationException;
+
+ void executeGoals( List goals, Map envVars )
+ throws VerificationException;
+
+ void assertArtifactContents( String org, String artifact, String version, String type, String contents )
+ throws IOException;
+
+ List getCliOptions();
+
+ void setCliOptions( List cliOptions );
+
+ Properties getSystemProperties();
+
+ void setSystemProperties( Properties systemProperties );
+
+ Properties getVerifierProperties();
+
+ void setVerifierProperties( Properties verifierProperties );
+
+ String getBasedir();
+
+ String getLocalRepo();
+
+ public void displayLogFile();
+
+ public void findLocalRepo( String settingsFile )
+ throws VerificationException;
+}
\ No newline at end of file
Propchange: maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/Verifier.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/verifier/Verifier.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"