You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by fg...@apache.org on 2006/06/27 13:44:20 UTC
svn commit: r417436 - in /maven/plugins/trunk/maven-repository-plugin/src:
main/java/org/apache/maven/plugins/repository/
test/java/org/apache/maven/plugins/repository/ test/resources/repo/
test/resources/repo/testgroup/ test/resources/repo/testgroup/t...
Author: fgiust
Date: Tue Jun 27 04:44:19 2006
New Revision: 417436
URL: http://svn.apache.org/viewvc?rev=417436&view=rev
Log:
adding tests for bundle-pack goal
Added:
maven/plugins/trunk/maven-repository-plugin/src/test/java/org/apache/maven/plugins/repository/BundlePackMojoTest.java (with props)
maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/
maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/
maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/
maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/
maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0-javadoc.jar
maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0-sources.jar
maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0.jar
maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0.pom
maven/plugins/trunk/maven-repository-plugin/src/test/resources/unit/bundle-pack/
maven/plugins/trunk/maven-repository-plugin/src/test/resources/unit/bundle-pack/pom.xml (with props)
Modified:
maven/plugins/trunk/maven-repository-plugin/src/main/java/org/apache/maven/plugins/repository/BundlePackMojo.java
Modified: maven/plugins/trunk/maven-repository-plugin/src/main/java/org/apache/maven/plugins/repository/BundlePackMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-repository-plugin/src/main/java/org/apache/maven/plugins/repository/BundlePackMojo.java?rev=417436&r1=417435&r2=417436&view=diff
==============================================================================
--- maven/plugins/trunk/maven-repository-plugin/src/main/java/org/apache/maven/plugins/repository/BundlePackMojo.java (original)
+++ maven/plugins/trunk/maven-repository-plugin/src/main/java/org/apache/maven/plugins/repository/BundlePackMojo.java Tue Jun 27 04:44:19 2006
@@ -57,7 +57,7 @@
/**
* @parameter expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
*/
- private JarArchiver jarArchiver;
+ protected JarArchiver jarArchiver;
/**
* Artifact resolver.
@@ -66,7 +66,7 @@
* @required
* @readonly
*/
- private ArtifactResolver artifactResolver;
+ protected ArtifactResolver artifactResolver;
/**
* Artifact factory.
@@ -87,29 +87,29 @@
protected ArtifactRepository localRepository;
/**
- * @parameter expression="${groupId}"
+ * @component
*/
- private String groupId;
+ protected InputHandler inputHandler;
/**
- * @parameter expression="${artifactId}"
+ * @parameter expression="${basedir}"
*/
- private String artifactId;
+ protected String basedir;
/**
- * @parameter expression="${version}"
+ * @parameter expression="${groupId}"
*/
- private String version;
+ protected String groupId;
/**
- * @component
+ * @parameter expression="${artifactId}"
*/
- private InputHandler inputHandler;
+ protected String artifactId;
/**
- * @parameter expression="${basedir}"
+ * @parameter expression="${version}"
*/
- private String basedir;
+ protected String version;
public void execute()
throws MojoExecutionException
Added: maven/plugins/trunk/maven-repository-plugin/src/test/java/org/apache/maven/plugins/repository/BundlePackMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-repository-plugin/src/test/java/org/apache/maven/plugins/repository/BundlePackMojoTest.java?rev=417436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-repository-plugin/src/test/java/org/apache/maven/plugins/repository/BundlePackMojoTest.java (added)
+++ maven/plugins/trunk/maven-repository-plugin/src/test/java/org/apache/maven/plugins/repository/BundlePackMojoTest.java Tue Jun 27 04:44:19 2006
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2005-2006 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.
+ */
+package org.apache.maven.plugins.repository;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.codehaus.plexus.archiver.zip.ZipEntry;
+import org.codehaus.plexus.archiver.zip.ZipFile;
+
+/**
+ * @author Fabrizio Giustina
+ * @version $Id$
+ */
+public class BundlePackMojoTest
+ extends AbstractMojoTestCase
+{
+
+ public void testPack()
+ throws Exception
+ {
+
+ File testPom = new File( getBasedir(), "src/test/resources/unit/bundle-pack/pom.xml" );
+
+ BundlePackMojo mojo = (BundlePackMojo) lookupMojo( "bundle-pack", testPom );
+ URL repoURL = new File( getBasedir(), "src/test/resources/repo" ).toURL();
+ mojo.localRepository = new DefaultArtifactRepository( "test", repoURL.toString(), new DefaultRepositoryLayout() );
+
+ File generatedFilesDir = new File( getBasedir(), "target/bundle-pack-tests" );
+ mojo.basedir = generatedFilesDir.getAbsolutePath();
+ mojo.execute();
+
+ ZipFile jar = new ZipFile( new File( generatedFilesDir, "testartifact-1.0-bundle.jar" ) );
+ Enumeration entries = jar.getEntries();
+ assertTrue( entries.hasMoreElements() );
+
+ if ( entries.hasMoreElements() )
+ {
+ ZipEntry entry = (ZipEntry) entries.nextElement();
+ assertEquals( entry.getName(), "testartifact-1.0-javadoc.jar" );
+
+ entry = (ZipEntry) entries.nextElement();
+ assertEquals( entry.getName(), "testartifact-1.0-sources.jar" );
+
+ entry = (ZipEntry) entries.nextElement();
+ assertEquals( entry.getName(), "testartifact-1.0.jar" );
+
+ entry = (ZipEntry) entries.nextElement();
+ assertEquals( entry.getName(), "pom.xml" );
+
+ entry = (ZipEntry) entries.nextElement();
+ assertEquals( entry.getName(), "META-INF/MANIFEST.MF" );
+
+ entry = (ZipEntry) entries.nextElement();
+ assertEquals( entry.getName(), "META-INF/" );
+ }
+
+ }
+
+}
Propchange: maven/plugins/trunk/maven-repository-plugin/src/test/java/org/apache/maven/plugins/repository/BundlePackMojoTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-repository-plugin/src/test/java/org/apache/maven/plugins/repository/BundlePackMojoTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0-javadoc.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0-javadoc.jar?rev=417436&view=auto
==============================================================================
(empty)
Added: maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0-sources.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0-sources.jar?rev=417436&view=auto
==============================================================================
(empty)
Added: maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0.jar?rev=417436&view=auto
==============================================================================
(empty)
Added: maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0.pom
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0.pom?rev=417436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0.pom (added)
+++ maven/plugins/trunk/maven-repository-plugin/src/test/resources/repo/testgroup/testartifact/1.0/testartifact-1.0.pom Tue Jun 27 04:44:19 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>testgroup</groupId>
+ <artifactId>testartifact</artifactId>
+ <version>1.0</version>
+ <name>Test Artifact</name>
+ <url>http://dummy/project</url>
+ <description>just a dummy project for tests</description>
+ <licenses>
+ <license>
+ <name>dummy license name</name>
+ <url>dummy license url</url>
+ </license>
+ </licenses>
+</project>
Added: maven/plugins/trunk/maven-repository-plugin/src/test/resources/unit/bundle-pack/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-repository-plugin/src/test/resources/unit/bundle-pack/pom.xml?rev=417436&view=auto
==============================================================================
--- maven/plugins/trunk/maven-repository-plugin/src/test/resources/unit/bundle-pack/pom.xml (added)
+++ maven/plugins/trunk/maven-repository-plugin/src/test/resources/unit/bundle-pack/pom.xml Tue Jun 27 04:44:19 2006
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>def.configuration</groupId>
+ <artifactId>default-configuration</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-repository-plugin</artifactId>
+ <configuration>
+ <groupId>testgroup</groupId>
+ <artifactId>testartifact</artifactId>
+ <version>1.0</version>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/plugins/trunk/maven-repository-plugin/src/test/resources/unit/bundle-pack/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision