diff --git a/maven-core-it-verifier/.cvsignore b/maven-core-it-verifier/.cvsignore new file mode 100644 index 0000000000..39c914ada7 --- /dev/null +++ b/maven-core-it-verifier/.cvsignore @@ -0,0 +1,9 @@ +*~ +*.log +target +*.ipr +*.iws +dist +target +.classpath +.project diff --git a/maven-core-it-verifier/maven-core-it-verifier.iml b/maven-core-it-verifier/maven-core-it-verifier.iml new file mode 100644 index 0000000000..25bf14f1f3 --- /dev/null +++ b/maven-core-it-verifier/maven-core-it-verifier.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/maven-core-it-verifier/project.xml b/maven-core-it-verifier/project.xml new file mode 100644 index 0000000000..9e8802a110 --- /dev/null +++ b/maven-core-it-verifier/project.xml @@ -0,0 +1,5 @@ + + maven + maven-core-it-verifier + 1.0 + diff --git a/maven-core-it-verifier/src/main/java/org/apache/maven/it/VerificationException.java b/maven-core-it-verifier/src/main/java/org/apache/maven/it/VerificationException.java new file mode 100644 index 0000000000..4e5f72247c --- /dev/null +++ b/maven-core-it-verifier/src/main/java/org/apache/maven/it/VerificationException.java @@ -0,0 +1,28 @@ +package org.apache.maven.it; + +/** + * @author Jason van Zyl + * @version $Id$ + */ +public class VerificationException + extends Exception +{ + public VerificationException() + { + } + + public VerificationException( String message ) + { + super( message ); + } + + public VerificationException( Throwable cause ) + { + super( cause ); + } + + public VerificationException( String message, Throwable cause ) + { + super( message, cause ); + } +} diff --git a/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java b/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java new file mode 100644 index 0000000000..d119575fd1 --- /dev/null +++ b/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java @@ -0,0 +1,91 @@ +package org.apache.maven.it; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.InputStream; +import java.net.URL; + +/** + * @author Jason van Zyl + * @version $Id$ + */ +public class Verifier +{ + private String basedir; + + public Verifier( String basedir ) + { + this.basedir = basedir; + } + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + public void verify() + throws VerificationException + { + try + { + BufferedReader reader = new BufferedReader( new FileReader( new File( basedir, "expected-results.txt" ) ) ); + + String line = ""; + + while ( ( line = reader.readLine() ) != null ) + { + verifyExpectedResult( line ); + } + } + catch ( Exception e ) + { + throw new VerificationException( e ); + } + } + + private void verifyExpectedResult( String line ) + throws VerificationException + { + if ( line.indexOf( "!/" ) > 0 ) + { + String urlString = "jar:file:" + line; + + try + { + URL url = new URL( urlString ); + + InputStream is = url.openStream(); + + if ( is == null ) + { + throw new VerificationException( "Expected JAR resource was not found: " + line ); + } + } + catch ( Exception e ) + { + throw new VerificationException( "Expected JAR resource was not found: " + line ); + } + } + else + { + File expectedFile = new File( basedir, line ); + + if ( !expectedFile.exists() ) + { + throw new VerificationException( "Expected file was not found: " + line ); + } + } + } + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + public static void main( String args[] ) + throws VerificationException + { + Verifier verifier = new Verifier( args[0] ); + + verifier.verify(); + } +} diff --git a/maven-core-it/README.txt b/maven-core-it/README.txt new file mode 100644 index 0000000000..70024ec225 --- /dev/null +++ b/maven-core-it/README.txt @@ -0,0 +1,21 @@ +it0000: The simplest of builds. We have one application class and one test + class. There are no resources, no source generation, no resource + generation and a the super model is employed to provide the build + information. + +it0001: Build upon it0000 we add an application resource that is packaged + up in the resultant JAR. + +------------------------------------------------------------------------------- + +- generated sources +- generated resources from sources +- generated resources from generated sources +- filtered resources +- build that requires a plugin download +- transitive dependencies + +- write a small program to generate a massively nested build + which which use the reactor and inheritence. we need to have + integration tests that go far beyond what the average user + would ever setup. diff --git a/maven-core-it/integration-tests.txt b/maven-core-it/integration-tests.txt new file mode 100644 index 0000000000..9cf7fdf2fc --- /dev/null +++ b/maven-core-it/integration-tests.txt @@ -0,0 +1,2 @@ +it0000 +it0001 diff --git a/maven-core-it/it0000/.cvsignore b/maven-core-it/it0000/.cvsignore new file mode 100644 index 0000000000..39c914ada7 --- /dev/null +++ b/maven-core-it/it0000/.cvsignore @@ -0,0 +1,9 @@ +*~ +*.log +target +*.ipr +*.iws +dist +target +.classpath +.project diff --git a/maven-core-it/it0000/expected-results.txt b/maven-core-it/it0000/expected-results.txt new file mode 100644 index 0000000000..b576289f9b --- /dev/null +++ b/maven-core-it/it0000/expected-results.txt @@ -0,0 +1,3 @@ +target/classes/org/apache/maven/it0000/Person.class +target/test-classes/org/apache/maven/it0000/PersonTest.class +target/maven-core-it0000-1.0.jar diff --git a/maven-core-it/it0000/project.xml b/maven-core-it/it0000/project.xml new file mode 100644 index 0000000000..dc0b32651d --- /dev/null +++ b/maven-core-it/it0000/project.xml @@ -0,0 +1,13 @@ + + maven + maven-core-it0000 + 1.0 + + + junit + junit + 3.8.1 + test + + + diff --git a/maven-core-it/it0000/src/main/java/org/apache/maven/it0000/Person.java b/maven-core-it/it0000/src/main/java/org/apache/maven/it0000/Person.java new file mode 100644 index 0000000000..a9fb4bc9d2 --- /dev/null +++ b/maven-core-it/it0000/src/main/java/org/apache/maven/it0000/Person.java @@ -0,0 +1,16 @@ +package org.apache.maven.it0000; + +public class Person +{ + private String name; + + public void setName( String name ) + { + this.name = name; + } + + public String getName() + { + return name; + } +} diff --git a/maven-core-it/it0000/src/test/java/org/apache/maven/it0000/PersonTest.java b/maven-core-it/it0000/src/test/java/org/apache/maven/it0000/PersonTest.java new file mode 100644 index 0000000000..354f917f46 --- /dev/null +++ b/maven-core-it/it0000/src/test/java/org/apache/maven/it0000/PersonTest.java @@ -0,0 +1,16 @@ +package org.apache.maven.it0000; + +import junit.framework.TestCase; + +public class PersonTest + extends TestCase +{ + public void testPerson() + { + Person person = new Person(); + + person.setName( "foo" ); + + assertEquals( "foo", person.getName() ); + } +} diff --git a/maven-core-it/it0001/.cvsignore b/maven-core-it/it0001/.cvsignore new file mode 100644 index 0000000000..39c914ada7 --- /dev/null +++ b/maven-core-it/it0001/.cvsignore @@ -0,0 +1,9 @@ +*~ +*.log +target +*.ipr +*.iws +dist +target +.classpath +.project diff --git a/maven-core-it/it0001/bootstrap.repo b/maven-core-it/it0001/bootstrap.repo new file mode 100644 index 0000000000..9c44e6111e --- /dev/null +++ b/maven-core-it/it0001/bootstrap.repo @@ -0,0 +1 @@ +/home/jvanzyl/maven-repo-local \ No newline at end of file diff --git a/maven-core-it/it0001/expected-results.txt b/maven-core-it/it0001/expected-results.txt new file mode 100644 index 0000000000..ab62f2fc0c --- /dev/null +++ b/maven-core-it/it0001/expected-results.txt @@ -0,0 +1,4 @@ +target/classes/org/apache/maven/it0001/Person.class +target/test-classes/org/apache/maven/it0001/PersonTest.class +target/maven-core-it0001-1.0.jar +target/maven-core-it0001-1.0.jar!/it0001.properties diff --git a/maven-core-it/it0001/project.xml b/maven-core-it/it0001/project.xml new file mode 100644 index 0000000000..761e045d2f --- /dev/null +++ b/maven-core-it/it0001/project.xml @@ -0,0 +1,13 @@ + + maven + maven-core-it0001 + 1.0 + + + junit + junit + 3.8.1 + test + + + diff --git a/maven-core-it/it0001/src/main/java/org/apache/maven/it0001/Person.java b/maven-core-it/it0001/src/main/java/org/apache/maven/it0001/Person.java new file mode 100644 index 0000000000..613e499ae0 --- /dev/null +++ b/maven-core-it/it0001/src/main/java/org/apache/maven/it0001/Person.java @@ -0,0 +1,16 @@ +package org.apache.maven.it0001; + +public class Person +{ + private String name; + + public void setName( String name ) + { + this.name = name; + } + + public String getName() + { + return name; + } +} diff --git a/maven-core-it/it0001/src/main/resources/it0001.properties b/maven-core-it/it0001/src/main/resources/it0001.properties new file mode 100644 index 0000000000..f54f8ab106 --- /dev/null +++ b/maven-core-it/it0001/src/main/resources/it0001.properties @@ -0,0 +1 @@ +name = jason diff --git a/maven-core-it/it0001/src/test/java/org/apache/maven/it0001/PersonTest.java b/maven-core-it/it0001/src/test/java/org/apache/maven/it0001/PersonTest.java new file mode 100644 index 0000000000..80014fa03b --- /dev/null +++ b/maven-core-it/it0001/src/test/java/org/apache/maven/it0001/PersonTest.java @@ -0,0 +1,16 @@ +package org.apache.maven.it0001; + +import junit.framework.TestCase; + +public class PersonTest + extends TestCase +{ + public void testPerson() + { + Person person = new Person(); + + person.setName( "foo" ); + + assertEquals( "foo", person.getName() ); + } +} diff --git a/maven-core-it/maven-core-it.sh b/maven-core-it/maven-core-it.sh new file mode 100755 index 0000000000..244e3800a9 --- /dev/null +++ b/maven-core-it/maven-core-it.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +home=`pwd` + +cp=`pwd`/../maven-core-it-verifier/target/maven-core-it-verifier-1.0.jar +verifier=org.apache.maven.it.Verifier + +integration_tests=`cat integration-tests.txt` + +for integration_test in $integration_tests +do + echo "Running integration test $integration_test ..." + + ( + cd $integration_test + + m2 clean jar + + java -cp $cp $verifier `pwd` + ) +done