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/framework/src/test/org/apache/myrmidon/framework/file/test PathTestCase.java path.ant
Date Mon, 27 May 2002 13:06:07 GMT
adammurdoch    02/05/27 06:06:07

  Modified:    framework/src/java/org/apache/myrmidon/framework/file
                        FileListToStringConverter.java
               framework/src/test/org/apache/myrmidon/framework/conditions/test
                        isset.ant
               framework/src/test/org/apache/myrmidon/framework/file/test
                        PathTestCase.java path.ant
  Added:       framework/src/java/org/apache/myrmidon/framework/file
                        ListPathTask.java StringToFileConverter.java
               framework/src/test/org/apache/myrmidon/framework
                        LogTask.java
  Removed:     antlib/src/java/org/apache/antlib/core
                        StringToFileConverter.java
               antlib/src/java/org/apache/antlib/file ListPathTask.java
  Log:
  Fixed the last of the framework tests, by moving <list-path> task and
  StringToFileConverter from antlib to framework.
  
  Revision  Changes    Path
  1.3       +2 -2      jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/file/FileListToStringConverter.java
  
  Index: FileListToStringConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/file/FileListToStringConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FileListToStringConverter.java	20 Apr 2002 12:53:37 -0000	1.2
  +++ FileListToStringConverter.java	27 May 2002 13:06:07 -0000	1.3
  @@ -14,10 +14,10 @@
   import org.apache.myrmidon.api.TaskException;
   
   /**
  - * Converters from FileList to String.
  + * Converts from FileList to String.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.2 $ $Date: 2002/04/20 12:53:37 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/27 13:06:07 $
    *
    * @ant.converter source="org.apache.myrmidon.framework.file.FileList" destination="java.lang.String"
    */
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/file/ListPathTask.java
  
  Index: ListPathTask.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.framework.file;
  
  import org.apache.myrmidon.api.AbstractTask;
  import org.apache.myrmidon.api.TaskException;
  
  /**
   * A diagnostic task that lists the contents of a path.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/05/27 13:06:07 $
   *
   * @ant.task name="list-path"
   */
  public class ListPathTask
      extends AbstractTask
  {
      private final Path m_path = new Path();
  
      /**
       * Adds a nested path.
       */
      public void add( final FileList list )
      {
          m_path.add( list );
      }
  
      /**
       * Executes the task.
       */
      public void execute()
          throws TaskException
      {
          final String[] files = m_path.listFiles( getContext() );
          for( int i = 0; i < files.length; i++ )
          {
              final String file = files[ i ];
              getContext().info( file );
          }
      }
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/file/StringToFileConverter.java
  
  Index: StringToFileConverter.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.framework.file;
  
  import java.io.File;
  import org.apache.aut.converter.AbstractConverter;
  import org.apache.aut.converter.ConverterException;
  import org.apache.avalon.excalibur.i18n.ResourceManager;
  import org.apache.avalon.excalibur.i18n.Resources;
  import org.apache.myrmidon.api.TaskContext;
  import org.apache.myrmidon.api.TaskException;
  
  /**
   * String to file converter
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @ant.converter source="java.lang.String" destination="java.io.File"
   */
  public class StringToFileConverter
      extends AbstractConverter
  {
      private static final Resources REZ =
          ResourceManager.getPackageResources( StringToFileConverter.class );
  
      public StringToFileConverter()
      {
          super( String.class, File.class );
      }
  
      public Object convert( final Object object, final Object context )
          throws ConverterException
      {
          try
          {
              final TaskContext taskContext = (TaskContext)context;
              return taskContext.resolveFile( (String)object );
          }
          catch( final TaskException te )
          {
              final String message = REZ.getString( "convert.bad-file.error", object );
              throw new ConverterException( message, te );
          }
      }
  }
  
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/LogTask.java
  
  Index: LogTask.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.framework;
  
  import org.apache.myrmidon.api.AbstractTask;
  import org.apache.myrmidon.api.TaskException;
  
  /**
   * Log task used by framework tests.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/05/27 13:06:07 $
   *
   * @ant.task name="unit-test-log"
   */
  public class LogTask
      extends AbstractTask
  {
      private String m_content;
  
      public void addContent( final String content )
      {
          m_content = content;
      }
  
      public void execute()
          throws TaskException
      {
          getContext().info( m_content );
      }
  }
  
  
  
  1.3       +1 -1      jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/conditions/test/isset.ant
  
  Index: isset.ant
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/conditions/test/isset.ant,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- isset.ant	17 May 2002 07:48:10 -0000	1.2
  +++ isset.ant	27 May 2002 13:06:07 -0000	1.3
  @@ -3,7 +3,7 @@
   
       <!-- Set to some arbirary value -->
       <target name="set">
  -        <path id="test-prop" location="some-location"/>
  +        <path id="test-prop" path="some-path"/>
           <assert>
               <is-set property="test-prop"/>
           </assert>
  
  
  
  1.3       +3 -3      jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/file/test/PathTestCase.java
  
  Index: PathTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/file/test/PathTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PathTestCase.java	11 May 2002 12:44:01 -0000	1.2
  +++ PathTestCase.java	27 May 2002 13:06:07 -0000	1.3
  @@ -17,7 +17,7 @@
    * Test-cases for the <path> data type.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.2 $ $Date: 2002/05/11 12:44:01 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/27 13:06:07 $
    */
   public class PathTestCase
       extends AbstractTaskTestCase
  @@ -89,7 +89,7 @@
           };
           final String path = PathUtil.formatPath( files );
           final LogMessageTracker listener = new LogMessageTracker();
  -        listener.addExpectedMessage( "convert-path-to-string", "test-path = " + path );
  +        listener.addExpectedMessage( "/unit-test-log", "test-path = " + path );
   
           final File projectFile = getTestResource( "path.ant" );
           executeTarget( projectFile, "convert-path-to-string", listener );
  @@ -111,7 +111,7 @@
           {
               final String fileName = files[ i ];
               final File file = FileUtil.resolveFile( baseDir, fileName );
  -            listener.addExpectedMessage( targetName, file.getAbsolutePath() );
  +            listener.addExpectedMessage( "/list-path", file.getAbsolutePath() );
           }
   
           // Execute the target
  
  
  
  1.2       +1 -1      jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/file/test/path.ant
  
  Index: path.ant
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/file/test/path.ant,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- path.ant	14 Apr 2002 09:33:13 -0000	1.1
  +++ path.ant	27 May 2002 13:06:07 -0000	1.2
  @@ -74,7 +74,7 @@
       <!-- Test converting a path to a string -->
       <target name="convert-path-to-string">
           <path id="test-path" path="file1:file2"/>
  -        <log>test-path = ${test-path}</log>
  +        <unit-test-log>test-path = ${test-path}</unit-test-log>
       </target>
   
   </project>
  
  
  

--
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