mirror of https://github.com/apache/maven.git
o Decoupled IT for MNG-3680 from production deps/plugins
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@734236 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ea82a49374
commit
2c44c15783
|
@ -20,46 +20,44 @@ package org.apache.maven.it;
|
|||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.it.Verifier;
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
/**
|
||||
* Verify that dependencies with invalid POMs can still be used without failing
|
||||
* the build.
|
||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3680">MNG-3680</a>.
|
||||
*
|
||||
* @author jdcasey
|
||||
*/
|
||||
public class MavenITmng3680InvalidDependencyPOMTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng3680InvalidDependencyPOMTest()
|
||||
{
|
||||
super( "(2.0.9,)" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verify that dependencies with invalid POMs can still be used without failing the build.
|
||||
*/
|
||||
public void testitMNG3680 ()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3680" );
|
||||
File pluginDir = new File( testDir, "maven-mng3680-plugin" );
|
||||
|
||||
Verifier verifier = new Verifier( pluginDir.getAbsolutePath() );
|
||||
|
||||
verifier.executeGoal( "install" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
|
||||
verifier.deleteArtifact( "tests", "dep-L1", "1", "jar" );
|
||||
verifier.deleteArtifact( "tests", "dep-L1", "1", "pom" );
|
||||
|
||||
verifier.deleteArtifact( "tests", "dep-L1", "1", "jar" );
|
||||
verifier.deleteArtifact( "tests", "dep-L2", "1", "pom" );
|
||||
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.deleteArtifacts( "org.apache.maven.its.mng3680" );
|
||||
verifier.executeGoal( "validate" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
List artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
|
||||
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng3680:direct:jar:0.1" ) );
|
||||
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng3680:transitive:jar:0.1" ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<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>tests</groupId>
|
||||
<artifactId>dep-L2</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1</version>
|
||||
<name>dep-L2</name>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>dep-repo</id>
|
||||
<url>file://${pom.basedir}/..</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
|
@ -1,13 +0,0 @@
|
|||
package tests.level2;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class AppLevel2
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello World!" );
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -1,28 +0,0 @@
|
|||
<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>tests</groupId>
|
||||
<artifactId>dep-L1</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>tests</groupId>
|
||||
<artifactId>dep-L2</artifactId>
|
||||
<version>1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- This is an invalid repositories section, which would trip up the model parser
|
||||
if it were used in strict mode, or if the handling of the strict-mode flag
|
||||
doesn't apply to association lists.
|
||||
|
||||
Dependency POMs should always be parsed in non-strict mode, so this
|
||||
shouldn't prevent the inclusion of the above dependency.
|
||||
-->
|
||||
<repositories>
|
||||
<id>imaginary-repo</id>
|
||||
<url>http://repository.imaginary/</url>
|
||||
</repositories>
|
||||
</project>
|
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
624ade12bfc6d4f4b651626cf9009700
|
|
@ -1 +0,0 @@
|
|||
f4f142d0469c316b1ee67c05445415ec8ff38e4e
|
|
@ -1,16 +0,0 @@
|
|||
<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>tests</groupId>
|
||||
<artifactId>dep-L2</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1</version>
|
||||
<name>dep-L2</name>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>dep-repo</id>
|
||||
<url>file://${pom.basedir}/..</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
|
@ -1 +0,0 @@
|
|||
980a7b547686732abf321a5c17c95fb1
|
|
@ -1 +0,0 @@
|
|||
cce03f3942f7aadaee9ed0e8f4cf384fa4fed319
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<groupId>tests</groupId>
|
||||
<artifactId>dep-L2</artifactId>
|
||||
<version>1</version>
|
||||
<versioning>
|
||||
<versions>
|
||||
<version>1</version>
|
||||
</versions>
|
||||
<lastUpdated>20080725163900</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
|
@ -1 +0,0 @@
|
|||
daa840dd62763fc61fdf6d78ef6c7da3
|
|
@ -1 +0,0 @@
|
|||
3f10e68aeceeb95476ec0b0ba3ed2be3ab245be9
|
|
@ -1,28 +0,0 @@
|
|||
<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.mng3680</groupId>
|
||||
<artifactId>maven-mng3680-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
<name>maven-mng3680-plugin Maven Mojo</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<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>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,79 +0,0 @@
|
|||
package plugin;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 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.artifact.Artifact;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Goal which touches a timestamp file.
|
||||
*
|
||||
* @goal check
|
||||
* @requiresDependencyResolution compile
|
||||
* @phase validate
|
||||
*/
|
||||
public class MyMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${project.compileArtifacts}"
|
||||
* @required
|
||||
*/
|
||||
private List artifacts;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
boolean foundL1 = false;
|
||||
boolean foundL2 = false;
|
||||
|
||||
if ( artifacts != null )
|
||||
{
|
||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
||||
{
|
||||
Artifact artifact = (Artifact) it.next();
|
||||
|
||||
if ( !foundL1 && artifact.getArtifactId().equals( "dep-L1" ) )
|
||||
{
|
||||
foundL1 = true;
|
||||
}
|
||||
else if ( !foundL2 && artifact.getArtifactId().equals( "dep-L2" ) )
|
||||
{
|
||||
foundL2 = true;
|
||||
}
|
||||
|
||||
if ( foundL1 && foundL2 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !foundL1 || !foundL2 )
|
||||
{
|
||||
throw new MojoExecutionException( "Didn't find the following artifacts: " + ( foundL1 ? "" : "\n- dep-L1" )
|
||||
+ ( foundL2 ? "" : "\n- dep-L2" ) );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,45 +1,54 @@
|
|||
<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.mng3680</groupId>
|
||||
<artifactId>mng-3680-invalidDependencyPOM</artifactId>
|
||||
<artifactId>test</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1</version>
|
||||
<name>mng-3680-invalidDependencyPOM</name>
|
||||
|
||||
<name>Maven Integration Test :: MNG-3680</name>
|
||||
<description>
|
||||
Verify that dependencies with invalid POMs can still be used without failing the build.
|
||||
</description>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dep-repo</id>
|
||||
<url>file://${pom.basedir}/dep-repo</url>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
<releases>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tests</groupId>
|
||||
<artifactId>dep-L1</artifactId>
|
||||
<version>1</version>
|
||||
<!-- This has a broken POM, yet it's dependencies should contribute to this build -->
|
||||
<groupId>org.apache.maven.its.mng3680</groupId>
|
||||
<artifactId>direct</artifactId>
|
||||
<version>0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.mng3680</groupId>
|
||||
<artifactId>maven-mng3680-plugin</artifactId>
|
||||
<version>1</version>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-dependency-resolution</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>check-deps</id>
|
||||
<id>test</id>
|
||||
<phase>validate</phase>
|
||||
<configuration>
|
||||
<testArtifacts>target/artifacts.txt</testArtifacts>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,57 @@
|
|||
<?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.mng3680</groupId>
|
||||
<artifactId>direct</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its.mng3680</groupId>
|
||||
<artifactId>transitive</artifactId>
|
||||
<version>0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!--
|
||||
This is an invalid repositories section (missing <repository> element), which would trip up the model parser
|
||||
if it were used in strict mode, or if the handling of the strict-mode flag
|
||||
doesn't apply to association lists.
|
||||
|
||||
Dependency POMs should always be parsed in non-strict mode, so this
|
||||
shouldn't prevent the inclusion of the above dependency.
|
||||
-->
|
||||
<repositories>
|
||||
<id>imaginary-repo</id>
|
||||
<url>http://repository.imaginary/</url>
|
||||
</repositories>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><metadata>
|
||||
<groupId>org.apache.maven.its.mng3680</groupId>
|
||||
<artifactId>direct</artifactId>
|
||||
<version>0.1</version>
|
||||
<versioning>
|
||||
<versions>
|
||||
<version>0.1</version>
|
||||
</versions>
|
||||
<lastUpdated>20090113200208</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
Binary file not shown.
|
@ -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.mng3680</groupId>
|
||||
<artifactId>transitive</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><metadata>
|
||||
<groupId>org.apache.maven.its.mng3680</groupId>
|
||||
<artifactId>transitive</artifactId>
|
||||
<version>0.1</version>
|
||||
<versioning>
|
||||
<versions>
|
||||
<version>0.1</version>
|
||||
</versions>
|
||||
<lastUpdated>20090113200129</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
|
@ -1,15 +0,0 @@
|
|||
package tests;
|
||||
|
||||
import tests.level2.AppLevel2;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello World!" );
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package tests;
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue