mirror of https://github.com/apache/maven.git
[MNG-4091] add test for bad plugin descriptor handling
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@755085 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
497c2faf6f
commit
2e0ff48d0c
|
@ -92,6 +92,7 @@ public class IntegrationTestSuite
|
||||||
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
|
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
|
||||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||||
|
|
||||||
|
suite.addTestSuite( MavenITmng4091BadPluginDescriptorTest.class );
|
||||||
suite.addTestSuite( MavenITmng4087PercentEncodedFileUrlTest.class );
|
suite.addTestSuite( MavenITmng4087PercentEncodedFileUrlTest.class );
|
||||||
suite.addTestSuite( MavenITmng4086ExplicitPluginMetaversionTest.class );
|
suite.addTestSuite( MavenITmng4086ExplicitPluginMetaversionTest.class );
|
||||||
suite.addTestSuite( MavenITmng4072InactiveProfileReposTest.class );
|
suite.addTestSuite( MavenITmng4072InactiveProfileReposTest.class );
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
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 java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MNG-4091 - Bad plugin descriptor error handling
|
||||||
|
*/
|
||||||
|
public class MavenITmng4091BadPluginDescriptorTest
|
||||||
|
extends AbstractMavenIntegrationTestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public MavenITmng4091BadPluginDescriptorTest()
|
||||||
|
{
|
||||||
|
super( "[2.1.0,)" ); // only test in 2.1.0+
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testitMNG4091()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4091" );
|
||||||
|
|
||||||
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
|
verifier.setAutoclean( false );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
verifier.executeGoal( "validate" );
|
||||||
|
|
||||||
|
fail( "should throw an error during execution." );
|
||||||
|
}
|
||||||
|
catch ( VerificationException e )
|
||||||
|
{
|
||||||
|
// expected...it'd be nice if we could get the specifics of the exception right here...
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
verifier.resetStreams();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
|
||||||
|
|
||||||
|
String msg = "Plugin's descriptor contains the wrong version: 2.0-SNAPSHOT";
|
||||||
|
|
||||||
|
boolean foundMessage = false;
|
||||||
|
for ( Iterator it = logFile.iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
String line = (String) it.next();
|
||||||
|
if ( line.indexOf( msg ) > -1 )
|
||||||
|
{
|
||||||
|
foundMessage = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue( "User-friendly message was not found in output.", foundMessage );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -109,6 +109,12 @@ under the License.
|
||||||
<version>${itPluginVersion}</version>
|
<version>${itPluginVersion}</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
|
<artifactId>maven-it-plugin-invalid-descriptor</artifactId>
|
||||||
|
<version>${itPluginVersion}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.its.plugins</groupId>
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
<artifactId>maven-it-plugin-log-file</artifactId>
|
<artifactId>maven-it-plugin-log-file</artifactId>
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?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-descriptor-test</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<name>MNG-4091 - Profile activation warning test</name>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
|
<artifactId>maven-it-plugin-invalid-descriptor</artifactId>
|
||||||
|
<version>2.1-SNAPSHOT</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>test</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>test</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?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-invalid-descriptor</artifactId>
|
||||||
|
<packaging>maven-plugin</packaging>
|
||||||
|
|
||||||
|
<name>Maven Integration Test Plugin :: Invalid Descriptor</name>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<!-- forces overwrite of generated one -->
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @goal test
|
||||||
|
*
|
||||||
|
* @phase process-sources
|
||||||
|
*/
|
||||||
|
public class CoreItMojo
|
||||||
|
extends AbstractMojo
|
||||||
|
{
|
||||||
|
public void execute()
|
||||||
|
throws MojoExecutionException
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException( "Should not be run" );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<plugin>
|
||||||
|
<description>Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.</description>
|
||||||
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
|
<artifactId>maven-it-plugin-invalid-descriptor</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
<goalPrefix>itinvalid-descriptor</goalPrefix>
|
||||||
|
<isolatedRealm>false</isolatedRealm>
|
||||||
|
<inheritedByDefault>true</inheritedByDefault>
|
||||||
|
<mojos>
|
||||||
|
<mojo>
|
||||||
|
<goal>test</goal>
|
||||||
|
<description></description>
|
||||||
|
<requiresDirectInvocation>false</requiresDirectInvocation>
|
||||||
|
<requiresProject>true</requiresProject>
|
||||||
|
<requiresReports>false</requiresReports>
|
||||||
|
<aggregator>false</aggregator>
|
||||||
|
<requiresOnline>false</requiresOnline>
|
||||||
|
<inheritedByDefault>true</inheritedByDefault>
|
||||||
|
<phase>process-sources</phase>
|
||||||
|
<implementation>org.apache.maven.plugin.coreit.CoreItMojo</implementation>
|
||||||
|
<language>java</language>
|
||||||
|
<instantiationStrategy>per-lookup</instantiationStrategy>
|
||||||
|
<executionStrategy>once-per-session</executionStrategy>
|
||||||
|
<parameters/>
|
||||||
|
</mojo>
|
||||||
|
</mojos>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
<version>2.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
|
@ -42,6 +42,7 @@ under the License.
|
||||||
<module>maven-it-plugin-expression</module>
|
<module>maven-it-plugin-expression</module>
|
||||||
<module>maven-it-plugin-error</module>
|
<module>maven-it-plugin-error</module>
|
||||||
<module>maven-it-plugin-fork</module>
|
<module>maven-it-plugin-fork</module>
|
||||||
|
<module>maven-it-plugin-invalid-descriptor</module>
|
||||||
<module>maven-it-plugin-log-file</module>
|
<module>maven-it-plugin-log-file</module>
|
||||||
<module>maven-it-plugin-no-project</module>
|
<module>maven-it-plugin-no-project</module>
|
||||||
<module>maven-it-plugin-packaging</module>
|
<module>maven-it-plugin-packaging</module>
|
||||||
|
|
Loading…
Reference in New Issue