Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 32186 invoked from network); 5 May 2006 10:18:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 May 2006 10:18:41 -0000 Received: (qmail 93826 invoked by uid 500); 5 May 2006 10:18:40 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 93608 invoked by uid 500); 5 May 2006 10:18:38 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 93593 invoked by uid 99); 5 May 2006 10:18:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 May 2006 03:18:37 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 05 May 2006 03:18:36 -0700 Received: (qmail 32043 invoked by uid 65534); 5 May 2006 10:18:16 -0000 Message-ID: <20060505101816.32042.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r400037 - in /maven/plugins/trunk/maven-assembly-plugin/src/test: java/org/apache/maven/plugin/assembly/ plugin-configs/directory-inline/ plugin-configs/directory/ Date: Fri, 05 May 2006 10:18:14 -0000 To: commits@maven.apache.org From: aramirez@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: aramirez Date: Fri May 5 03:18:12 2006 New Revision: 400037 URL: http://svn.apache.org/viewcvs?rev=400037&view=rev Log: PR: MASSEMBLY-88 added test for both directory-inline and directory mojo Added: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory-inline/ maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory-inline/min-plugin-config.xml maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/appendAssemblyId-false-plugin-config.xml maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/min-plugin-config-with-exceptions.xml Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java Added: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java?rev=400037&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryInlineMojoTest.java Fri May 5 03:18:12 2006 @@ -0,0 +1,50 @@ +package org.apache.maven.plugin.assembly; + +import org.apache.maven.plugin.assembly.stubs.ArchiverManagerStub; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.project.MavenProject; + +import java.io.File; +import java.util.Map; +import java.util.Set; +import java.util.Iterator; + +/* + * Copyright 2001-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. + */ + +public class DirectoryInlineMojoTest +extends AbstractMojoTestCase +{ + public void testAssemblyDirectory() + throws Exception + { + File testPom = new File( getBasedir(), + "src/test/plugin-configs/directory-inline/min-plugin-config.xml" ); + + DirectoryInlineMojo mojo = ( DirectoryInlineMojo ) lookupMojo( "directory-inline", testPom ); + + assertNotNull( mojo ); + + mojo.execute(); + + Map filesArchived = ArchiverManagerStub.archiverStub.getFiles(); + + Set files = filesArchived.keySet(); + + assertEquals( 1, files.size() ); + } +} Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java?rev=400037&r1=400036&r2=400037&view=diff ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java (original) +++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/DirectoryMojoTest.java Fri May 5 03:18:12 2006 @@ -1,7 +1,7 @@ package org.apache.maven.plugin.assembly; /* - * Copyright 2001-2006 The Apache Software Foundation. + * 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. @@ -62,6 +62,46 @@ assertEquals( 1, files.size() ); } + public void testAssemblyDirectoryWithAppendAssemblyIdAsFalse() + throws Exception + { + File testPom = new File( getBasedir(), + "src/test/plugin-configs/directory/appendAssemblyId-false-plugin-config.xml" ); + + DirectoryMojo mojo = ( DirectoryMojo ) lookupMojo( "directory", testPom ); + + assertNotNull( mojo ); + + String classifier = ( String ) getVariableValueFromObject( mojo, "classifier" ); + + String finalName = ( String ) getVariableValueFromObject( mojo, "finalName" ); + + File outputDir = ( File ) getVariableValueFromObject( mojo, "outputDirectory" ); + + MavenProject project = ( MavenProject ) getVariableValueFromObject( mojo, "executedProject" ); + + Set artifacts = project.getArtifacts(); + + mojo.execute(); + + File dir = new File( outputDir, finalName + "-" + classifier ); + + assertTrue( dir.exists() ); + + Map filesArchived = ArchiverManagerStub.archiverStub.getFiles(); + + Set files = filesArchived.keySet(); + + for( Iterator iter = artifacts.iterator(); iter.hasNext(); ) + { + Artifact artifact = ( Artifact ) iter.next(); + + assertTrue( files.contains( artifact.getFile() ) ); + assertTrue( artifact.getFile().getName().endsWith( ".jar" ) ); + } + + assertTrue( "Test project is in archive", files.contains( project.getArtifact().getFile() ) ); + } public void testAssemblyDirectoryWithDependencySet() throws Exception @@ -92,5 +132,27 @@ } assertTrue( "Test project is in archive", files.contains( project.getArtifact().getFile() ) ); + } + + public void testAssemblyDirectoryToThrowNoSuchArchiverException() + throws Exception + { + File testPom = new File( getBasedir(), + "src/test/plugin-configs/directory/min-plugin-config-with-exceptions.xml" ); + + DirectoryMojo mojo = ( DirectoryMojo ) lookupMojo( "directory", testPom ); + + assertNotNull( mojo ); + + try + { + mojo.execute(); + + fail( "Failure Expected" ); + } + catch( Exception e ) + { + //expected + } } } Added: maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory-inline/min-plugin-config.xml URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory-inline/min-plugin-config.xml?rev=400037&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory-inline/min-plugin-config.xml (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory-inline/min-plugin-config.xml Fri May 5 03:18:12 2006 @@ -0,0 +1,33 @@ + + + + + + maven-assembly-plugin + + ${basedir}/src/test/resources/assemblies/simple.xml + ${basedir} + + ${basedir}/target/test-harness/directory-inline/min/target + directory-inline-min + + true + + + + + \ No newline at end of file Added: maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/appendAssemblyId-false-plugin-config.xml URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/appendAssemblyId-false-plugin-config.xml?rev=400037&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/appendAssemblyId-false-plugin-config.xml (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/appendAssemblyId-false-plugin-config.xml Fri May 5 03:18:12 2006 @@ -0,0 +1,35 @@ + + + + + + maven-assembly-plugin + + ${basedir}/src/test/resources/assemblies/dependencySet-default.xml + ${basedir} + + + ${basedir}/target/test-harness/directory/appendAssemblyId-false/target + directory-appendAssemblyId-false + + false + classifier + + + + + \ No newline at end of file Added: maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/min-plugin-config-with-exceptions.xml URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/min-plugin-config-with-exceptions.xml?rev=400037&view=auto ============================================================================== --- maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/min-plugin-config-with-exceptions.xml (added) +++ maven/plugins/trunk/maven-assembly-plugin/src/test/plugin-configs/directory/min-plugin-config-with-exceptions.xml Fri May 5 03:18:12 2006 @@ -0,0 +1,33 @@ + + + + + + maven-assembly-plugin + + ${basedir}/src/test/resources/assemblies/simple.xml + ${basedir} + + ${basedir}/target/test-harness/directory-inline/min/target + directory-inline-min + + true + + + + + \ No newline at end of file