You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by mi...@apache.org on 2003/05/23 20:36:20 UTC

cvs commit: maven-new/core/src/test/org/apache/maven/artifact/layout DefaultRepositoryLayoutTest.xml DefaultRepositoryLayoutTest.java

michal      2003/05/23 11:36:20

  Modified:    core/src/test/org/apache/maven/artifact/layout
                        DefaultRepositoryLayoutTest.java
  Added:       core/src/test/org/apache/maven/artifact/layout
                        DefaultRepositoryLayoutTest.xml
  Log:
  Converted to PlexusTestCase
  
  Revision  Changes    Path
  1.2       +55 -22    maven-new/core/src/test/org/apache/maven/artifact/layout/DefaultRepositoryLayoutTest.java
  
  Index: DefaultRepositoryLayoutTest.java
  ===================================================================
  RCS file: /home/cvs/maven-new/core/src/test/org/apache/maven/artifact/layout/DefaultRepositoryLayoutTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultRepositoryLayoutTest.java	21 May 2003 08:05:25 -0000	1.1
  +++ DefaultRepositoryLayoutTest.java	23 May 2003 18:36:19 -0000	1.2
  @@ -57,15 +57,17 @@
   
   import org.apache.maven.artifact.Artifact;
   import org.apache.maven.artifact.DefaultArtifact;
  -import junit.framework.TestCase;
  +import org.apache.plexus.PlexusTestCase;
   
   /**
    * @author <a href="mailto:michal.maczka@dimatics.com">Michal Maczka</a>
    * @version $Id$
    */
  -public class DefaultRepositoryLayoutTest extends TestCase
  +public class DefaultRepositoryLayoutTest extends PlexusTestCase
   {
   
  +    private RepositoryLayout repositoryLayout = null;
  +
       /**
        * Constructor for DefaultRepositoryLayoutTest.
        * @param arg0
  @@ -75,37 +77,68 @@
           super(arg0);
       }
   
  +    public void setUp() throws Exception
  +    {
  +        super.setUp();
  +        repositoryLayout = (RepositoryLayout) lookup(RepositoryLayout.ROLE);
  +    }
  +
       public void testGeneratePath()
       {
  -        DefaultRepositoryLayout repositoryLayout =        
  +        DefaultRepositoryLayout repositoryLayout =
               new DefaultRepositoryLayout();
           try
           {
  -			repositoryLayout.initialize();
  +            repositoryLayout.initialize();
           }
  -        catch(Exception e)
  +        catch (Exception e)
           {
  -          String msg = "Repository Layout service cannot be initialized";
  -          fail(msg);
  -        }           
  -        Artifact artifactA = new DefaultArtifact();
  -        artifactA.setArtifactId("mm_id");
  -        artifactA.setGroupId("mm_group_id");
  -        artifactA.setVersion("1.0.0");
  -        artifactA.setType("a");
  -        String expectedPath = "mm_group_id/as/mm_id-1.0.0.a";
  -        String actualPath = null;
  +            String msg = "Repository Layout service cannot be initialized.";
  +            fail(msg);
  +        }
  +        
  +        String msg = "Expected path in repository is different than actual.";
  +
  +        Artifact a = new DefaultArtifact();
  +        a.setArtifactId("mm_id");
  +        a.setGroupId("mm_group_id");
  +        a.setVersion("1.0.0");
  +        a.setType("a");
  +        String expectedPath1 = "mm_group_id/as/mm_id-1.0.0.a";
  +        String actualPath1 = null;
           try
           {
  -            actualPath = repositoryLayout.generatePath(artifactA);
  +            actualPath1 = repositoryLayout.generatePath(a);
           }
           catch (Exception e)
           {
  -            String msg = "Cannot bulid repository layout for: " + artifactA;
  -            fail(msg);
  -        }        
  -        String msg = "Expected path in repository is different than actual";
  -        assertEquals(msg, expectedPath, actualPath);
  +            String msg2 =
  +                "Cannot bulid repository layout for: " + a + ".";
  +            fail(msg2);
  +        }
  +
  +        assertEquals(msg, expectedPath1, actualPath1);
  +
  +        Artifact ejb = new DefaultArtifact();
  +		ejb.setGroupId("boo");
  +        ejb.setArtifactId("foo");        
  +        ejb.setVersion("1.1.1");
  +        ejb.setType("ejb");
  +        String expectedPath2 = "boo/ejbs/foo-1.1.1.jar";
  +        String actualPath2 = null;
  +        try
  +        {
  +            actualPath2 = repositoryLayout.generatePath(ejb);
  +        }
  +        catch (Exception e)
  +        {
  +            String msg2 =
  +                "Cannot bulid repository layout for: " + ejb + ".";
  +            fail(msg2);
  +        }
  +
  +        assertEquals(msg, expectedPath2, actualPath2);
  +
       }
   
   }
  
  
  
  1.1                  maven-new/core/src/test/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>  
    </components>
  </configuration>
  
  
  

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