[MNG-2054] Adding integration test.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@380858 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2006-02-24 23:16:20 +00:00
parent 6038e135aa
commit 5bdc77bd16
11 changed files with 224 additions and 0 deletions

View File

@ -258,6 +258,8 @@ it0094: Test classloading issues with mojos after 2.0 (MNG-1898).
it0095: Test URL calculation when modules are in sibling dirs of parent. (MNG-2006) it0095: Test URL calculation when modules are in sibling dirs of parent. (MNG-2006)
it0096: Test that plugin executions from >1 step of inheritance don't run multiple times.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
- generated sources - generated sources

View File

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

View File

@ -0,0 +1 @@
package

View File

@ -0,0 +1,19 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.it0096</groupId>
<artifactId>maven-it0096-root</artifactId>
<version>1</version>
</parent>
<artifactId>maven-it0096-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 it0096
*/
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, "it0096-test.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.it0096</groupId>
<artifactId>maven-it0096-root</artifactId>
<version>1</version>
<packaging>pom</packaging>
<modules>
<module>plugin</module>
<module>project</module>
</modules>
</project>

View File

@ -0,0 +1,32 @@
<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.it0096</groupId>
<artifactId>maven-it0096-root</artifactId>
<version>1</version>
</parent>
<artifactId>maven-it0096-project-level1</artifactId>
<packaging>pom</packaging>
<modules>
<module>project-level2</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.it0096</groupId>
<artifactId>maven-it0096-plugin</artifactId>
<version>1</version>
<executions>
<execution>
<id>it0096</id>
<phase>initialize</phase>
<goals>
<goal>it0096</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.it0096</groupId>
<artifactId>maven-it0096-project-level1</artifactId>
<version>1</version>
</parent>
<artifactId>maven-it0096-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.it0096</groupId>
<artifactId>maven-it0096-project-level2</artifactId>
<version>1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-it0096-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 );
}
}