Repository: maven-integration-testing
Updated Branches:
  refs/heads/MNG-5889 [created] 8e2cbf5a6


[MNG-5889] .mvn directory should be picked when using --file

Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/8e2cbf5a
Tree: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/8e2cbf5a
Diff: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/8e2cbf5a

Branch: refs/heads/MNG-5889
Commit: 8e2cbf5a6f5c27fd2269d8a2c6992600e0167877
Parents: 80438a6
Author: Hervé Boutemy <hbout...@apache.org>
Authored: Mon Nov 14 00:37:52 2016 +0100
Committer: Hervé Boutemy <hbout...@apache.org>
Committed: Sun Feb 12 22:44:22 2017 +0100

----------------------------------------------------------------------
 .../apache/maven/it/IntegrationTestSuite.java   |  1 +
 .../it/MavenITmng5771CoreExtensionsTest.java    |  7 ++-
 .../it/MavenITmng5889CoreExtensionsTest.java    | 62 ++++++++++++++++++++
 3 files changed, 68 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/8e2cbf5a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java 
b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index c9b5ace..f6c6114 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -108,6 +108,7 @@ public class IntegrationTestSuite
 
         suite.addTestSuite( MavenITmng5958LifecyclePhaseBinaryCompat.class );
         suite.addTestSuite( 
MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.class );
+        suite.addTestSuite( MavenITmng5889CoreExtensionsTest.class );
         suite.addTestSuite( MavenITmng5840ParentVersionRanges.class );
         suite.addTestSuite( MavenITmng5840RelativePathReactorMatching.class );
         suite.addTestSuite( MavenITmng5805PkgTypeMojoConfiguration.class );

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/8e2cbf5a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java
 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java
index fd99a79..fb149a4 100644
--- 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java
+++ 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java
@@ -5,6 +5,11 @@ import java.util.Properties;
 
 import org.apache.maven.it.util.ResourceExtractor;
 
+/**
+ * This is a test set for <a 
href="https://issues.apache.org/jira/browse/MNG-5771";>MNG-5771</a>:
+ * check that Maven loads core extensions and components contributed by 
<code>.mvn/extensions.xml</code>
+ * are available to regular plugins. 
+ */
 public class MavenITmng5771CoreExtensionsTest
     extends AbstractMavenIntegrationTestCase
 {
@@ -83,6 +88,4 @@ public class MavenITmng5771CoreExtensionsTest
         
         server.stop();
     }
-    
-
 }

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/8e2cbf5a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889CoreExtensionsTest.java
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889CoreExtensionsTest.java
 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889CoreExtensionsTest.java
new file mode 100644
index 0000000..70d8b39
--- /dev/null
+++ 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889CoreExtensionsTest.java
@@ -0,0 +1,62 @@
+package org.apache.maven.it;
+
+import java.io.File;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * This is a test set for <a 
href="https://issues.apache.org/jira/browse/MNG-5889";>MNG-5889</a>:
+ * check that extensions in <code>.mvn/</code> are found when Maven is run 
with <code>-f path/to/pom.xml</code>.
+ * Reuses MNG-5771 core extensions IT to run the test in new conditions.
+ * 
+ * @see MavenITmng5771CoreExtensionsTest
+ */
+public class MavenITmng5889CoreExtensionsTest
+    extends AbstractMavenIntegrationTestCase
+{
+    public MavenITmng5889CoreExtensionsTest()
+    {
+        super( "[3.5.0,)" );
+    }
+
+    /**
+     * check that <code>.mvn/</code> is found when current dir does not 
contain <code>pom.xml</code>
+     * but path to POM set by <code>--file path/to/pom.xml</code>
+     */
+    public void testCoreExtensionLongOption()
+        throws Exception
+    {
+        runCoreExtensionWithOption( "--file" );
+    }
+
+    /**
+     * check that <code>.mvn/</code> is found when current dir does not 
contain <code>pom.xml</code>
+     * but path to POM set by <code>-f path/to/pom.xml</code>
+     */
+    public void testCoreExtensionShortOption()
+        throws Exception
+    {
+        runCoreExtensionWithOption( "-f" );
+    }
+
+    private void runCoreExtensionWithOption( String option )
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-5771-core-extensions" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() ); // not 
client directory
+        verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", 
verifier.newDefaultFilterProperties() );
+
+        verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.deleteDirectory( "client/target" );
+        verifier.deleteArtifacts( "org.apache.maven.its.it-core-extensions" );
+        verifier.getCliOptions().add( "-s" );
+        verifier.getCliOptions().add( new File( testDir, "settings.xml" 
).getAbsolutePath() );
+        verifier.getCliOptions().add( option ); // -f/--file client/pom.xml
+        verifier.getCliOptions().add( new File( testDir, "client/pom.xml" 
).getAbsolutePath() );
+        verifier.setForkJvm( true ); // force forked JVM since we need the 
shell script to detect .mvn/ location
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+    }
+}

Reply via email to