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 2008/08/10 12:45:39 UTC

svn commit: r684451 - in /maven/plugins/trunk/maven-invoker-plugin/src/it: local-repo-default/ local-repo-default/src/it/project/ local-repo-isolated/ local-repo-isolated/src/it/project/

Author: bentmann
Date: Sun Aug 10 03:45:38 2008
New Revision: 684451

URL: http://svn.apache.org/viewvc?rev=684451&view=rev
Log:
o Strengthened IT to check that the default local repo path is properly propagated to the sub build

Added:
    maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/postbuild.bsh   (with props)
Modified:
    maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml
    maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh
    maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/src/it/project/pom.xml
    maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/verify.bsh

Modified: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml?rev=684451&r1=684450&r2=684451&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml Sun Aug 10 03:45:38 2008
@@ -19,8 +19,8 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven.test</groupId>
-  <artifactId>unit</artifactId>
+  <groupId>test</groupId>
+  <artifactId>local-repo-default</artifactId>
   <version>0.1-SNAPSHOT</version>
   <packaging>pom</packaging>
 

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/postbuild.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/postbuild.bsh?rev=684451&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/postbuild.bsh (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/postbuild.bsh Sun Aug 10 03:45:38 2008
@@ -0,0 +1,20 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+try
+{
+    // just dump our local repo path for verification by the parent build
+    File textFile = new File( basedir, "target/local-repo-path.txt" );
+    textFile.getParentFile().mkdirs();
+    Writer writer = new OutputStreamWriter( new FileOutputStream( textFile ), "UTF-8" );
+    writer.write( localRepositoryPath.getAbsolutePath() );
+    writer.close();
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/postbuild.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/postbuild.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh?rev=684451&r1=684450&r2=684451&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh Sun Aug 10 03:45:38 2008
@@ -7,7 +7,39 @@
     File badRepoDir = new File( basedir, "target/bad-repo" );
     if ( badRepoDir.exists() )
     {
-        System.out.println( "IT used wrong local repository: " + badRepoDir );
+        System.out.println( "Sub build used wrong local repository (from its settings.xml): " + badRepoDir );
+        return false;
+    }
+
+    /*
+     * NOTE: This relies heavily on the Invoker Plugin's configuration of our parent build, not nice but until MINVOKER-49
+     * is available here, we have no other way of getting the path.
+     */
+    File localRepoPathOfThisBuild = new File( basedir.getParentFile().getParentFile(), "local-repo" );
+    System.out.println("Local repository of this build: " + localRepoPathOfThisBuild);
+
+    File textFile = new File( basedir, "src/it/project/target/local-repo-path.txt" );
+    BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( textFile ), "UTF-8" ) );
+    File localRepoPathOfSubBuild = new File ( reader.readLine() );
+    reader.close();
+    System.out.println("Local repository of sub build: " + localRepoPathOfSubBuild);
+
+    /*
+     * This is partly a sanity check of the Maven core (i.e. its MavenSettingsBuilder) which should ensure
+     *   ${settings.localRepository} == ${maven.repo.local}
+     * This IT is run with maven.repo.local but the Invoker Plugin passes settings.localRepository down to the sub build
+     * so these paths must match.
+     */
+    if ( !localRepoPathOfThisBuild.equals( localRepoPathOfSubBuild ) )
+    {
+        System.out.println( "Sub build used wrong local repository: " + localRepoPathOfSubBuild );
+        return false;
+    }
+
+    File installedFile = new File( localRepoPathOfThisBuild, "test/local-repo-default/0.1-SNAPSHOT/local-repo-default-0.1-SNAPSHOT.pom" );
+    if ( !installedFile.isFile() )
+    {
+        System.out.println( "Installed file missing in local repo: " + installedFile );
         return false;
     }
 }

Modified: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/src/it/project/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/src/it/project/pom.xml?rev=684451&r1=684450&r2=684451&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/src/it/project/pom.xml (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/src/it/project/pom.xml Sun Aug 10 03:45:38 2008
@@ -19,8 +19,8 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven.test</groupId>
-  <artifactId>unit</artifactId>
+  <groupId>test</groupId>
+  <artifactId>local-repo-isolated</artifactId>
   <version>0.1-SNAPSHOT</version>
   <packaging>pom</packaging>
 

Modified: maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/verify.bsh?rev=684451&r1=684450&r2=684451&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/verify.bsh (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-isolated/verify.bsh Sun Aug 10 03:45:38 2008
@@ -18,7 +18,7 @@
         return false;
     }
 
-    File installedFile = new File( itRepoDir, "org/apache/maven/test/unit/0.1-SNAPSHOT/unit-0.1-SNAPSHOT.pom" );
+    File installedFile = new File( itRepoDir, "test/local-repo-isolated/0.1-SNAPSHOT/local-repo-isolated-0.1-SNAPSHOT.pom" );
     if ( !installedFile.isFile() )
     {
         System.out.println( "Installed file missing in local repo: " + installedFile );