You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by jv...@apache.org on 2004/06/18 00:04:37 UTC

cvs commit: maven-components/maven-core/src/test/java/org/apache/maven/artifact/installer DefaultArtifactInstallerTest.java

jvanzyl     2004/06/17 15:04:37

  Modified:    maven-core/src/main/java/org/apache/maven/artifact/installer
                        DefaultArtifactInstaller.java
               maven-core/src/main/resources/org/apache/maven plexus.xml
  Added:       maven-core/src/test/java/org/apache/maven/artifact/installer
                        DefaultArtifactInstallerTest.java
  Log:
  o adding bits and bobs to get the artifact installer to work.
  
  Revision  Changes    Path
  1.2       +7 -13     maven-components/maven-core/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
  
  Index: DefaultArtifactInstaller.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultArtifactInstaller.java	17 Jun 2004 18:54:40 -0000	1.1
  +++ DefaultArtifactInstaller.java	17 Jun 2004 22:04:37 -0000	1.2
  @@ -14,14 +14,14 @@
    * @author <a href="michal@codehaus.org">Michal Maczka</a>
    * @version $Id$
    */
  -public class DefaultArtifactInstaller implements ArtifactInstaller
  +public class DefaultArtifactInstaller
  +    implements ArtifactInstaller
   {
  -
       private MavenArtifactFactory artifactFactory;
   
  -    public void install( File file, String type, MavenProject project ) throws Exception
  +    public void install( File file, String type, MavenProject project )
  +        throws Exception
       {
  -
           if ( project.getVersion().endsWith( "SNAPSHOT" ) )
           {
               String timestamp = SnapshotUtils.getTimestamp();
  @@ -32,7 +32,6 @@
   
               FileUtils.fileWrite( snapshotVersionFile.getPath(), timestamp );
   
  -
               // we don't want to install pom twice
               if ( !type.equals( "pom" ) )
               {
  @@ -43,9 +42,7 @@
                   File pomSnapshotVersionFile = pomArtifact.getSnapshotVersionFile();
   
                   FileUtils.fileWrite( pomSnapshotVersionFile.getPath(), timestamp );
  -
               }
  -
           }
   
           installFile( file, type, project.getVersion(), project );
  @@ -54,12 +51,11 @@
           {
               installFile( project.getFile(), "pom", project.getVersion(), project );
           }
  -
       }
   
  -    public MavenArtifact installFile( File file, String type, String version, MavenProject project ) throws Exception
  +    public MavenArtifact installFile( File file, String type, String version, MavenProject project )
  +        throws Exception
       {
  -
           String localRepository = project.getLocalRepository();
   
           Dependency dependency = new Dependency();
  @@ -84,7 +80,5 @@
           FileUtils.fileCopy( file.getPath(), artifact.getPath() );
   
           return artifact;
  -
  -
       }
   }
  
  
  
  1.10      +9 -0      maven-components/maven-core/src/main/resources/org/apache/maven/plexus.xml
  
  Index: plexus.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/resources/org/apache/maven/plexus.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- plexus.xml	17 Jun 2004 19:38:50 -0000	1.9
  +++ plexus.xml	17 Jun 2004 22:04:37 -0000	1.10
  @@ -124,5 +124,14 @@
           </requirement>
         </requirements>
       </component>
  +    <component>
  +      <role>org.apache.maven.artifact.installer.ArtifactInstaller</role>
  +      <implementation>org.apache.maven.artifact.installer.DefaultArtifactInstaller</implementation>
  +      <requirements>
  +        <requirement>
  +         <role>org.apache.maven.artifact.factory.MavenArtifactFactory</role>
  +       </requirement>
  +      </requirements>
  +    </component>
     </components>
   </configuration>
  
  
  
  1.1                  maven-components/maven-core/src/test/java/org/apache/maven/artifact/installer/DefaultArtifactInstallerTest.java
  
  Index: DefaultArtifactInstallerTest.java
  ===================================================================
  package org.apache.maven.artifact.installer;
  
  /*
   * Copyright 2001-2004 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.
   */
  
  import java.io.File;
  import java.util.List;
  import java.util.Map;
  
  import org.apache.maven.artifact.MavenArtifact;
  import org.apache.maven.artifact.collector.ArtifactCollector;
  import org.apache.maven.artifact.collector.ArtifactCollectionResult;
  import org.apache.maven.project.AbstractProjectTestCase;
  import org.apache.maven.project.MavenProject;
  import org.apache.maven.project.MavenProjectBuilder;
  
  /**
   * @author <a href="mailto:mmaczka@interia.pl">Michal Maczka</a>
   * @version $Id: DefaultArtifactInstallerTest.java,v 1.1 2004/06/17 22:04:37 jvanzyl Exp $
   */
  public class DefaultArtifactInstallerTest
      extends AbstractProjectTestCase
  {
      public DefaultArtifactInstallerTest( String testName )
      {
          super( testName );
      }
  
      public void testArtifactInstaller()
          throws Exception
      {
          ArtifactInstaller ai = (ArtifactInstaller) lookup( ArtifactInstaller.ROLE );
      }
  }