You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2007/11/29 20:40:40 UTC

svn commit: r599558 - in /maven/plugins/trunk/maven-deploy-plugin/src: site/ site/apt/ site/apt/examples/ site/fml/ test/java/org/apache/maven/plugin/deploy/

Author: dennisl
Date: Thu Nov 29 11:40:37 2007
New Revision: 599558

URL: http://svn.apache.org/viewvc?rev=599558&view=rev
Log:
o Set EOL style to native.

Modified:
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploy-ftp.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploy-ssh-external.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploying-in-legacy-layout.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploying-with-classifiers.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploying-with-customed-pom.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/disabling-generic-pom.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/disabling-timestamps-suffix.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/file-deployment.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/index.apt   (contents, props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/project-deployment.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/apt/usage.apt   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/fml/faq.fml   (props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/site/site.xml   (contents, props changed)
    maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployFileMojoTest.java   (contents, props changed)

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploy-ftp.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploy-ssh-external.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploying-in-legacy-layout.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploying-with-classifiers.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/deploying-with-customed-pom.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/disabling-generic-pom.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/examples/disabling-timestamps-suffix.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/file-deployment.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/site/apt/index.apt?rev=599558&r1=599557&r2=599558&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/site/apt/index.apt (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/site/apt/index.apt Thu Nov 29 11:40:37 2007
@@ -1,83 +1,83 @@
-  ------
-  Maven 2 Deploy Plugin
-  ------
-  Jerome Lacoste
-  ------
-  January 29 2006
-  ------
-
-Maven Deploy Plugin
-  
-  The deploy plugin is primarily used during the deploy phase, to add your
-  artifact(s) to a remote repository for sharing with other developers and
-  projects. This is usually done in an integration or release environment. It can
-  also be used to deploy a particular artifact (e.g. a third party jar like
-  Sun's non redistributable reference implementations).
-
-  As a repository contains more than the artifacts (POMs, the metadata, MD5 and
-  SHA1 hash files...), deploying means not only copying the artifacts, but
-  making sure all this information is correctly updated. It's the reponsibility
-  of the deploy plugin.
-
-  To work, the deployment will require:
-
-  * information about the repository: its location, the transport method used to
-    access it (FTP, SCP, SFTP...) and the optional user specific required 
-    account information
-
-  * information about the artifact(s): the group, artifact, version, packaging,
-    classifier...
-
-  * a deployer: a method to actually perform the deployment. This can be
-    implemented as a wagon transport (making it cross-platform), or use a system
-    specific method.
-
-  []
-
-  The information will be taken from the implied (or specified) pom and from the
-  command line. The settings.xml file may also be parsed to retrieve user
-  credentials.
-
-
-* Goals Overview
-
-  The deploy plugin has 2 goals:
-
-  * {{{deploy-mojo.html}deploy:deploy}} is used to automatically install the
-    artifact, its pom and the attached artifacts produced by a particular
-    project. Most if not all of the information related to the deployment is stored
-    in the project's pom.
-
-  * {{{deploy-file-mojo.html}deploy:deploy-file}} is used to install a single artifact
-    along with its pom. In that case the artifact information can be taken from 
-    an optionally specified pomFile, but can be completed/overriden using the 
-    command line.
-
-* How To Use
-
-  Instructions on how to use the deploy plugin can be found {{{usage.html}here}}.
-
-* Examples
-
-  To provide you with better understanding on some usages of the deploy plugin,
-  you can take a look into the following examples:
-
-  <Project Deployment:>
-
-  * {{{examples/deploy-ftp.html}Deployment with FTP}}
-
-  * {{{examples/deploy-ssh-external.html}Deployment with external SSH}}
-
-  []
-
-  <File Deployment:>
-
-  * {{{examples/disabling-generic-pom.html}Disable the generation of pom}}
-
-  * {{{examples/deploying-with-customed-pom.html}Deploy an artifact with a customed pom}}
-
-  * {{{examples/deploying-with-classifiers.html}Deploy an artifact with classifier}}
-
-  * {{{examples/disabling-timestamps-suffix.html}Disable timestamps suffix in an artifact}}
-
-  * {{{examples/deploying-in-legacy-layout.html}Deploy an artifact in legacy layout}}
+  ------
+  Maven 2 Deploy Plugin
+  ------
+  Jerome Lacoste
+  ------
+  January 29 2006
+  ------
+
+Maven Deploy Plugin
+  
+  The deploy plugin is primarily used during the deploy phase, to add your
+  artifact(s) to a remote repository for sharing with other developers and
+  projects. This is usually done in an integration or release environment. It can
+  also be used to deploy a particular artifact (e.g. a third party jar like
+  Sun's non redistributable reference implementations).
+
+  As a repository contains more than the artifacts (POMs, the metadata, MD5 and
+  SHA1 hash files...), deploying means not only copying the artifacts, but
+  making sure all this information is correctly updated. It's the reponsibility
+  of the deploy plugin.
+
+  To work, the deployment will require:
+
+  * information about the repository: its location, the transport method used to
+    access it (FTP, SCP, SFTP...) and the optional user specific required 
+    account information
+
+  * information about the artifact(s): the group, artifact, version, packaging,
+    classifier...
+
+  * a deployer: a method to actually perform the deployment. This can be
+    implemented as a wagon transport (making it cross-platform), or use a system
+    specific method.
+
+  []
+
+  The information will be taken from the implied (or specified) pom and from the
+  command line. The settings.xml file may also be parsed to retrieve user
+  credentials.
+
+
+* Goals Overview
+
+  The deploy plugin has 2 goals:
+
+  * {{{deploy-mojo.html}deploy:deploy}} is used to automatically install the
+    artifact, its pom and the attached artifacts produced by a particular
+    project. Most if not all of the information related to the deployment is stored
+    in the project's pom.
+
+  * {{{deploy-file-mojo.html}deploy:deploy-file}} is used to install a single artifact
+    along with its pom. In that case the artifact information can be taken from 
+    an optionally specified pomFile, but can be completed/overriden using the 
+    command line.
+
+* How To Use
+
+  Instructions on how to use the deploy plugin can be found {{{usage.html}here}}.
+
+* Examples
+
+  To provide you with better understanding on some usages of the deploy plugin,
+  you can take a look into the following examples:
+
+  <Project Deployment:>
+
+  * {{{examples/deploy-ftp.html}Deployment with FTP}}
+
+  * {{{examples/deploy-ssh-external.html}Deployment with external SSH}}
+
+  []
+
+  <File Deployment:>
+
+  * {{{examples/disabling-generic-pom.html}Disable the generation of pom}}
+
+  * {{{examples/deploying-with-customed-pom.html}Deploy an artifact with a customed pom}}
+
+  * {{{examples/deploying-with-classifiers.html}Deploy an artifact with classifier}}
+
+  * {{{examples/disabling-timestamps-suffix.html}Disable timestamps suffix in an artifact}}
+
+  * {{{examples/deploying-in-legacy-layout.html}Deploy an artifact in legacy layout}}

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/index.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/project-deployment.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/apt/usage.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/fml/faq.fml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-deploy-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/site/site.xml?rev=599558&r1=599557&r2=599558&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/site/site.xml Thu Nov 29 11:40:37 2007
@@ -1,45 +1,45 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
-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>
-  <body>
-    <menu name="Overview">
-      <item name="Introduction" href="index.html"/>
-      <item name="Goals" href="plugin-info.html"/>
-      <item name="Usage" href="usage.html"/>
-      <item name="FAQ" href="faq.html"/>
-    </menu>
-    <menu name="Examples">
-      <item name="Project Deployment" collapse="true" href="project-deployment.html">
-        <item name="Deployment with FTP" href="examples/deploy-ftp.html" />
-        <item name="Deployment with external SSH " href="examples/deploy-ssh-external.html"/>
-      </item>
-
-      <item name="File Deployment" collapse="true" href="file-deployment.html">
-        <item name="Disable the generation of pom" href="examples/disabling-generic-pom.html"/>
-        <item name="Deploy an artifact with a customed pom" href="examples/deploying-with-customed-pom.html"/>
-        <item name="Deploy an artifact with classifier" href="examples/deploying-with-classifiers.html"/>
-        <item name="Disable timestamps suffix in an artifact" href="examples/disabling-timestamps-suffix.html"/>
-        <item name="Deploy an artifact in legacy layout" href="examples/deploying-in-legacy-layout.html"/>
-      </item>
-    </menu>
-  </body>
-</project>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+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>
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+      <item name="Goals" href="plugin-info.html"/>
+      <item name="Usage" href="usage.html"/>
+      <item name="FAQ" href="faq.html"/>
+    </menu>
+    <menu name="Examples">
+      <item name="Project Deployment" collapse="true" href="project-deployment.html">
+        <item name="Deployment with FTP" href="examples/deploy-ftp.html" />
+        <item name="Deployment with external SSH " href="examples/deploy-ssh-external.html"/>
+      </item>
+
+      <item name="File Deployment" collapse="true" href="file-deployment.html">
+        <item name="Disable the generation of pom" href="examples/disabling-generic-pom.html"/>
+        <item name="Deploy an artifact with a customed pom" href="examples/deploying-with-customed-pom.html"/>
+        <item name="Deploy an artifact with classifier" href="examples/deploying-with-classifiers.html"/>
+        <item name="Disable timestamps suffix in an artifact" href="examples/disabling-timestamps-suffix.html"/>
+        <item name="Deploy an artifact in legacy layout" href="examples/deploying-in-legacy-layout.html"/>
+      </item>
+    </menu>
+  </body>
+</project>

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployFileMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployFileMojoTest.java?rev=599558&r1=599557&r2=599558&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployFileMojoTest.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployFileMojoTest.java Thu Nov 29 11:40:37 2007
@@ -1,349 +1,349 @@
-package org.apache.maven.plugin.deploy;
-
-/*
- * 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 java.io.File;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.model.Model;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * @author <a href="mailto:aramirez@apache.org">Allan Ramirez</a>
- */
-public class DeployFileMojoTest
-    extends AbstractMojoTestCase
-{
-    private List expectedFiles;
-
-    private List fileList;
-
-    private File localRepo;
-
-    private File remoteRepo;
-
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-
-        remoteRepo = new File( getBasedir(), "target/remote-repo" );
-
-        if ( !remoteRepo.exists() )
-        {
-            remoteRepo.mkdirs();
-        }
-    }
-
-    public void testDeployTestEnvironment()
-        throws Exception
-    {
-        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-test/plugin-config.xml" );
-
-        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
-
-        assertNotNull( mojo );
-    }
-
-    public void testBasicDeployFile()
-        throws Exception
-    {
-        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-test/plugin-config.xml" );
-
-        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
-
-        assertNotNull( mojo );
-
-        String groupId = (String) getVariableValueFromObject( mojo, "groupId" );
-
-        String artifactId = (String) getVariableValueFromObject( mojo, "artifactId" );
-
-        String version = (String) getVariableValueFromObject( mojo, "version" );
-
-        String packaging = (String) getVariableValueFromObject( mojo, "packaging" );
-
-        File file = (File) getVariableValueFromObject( mojo, "file" );
-
-        String repositoryId = (String) getVariableValueFromObject( mojo, "repositoryId" );
-
-        String url = (String) getVariableValueFromObject( mojo, "url" );
-
-        assertEquals( "org.apache.maven.test", groupId );
-
-        assertEquals( "maven-deploy-file-test", artifactId );
-
-        assertEquals( "1.0", version );
-
-        assertEquals( "jar", packaging );
-
-        assertTrue( file.exists() );
-
-        assertEquals( "deploy-test", repositoryId );
-
-        assertEquals( "file://" + getBasedir() + "/target/remote-repo/deploy-file-test", url );
-        
-        mojo.execute();
-
-        //check the generated pom
-        File pom = new File( remoteRepo, "deploy-file-test/" + groupId.replace( '.', '/' ) +
-                                          "/" + artifactId + "/" + version + "/" + artifactId +
-                                          "-" + version + ".pom" );
-
-        assertTrue( pom.exists() );
-
-        Model model = mojo.readModel( pom );
-
-        assertEquals( "4.0.0", model.getModelVersion() );
-
-        assertEquals( groupId, model.getGroupId() );
-
-        assertEquals( artifactId, model.getArtifactId() );
-
-        assertEquals( version, model.getVersion() );
-
-        assertEquals( packaging, model.getPackaging() );
-
-        assertEquals( "POM was created from deploy:deploy-file", model.getDescription() );
-
-        //check the remote-repo
-        expectedFiles = new ArrayList();
-        fileList = new ArrayList();
-
-        File repo = new File( remoteRepo, "deploy-file-test" );
-
-        File[] files = repo.listFiles();
-
-        for ( int i = 0; i < files.length; i++ )
-        {
-            addFileToList( files[i], fileList );
-        }
-
-        expectedFiles.add( "org" );
-        expectedFiles.add( "apache" );
-        expectedFiles.add( "maven" );
-        expectedFiles.add( "test" );
-        expectedFiles.add( "maven-deploy-file-test" );
-        expectedFiles.add( "1.0" );
-        expectedFiles.add( "maven-metadata.xml" );
-        expectedFiles.add( "maven-metadata.xml.md5" );
-        expectedFiles.add( "maven-metadata.xml.sha1" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.jar" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.jar.md5" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.jar.sha1" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.pom" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.pom.md5" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.pom.sha1" );
-
-        assertEquals( expectedFiles.size(), fileList.size() );
-
-        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
-    }
-
-    public void testDeployIfPomFileParamIsSet()
-        throws Exception
-    {
-        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-pom-file/plugin-config.xml" );
-
-        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
-
-        assertNotNull( mojo );
-
-        File pomFile = ( File ) getVariableValueFromObject( mojo, "pomFile" );
-
-        assertNotNull( pomFile );
-
-        mojo.execute();
-
-        assertTrue( pomFile.exists() );
-    }
-
-    public void testDeployIfClassifierIsSet()
-        throws Exception
-    {
-        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-classifier/plugin-config.xml" );
-
-        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
-
-        assertNotNull( mojo );
-
-        String classifier = ( String ) getVariableValueFromObject( mojo, "classifier" );
-
-        String groupId = ( String ) getVariableValueFromObject( mojo, "groupId" );
-
-        String artifactId = ( String ) getVariableValueFromObject( mojo, "artifactId" );
-
-        String version = ( String ) getVariableValueFromObject( mojo, "version" );
-
-        assertEquals( "bin", classifier );
-
-        mojo.execute();
-
-        File deployedArtifact = new File( remoteRepo, "deploy-file-classifier/" + groupId.replace( '.', '/' ) +
-                                          "/" + artifactId + "/" + version + "/" + artifactId +
-                                          "-" + version + "-" + classifier + ".jar");
-
-        assertTrue( deployedArtifact.exists() );
-
-        mojo.setClassifier( "prod" );
-
-        assertEquals( "prod", mojo.getClassifier() );
-
-        mojo.execute();
-
-        File prodDeployedArtifact = new File( remoteRepo, "deploy-file-classifier/" + groupId.replace( '.', '/' ) +
-                                          "/" + artifactId + "/" + version + "/" + artifactId +
-                                          "-" + version + "-" + mojo.getClassifier() + ".jar");
-
-        assertTrue( prodDeployedArtifact.exists() );
-    }
-
-    public void testDeployIfArtifactIsNotJar()
-        throws Exception
-    {
-        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-artifact-not-jar/plugin-config.xml" );
-
-        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
-
-        assertNotNull( mojo );
-
-        String groupId = (String) getVariableValueFromObject( mojo, "groupId" );
-
-        String artifactId = (String) getVariableValueFromObject( mojo, "artifactId" );
-
-        String version = (String) getVariableValueFromObject( mojo, "version" );
-
-        String packaging = (String) getVariableValueFromObject( mojo, "packaging" );
-
-        assertEquals( "org.apache.maven.test", groupId );
-
-        assertEquals( "maven-deploy-file-test", artifactId );
-
-        assertEquals( "1.0", version );
-
-        assertEquals( "zip", packaging );
-
-        mojo.execute();
-
-        File file = new File( remoteRepo, "deploy-file-artifact-not-jar/" + groupId.replace( '.', '/' ) +
-                                          "/" + artifactId + "/" + version + "/" + artifactId +
-                                          "-" + version + ".zip");
-
-        assertTrue( file.exists() );
-    }
-
-    public void testDeployIfRepositoryLayoutIsLegacy()
-        throws Exception
-    {
-        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-legacy-repository-layout/plugin-config.xml" );
-
-        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
-
-        assertNotNull( mojo );
-
-        String repositoryLayout = (String) getVariableValueFromObject(  mojo, "repositoryLayout" );
-
-        String groupId = (String) getVariableValueFromObject( mojo, "groupId" );
-
-        String artifactId = (String) getVariableValueFromObject( mojo, "artifactId" );
-
-        String version = (String) getVariableValueFromObject( mojo, "version" );
-
-        assertEquals( "legacy", repositoryLayout );
-
-        mojo.execute();
-
-        File artifactFile = new File( remoteRepo, "deploy-file-legacy-repository-layout/" + groupId + "/jars/" + artifactId + "-" + version + ".jar" );
-
-        assertTrue( artifactFile.exists() );
-
-        //check the remote-repo
-        expectedFiles = new ArrayList();
-        fileList = new ArrayList();
-
-        File repo = new File( remoteRepo, "deploy-file-legacy-repository-layout" );
-
-        File[] files = repo.listFiles();
-
-        for ( int i = 0; i < files.length; i++ )
-        {
-            addFileToList( files[i], fileList );
-        }
-
-        expectedFiles.add( "org.apache.maven.test" );
-        expectedFiles.add( "jars" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.jar" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.jar.md5" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.jar.sha1" );
-        expectedFiles.add( "poms" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.pom" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.pom.md5" );
-        expectedFiles.add( "maven-deploy-file-test-1.0.pom.sha1" );
-        expectedFiles.add( "maven-metadata.xml" );
-        expectedFiles.add( "maven-metadata.xml.md5" );
-        expectedFiles.add( "maven-metadata.xml.sha1" );
-
-        assertEquals( expectedFiles.size(), fileList.size() );
-
-        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
-    }
-
-    private void addFileToList( File file, List fileList )
-    {
-        if ( !file.isDirectory() )
-        {
-            fileList.add( file.getName() );
-        }
-        else
-        {
-            fileList.add( file.getName() );
-
-            File[] files = file.listFiles();
-
-            for ( int i = 0; i < files.length; i++ )
-            {
-                addFileToList( files[i], fileList );
-            }
-        }
-    }
-
-    private int getSizeOfExpectedFiles( List fileList, List expectedFiles )
-    {
-        for ( Iterator iter = fileList.iterator(); iter.hasNext(); )
-        {
-            String fileName = (String) iter.next();
-
-            if ( expectedFiles.contains( fileName ) )
-            {
-                expectedFiles.remove( fileName );
-            }
-            else
-            {
-                fail( fileName + " is not included in the expected files" );
-            }
-        }
-        return expectedFiles.size();
-    }
-
-}
-
+package org.apache.maven.plugin.deploy;
+
+/*
+ * 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 java.io.File;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Model;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * @author <a href="mailto:aramirez@apache.org">Allan Ramirez</a>
+ */
+public class DeployFileMojoTest
+    extends AbstractMojoTestCase
+{
+    private List expectedFiles;
+
+    private List fileList;
+
+    private File localRepo;
+
+    private File remoteRepo;
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        remoteRepo = new File( getBasedir(), "target/remote-repo" );
+
+        if ( !remoteRepo.exists() )
+        {
+            remoteRepo.mkdirs();
+        }
+    }
+
+    public void testDeployTestEnvironment()
+        throws Exception
+    {
+        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-test/plugin-config.xml" );
+
+        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
+
+        assertNotNull( mojo );
+    }
+
+    public void testBasicDeployFile()
+        throws Exception
+    {
+        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-test/plugin-config.xml" );
+
+        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
+
+        assertNotNull( mojo );
+
+        String groupId = (String) getVariableValueFromObject( mojo, "groupId" );
+
+        String artifactId = (String) getVariableValueFromObject( mojo, "artifactId" );
+
+        String version = (String) getVariableValueFromObject( mojo, "version" );
+
+        String packaging = (String) getVariableValueFromObject( mojo, "packaging" );
+
+        File file = (File) getVariableValueFromObject( mojo, "file" );
+
+        String repositoryId = (String) getVariableValueFromObject( mojo, "repositoryId" );
+
+        String url = (String) getVariableValueFromObject( mojo, "url" );
+
+        assertEquals( "org.apache.maven.test", groupId );
+
+        assertEquals( "maven-deploy-file-test", artifactId );
+
+        assertEquals( "1.0", version );
+
+        assertEquals( "jar", packaging );
+
+        assertTrue( file.exists() );
+
+        assertEquals( "deploy-test", repositoryId );
+
+        assertEquals( "file://" + getBasedir() + "/target/remote-repo/deploy-file-test", url );
+        
+        mojo.execute();
+
+        //check the generated pom
+        File pom = new File( remoteRepo, "deploy-file-test/" + groupId.replace( '.', '/' ) +
+                                          "/" + artifactId + "/" + version + "/" + artifactId +
+                                          "-" + version + ".pom" );
+
+        assertTrue( pom.exists() );
+
+        Model model = mojo.readModel( pom );
+
+        assertEquals( "4.0.0", model.getModelVersion() );
+
+        assertEquals( groupId, model.getGroupId() );
+
+        assertEquals( artifactId, model.getArtifactId() );
+
+        assertEquals( version, model.getVersion() );
+
+        assertEquals( packaging, model.getPackaging() );
+
+        assertEquals( "POM was created from deploy:deploy-file", model.getDescription() );
+
+        //check the remote-repo
+        expectedFiles = new ArrayList();
+        fileList = new ArrayList();
+
+        File repo = new File( remoteRepo, "deploy-file-test" );
+
+        File[] files = repo.listFiles();
+
+        for ( int i = 0; i < files.length; i++ )
+        {
+            addFileToList( files[i], fileList );
+        }
+
+        expectedFiles.add( "org" );
+        expectedFiles.add( "apache" );
+        expectedFiles.add( "maven" );
+        expectedFiles.add( "test" );
+        expectedFiles.add( "maven-deploy-file-test" );
+        expectedFiles.add( "1.0" );
+        expectedFiles.add( "maven-metadata.xml" );
+        expectedFiles.add( "maven-metadata.xml.md5" );
+        expectedFiles.add( "maven-metadata.xml.sha1" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.jar" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.jar.md5" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.jar.sha1" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.pom" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.pom.md5" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.pom.sha1" );
+
+        assertEquals( expectedFiles.size(), fileList.size() );
+
+        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
+    }
+
+    public void testDeployIfPomFileParamIsSet()
+        throws Exception
+    {
+        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-pom-file/plugin-config.xml" );
+
+        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
+
+        assertNotNull( mojo );
+
+        File pomFile = ( File ) getVariableValueFromObject( mojo, "pomFile" );
+
+        assertNotNull( pomFile );
+
+        mojo.execute();
+
+        assertTrue( pomFile.exists() );
+    }
+
+    public void testDeployIfClassifierIsSet()
+        throws Exception
+    {
+        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-classifier/plugin-config.xml" );
+
+        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
+
+        assertNotNull( mojo );
+
+        String classifier = ( String ) getVariableValueFromObject( mojo, "classifier" );
+
+        String groupId = ( String ) getVariableValueFromObject( mojo, "groupId" );
+
+        String artifactId = ( String ) getVariableValueFromObject( mojo, "artifactId" );
+
+        String version = ( String ) getVariableValueFromObject( mojo, "version" );
+
+        assertEquals( "bin", classifier );
+
+        mojo.execute();
+
+        File deployedArtifact = new File( remoteRepo, "deploy-file-classifier/" + groupId.replace( '.', '/' ) +
+                                          "/" + artifactId + "/" + version + "/" + artifactId +
+                                          "-" + version + "-" + classifier + ".jar");
+
+        assertTrue( deployedArtifact.exists() );
+
+        mojo.setClassifier( "prod" );
+
+        assertEquals( "prod", mojo.getClassifier() );
+
+        mojo.execute();
+
+        File prodDeployedArtifact = new File( remoteRepo, "deploy-file-classifier/" + groupId.replace( '.', '/' ) +
+                                          "/" + artifactId + "/" + version + "/" + artifactId +
+                                          "-" + version + "-" + mojo.getClassifier() + ".jar");
+
+        assertTrue( prodDeployedArtifact.exists() );
+    }
+
+    public void testDeployIfArtifactIsNotJar()
+        throws Exception
+    {
+        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-artifact-not-jar/plugin-config.xml" );
+
+        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
+
+        assertNotNull( mojo );
+
+        String groupId = (String) getVariableValueFromObject( mojo, "groupId" );
+
+        String artifactId = (String) getVariableValueFromObject( mojo, "artifactId" );
+
+        String version = (String) getVariableValueFromObject( mojo, "version" );
+
+        String packaging = (String) getVariableValueFromObject( mojo, "packaging" );
+
+        assertEquals( "org.apache.maven.test", groupId );
+
+        assertEquals( "maven-deploy-file-test", artifactId );
+
+        assertEquals( "1.0", version );
+
+        assertEquals( "zip", packaging );
+
+        mojo.execute();
+
+        File file = new File( remoteRepo, "deploy-file-artifact-not-jar/" + groupId.replace( '.', '/' ) +
+                                          "/" + artifactId + "/" + version + "/" + artifactId +
+                                          "-" + version + ".zip");
+
+        assertTrue( file.exists() );
+    }
+
+    public void testDeployIfRepositoryLayoutIsLegacy()
+        throws Exception
+    {
+        File testPom = new File( getBasedir(), "target/test-classes/unit/deploy-file-legacy-repository-layout/plugin-config.xml" );
+
+        DeployFileMojo mojo = (DeployFileMojo) lookupMojo( "deploy-file", testPom );
+
+        assertNotNull( mojo );
+
+        String repositoryLayout = (String) getVariableValueFromObject(  mojo, "repositoryLayout" );
+
+        String groupId = (String) getVariableValueFromObject( mojo, "groupId" );
+
+        String artifactId = (String) getVariableValueFromObject( mojo, "artifactId" );
+
+        String version = (String) getVariableValueFromObject( mojo, "version" );
+
+        assertEquals( "legacy", repositoryLayout );
+
+        mojo.execute();
+
+        File artifactFile = new File( remoteRepo, "deploy-file-legacy-repository-layout/" + groupId + "/jars/" + artifactId + "-" + version + ".jar" );
+
+        assertTrue( artifactFile.exists() );
+
+        //check the remote-repo
+        expectedFiles = new ArrayList();
+        fileList = new ArrayList();
+
+        File repo = new File( remoteRepo, "deploy-file-legacy-repository-layout" );
+
+        File[] files = repo.listFiles();
+
+        for ( int i = 0; i < files.length; i++ )
+        {
+            addFileToList( files[i], fileList );
+        }
+
+        expectedFiles.add( "org.apache.maven.test" );
+        expectedFiles.add( "jars" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.jar" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.jar.md5" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.jar.sha1" );
+        expectedFiles.add( "poms" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.pom" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.pom.md5" );
+        expectedFiles.add( "maven-deploy-file-test-1.0.pom.sha1" );
+        expectedFiles.add( "maven-metadata.xml" );
+        expectedFiles.add( "maven-metadata.xml.md5" );
+        expectedFiles.add( "maven-metadata.xml.sha1" );
+
+        assertEquals( expectedFiles.size(), fileList.size() );
+
+        assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );
+    }
+
+    private void addFileToList( File file, List fileList )
+    {
+        if ( !file.isDirectory() )
+        {
+            fileList.add( file.getName() );
+        }
+        else
+        {
+            fileList.add( file.getName() );
+
+            File[] files = file.listFiles();
+
+            for ( int i = 0; i < files.length; i++ )
+            {
+                addFileToList( files[i], fileList );
+            }
+        }
+    }
+
+    private int getSizeOfExpectedFiles( List fileList, List expectedFiles )
+    {
+        for ( Iterator iter = fileList.iterator(); iter.hasNext(); )
+        {
+            String fileName = (String) iter.next();
+
+            if ( expectedFiles.contains( fileName ) )
+            {
+                expectedFiles.remove( fileName );
+            }
+            else
+            {
+                fail( fileName + " is not included in the expected files" );
+            }
+        }
+        return expectedFiles.size();
+    }
+
+}
+

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployFileMojoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native