You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/19 06:55:03 UTC

svn commit: r326389 - /maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java

Author: brett
Date: Tue Oct 18 21:54:57 2005
New Revision: 326389

URL: http://svn.apache.org/viewcvs?rev=326389&view=rev
Log:
delete metadata files for all versions to ensure intergration test works as expected

Modified:
    maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java

Modified: maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java?rev=326389&r1=326388&r2=326389&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java (original)
+++ maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java Tue Oct 18 21:54:57 2005
@@ -222,60 +222,31 @@
             newLine += convertArtifact( artifact );
             newLine += line.substring( index + 1 );
 
-            index = newLine.lastIndexOf( "SNAPSHOT" );
-            if ( index >= 0 )
-            {
-                List l = new ArrayList();
-                l.add( newLine );
-
-                int endIndex = newLine.lastIndexOf( '/' );
-
-                String command = null;
-                String filespec;
-                if ( hasCommand )
-                {
-                    int startIndex = newLine.indexOf( ' ' );
+            List l = new ArrayList();
+            l.add( newLine );
 
-                    command = newLine.substring( 0, startIndex );
+            int endIndex = newLine.lastIndexOf( '/' );
 
-                    filespec = newLine.substring( startIndex + 1, endIndex );
-                }
-                else
-                {
-                    filespec = newLine;
-                }
-
-                File dir = new File( filespec );
-                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" );
+            String command = null;
+            String filespec;
+            if ( hasCommand )
+            {
+                int startIndex = newLine.indexOf( ' ' );
 
-                        }
-                    } );
+                command = newLine.substring( 0, startIndex );
 
-                    for ( int i = 0; i < files.length; i++ )
-                    {
-                        if ( hasCommand )
-                        {
-                            l.add( command + " " + new File( dir, files[i] ).getPath() );
-                        }
-                        else
-                        {
-                            l.add( new File( dir, files[i] ).getPath() );
-                        }
-                    }
-                }
-
-                return l;
+                filespec = newLine.substring( startIndex + 1, endIndex );
             }
             else
             {
-                return Collections.singletonList( newLine );
+                filespec = newLine;
             }
+
+            File dir = new File( filespec );
+            addMetadataToList( dir, hasCommand, l, command );
+            addMetadataToList( dir.getParentFile(), hasCommand, l, command );
+
+            return l;
         }
         else
         {
@@ -283,6 +254,33 @@
         }
     }
 
+    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" );
+
+                }
+            } );
+
+            for ( int i = 0; i < files.length; i++ )
+            {
+                if ( hasCommand )
+                {
+                    l.add( command + " " + new File( dir, files[i] ).getPath() );
+                }
+                else
+                {
+                    l.add( new File( dir, files[i] ).getPath() );
+                }
+            }
+        }
+    }
+
     private static String convertArtifact( String artifact )
     {
         StringTokenizer tok = new StringTokenizer( artifact, ":" );
@@ -636,8 +634,8 @@
                 cli.createArgument().setLine( "-D" + key + "=" + properties.getProperty( key ) );
             }
 
-            boolean useMavenRepoLocal =
-                Boolean.valueOf( controlProperties.getProperty( "use.mavenRepoLocal", "true" ) ).booleanValue();
+            boolean useMavenRepoLocal = Boolean.valueOf(
+                controlProperties.getProperty( "use.mavenRepoLocal", "true" ) ).booleanValue();
             if ( useMavenRepoLocal )
             {
                 // Note: Make sure that the repo is surrounded by quotes as it can possibly have
@@ -852,8 +850,8 @@
 
                 Properties controlProperties = verifier.loadProperties( "verifier.properties" );
 
-                boolean chokeOnErrorOutput =
-                    Boolean.valueOf( controlProperties.getProperty( "failOnErrorOutput", "true" ) ).booleanValue();
+                boolean chokeOnErrorOutput = Boolean.valueOf(
+                    controlProperties.getProperty( "failOnErrorOutput", "true" ) ).booleanValue();
 
                 verifier.executeGoals( properties, controlProperties, "goals.txt" );