o Separated ITs for MNG-249 and MNG-870

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@735122 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-01-16 20:41:30 +00:00
parent b783521122
commit b61e03a1d0
15 changed files with 425 additions and 120 deletions

View File

@ -248,6 +248,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng0985NonExecutedPluginMngtGoalsTest.class );
suite.addTestSuite( MavenITmng0956ComponentInjectionViaProjectLevelPluginDepTest.class );
suite.addTestSuite( MavenITmng0932TestJarDeploymentTest.class );
suite.addTestSuite( MavenITmng0870ReactorAwarePluginDiscoveryTest.class );
suite.addTestSuite( MavenITmng0866EvaluateDefaultValueTest.class );
suite.addTestSuite( MavenITmng0851CustomPomFilenameTest.class );
suite.addTestSuite( MavenITmng0848SystemPropOverridesDefaultValueTest.class );

View File

@ -25,8 +25,7 @@ import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-249">MNG-249</a> and
* <a href="http://jira.codehaus.org/browse/MNG-870">MNG-870</a>.
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-249">MNG-249</a>.
*
* @author Brett Porter
* @version $Id$
@ -51,7 +50,6 @@ public class MavenITmng0249ResolveDepsFromReactorTest
"test-component-c/target/test-component-c-0.1.war!/WEB-INF/lib/test-component-a-0.1.jar" );
verifier.assertFilePresent(
"test-component-c/target/test-component-c-0.1.war!/WEB-INF/lib/test-component-b-0.1.jar" );
verifier.assertFilePresent( "test-component-c/target/my-test" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();

View File

@ -0,0 +1,63 @@
package org.apache.maven.it;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.File;
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-870">MNG-870</a>.
*
* @author Benjamin Bentmann
* @version $Id$
*/
public class MavenITmng0870ReactorAwarePluginDiscoveryTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng0870ReactorAwarePluginDiscoveryTest()
{
super();
}
/**
* Test that the reactor can resolve plugins that have just been built by a previous module and are not yet
* installed to the local repo.
*/
public void testitMNG0870()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0870" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "project/target" );
verifier.deleteArtifacts( "org.apache.maven.its.mng0870" );
verifier.filterFile( "pom.xml", "pom.xml", "UTF-8", verifier.newDefaultFilterProperties() );
verifier.executeGoal( "initialize" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "project/target/touch.txt" );
}
}

View File

@ -10,6 +10,5 @@
<module>test-component-c</module>
<module>test-component-b</module>
<module>test-component-a</module>
<module>test-plugin</module>
</modules>
</project>

View File

@ -17,24 +17,4 @@
<version>0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.it0042</groupId>
<artifactId>test-plugin</artifactId>
<version>0.1</version>
<configuration>
<value>my-test</value>
</configuration>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,19 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-it-it0042</artifactId>
<groupId>org.apache.maven.its.it0042</groupId>
<version>0.1</version>
</parent>
<artifactId>test-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>0.1</version>
<name>Test Plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0-beta-1</version>
</dependency>
</dependencies>
</project>

View File

@ -1,77 +0,0 @@
package org.apache.maven.plugin.coreit.it0042;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
/**
* @goal test
*
* @phase process-sources
*
* @description Goal which cleans the build
*/
public class CoreItMojo
extends AbstractMojo
{
/**
* @parameter expression="${project.build.directory}"
* @required
*/
private String outputDirectory;
/**
* @parameter
* @required
*/
private String value;
public void execute()
throws MojoExecutionException
{
touch( new File( outputDirectory ), value );
}
private static void touch( File dir, String file )
throws MojoExecutionException
{
try
{
if ( !dir.exists() )
{
dir.mkdirs();
}
File touch = new File( dir, file );
FileWriter w = new FileWriter( touch );
w.write( file );
w.close();
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error touching file", e );
}
}
}

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.its.mng0870</groupId>
<artifactId>test</artifactId>
<version>1-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.its.mng0870</groupId>
<artifactId>it-maven-plugin</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Maven Integration Test :: MNG-870 :: Test Plugin</name>
<description>
Test that the reactor can resolve plugins that have just been built by a previous module and are not yet
installed to the local repo.
</description>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<!--
NOTE: It's a essential part of the test to have a dependency that is not part of the core to check the plugin
POM is resolved, too.
-->
<groupId>org.apache.maven.its.mng0870</groupId>
<artifactId>dep</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>.</directory>
<includes>
<include>pom.xml</include>
<include>src/**</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<!-- We don't build the plugin from sources here but use the ready-made plugin artifact -->
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-artifact</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<mainFile>it-maven-plugin-0.1-SNAPSHOT.jar</mainFile>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>initialize</phase>
<goals>
<goal>set</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,86 @@
package org.apache.maven.plugin.coreit;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
/**
* Creates a touch file if and only if a resource from the plugin dependency was successfully loaded, fails otherwise.
*
* @goal load
* @phase validate
*
* @author Benjamin Bentmann
* @version $Id$
*/
public class LoadMojo
extends AbstractMojo
{
/**
* The path to the output file, relative to the project base directory.
*
* @parameter expression="${touch.file}" default-value="target/touch.txt"
*/
private File file;
/**
* Runs this mojo.
*
* @throws MojoExecutionException If the output file could not be created.
* @throws MojoFailureException If the output file has not been set.
*/
public void execute()
throws MojoExecutionException, MojoFailureException
{
String resource = "mng0870.properties";
getLog().info( "[MAVEN-CORE-IT-LOG] Loading resource from plugin dependency: " + resource );
URL url = getClass().getResource( "/" + resource );
getLog().info( "[MAVEN-CORE-IT-LOG] " + url );
if ( url == null )
{
throw new MojoExecutionException( "Resource was not found, incomplete plugin class realm" );
}
getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + file );
try
{
file.getParentFile().mkdirs();
file.createNewFile();
}
catch ( IOException e )
{
throw new MojoExecutionException( "Output file could not be created: " + file, e );
}
}
}

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng0870</groupId>
<artifactId>test</artifactId>
<version>1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Maven Integration Test :: MNG-870</name>
<description>
Test that the reactor can resolve plugins that have just been built by a previous module and are not yet
installed to the local repo.
</description>
<modules>
<module>plugin</module>
<module>project</module>
</modules>
<repositories>
<repository>
<id>maven-core-it</id>
<url>@baseurl@/repo</url>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven-core-it</id>
<url>@baseurl@/repo</url>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.its.mng0870</groupId>
<artifactId>test</artifactId>
<version>1-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.its.mng0870</groupId>
<artifactId>project</artifactId>
<version>0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-870 :: Plugin Consumer</name>
<description>
Test that the reactor can resolve plugins that have just been built by a previous module and are not yet
installed to the local repo.
</description>
<build>
<plugins>
<plugin>
<!-- Use the just built plugin which requires both its JAR and its POM (to get plugin dependencies) -->
<groupId>org.apache.maven.its.mng0870</groupId>
<artifactId>it-maven-plugin</artifactId>
<version>0.1-SNAPSHOT</version>
<configuration>
<file>target/touch.txt</file>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>initialize</phase>
<goals>
<goal>load</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng0870</groupId>
<artifactId>dep</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?><metadata>
<groupId>org.apache.maven.its.mng0870</groupId>
<artifactId>dep</artifactId>
<version>0.1</version>
<versioning>
<release>0.1</release>
<versions>
<version>0.1</version>
</versions>
<lastUpdated>20090116193749</lastUpdated>
</versioning>
</metadata>