maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-core-it/it0013 prebuild-hook.txt
Date Mon, 04 Apr 2005 06:15:04 GMT
brett       2005/04/03 23:15:04

  Modified:    maven-core-it-verifier/src/main/java/org/apache/maven/it
                        Verifier.java
               maven-core-it/it0002 expected-results.txt prebuild-hook.txt
               maven-core-it/it0003 expected-results.txt prebuild-hook.txt
               maven-core-it/it0004 expected-results.txt prebuild-hook.txt
               maven-core-it/it0005 expected-results.txt prebuild-hook.txt
               maven-core-it/it0007 expected-results.txt prebuild-hook.txt
               maven-core-it/it0008 prebuild-hook.txt
               maven-core-it/it0009 prebuild-hook.txt
               maven-core-it/it0013 prebuild-hook.txt
  Removed:     maven-core-it/it0006 .cvsignore
               maven-core-it/it0010 prebuild-hook.txt
               maven-core-it/it0011 prebuild-hook.txt
               maven-core-it/it0012 prebuild-hook.txt
  Log:
  clean up integration tests, make them repository independent
  
  Revision  Changes    Path
  1.26      +68 -41    maven-components/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
  
  Index: Verifier.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Verifier.java	16 Mar 2005 06:29:33 -0000	1.25
  +++ Verifier.java	4 Apr 2005 06:15:03 -0000	1.26
  @@ -11,7 +11,6 @@
   
   import javax.xml.parsers.SAXParser;
   import javax.xml.parsers.SAXParserFactory;
  -
   import java.io.BufferedReader;
   import java.io.ByteArrayOutputStream;
   import java.io.File;
  @@ -26,6 +25,7 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.StringTokenizer;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
  @@ -48,6 +48,9 @@
   
       private final PrintStream originalErr;
   
  +    // TODO: needs to be configurable
  +    private static String localRepoLayout = "legacy";
  +
       public Verifier( String basedir )
       {
           this.basedir = basedir;
  @@ -141,7 +144,8 @@
                       continue;
                   }
   
  -                line = replace( line, "${localRepository}", localRepo );
  +
  +                line = replaceArtifacts( line );
   
                   lines.add( line );
               }
  @@ -155,6 +159,67 @@
           return lines;
       }
   
  +    private static String replaceArtifacts( String line )
  +    {
  +        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 + "'" );
  +            }
  +            String artifact = line.substring( newLine.length() + MARKER.length(), index
);
  +
  +            newLine += convertArtifact( artifact );
  +            newLine += line.substring( index + 1 );
  +
  +            line = replaceArtifacts( newLine );
  +        }
  +        return line;
  +    }
  +
  +    private static String convertArtifact( 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 ext = a[3];
  +        if ( a[3].equals( "maven-plugin" ) )
  +        {
  +            ext = "jar";
  +        }
  +
  +        String repositoryPath;
  +        if ( "legacy".equals( localRepoLayout ) )
  +        {
  +            repositoryPath = a[0] + "/" + a[3] + "s/" + a[1] + "-" + a[2] + "." + ext;
  +        }
  +        else if ( "default".equals( localRepoLayout ) )
  +        {
  +            String pathGroup = a[0].replace( '.', '/' );
  +            repositoryPath = pathGroup + "/" + a[1] + "/" + a[2];
  +            repositoryPath = repositoryPath + "/" + a[1] + "-" + a[2] + "." + ext;
  +        }
  +        else
  +        {
  +            throw new IllegalStateException( "Unknown layout: " + localRepoLayout );
  +        }
  +
  +        return localRepo + "/" + repositoryPath;
  +    }
  +
       public void executeHook( String filename ) throws VerificationException
       {
           try
  @@ -313,44 +378,6 @@
       //
       // ----------------------------------------------------------------------
   
  -    public static String replaceOnce( String text, String repl, String with )
  -    {
  -        return replace( text, repl, with, 1 );
  -    }
  -
  -    public static String replace( String text, String repl, String with )
  -    {
  -        return replace( text, repl, with, -1 );
  -    }
  -
  -    public static String replace( String text, String repl, String with, int max )
  -    {
  -        if ( text == null || repl == null || with == null || repl.length() == 0 )
  -        {
  -            return text;
  -        }
  -
  -        StringBuffer buf = new StringBuffer( text.length() );
  -
  -        int start = 0, end = 0;
  -
  -        while ( ( end = text.indexOf( repl, start ) ) != -1 )
  -        {
  -            buf.append( text.substring( start, end ) ).append( with );
  -
  -            start = end + repl.length();
  -
  -            if ( --max == 0 )
  -            {
  -                break;
  -            }
  -        }
  -
  -        buf.append( text.substring( start ) );
  -
  -        return buf.toString();
  -    }
  -
       public void executeGoals( String filename ) throws VerificationException
       {
           String mavenHome = System.getProperty( "maven.home" );
  
  
  
  1.4       +1 -1      maven-components/maven-core-it/it0002/expected-results.txt
  
  Index: expected-results.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0002/expected-results.txt,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- expected-results.txt	23 Mar 2005 06:52:52 -0000	1.3
  +++ expected-results.txt	4 Apr 2005 06:15:03 -0000	1.4
  @@ -2,4 +2,4 @@
   target/test-classes/org/apache/maven/it0002/PersonTest.class
   target/maven-core-it0002-1.0.jar
   target/maven-core-it0002-1.0.jar!/it0002.properties
  -${localRepository}/org.apache.maven/jars/maven-core-it-support-1.0.jar
  +${artifact:org.apache.maven:maven-core-it-support:1.0:jar}
  
  
  
  1.3       +1 -1      maven-components/maven-core-it/it0002/prebuild-hook.txt
  
  Index: prebuild-hook.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0002/prebuild-hook.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- prebuild-hook.txt	23 Mar 2005 06:52:52 -0000	1.2
  +++ prebuild-hook.txt	4 Apr 2005 06:15:03 -0000	1.3
  @@ -1 +1 @@
  -rm ${localRepository}/org.apache.maven/jars/maven-core-it-support-1.0.jar
  +rm ${artifact:org.apache.maven:maven-core-it-support:1.0:jar}
  
  
  
  1.4       +1 -1      maven-components/maven-core-it/it0003/expected-results.txt
  
  Index: expected-results.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0003/expected-results.txt,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- expected-results.txt	23 Mar 2005 06:52:52 -0000	1.3
  +++ expected-results.txt	4 Apr 2005 06:15:03 -0000	1.4
  @@ -2,4 +2,4 @@
   target/test-classes/org/apache/maven/it0003/PersonTest.class
   target/maven-core-it0003-1.0.jar
   target/maven-core-it0003-1.0.jar!/it0003.properties
  -${localRepository}/org.apache.maven/jars/maven-core-it0003-1.0.jar
  +${artifact:org.apache.maven:maven-core-it0003:1.0:jar}
  
  
  
  1.3       +1 -1      maven-components/maven-core-it/it0003/prebuild-hook.txt
  
  Index: prebuild-hook.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0003/prebuild-hook.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- prebuild-hook.txt	23 Mar 2005 06:52:52 -0000	1.2
  +++ prebuild-hook.txt	4 Apr 2005 06:15:03 -0000	1.3
  @@ -1 +1 @@
  -rm ${localRepository}/org.apache.maven/jars/maven-core-it0003-1.0.jar
  +rm ${artifact:org.apache.maven:maven-core-it0003:1.0:jar}
  
  
  
  1.4       +1 -1      maven-components/maven-core-it/it0004/expected-results.txt
  
  Index: expected-results.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0004/expected-results.txt,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- expected-results.txt	23 Mar 2005 06:52:52 -0000	1.3
  +++ expected-results.txt	4 Apr 2005 06:15:04 -0000	1.4
  @@ -1 +1 @@
  -${localRepository}/org.apache.maven/poms/maven-core-it0004-1.0.pom
  +${artifact:org.apache.maven:maven-core-it0004:1.0:pom}
  
  
  
  1.3       +1 -1      maven-components/maven-core-it/it0004/prebuild-hook.txt
  
  Index: prebuild-hook.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0004/prebuild-hook.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- prebuild-hook.txt	23 Mar 2005 06:52:52 -0000	1.2
  +++ prebuild-hook.txt	4 Apr 2005 06:15:04 -0000	1.3
  @@ -1 +1 @@
  -rm ${localRepository}/org.apache.maven/poms/maven-core-it0004-1.0.pom
  +rm ${artifact:org.apache.maven:maven-core-it0004:1.0:pom}
  
  
  
  1.5       +1 -1      maven-components/maven-core-it/it0005/expected-results.txt
  
  Index: expected-results.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0005/expected-results.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- expected-results.txt	23 Mar 2005 06:52:52 -0000	1.4
  +++ expected-results.txt	4 Apr 2005 06:15:04 -0000	1.5
  @@ -1 +1 @@
  -${localRepository}/org.apache.maven/poms/maven-core-it0005-1.0-SNAPSHOT.pom
  +${artifact:org.apache.maven:maven-core-it0005:1.0-SNAPSHOT:pom}
  
  
  
  1.3       +1 -1      maven-components/maven-core-it/it0005/prebuild-hook.txt
  
  Index: prebuild-hook.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0005/prebuild-hook.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- prebuild-hook.txt	23 Mar 2005 06:52:52 -0000	1.2
  +++ prebuild-hook.txt	4 Apr 2005 06:15:04 -0000	1.3
  @@ -1 +1 @@
  -rm ${localRepository}/org.apache.maven/poms/maven-core-it0005-1.0-SNAPSHOT.pom
  +rm ${artifact:org.apache.maven:maven-core-it0005:1.0-SNAPSHOT:pom}
  
  
  
  1.6       +1 -1      maven-components/maven-core-it/it0007/expected-results.txt
  
  Index: expected-results.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0007/expected-results.txt,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- expected-results.txt	23 Mar 2005 06:52:53 -0000	1.5
  +++ expected-results.txt	4 Apr 2005 06:15:04 -0000	1.6
  @@ -2,4 +2,4 @@
   target/test-classes/org/apache/maven/it0007/PersonTest.class
   target/maven-core-it0007-1.0.jar
   target/maven-core-it0007-1.0.jar!/it0007.properties
  -${localRepository}/org.apache.maven/poms/maven-core-it-support-1.0.pom
  +${artifact:org.apache.maven:maven-core-it-support:1.0:pom}
  
  
  
  1.3       +1 -1      maven-components/maven-core-it/it0007/prebuild-hook.txt
  
  Index: prebuild-hook.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0007/prebuild-hook.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- prebuild-hook.txt	23 Mar 2005 06:52:53 -0000	1.2
  +++ prebuild-hook.txt	4 Apr 2005 06:15:04 -0000	1.3
  @@ -1 +1 @@
  -rm ${localRepository}/org.apache.maven/poms/maven-core-it-support-parent-1.0.pom
  +rm ${artifact:org.apache.maven:maven-core-it-support:1.0:pom}
  
  
  
  1.3       +1 -1      maven-components/maven-core-it/it0008/prebuild-hook.txt
  
  Index: prebuild-hook.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0008/prebuild-hook.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- prebuild-hook.txt	23 Mar 2005 06:52:53 -0000	1.2
  +++ prebuild-hook.txt	4 Apr 2005 06:15:04 -0000	1.3
  @@ -1 +1 @@
  -rm ${localRepository}/org.apache.maven/maven-plugins/maven-core-it-plugin-1.0-SNAPSHOT.jar
  +rm ${artifact:org.apache.maven:maven-core-it-plugin:1.0-SNAPSHOT:maven-plugin}
  
  
  
  1.5       +1 -1      maven-components/maven-core-it/it0009/prebuild-hook.txt
  
  Index: prebuild-hook.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0009/prebuild-hook.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- prebuild-hook.txt	23 Mar 2005 06:52:53 -0000	1.4
  +++ prebuild-hook.txt	4 Apr 2005 06:15:04 -0000	1.5
  @@ -1 +1 @@
  -rm ${localRepository}/org.apache.maven/maven-plugins/maven-core-it-plugin-1.0-SNAPSHOT.jar
  +rm ${artifact:org.apache.maven:maven-core-it-plugin:1.0-SNAPSHOT:maven-plugin}
  
  
  
  1.4       +1 -1      maven-components/maven-core-it/it0013/prebuild-hook.txt
  
  Index: prebuild-hook.txt
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core-it/it0013/prebuild-hook.txt,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- prebuild-hook.txt	23 Mar 2005 06:52:53 -0000	1.3
  +++ prebuild-hook.txt	4 Apr 2005 06:15:04 -0000	1.4
  @@ -1 +1 @@
  -rm ${localRepository}/org.apache.maven/maven-plugins/maven-it0013-plugin-1.0-SNAPSHOT.jar
  +rm ${artifact:org.apache.maven:maven-it0013-plugin:1.0-SNAPSHOT:maven-plugin}
  
  
  

Mime
View raw message