You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2009/07/14 01:35:27 UTC

svn commit: r793748 - in /maven/core-integration-testing/trunk: core-it-suite/src/test/java/org/apache/maven/it/ core-it-suite/src/test/resources/mng-3506/ core-it-suite/src/test/resources/mng-3506/src/ core-it-suite/src/test/resources/mng-3506/src/mai...

Author: jdcasey
Date: Mon Jul 13 23:35:26 2009
New Revision: 793748

URL: http://svn.apache.org/viewvc?rev=793748&view=rev
Log:
[MNG-3506] IT to verify that artifact handlers used in a project packaging can be loaded from a project's own build extensions.

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3506ArtifactHandlerExtensionUsageTest.java
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/pom.xml
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/apache/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/apache/maven/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/apache/maven/it/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/apache/maven/it/mng3506/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/apache/maven/it/mng3506/App.java
    maven/core-integration-testing/trunk/core-it-support/core-it-extension/
    maven/core-integration-testing/trunk/core-it-support/core-it-extension/pom.xml
    maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/
    maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/main/
    maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/main/resources/
    maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/main/resources/META-INF/
    maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/main/resources/META-INF/plexus/
    maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/main/resources/META-INF/plexus/components.xml
Modified:
    maven/core-integration-testing/trunk/core-it-support/pom.xml

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3506ArtifactHandlerExtensionUsageTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3506ArtifactHandlerExtensionUsageTest.java?rev=793748&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3506ArtifactHandlerExtensionUsageTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3506ArtifactHandlerExtensionUsageTest.java Mon Jul 13 23:35:26 2009
@@ -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() );
+    }
+}

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/pom.xml?rev=793748&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/pom.xml Mon Jul 13 23:35:26 2009
@@ -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>

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/apache/maven/it/mng3506/App.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/apache/maven/it/mng3506/App.java?rev=793748&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/apache/maven/it/mng3506/App.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3506/src/main/java/org/apache/maven/it/mng3506/App.java Mon Jul 13 23:35:26 2009
@@ -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!" );
+    }
+}

Added: maven/core-integration-testing/trunk/core-it-support/core-it-extension/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-extension/pom.xml?rev=793748&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-extension/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-extension/pom.xml Mon Jul 13 23:35:26 2009
@@ -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>

Added: maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/main/resources/META-INF/plexus/components.xml?rev=793748&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/main/resources/META-INF/plexus/components.xml (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-extension/src/main/resources/META-INF/plexus/components.xml Mon Jul 13 23:35:26 2009
@@ -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>
\ No newline at end of file

Modified: maven/core-integration-testing/trunk/core-it-support/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/pom.xml?rev=793748&r1=793747&r2=793748&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/pom.xml (original)
+++ maven/core-integration-testing/trunk/core-it-support/pom.xml Mon Jul 13 23:35:26 2009
@@ -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 @@
 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 @@
     <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 @@
       </repositories>
     </profile>
   </profiles>
-</project>
+</project>
\ No newline at end of file