[MNG-4238] IT to verify that artifact handlers used in a project packaging can be loaded from a project's own build extensions.

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@793748 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2009-07-13 23:35:26 +00:00
parent 1f91a4d7fa
commit c9a7107c0a
6 changed files with 229 additions and 5 deletions

View File

@ -0,0 +1,79 @@
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 org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.io.IOException;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3506">MNG-3506</a>.
*
* @author John Casey
* @version $Id$
*/
public class MavenITmng3506ArtifactHandlerExtensionUsageTest
extends AbstractMavenIntegrationTestCase
{
private static final String GID = "org.apache.maven.it.mng3506";
private static final String AID = "mng-3506";
private static final String VERSION = "1";
private static final String TYPE = "jar";
private static final String BAD_TYPE = "coreit";
public MavenITmng3506ArtifactHandlerExtensionUsageTest()
{
super( "(2.2.0,)" );
}
public void testProjectPackagingUsage()
throws IOException, VerificationException
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3506" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
// remove the artifact+POM that should be installed here.
verifier.deleteArtifact( GID, AID, VERSION, "pom" );
verifier.deleteArtifact( GID, AID, VERSION, TYPE );
// shouldn't exist, but we want to make sure we're testing the current pass properly...
verifier.deleteArtifact( GID, AID, VERSION, BAD_TYPE );
verifier.executeGoal( "install" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
// Now, if everything worked, we have a .pom and a .jar in the local repo.
// IF IT DIDN'T, we have a .pom and a .coreit in the local repo...
String path = verifier.getArtifactPath( GID, AID, VERSION, TYPE );
assertTrue( path + " should have been installed.", new File( path ).exists() );
path = verifier.getArtifactPath( GID, AID, VERSION, "pom" );
assertTrue( path + " should have been installed.", new File( path ).exists() );
path = verifier.getArtifactPath( GID, AID, VERSION, BAD_TYPE );
assertFalse( path + " should NOT have been installed.", new File( path ).exists() );
}
}

View File

@ -0,0 +1,24 @@
<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.it.mng3506</groupId>
<artifactId>mng-3506</artifactId>
<version>1</version>
<!-- This is the critical piece for the test.
If the extension's artifact handler is used, we'll install a .jar.
If it's not, the default artifact handler will cause Maven to
install a .coreit artifact.
-->
<packaging>coreit</packaging>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.its</groupId>
<artifactId>core-it-extension</artifactId>
<version>2.1-SNAPSHOT</version>
</extension>
</extensions>
</build>
</project>

View File

@ -0,0 +1,13 @@
package org.apache.maven.it.mng3506;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

View File

@ -0,0 +1,48 @@
<?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>core-integration-testing</artifactId>
<groupId>org.apache.maven.its</groupId>
<version>2.1-SNAPSHOT</version>
</parent>
<artifactId>core-it-extension</artifactId>
<name>Maven Integration Test Extension</name>
<dependencies>
<dependency>
<!--
NOTE: This is a dummy dependency required to make the DefaultExtensionManager load the wagon into the extension
container and not the core container. To be loaded into the extension container, an extension needs at least two
dependencies (not counting the ever present plexus-utils).
-->
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,62 @@
<!--
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.
-->
<component-set>
<components>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>coreit</role-hint>
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
<configuration>
<type>coreit</type>
<packaging>coreit</packaging>
<extension>jar</extension>
<language>java</language>
<addedToClasspath>true</addedToClasspath>
</configuration>
</component>
<component>
<!-- This is just a copy of the 'jar' lifecycle mapping, from maven-core. -->
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>coreit</role-hint>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<lifecycles>
<lifecycle>
<id>default</id>
<phases>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
<process-test-resources>
org.apache.maven.plugins:maven-resources-plugin:testResources
</process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
<package>
org.apache.maven.plugins:maven-jar-plugin:jar
</package>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
</lifecycle>
</lifecycles>
</configuration>
</component>
</components>
</component-set>

View File

@ -1,5 +1,4 @@
<?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
@ -17,9 +16,7 @@ software distributed under the License is distributed on an
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">
--><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>
@ -42,6 +39,7 @@ under the License.
<module>core-it-wagon</module>
<module>core-it-support-artifacts</module>
<module>maven-it-helper</module>
<module>core-it-extension</module>
</modules>
<scm>
@ -73,4 +71,4 @@ under the License.
</repositories>
</profile>
</profiles>
</project>
</project>