You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/08/02 23:37:46 UTC

svn commit: r981694 - /maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java

Author: bentmann
Date: Mon Aug  2 21:37:46 2010
New Revision: 981694

URL: http://svn.apache.org/viewvc?rev=981694&view=rev
Log:
o Added factory method to create verifier setup with global settings

Modified:
    maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java

Modified: maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java?rev=981694&r1=981693&r2=981694&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java (original)
+++ maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java Mon Aug  2 21:37:46 2010
@@ -378,4 +378,51 @@ public abstract class AbstractMavenInteg
         }
         return version;
     }
+
+    protected Verifier newVerifier( File basedir )
+        throws VerificationException
+    {
+        return newVerifier( basedir.getAbsolutePath() );
+    }
+
+    protected Verifier newVerifier( String basedir )
+        throws VerificationException
+    {
+        return newVerifier( basedir, false );
+    }
+
+    protected Verifier newVerifier( String basedir, boolean debug )
+        throws VerificationException
+    {
+        Verifier verifier = new Verifier( basedir, debug );
+
+        verifier.setAutoclean( false );
+
+        String globalSettings = System.getProperty( "maven.test.global-settings", "" );
+        if ( globalSettings.length() > 0 )
+        {
+            globalSettings = new File( globalSettings ).getAbsolutePath();
+
+            // dedicated CLI option only available since MNG-3914
+            if ( matchesVersionRange( "[2.1.0,)" ) )
+            {
+                verifier.getCliOptions().add( "--global-settings" );
+                if ( globalSettings.indexOf( ' ' ) < 0 )
+                {
+                    verifier.getCliOptions().add( globalSettings );
+                }
+                else
+                {
+                    verifier.getCliOptions().add( '"' + globalSettings + '"' );
+                }
+            }
+            else
+            {
+                verifier.getSystemProperties().put( "org.apache.maven.global-settings", globalSettings );
+            }
+        }
+
+        return verifier;
+    }
+
 }