[MNG-2068] Adding integration test.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@380862 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2006-02-24 23:30:50 +00:00
parent 5bdc77bd16
commit d0fd1579a9
12 changed files with 219 additions and 0 deletions

View File

@ -260,6 +260,9 @@ it0095: Test URL calculation when modules are in sibling dirs of parent. (MNG-20
it0096: Test that plugin executions from >1 step of inheritance don't run multiple times.
it0097: Test that the implied relative path for the parent POM works, even two
levels deep.
-------------------------------------------------------------------------------
- generated sources

View File

@ -1,3 +1,4 @@
it0097
it0096
it0095
it0094

View File

@ -0,0 +1 @@
project/project-level2/project-level3/target/it0097.txt

View File

@ -0,0 +1 @@
package

View File

@ -0,0 +1,15 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it0097</groupId>
<version>1</version>
<artifactId>maven-it0097-plugin</artifactId>
<packaging>maven-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,56 @@
package org.apache.maven.it0096;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
/**
* @goal it0097
*/
public class It0096Mojo extends AbstractMojo
{
/**
* @parameter default-value="${project.build.directory}"
* @required
* @readonly
*/
private File targetDirectory;
public void execute() throws MojoExecutionException
{
targetDirectory.mkdirs();
File myFile = new File( targetDirectory, "it0097.txt" );
if ( myFile.exists() )
{
throw new MojoExecutionException( "This mojo has already been run, or the project wasn't cleaned." );
}
else
{
FileWriter writer = null;
try
{
writer = new FileWriter( myFile );
writer.write( "test" );
writer.close();
}
catch ( IOException e )
{
throw new MojoExecutionException( "Failed to write test file: " + myFile );
}
finally
{
if ( writer != null )
{
try{ writer.close(); }
catch( IOException e ) {}
}
}
}
}
}

View File

@ -0,0 +1,12 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it0097</groupId>
<artifactId>maven-it0097-launcher</artifactId>
<version>1</version>
<packaging>pom</packaging>
<modules>
<module>plugin</module>
<module>project/project-level2/project-level3</module>
</modules>
</project>

View File

@ -0,0 +1,29 @@
<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.it0097</groupId>
<version>1</version>
<artifactId>maven-it0097-project-level1</artifactId>
<packaging>pom</packaging>
<modules>
<module>project-level2</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.it0097</groupId>
<artifactId>maven-it0097-plugin</artifactId>
<version>1</version>
<executions>
<execution>
<id>it0097</id>
<phase>initialize</phase>
<goals>
<goal>it0097</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,16 @@
<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>
<parent>
<groupId>org.apache.maven.it0097</groupId>
<artifactId>maven-it0097-project-level1</artifactId>
<version>1</version>
</parent>
<artifactId>maven-it0097-project-level2</artifactId>
<packaging>pom</packaging>
<modules>
<module>project-level3</module>
</modules>
</project>

View File

@ -0,0 +1,34 @@
<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">
<parent>
<groupId>org.apache.maven.it0097</groupId>
<artifactId>maven-it0097-project-level2</artifactId>
<version>1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-it0097-project-level3</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,13 @@
package com.stchome.mavenTest;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

View File

@ -0,0 +1,38 @@
package com.stchome.mavenTest;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}