ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test DefaultProjectBuilderTestCase.java
Date Tue, 21 May 2002 01:49:05 GMT
donaldp     02/05/20 18:49:05

  Modified:    container/src/test/org/apache/myrmidon/components/builder/test
                        DefaultProjectBuilderTestCase.java
  Log:
  Oops - have to make test case compile again
  
  Revision  Changes    Path
  1.7       +59 -51    jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java
  
  Index: DefaultProjectBuilderTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultProjectBuilderTestCase.java	17 May 2002 07:43:47 -0000	1.6
  +++ DefaultProjectBuilderTestCase.java	21 May 2002 01:49:05 -0000	1.7
  @@ -8,6 +8,7 @@
   package org.apache.myrmidon.components.builder.test;
   
   import java.io.File;
  +import java.io.IOException;
   import java.util.Arrays;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.excalibur.io.FileUtil;
  @@ -21,7 +22,7 @@
    * Test cases for {@link DefaultProjectBuilder}.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.6 $ $Date: 2002/05/17 07:43:47 $
  + * @version $Revision: 1.7 $ $Date: 2002/05/21 01:49:05 $
    */
   public class DefaultProjectBuilderTestCase
       extends AbstractContainerTestCase
  @@ -42,16 +43,9 @@
           m_builder.enableLogging( getLogger() );
       }
   
  -    /**
  -     * Creates a project, with default values set.
  -     */
  -    private DefaultProject createProject( final File projFile )
  +    private String getURIFor( final File projFile ) throws IOException
       {
  -        final DefaultProject project = new DefaultProject();
  -        project.setProjectName( FileUtil.removeExtension( projFile.getName() ) );
  -        project.setBaseDirectory( getTestDirectory( "." ) );
  -        project.setDefaultTargetName( "main" );
  -        return project;
  +        return projFile.getCanonicalFile().toURL().toExternalForm();
       }
   
       /**
  @@ -70,10 +64,10 @@
           catch( ProjectException e )
           {
               final String[] messages =
  -            {
  -                REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
  -                REZ.getString( "ant.no-project-file.error" )
  -            };
  +                {
  +                    REZ.getString( "ant.project-build.error", projFile.getAbsolutePath()
),
  +                    REZ.getString( "ant.no-project-file.error" )
  +                };
               assertSameMessage( messages, e );
           }
   
  @@ -88,10 +82,10 @@
           catch( ProjectException e )
           {
               final String[] messages =
  -            {
  -                REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
  -                REZ.getString( "ant.no-project-file.error" )
  -            };
  +                {
  +                    REZ.getString( "ant.project-build.error", projFile.getAbsolutePath()
),
  +                    REZ.getString( "ant.no-project-file.error" )
  +                };
               assertSameMessage( messages, e );
           }
       }
  @@ -110,10 +104,10 @@
           catch( ProjectException e )
           {
               final String[] messages =
  -            {
  -                REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
  -                REZ.getString( "ant.project-parse.error" )
  -            };
  +                {
  +                    REZ.getString( "ant.project-build.error", projFile.getAbsolutePath()
),
  +                    REZ.getString( "ant.project-parse.error" )
  +                };
               assertSameMessage( messages, e );
           }
       }
  @@ -129,10 +123,19 @@
           Project project = m_builder.build( projFile.getAbsolutePath() );
   
           // Compare against expected project
  -        DefaultProject expected = createProject( projFile );
  +        DefaultProject expected =
  +            new DefaultProject( getNameFor( projFile ),
  +                                getURIFor( projFile ),
  +                                getTestDirectory(),
  +                                "main" );
           assertSameProject( expected, project );
       }
   
  +    private String getNameFor( final File projFile )
  +    {
  +        return FileUtil.removeExtension( projFile.getName() );
  +    }
  +
       /**
        * Tests setting the project name.
        */
  @@ -143,8 +146,11 @@
           Project project = m_builder.build( projFile.getAbsolutePath() );
   
           // Compare against expected project
  -        DefaultProject expected = createProject( projFile );
  -        expected.setProjectName( "some-project" );
  +        DefaultProject expected =
  +            new DefaultProject( "some-project",
  +                                getURIFor( projFile ),
  +                                getTestDirectory(),
  +                                "main" );
           assertSameProject( expected, project );
       }
   
  @@ -158,9 +164,8 @@
           Project project = m_builder.build( projFile.getAbsolutePath() );
   
           // Compare against expected project
  -        DefaultProject expected = createProject( projFile );
           final File baseDir = getTestDirectory( "other-base-dir" );
  -        expected.setBaseDirectory( baseDir );
  +        DefaultProject expected = new DefaultProject( getNameFor( projFile ), getURIFor(
projFile ), baseDir, "main" );
           assertSameProject( expected, project );
       }
   
  @@ -174,8 +179,11 @@
           Project project = m_builder.build( projFile.getAbsolutePath() );
   
           // Compare against expected project
  -        DefaultProject expected = createProject( projFile );
  -        expected.setDefaultTargetName( "some-target" );
  +        DefaultProject expected =
  +            new DefaultProject( getNameFor( projFile ),
  +                                getURIFor( projFile ),
  +                                getTestDirectory(),
  +                                "some-target" );
           assertSameProject( expected, project );
       }
   
  @@ -194,10 +202,10 @@
           catch( ProjectException e )
           {
               final String[] messages =
  -            {
  -                REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
  -                REZ.getString( "ant.version-missing.error" )
  -            };
  +                {
  +                    REZ.getString( "ant.project-build.error", projFile.getAbsolutePath()
),
  +                    REZ.getString( "ant.version-missing.error" )
  +                };
               assertSameMessage( messages, e );
           }
   
  @@ -211,10 +219,10 @@
           catch( ProjectException e )
           {
               final String[] messages =
  -            {
  -                REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
  -                REZ.getString( "ant.malformed.version", "ant2" )
  -            };
  +                {
  +                    REZ.getString( "ant.project-build.error", projFile.getAbsolutePath()
),
  +                    REZ.getString( "ant.malformed.version", "ant2" )
  +                };
               assertSameMessage( messages, e );
           }
   
  @@ -228,10 +236,10 @@
           catch( ProjectException e )
           {
               final String[] messages =
  -            {
  -                REZ.getString( "ant.project-build.error", projFile.getAbsolutePath() ),
  -                REZ.getString( "ant.bad-version.error", "2.0.0", "1.0.2" )
  -            };
  +                {
  +                    REZ.getString( "ant.project-build.error", projFile.getAbsolutePath()
),
  +                    REZ.getString( "ant.bad-version.error", "2.0.0", "1.0.2" )
  +                };
               assertSameMessage( messages, e );
           }
       }
  @@ -242,7 +250,7 @@
       protected void assertSameProject( final Project expected,
                                         final Project project )
       {
  -        assertEquals( expected.getProjectName(), project.getProjectName() );
  +        assertEquals( expected.getName(), project.getName() );
           assertEquals( expected.getBaseDirectory(), project.getBaseDirectory() );
           assertEquals( expected.getDefaultTargetName(), project.getDefaultTargetName() );
   
  @@ -270,10 +278,10 @@
           catch( Exception e )
           {
               final String[] messages =
  -            {
  -                REZ.getString( "ant.project-build.error", badProjectFile.getAbsolutePath()
),
  -                REZ.getString( "ant.project-bad-name.error" )
  -            };
  +                {
  +                    REZ.getString( "ant.project-build.error", badProjectFile.getAbsolutePath()
),
  +                    REZ.getString( "ant.project-bad-name.error" )
  +                };
               assertSameMessage( messages, e );
           }
   
  @@ -287,11 +295,11 @@
           catch( Exception e )
           {
               final String[] messages =
  -            {
  -                REZ.getString( "ant.project-build.error", badTargetFile.getAbsolutePath()
),
  -                // TODO - check error message
  -                null
  -            };
  +                {
  +                    REZ.getString( "ant.project-build.error", badTargetFile.getAbsolutePath()
),
  +                    // TODO - check error message
  +                    null
  +                };
               assertSameMessage( messages, e );
           }
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message