ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test DefaultProjectBuilderTestCase.java bad-target-name.ant
Date Mon, 27 May 2002 13:42:31 GMT
adammurdoch    02/05/27 06:42:30

  Modified:    container/src/test/org/apache/myrmidon/components/builder/test
                        DefaultProjectBuilderTestCase.java
  Removed:     container/src/test/org/apache/myrmidon/components/builder/test
                        bad-target-name.ant
  Log:
  Fixed last broken unit test (ever):
  * Make sure project builder is initialised properly.
  * Removed test for target name validation, as project builder isn't responsible for this
any more.
  
  Revision  Changes    Path
  1.10      +15 -25    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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultProjectBuilderTestCase.java	23 May 2002 09:19:24 -0000	1.9
  +++ DefaultProjectBuilderTestCase.java	27 May 2002 13:42:30 -0000	1.10
  @@ -12,9 +12,14 @@
   import java.util.Collections;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.excalibur.io.FileUtil;
  +import org.apache.avalon.framework.container.ContainerUtil;
  +import org.apache.avalon.framework.service.DefaultServiceManager;
   import org.apache.myrmidon.AbstractContainerTestCase;
  +import org.apache.myrmidon.components.builder.DefaultModelBuilder;
   import org.apache.myrmidon.components.builder.DefaultProject;
   import org.apache.myrmidon.components.builder.DefaultProjectBuilder;
  +import org.apache.myrmidon.interfaces.builder.ModelBuilder;
  +import org.apache.myrmidon.interfaces.builder.ProjectBuilder;
   import org.apache.myrmidon.interfaces.builder.ProjectException;
   import org.apache.myrmidon.interfaces.oldmodel.Project;
   
  @@ -22,14 +27,14 @@
    * Test cases for {@link DefaultProjectBuilder}.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.9 $ $Date: 2002/05/23 09:19:24 $
  + * @version $Revision: 1.10 $ $Date: 2002/05/27 13:42:30 $
    */
   public class DefaultProjectBuilderTestCase
       extends AbstractContainerTestCase
   {
       private static final Resources REZ = getResourcesForTested( DefaultProjectBuilderTestCase.class
);
   
  -    private DefaultProjectBuilder m_builder;
  +    private ProjectBuilder m_builder;
   
       public DefaultProjectBuilderTestCase( String name )
       {
  @@ -39,8 +44,11 @@
       protected void setUp() throws Exception
       {
           super.setUp();
  +        final DefaultServiceManager serviceManager = new DefaultServiceManager();
  +        serviceManager.put( ModelBuilder.ROLE, new DefaultModelBuilder() );
           m_builder = new DefaultProjectBuilder();
  -        m_builder.enableLogging( getLogger() );
  +        ContainerUtil.enableLogging( m_builder, getLogger() );
  +        ContainerUtil.service( m_builder, serviceManager );
       }
   
       private String getURIFor( final File projFile ) throws IOException
  @@ -120,7 +128,7 @@
       {
           // Build project
           final File projFile = getTestResource( "defaults.ant" );
  -        Project project = m_builder.build( projFile.getAbsolutePath() );
  +        final Project project = m_builder.build( projFile.getAbsolutePath() );
   
           // Compare against expected project
           DefaultProject expected =
  @@ -145,7 +153,7 @@
       {
           // Build project
           final File projFile = getTestResource( "set-project-name.ant" );
  -        Project project = m_builder.build( projFile.getAbsolutePath() );
  +        final Project project = m_builder.build( projFile.getAbsolutePath() );
   
           // Compare against expected project
           DefaultProject expected =
  @@ -165,7 +173,7 @@
       {
           // Build project
           final File projFile = getTestResource( "set-base-dir.ant" );
  -        Project project = m_builder.build( projFile.getAbsolutePath() );
  +        final Project project = m_builder.build( projFile.getAbsolutePath() );
   
           // Compare against expected project
           final File baseDir = getTestDirectory( "other-base-dir" );
  @@ -186,7 +194,7 @@
       {
           // Build project
           final File projFile = getTestResource( "set-default-target.ant" );
  -        Project project = m_builder.build( projFile.getAbsolutePath() );
  +        final Project project = m_builder.build( projFile.getAbsolutePath() );
   
           // Compare against expected project
           DefaultProject expected =
  @@ -293,24 +301,6 @@
                   {
                       REZ.getString( "ant.project-build.error", badProjectFile.getAbsolutePath()
),
                       REZ.getString( "ant.project-bad-name.error" )
  -                };
  -            assertSameMessage( messages, e );
  -        }
  -
  -        // Check bad target name
  -        final File badTargetFile = getTestResource( "bad-target-name.ant" );
  -        try
  -        {
  -            m_builder.build( badTargetFile.getAbsolutePath() );
  -            fail();
  -        }
  -        catch( Exception e )
  -        {
  -            final String[] messages =
  -                {
  -                    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