add a plugin dependency test as well to make sure this doesn't trigger the new validation errors

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@755194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-03-17 11:27:43 +00:00
parent 2e0ff48d0c
commit 848c7137a6
8 changed files with 193 additions and 3 deletions

View File

@ -22,6 +22,7 @@ package org.apache.maven.it;
import java.io.File;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import org.apache.maven.it.util.ResourceExtractor;
@ -37,10 +38,10 @@ public class MavenITmng4091BadPluginDescriptorTest
super( "[2.1.0,)" ); // only test in 2.1.0+
}
public void testitMNG4091()
public void testitMNG4091_InvalidDescriptor()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4091" );
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4091/invalid" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
@ -78,5 +79,21 @@ public class MavenITmng4091BadPluginDescriptorTest
assertTrue( "User-friendly message was not found in output.", foundMessage );
}
public void testitMNG4091_PluginDependency()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4091/plugin-dependency" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Properties props = verifier.loadProperties( "target/plugin-dependency.properties" );
assertTrue( props.isEmpty() );
}
}

View File

@ -157,6 +157,12 @@ under the License.
<version>${itPluginVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-plugin-dependency</artifactId>
<version>${itPluginVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-project-interpolation</artifactId>

View File

@ -27,7 +27,7 @@ under the License.
<version>1</version>
<packaging>pom</packaging>
<name>MNG-4091 - Profile activation warning test</name>
<name>MNG-4091 - Plugin with invalid descriptor test</name>
<build>
<plugins>

View File

@ -0,0 +1,54 @@
<?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 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.its.mng4091</groupId>
<artifactId>plugin-dependency-descriptor-test</artifactId>
<version>1</version>
<packaging>pom</packaging>
<name>MNG-4091 - Plugin dependency test</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-plugin-dependency</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test</id>
<phase>validate</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<file>target/plugin-dependency.properties</file>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -184,4 +184,9 @@ public class EvalMojo
getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile );
}
public void setOutputFile( File outputFile )
{
this.outputFile = outputFile;
}
}

View File

@ -0,0 +1,55 @@
<?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 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>
<artifactId>maven-it-plugins</artifactId>
<groupId>org.apache.maven.its.plugins</groupId>
<version>2.1-SNAPSHOT</version>
</parent>
<artifactId>maven-it-plugin-plugin-dependency</artifactId>
<packaging>maven-plugin</packaging>
<name>Maven Integration Test Plugin :: Plugin Dependency</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-expression</artifactId>
<version>2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,52 @@
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.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import java.io.File;
/**
* @goal test
*
* @phase process-sources
*/
public class DerivedItMojo
extends EvalMojo
{
/**
* The path to the output file for the properties with the expression values. For each expression given by the
* parameter {@link #expressions} an similar named properties key will be used to save the expression value. If an
* expression evaluated to <code>null</code>, there will be no corresponding key in the properties file.
*
* @parameter
*/
private File file;
public void execute()
throws MojoFailureException, MojoExecutionException
{
super.setOutputFile( file );
super.execute();
}
}

View File

@ -47,6 +47,7 @@ under the License.
<module>maven-it-plugin-no-project</module>
<module>maven-it-plugin-packaging</module>
<module>maven-it-plugin-parameter-implementation</module>
<module>maven-it-plugin-plugin-dependency</module>
<module>maven-it-plugin-project-interpolation</module>
<module>maven-it-plugin-setter</module>
<module>maven-it-plugin-site</module>