maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mic...@apache.org
Subject cvs commit: maven-components/maven-artifact-factory/src/test/resources project.properties project.xml
Date Wed, 17 Dec 2003 22:20:08 GMT
michal      2003/12/17 14:20:08

  Added:       maven-artifact-factory/src/test/resources/overriding/legacy
                        project.xml project.properties
               maven-artifact-factory .cvsignore project.xml
                        project.properties checkstyle.xml LICENSE.txt
               maven-artifact-factory/src/test/resources/overriding
                        project.properties project.xml
               maven-artifact-factory/src/test/java/org/apache/maven/artifact/layout
                        DefaultRepositoryLayoutTest.java
                        DefaultRepositoryLayoutTest.xml
               maven-artifact-factory/src/test/java/org/apache/maven/artifact/factory
                        DefaultArtifactFactoryTest.java
                        DefaultArtifactFactoryTest.xml
               maven-artifact-factory/src/test/resources project.properties
                        project.xml
  Log:
  Small part of maven-artifat project extracted
  
  Revision  Changes    Path
  1.1                  maven-components/maven-artifact-factory/src/test/resources/overriding/legacy/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
      <groupId>maven</groupId>
      <artifactId>maven</artifactId>
  
      <dependencies>
  
          <!-- JAR overriding in POM-->
          <dependency>
              <groupId>g1</groupId>
              <artifactId>d1</artifactId>
              <version>v1</version>
              <jar>lutefisk.fish</jar>
          </dependency>    
      
      
      
      
          <!-- File overriding in properties file -->
          <dependency>
              <groupId>g2</groupId>
              <artifactId>d2</artifactId>
              <version>3.0</version>
          </dependency>    
      
      
          <!-- jar overriding in properties file and POM. POM wins -->
          <dependency>
              <groupId>g3</groupId>
              <artifactId>d3</artifactId>
              <version>3.0</version>
              <jar>should_be_ignored</jar>
          </dependency>    
      
          <!-- Version overriding in properties file -->
          <dependency>
              <groupId>g4</groupId>
              <artifactId>d4</artifactId>
              <version>v2</version>
          </dependency>
  
      </dependencies>
  
  </project>
  
  
  
  1.1                  maven-components/maven-artifact-factory/src/test/resources/overriding/legacy/project.properties
  
  Index: project.properties
  ===================================================================
  # ------------------------------------------------------------------------
  # M A V E N  L E G A CY  J A R  O V E R R I D E
  # ------------------------------------------------------------------------
  maven.jar.override = on
  
  
  # ------------------------------------------------------------------------
  # Artifacts set explicity by path.
  # ------------------------------------------------------------------------
  maven.jar.d2 = /lib/d2.jar
  maven.jar.d3 = /lib/d3.jar
  
  
  # ------------------------------------------------------------------------
  # Artifacts set explicity by version.
  # ------------------------------------------------------------------------
  maven.jar.d4 = 1.1
  
  
  
  
  
  
  
  
  1.1                  maven-components/maven-artifact-factory/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  *.log
  target
  .classpath
  .project
  default.lst
  test.out
  default.ajsym
  
  
  
  1.1                  maven-components/maven-artifact-factory/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
      <pomVersion>3</pomVersion>
      <name>Maven Artifact Factory</name>
      <groupId>maven</groupId>
      <id>maven-artifact-factory</id>
      <artifactId>maven-artifact-factory</artifactId>
      <currentVersion>2.0-alpha-2</currentVersion>
      <gumpRepositoryId>jakarta</gumpRepositoryId>
      <description>Maven Artifact Factory</description>
      <shortDescription>Maven Artifact Factory</shortDescription>
  
      <versions/>
      <branches/>
  
      <developers>
          <developer>
              <name>Jason van Zyl</name>
              <id>jvanzyl</id>
              <email>jason@zenplex.com</email>
              <organization>Zenplex</organization>
              <roles>
                  <role>Architect</role>
                  <role>Release Manager</role>
              </roles>
          </developer>
          <developer>
              <name>Michal Maczka</name>
              <id>michal</id>
              <email>michal.maczka@dimatics.com</email>
              <organization>Dimatics</organization>
              <roles>
                  <role>Developer</role>
              </roles>
          </developer>
      </developers>
  
      <contributors/>
  
      <dependencies>
  
          <dependency>
              <groupId>maven</groupId>
              <artifactId>maven-model</artifactId>
              <version>2.0-alpha-2</version>
          </dependency>
  
          <dependency>
              <groupId>maven</groupId>
              <artifactId>maven-project</artifactId>
              <version>2.0-alpha-1</version>
          </dependency>
          
          
          <dependency>
              <groupId>maven</groupId>
              <artifactId>maven-model-tools</artifactId>
              <version>2.0-alpha-2</version>
          </dependency>
  
  
          <dependency>
              <groupId>plexus</groupId>
              <artifactId>plexus</artifactId>
              <version>0.11</version>
          </dependency>
          
          <dependency>
              <groupId>plexus</groupId>
              <artifactId>plexus-utils</artifactId>
              <version>1.0-beta-2</version>
          </dependency>
          
          <dependency>
             <groupId>xstream</groupId>
             <artifactId>xstream</artifactId>
             <version>0.2</version>
           </dependency>
  
  
          <dependency>
              <groupId>avalon</groupId>
              <artifactId>avalon-framework-api</artifactId>
              <version>4.1.4</version>
          </dependency>
  
          <!-- Component Testing -->
  
          <dependency>
              <id>classworlds</id>
              <version>1.0</version>
          </dependency>
  
          <dependency>
              <groupId>xpp3</groupId>
              <artifactId>xpp3</artifactId>
              <version>1.1.2a</version>
          </dependency>
  
          <dependency>
              <groupId>xmlpull</groupId>
              <artifactId>xmlpull</artifactId>
              <version>1.1.2.1</version>
          </dependency>
  
  
      </dependencies>
  
      <build>        
          <sourceDirectory>src/main/java</sourceDirectory>
          <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
          <unitTest>
              <includes>
                  <include>**/*Test.java</include>
              </includes>
  
              <resources>
                  <resource>
                      <directory>src/test/java</directory>
                      <includes>
                          <include>**/*.xml</include>
                      </includes>
                  </resource>
                  <resource>
                      <directory>src/test/resources</directory>
                      <includes>
                          <include>**/*.xml</include>
                      </includes>
                  </resource>
              </resources>
  
          </unitTest>
  
          <resources>
              <resource>
                  <directory>src/main/conf</directory>
                  <includes>
                      <include>layout*.properties</include>                   
                  </includes>
              </resource>
          </resources>
      </build>
  
      <reports>
          <report>maven-jdepend-plugin</report>
          <report>maven-checkstyle-plugin</report>
          <report>maven-changes-plugin</report>
          <report>maven-changelog-plugin</report>
          <report>maven-file-activity-plugin</report>
          <report>maven-developer-activity-plugin</report>
          <report>maven-javadoc-plugin</report>
          <report>maven-jxr-plugin</report>
          <report>maven-junit-report-plugin</report>
          <report>maven-tasklist-plugin</report>
          <report>maven-pmd-plugin</report>
          <report>maven-simian-plugin</report>
          <report>maven-clover-plugin</report>
      </reports>
  
  </project>
  
  
  
  1.1                  maven-components/maven-artifact-factory/project.properties
  
  Index: project.properties
  ===================================================================
  maven.junit.fork=true
  
  
  # -------------------------------------------------------------------
  # C H E C K S T Y L E  P R O P E R T I E S
  # -------------------------------------------------------------------
  maven.checkstyle.properties = ${basedir}/checkstyle.xml
  
  
  
  1.1                  maven-components/maven-artifact-factory/checkstyle.xml
  
  Index: checkstyle.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE module PUBLIC
      "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
      "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
  
  <!--
    Checkstyle checks configured for Maven.
  -->
  
  <module name="Checker">
  
      <!-- Checks that a package.html file exists for each package.     -->
      <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
      <module name="PackageHtml"/>
  
      <!-- Checks whether files end with a new line.                        -->
      <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
      <module name="NewlineAtEndOfFile"/>
  
      <!-- Checks that property files contain the same keys.         -->
      <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
      <module name="Translation"/>
  
      <module name="TreeWalker">
  
          <property name="cacheFile" value="${checkstyle.cache.file}"/>
  
          <!-- ************************************************************** -->
          <!-- Checks that are different from the sun coding conventions ones -->
          <!-- ************************************************************** -->
          <module name="Header">
              <property name="headerFile" value="${basedir}/LICENSE.txt"/>
              <property name="ignoreLines" value="1,2,3,4,5,6"/>
          </module>
          <property name="tabWidth" value="4"/>
          <module name="LeftCurly">
              <property name="option" value="nl"/>
          </module>
          <module name="RightCurly">
              <property name="option" value="alone"/>
          </module>
          <module name="LineLength">
              <property name="max" value="132"/>
          </module>
          <module name="MethodLength">
              <property name="max" value="175"/>
          </module>
          <!-- No Paren pad check
          <module name="ParenPad"/>
          -->
          <module name="ConstantName">
              <property name="format" value="log|^[a-zA-Z][a-zA-Z0-9_]*$"/>
          </module>
          
          <!-- ************************************************************** -->
          <!-- Default Sun coding conventions checks                          -->
          <!-- ************************************************************** -->
  
          <!-- Checks for Javadoc comments.                     -->
          <!-- See http://checkstyle.sf.net/config_javadoc.html -->
          <module name="JavadocMethod"/>
          <module name="JavadocType"/>
          <module name="JavadocVariable"/>
  
  
          <!-- Checks for Naming Conventions.                  -->
          <!-- See http://checkstyle.sf.net/config_naming.html -->
          <module name="LocalFinalVariableName"/>
          <module name="LocalVariableName"/>
          <module name="MethodName"/>
          <module name="PackageName"/>
          <module name="ParameterName"/>
          <module name="StaticVariableName"/>
          <module name="TypeName"/>
          <module name="MemberName"/>
  
          <!-- Checks for imports                              -->
          <!-- See http://checkstyle.sf.net/config_import.html -->
          <module name="AvoidStarImport"/>
          <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
          <module name="RedundantImport"/>
          <module name="UnusedImports"/>
  
  
          <!-- Checks for Size Violations.                    -->
          <!-- See http://checkstyle.sf.net/config_sizes.html -->
          <module name="FileLength"/>
          <module name="ParameterNumber"/>
  
  
          <!-- Checks for whitespace                               -->
          <!-- See http://checkstyle.sf.net/config_whitespace.html -->
          <module name="EmptyForIteratorPad"/>
          <module name="NoWhitespaceAfter"/>
          <module name="NoWhitespaceBefore"/>
          <module name="OperatorWrap"/>
          <module name="TabCharacter"/>
          <module name="WhitespaceAfter"/>
          <module name="WhitespaceAround"/>
  
  
          <!-- Modifier Checks                                    -->
          <!-- See http://checkstyle.sf.net/config_modifiers.html -->
          <module name="ModifierOrder"/>
          <module name="RedundantModifier"/>
  
  
          <!-- Checks for blocks. You know, those {}'s         -->
          <!-- See http://checkstyle.sf.net/config_blocks.html -->
          <module name="AvoidNestedBlocks"/>
          <module name="EmptyBlock"/>
  
          <module name="NeedBraces"/>
  
  
          <!-- Checks for common coding problems               -->
          <!-- See http://checkstyle.sf.net/config_coding.html -->
          <module name="AvoidInlineConditionals"/>
          <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
          <module name="EmptyStatement"/>
          <module name="EqualsHashCode"/>
          <module name="HiddenField"/>
          <module name="IllegalInstantiation"/>
          <module name="InnerAssignment"/>
          <module name="MagicNumber"/>
          <module name="MissingSwitchDefault"/>
          <!--<module name="RedundantThrows"/>-->
          <module name="SimplifyBooleanExpression"/>
          <module name="SimplifyBooleanReturn"/>
  
          <!-- Checks for class design                         -->
          <!-- See http://checkstyle.sf.net/config_design.html -->
          <!--<module name="DesignForExtension"/>-->
          <module name="FinalClass"/>
          <module name="HideUtilityClassConstructor"/>
          <module name="InterfaceIsType"/>
          <module name="VisibilityModifier"/>
  
  
          <!-- Miscellaneous other checks.                   -->
          <!-- See http://checkstyle.sf.net/config_misc.html -->
          <module name="ArrayTypeStyle"/>
          <!-- <module name="FinalParameters"/> -->
          <module name="GenericIllegalRegexp">
              <property name="format" value="\s+$"/>
              <property name="message" value="Line has trailing spaces."/>
          </module>
          <module name="TodoComment"/>
          <module name="UpperEll"/>
  
      </module>
  
  </module>
  
  
  
  1.1                  maven-components/maven-artifact-factory/LICENSE.txt
  
  Index: LICENSE.txt
  ===================================================================
  
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Maven" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  
  
  1.1                  maven-components/maven-artifact-factory/src/test/resources/overriding/project.properties
  
  Index: project.properties
  ===================================================================
  # ------------------------------------------------------------------------
  # M A V E N   A R T I F A C T  O V E R R I D E
  # ------------------------------------------------------------------------
  maven.artifact.override = on
  
  
  # ------------------------------------------------------------------------
  # Artifacts set explicity by path.
  # ------------------------------------------------------------------------
  maven.override.artifact.g2.d2.jar = /lib/d2.jar
  maven.override.artifact.g3.d3.jar = /lib/d3.jar
  
  
  # ------------------------------------------------------------------------
  # Artifacts set explicity by version.
  # ------------------------------------------------------------------------
  maven.override.version.g4.d4.jar = 1.1
  
  
  
  
  
  
  
  
  1.1                  maven-components/maven-artifact-factory/src/test/resources/overriding/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
      <groupId>maven</groupId>
      <artifactId>maven</artifactId>
  
      <dependencies>
  
          <!-- File overriding in POM-->
          <dependency>
              <groupId>g1</groupId>
              <artifactId>d1</artifactId>
              <version>v1</version>
              <artifact>lutefisk.fish</artifact>
          </dependency>    
      
      
      
      
          <!-- File overriding in properties file -->
          <dependency>
              <groupId>g2</groupId>
              <artifactId>d2</artifactId>
              <version>3.0</version>
          </dependency>    
      
      
          <!-- File overriding in properties file and POM. POM wins -->
          <dependency>
              <groupId>g3</groupId>
              <artifactId>d3</artifactId>
              <version>3.0</version>
              <artifact>should_be_ignored</artifact>
          </dependency>    
      
          <!-- Version overriding in properties file -->
          <dependency>
              <groupId>g4</groupId>
              <artifactId>d4</artifactId>
              <version>v2</version>
          </dependency>
  
      </dependencies>
  
  </project>
  
  
  
  1.1                  maven-components/maven-artifact-factory/src/test/java/org/apache/maven/artifact/layout/DefaultRepositoryLayoutTest.java
  
  Index: DefaultRepositoryLayoutTest.java
  ===================================================================
  package org.apache.maven.artifact.layout;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache MavenSession" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache MavenSession", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  import org.apache.maven.model.Dependency;
  import org.codehaus.plexus.PlexusTestCase;
  
  /**
   * @author <a href="mailto:michal.maczka@dimatics.com">Michal Maczka</a>
   * @version $Id: DefaultRepositoryLayoutTest.java,v 1.1 2003/12/17 22:20:08 michal Exp $
   */
  public class DefaultRepositoryLayoutTest extends PlexusTestCase
  {
      private RepositoryLayout repositoryLayout = null;
  
      /**
       * Constructor for DefaultRepositoryLayoutTest.
       * 
       * @param arg0 
       */
      public DefaultRepositoryLayoutTest( final String arg0 )
      {
          super( arg0 );
      }
  
      public void setUp() throws Exception
      {
          super.setUp();
          repositoryLayout = ( RepositoryLayout ) lookup( RepositoryLayout.ROLE );
      }
  
      public void testGeneratePath()
      {
          final String msg = "Expected path in repository is different than actual.";
  
          final String groupId1 = "mm_group_id";
          final String artifactId1 = "mm_id";
  
          final String version1 = "1.0.0";
          final String type1 = "a";
  
          final String expectedPathD = "mm_group_id/as/mm_id-1.0.0.a";
          String actualPathD = null;
  
          try
          {
              actualPathD =
                      repositoryLayout.generatePath(
                              groupId1,
                              artifactId1,
                              type1,
                              version1 );
          }
          catch ( Exception e )
          {
              final String msg2 =
                      "Cannot bulid repository layout for: " + artifactId1 + ".";
  
              fail( msg2 );
          }
  
          assertEquals( msg, expectedPathD, actualPathD );
  
          final Dependency ejb = new Dependency();
  
          ejb.setGroupId( "boo" );
          ejb.setArtifactId( "foo" );
          ejb.setVersion( "1.1.1" );
          ejb.setType( "ejb" );
  
          final String expectedPathEjb = "boo/ejbs/foo-1.1.1.jar";
          String actualPathEjb = null;
  
          try
          {
              actualPathEjb = repositoryLayout.generatePath( ejb );
          }
          catch ( Exception e )
          {
              final String msg2 = "Cannot bulid repository layout for: " + ejb + ".";
  
              fail( msg2 );
          }
  
          assertEquals( msg, expectedPathEjb, actualPathEjb );
  
          final Dependency nativeD = new Dependency();
  
          nativeD.setGroupId( "boo" );
          nativeD.setArtifactId( "foo" );
          nativeD.setVersion( "1.1.1" );
          nativeD.setType( "native" );
  
          String expectedPathNative = null;
  
          final String osName = System.getProperty( "os.name" );
  
          if ( osName.toLowerCase().startsWith( "windows" ) )
          {
              expectedPathNative = "boo/native/foo-1.1.1.dll";
          }
          else
          {
              expectedPathNative = "boo/native/foo-1.1.1.so";
          }
  
          String actualPathNative = null;
  
          try
          {
              actualPathNative = repositoryLayout.generatePath( nativeD );
          }
          catch ( Exception e )
          {
              final String msg2 =
                      "Cannot bulid repository layout for: " + nativeD + ".";
  
              fail( msg2 );
          }
  
          assertEquals( msg, expectedPathNative, actualPathNative );
      }
  
      public void testDependecyWithOverridenFile()
      {
      	
      	final Dependency dep = new Dependency();
  
          dep.setGroupId( "boo" );
          dep.setArtifactId( "foo" );
          dep.setVersion( "1.1.1" );
          dep.setType( "ejb" );
          dep.setArtifact( "kaa.jar" );
  
          final String expectedPath = "boo/ejbs/kaa.jar";
          String actualPath = null;
  
          try
          {
              actualPath = repositoryLayout.generatePath( dep );
          }
          catch ( Exception e )
          {
              final String msg2 = "Cannot bulid repository layout for: " + dep + ".";
  
              fail( msg2 );
          }
          final String msg = "Expected path in repository is different than actual.";
          assertEquals( msg, expectedPath, actualPath );
      }
  
  }
  
  
  
  1.1                  maven-components/maven-artifact-factory/src/test/java/org/apache/maven/artifact/layout/DefaultRepositoryLayoutTest.xml
  
  Index: DefaultRepositoryLayoutTest.xml
  ===================================================================
  <configuration>
      <components>
          <component>
              <role>org.apache.maven.artifact.layout.RepositoryLayout</role>
              <implementation>org.apache.maven.artifact.layout.DefaultRepositoryLayout</implementation>
              <configuration/>
          </component>
          <component>
              <role>org.codehaus.plexus.i18n.I18N</role>
              <implementation>org.codehaus.plexus.i18n.DefaultI18N</implementation>
              <configuration/>
          </component>
      </components>
  </configuration>
  
  
  
  1.1                  maven-components/maven-artifact-factory/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java
  
  Index: DefaultArtifactFactoryTest.java
  ===================================================================
  package org.apache.maven.artifact.factory;
  
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache MavenSession" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache MavenSession", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  import org.apache.maven.artifact.Artifact;
  import org.apache.maven.project.Project;
  import org.apache.maven.project.ProjectBuilder;
  import org.codehaus.plexus.PlexusTestCase;
  
  import java.io.File;
  import java.util.List;
  
  /**
   * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
   * @version $Id: DefaultArtifactFactoryTest.java,v 1.1 2003/12/17 22:20:08 michal Exp $
   */
  public class DefaultArtifactFactoryTest extends PlexusTestCase
  {
      private ArtifactFactory artifactFactory;
      private ProjectBuilder builder;
  
      /**
       * Constructor for DefaultArtifactFactoryTest.
       * 
       * @param testName 
       */
      public DefaultArtifactFactoryTest( final String testName )
      {
          super( testName );
      }
  
      /**
       * @see junit.framework.TestCase#setUp()
       */
      public void setUp() throws Exception
      {
          super.setUp();
  
          artifactFactory = ( ArtifactFactory ) lookup( ArtifactFactory.ROLE );
          builder = ( ProjectBuilder ) lookup( ProjectBuilder.ROLE );
          
          //String basedir =  System.getProperty( "basedir" );
         
          artifactFactory.setMavenRepoLocal( "src/test/resources/maven-repo-local" );
      }
  
      public void testCreateArtifacts()
      {
          Project project = null;
  
          try
          {
              project = builder.build( new File( getTestFile( basedir,
                      "src/test/resources/project.xml" ) ) );
          }
          catch ( Exception e )
          {
              final String msg = "Cannot get project sample: " + e.getMessage();
  
              fail( msg );
          }
  
          List artifacts = null;
          
          
  
          try
          {
              artifacts = artifactFactory.createArtifacts( project, null );
          }
          catch ( Exception e )
          {
              final String msg = "Failed to create list of artifacts: "
                      + e.getMessage();
  
              fail( msg );
          }
  
          final String repositoryPath = artifactFactory.getMavenRepoLocal( project );
  
          //1 Check if we have required number of artifacts
          final int expectedNumberOfArtifacts = 2;
          final int actualNumberOfArtifacts = artifacts.size();
  
          assertEquals( "Artifact list has unexpected size.",
                  expectedNumberOfArtifacts, actualNumberOfArtifacts );
  
          // 2 Check if artifacts are not null       
          final Artifact artifact1 = ( Artifact ) artifacts.get( 0 );
          final Artifact artifact2 = ( Artifact ) artifacts.get( 1 );
          final String msg1 = "No artifact should be null.";
  
          assertNotNull( msg1, artifact1 );
          assertNotNull( msg1, artifact2 );
  
          //3 Check if paths were build correctly
          final String msg2 = "Artifact has incorrect path.";
  
          // a1
          final String expectedPath1 = "g1/jars/d1-1.0.jar";
          final String actualPath1 = artifact1.getPath();
  
          assertEquals( msg2 + artifact1, expectedPath1, actualPath1 );
  
          // a2
          final String expectedPath2 = "g2/jars/d2-2.0.jar";
          final String actualPath2 = artifact2.getPath();
  
          assertEquals( msg2 + artifact2, expectedPath2, actualPath2 );
  
          //4 Check if files were set correctly
          final String msg3 = "Artifact file has been set incorrectly.";
  
          // a1
          final File expectedFile1 = new File( repositoryPath, "g1/jars/d1-1.0.jar" );
          final File actualFile1 = artifact1.getFile();
  
          assertEquals( msg3, expectedFile1, actualFile1 );
  
          // a2
          final File expectedFile2 = new File( repositoryPath, "g2/jars/d2-2.0.jar" );
          final File actualFile2 = artifact2.getFile();
  
          assertEquals( msg3, expectedFile2, actualFile2 );
  
          // 5 check if some fields were set correctly             
          assertNull( "Version should not be overriden",
                  artifact1.getOverriddenVersion() );
          assertFalse( "File should not be overriden",
                  artifact1.isFileOverridden() );
          assertFalse( "Artifact is not a SNAPHOT", artifact1.isSnapshot() );
      }
  
      public void testArtifactOverrding()
      {
          doTestArtifact( "src/test/resources/overriding/project.xml" );
      }
  
      /**
       *
       *
       */
      public void doTestArtifact( final String projectFile )
      {
          Project project = null;
  
          try
          {
              project = builder.build( new File( getTestFile( projectFile ) ) );
          }
          catch ( Exception e )
          {
              final String msg = "Cannot get project sample : '" + projectFile + "'. "
                      + e.getMessage();
  
              fail( msg );
          }
  
          List artifacts = null;
  
          try
          {
              artifacts = artifactFactory.createArtifacts( project, null );
          }
          catch ( Exception e )
          {
              final String msg = "Failed to create list of artifacts: "
                      + e.getMessage();
  
              fail( msg );
          }
  
          final String repositoryPath = artifactFactory.getMavenRepoLocal( project );
  
          //1 Check if overddiing is turn on
          //boolean isOverringOn = project.getMavenArtifactOverride();
  
          //assertTrue( "Overriding is not turned on", isOverringOn );
  
          //2 Check if we have required number of artifacts
          final int expectedNumberOfArtifacts = 4;
          final int actualNumberOfArtifacts = artifacts.size();
  
          assertEquals( "Artifact list has unexpected size.",
                  expectedNumberOfArtifacts, actualNumberOfArtifacts );
  
          //3 Check if artifacts are not null       
          final Artifact artifact1 = ( Artifact ) artifacts.get( 0 );
          final Artifact artifact2 = ( Artifact ) artifacts.get( 1 );
          final Artifact artifact3 = ( Artifact ) artifacts.get( 2 );
          final Artifact artifact4 = ( Artifact ) artifacts.get( 3 );
  
          final String msg1 = "No artifact should be null.";
  
          assertNotNull( msg1, artifact1 );
          assertNotNull( msg1, artifact2 );
          assertNotNull( msg1, artifact3 );
          assertNotNull( msg1, artifact4 );
  
          //4 Check if files were set correctly
          final String msg3 = "Artifact file has been set incorrectly.";
  
          // a1 - file overrding in POM
          final File expectedFile1 = new File( repositoryPath, "g1/jars/lutefisk.fish" );
          final File actualFile1 = artifact1.getFile();
  
          System.out.println( "File overriding in POM: " +
          		expectedFile1 + "   "  +actualFile1);
          assertEquals( "File overriding in POM: " + msg3, expectedFile1,
                  actualFile1 );
  
          // a2 file overring in properties file
          final File expectedFile2 = new File( "/lib/d2.jar" );
          final File actualFile2 = artifact2.getFile();
  
          assertEquals( "File overriding in prop. file: " + msg3, expectedFile2,
                  actualFile2 );
  
          // a3 file overring in properties file and POM
          final File expectedFile3 = new File( "/lib/d3.jar" );
          final File actualFile3 = artifact3.getFile();
  
          assertEquals( "File overriding in prop. file and POM: " + msg3,
                  expectedFile3, actualFile3 );
  
          // a4 - version overrding in  POM 
          final File expectedFile4 = new File( repositoryPath, "/g4/jars/d4-1.1.jar" );
          final File actualFile4 = artifact4.getFile();
  
          System.out.println( "Version overriding in prop. file: " +
                   expectedFile4 + "   "  +actualFile4);
          assertEquals( "Version overriding in prop. file: " + msg3,
                  expectedFile4, actualFile4 );
  
          //4 check if some choosen artifacts' fields were set properly        
          assertNotNull( "Version was overriden.",
                  artifact4.getOverriddenVersion() );
          assertFalse( "File should not be overriden.",
                  artifact4.isFileOverridden() );
  
          assertNull( "Version should not be overriden.",
                  artifact3.getOverriddenVersion() );
          assertTrue( "File was not overriden.", artifact3.isFileOverridden() );
      }
  
      public void testCreatePomArtifact()
      {
          Project project = null;
  
          try
          {
              project = builder.build( new File( getTestFile( basedir,
                      "src/test/resources/project.xml" ) ) );
          }
          catch ( Exception e )
          {
              final String msg = "Cannot get project sample : '"
                      + "src/test/resources/project.xml" + "'. " + e.getMessage();
  
              fail( msg );
          }
  
          List artifacts = null;
  
          try
          {
              artifacts = artifactFactory.createArtifacts( project, null );
          }
          catch ( Exception e )
          {
              final String msg = "Failed to create list of artifacts: "
                      + e.getMessage();
  
              fail( msg );
          }
  
          try
          {
              final String repositoryPath = artifactFactory.getMavenRepoLocal( project );
              final Artifact artifact1 = ( Artifact ) artifacts.get( 0 );
  
              System.out.println( artifact1 );
              final Artifact pomArtifact = artifactFactory.createPomArtifact( artifact1 );
              System.out.println( "artifact:" + pomArtifact );
              System.out.println( "artifact file:" + pomArtifact.getFile() );
          }
          catch ( Exception e )
          {
          }
      }
  
      public void testLegacyArtifactOverrding()
      {
          doTestArtifact( "src/test/resources/overriding/legacy/project.xml" );
      }
  }
  
  
  
  1.1                  maven-components/maven-artifact-factory/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.xml
  
  Index: DefaultArtifactFactoryTest.xml
  ===================================================================
  <configuration>
      <components>
          <component>
              <role>org.apache.maven.project.ProjectBuilder</role>
              <implementation>org.apache.maven.project.DefaultProjectBuilder</implementation>
              <configuration/>
          </component>
          <component>
              <role>org.apache.maven.model.ModelUnmarshaller</role>
              <implementation>org.apache.maven.model.DefaultModelUnmarshaller</implementation>
              <configuration/>
          </component>
          <!-- ProjectBuilder needs it. Possibly Remove this -->
          <component>
              <role>org.apache.maven.model.ModelMarshaller</role>
              <implementation>org.apache.maven.model.DefaultModelMarshaller</implementation>
              <configuration/>
          </component>
  
          <component>
              <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
              <implementation>org.apache.maven.artifact.factory.DefaultArtifactFactory</implementation>
              <configuration/>
          </component>
          <component>
              <role>org.apache.maven.artifact.layout.RepositoryLayout</role>
              <implementation>org.apache.maven.artifact.layout.DefaultRepositoryLayout</implementation>
              <configuration/>
          </component>
  
          <component>
              <role>org.codehaus.plexus.i18n.I18N</role>
              <implementation>org.codehaus.plexus.i18n.DefaultI18N</implementation>
              <configuration/>
          </component>
      </components>
  </configuration>
  
  
  
  1.1                  maven-components/maven-artifact-factory/src/test/resources/project.properties
  
  Index: project.properties
  ===================================================================
  maven.repo.local=src/test/resources/maven-repo-local
  
  
  1.1                  maven-components/maven-artifact-factory/src/test/resources/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
      <pomVersion>3</pomVersion>
      <groupId>maven</groupId>
      <artifactId>maven</artifactId>
      <name>Maven</name>
      <currentVersion>1.0-beta-9</currentVersion>
      <inceptionYear>2001</inceptionYear>
      <package>org.apache.maven</package>
      <gumpRepositoryId>jakarta</gumpRepositoryId>
      <description>Description</description>
      <shortDescription>shortDescription</shortDescription>
      <url>http://maven.apache.org/</url>
      <issueTrackingUrl>issueTrackingUrl</issueTrackingUrl>
      <siteAddress>maven.apache.org</siteAddress>
      <siteDirectory>/www/maven.apache.org/</siteDirectory>
      <distributionDirectory>/www/maven.apache.org/builds/</distributionDirectory>
  
      <organization>
          <name>Apache Software Foundation</name>
          <url>http://apache.org/</url>
          <logo>/images/jakarta-logo-blue.gif</logo>
      </organization>
  
      <repository>
          <connection>anon-connection</connection>
          <developerConnection>developer-connection</developerConnection>
          <url>repository-url</url>
      </repository>
  
      <versions>
          <version>
              <id>b1</id>
              <name>1.0-b1</name>
              <tag>MAVEN_1_0_B1</tag>
          </version>
      </versions>
  
      <mailingLists>
          <mailingList>
              <name>Maven User List</name>
              <subscribe>subscribe</subscribe>
              <unsubscribe>unsubscribe</unsubscribe>
              <archive>archive</archive>
          </mailingList>
      </mailingLists>
  
      <developers>
          <developer>
              <name>Jason van Zyl</name>
              <id>jvanzyl</id>
              <email>jason@maven.org</email>
              <organization>Zenplex</organization>
              <roles>
                  <role>Founder</role>
                  <role>Release Manager</role>
              </roles>
          </developer>
      </developers>
  
      <contributors>
          <contributor>
              <name>Martin van dem Bemt</name>
              <email>mvdb@mvdb.com</email>
          </contributor>
      </contributors>
  
      <dependencies>
  
          <dependency>
              <groupId>g1</groupId>
              <artifactId>d1</artifactId>
              <version>1.0</version>
              <url>d1-url</url>
          </dependency>
  
          <dependency>
              <groupId>g2</groupId>
              <artifactId>d2</artifactId>
              <version>2.0</version>
              <url>d2-url</url>
          </dependency>
  
      </dependencies>
  
      <build>
          <nagEmailAddress>jason@maven.org</nagEmailAddress>
          <sourceDirectory>sourceDirectory</sourceDirectory>
          <unitTestSourceDirectory>unitTestSourceDirectory</unitTestSourceDirectory>
          <unitTest>
              <includes>
                  <include>**/*Test.java</include>
              </includes>
              <excludes>
                  <exclude>**/RepositoryTest.java</exclude>
                  <exclude>**/JAXPTest.java</exclude>
              </excludes>
              <resources>
                  <resource>
                      <directory>${basedir}/src/test</directory>
                      <includes>
                          <include>**/*.xml</include>
                      </includes>
                  </resource>
              </resources>
          </unitTest>
          <resources>
              <resource>
                  <directory>src/conf</directory>
                  <includes>
                      <include>*.xsd</include>
                      <include>*.dtd</include>
                      <include>*.mod</include>
                      <include>log4j.properties</include>
                      <include>driver.jelly</include>
                      <include>driver.properties</include>
                  </includes>
              </resource>
              <resource>
                  <directory>src/messages</directory>
                  <targetPath>org/apache/maven/messages</targetPath>
                  <includes>
                      <include>messages*.properties</include>
                  </includes>
              </resource>
          </resources>
      </build>
  
      <reports>
          <report>maven-jdepend-plugin</report>
          <report>maven-checkstyle-plugin</report>
          <report>maven-changelog-plugin</report>
          <report>maven-file-activity-plugin</report>
          <report>maven-developer-activity-plugin</report>
          <report>maven-javadoc-plugin</report>
          <report>maven-jxr-plugin</report>
          <report>maven-junit-report-plugin</report>
          <report>maven-tasklist-plugin</report>
          <report>maven-jellydoc-plugin</report>
      </reports>
  
  </project>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message