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/aut/src/test/org/apache/aut/vfs/test AbstractFileSystemTestCase.java FtpFileSystemTestCase.java LocalFileSystemTestCase.java NestedZipFileSystemTestCase.java SmbFileSystemTestCase.java ZipFileSystemTestCase.java nested.zip test.zip
Date Sat, 13 Apr 2002 04:30:57 GMT
adammurdoch    02/04/12 21:30:57

  Modified:    aut      build.xml
               aut/src/test/org/apache/aut/vfs/test
                        AbstractFileSystemTestCase.java
  Added:       aut/src/test/org/apache/aut/vfs/provider/ftp/test
                        FtpFileSystemTestCase.java
               aut/src/test/org/apache/aut/vfs/provider/local/test
                        LocalFileSystemTestCase.java
               aut/src/test/org/apache/aut/vfs/provider/smb/test
                        SmbFileSystemTestCase.java
               aut/src/test/org/apache/aut/vfs/provider/zip/test
                        NestedZipFileSystemTestCase.java
                        ZipFileSystemTestCase.java nested.zip test.zip
  Removed:     aut/src/test/org/apache/aut/vfs/test
                        FtpFileSystemTestCase.java
                        LocalFileSystemTestCase.java
                        NestedZipFileSystemTestCase.java
                        SmbFileSystemTestCase.java
                        ZipFileSystemTestCase.java nested.zip test.zip
  Log:
  - Moved vfs provider tests to their own packages.
  - Fixed build when NetComponents and/or jCFIS not present.
  - Fixed 'mktestdata' target.
  
  Revision  Changes    Path
  1.6       +9 -20     jakarta-ant-myrmidon/aut/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/aut/build.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- build.xml	11 Apr 2002 12:58:00 -0000	1.5
  +++ build.xml	13 Apr 2002 04:30:57 -0000	1.6
  @@ -82,9 +82,9 @@
               <classpath refid="project.class.path" />
               <src path="${test.dir}"/>
               <include name="**/*.java"/>
  -            <exclude name="org/apache/aut/vfs/provider/smb/*.java" 
  +            <exclude name="org/apache/aut/vfs/provider/smb/**/*.java"
                        unless="jcifs.present" />
  -            <exclude name="org/apache/aut/vfs/provider/ftp/*.java" 
  +            <exclude name="org/apache/aut/vfs/provider/ftp/**/*.java"
                        unless="netcomp.present" />
           </javac>
   
  @@ -158,23 +158,16 @@
           </javadoc>
       </target>
   
  -    <target name="mktestdata" description="Regenerate test data">
  +    <target name="mktestdata" depends="prepare" description="Regenerate test data">
   
  -        <!-- Prepare the VFS tests -->
  -        <copy todir="${test.working.dir}">
  -            <fileset dir="${test.dir}">
  -                <exclude name="**/*.java"/>
  -            </fileset>
  -        </copy>
  -
  -        <property name="test.vfs.dir" location="${test.working.dir}/org/apache/aut/vfs/test"/>
  -        <mkdir dir="${test.vfs.dir}/write-tests"/>
  +        <property name="test.vfs.dir" location="src/test/org/apache/aut/vfs/test"/>
           <mkdir dir="${test.vfs.dir}/basedir/emptydir"/>
  -        <zip zipfile="${test.vfs.dir}/test.zip">
  +        <property name="test.zip.dir" location="src/test/org/apache/aut/vfs/provider/zip/test"/>
  +        <zip zipfile="${test.zip.dir}/test.zip">
               <fileset dir="${test.vfs.dir}" includes="basedir/**"/>
           </zip>
  -        <zip zipfile="${test.vfs.dir}/nested.zip">
  -            <fileset dir="${test.vfs.dir}" includes="test.zip"/>
  +        <zip zipfile="${test.zip.dir}/nested.zip">
  +            <fileset dir="${test.zip.dir}" includes="test.zip"/>
           </zip>
   
       </target>
  @@ -194,11 +187,7 @@
               </fileset>
           </copy>
   
  -        <!-- next two lines should be put into suite setUp() -->
  -        <mkdir dir="${test.working.dir}/org/apache/aut/vfs/test/write-tests"/>
  -        <mkdir dir="${test.working.dir}/org/apache/aut/vfs/test/basedir/emptydir"/>
  -
  -        <junit fork="true"
  +        <junit fork="false"
               haltonfailure="${junit.failonerror}"
               printsummary="yes"
               dir="${build.tests}">
  
  
  
  1.1                  jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/provider/ftp/test/FtpFileSystemTestCase.java
  
  Index: FtpFileSystemTestCase.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.aut.vfs.provider.ftp.test;
  
  import org.apache.aut.vfs.provider.ftp.FtpFileSystemProvider;
  import org.apache.aut.vfs.test.AbstractWritableFileSystemTestCase;
  import org.apache.aut.vfs.FileObject;
  
  /**
   * Tests for FTP file systems.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   */
  public class FtpFileSystemTestCase
      extends AbstractWritableFileSystemTestCase
  {
      public FtpFileSystemTestCase( String name )
      {
          super( name );
      }
  
      /**
       * Returns the URI for the base folder.
       */
      protected FileObject getBaseFolder() throws Exception
      {
          final String uri = System.getProperty( "test.ftp.uri" ) + "/read-tests";
          m_manager.addProvider( "ftp", new FtpFileSystemProvider() );
          return m_manager.resolveFile( uri );
      }
  
      /**
       * Returns the URI for the area to do tests in.
       */
      protected FileObject getWriteFolder() throws Exception
      {
          final String uri = System.getProperty( "test.ftp.uri" ) + "/write-tests";
          return m_manager.resolveFile( uri );
      }
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/provider/local/test/LocalFileSystemTestCase.java
  
  Index: LocalFileSystemTestCase.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.aut.vfs.provider.local.test;
  
  import java.io.File;
  import org.apache.aut.vfs.test.AbstractWritableFileSystemTestCase;
  import org.apache.aut.vfs.FileObject;
  
  /**
   * Tests for the local file system.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   */
  public class LocalFileSystemTestCase extends AbstractWritableFileSystemTestCase
  {
      public LocalFileSystemTestCase( String name )
      {
          super( name );
      }
  
      /**
       * Returns the URI for the base folder.
       */
      protected FileObject getBaseFolder() throws Exception
      {
          // Cheat a little
          final File testDir = getTestResource( "../../../test/basedir" );
          final File emptyDir = new File( testDir, "emptydir" );
          emptyDir.mkdirs();
          return m_manager.convert( testDir );
      }
  
      /**
       * Returns the URI for the area to do tests in.
       */
      protected FileObject getWriteFolder() throws Exception
      {
          final File testDir = getTestDirectory( "write-tests" );
          return m_manager.convert( testDir );
      }
  
      /**
       * Tests resolution of an absolute file name.
       */
      public void testAbsoluteFileName() throws Exception
      {
          // Locate file by absolute file name
          String fileName = new File( "testdir" ).getAbsolutePath();
          FileObject absFile = m_manager.resolveFile( fileName );
  
          // Locate file by URI
          String uri = "file://" + fileName.replace( File.separatorChar, '/' );
          FileObject uriFile = m_manager.resolveFile( uri );
  
          assertSame( "file object", absFile, uriFile );
      }
  
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/provider/smb/test/SmbFileSystemTestCase.java
  
  Index: SmbFileSystemTestCase.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.aut.vfs.provider.smb.test;
  
  import org.apache.aut.vfs.provider.smb.SmbFileSystemProvider;
  import org.apache.aut.vfs.test.AbstractWritableFileSystemTestCase;
  import org.apache.aut.vfs.FileObject;
  
  /**
   * Tests for the SMB file system.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   */
  public class SmbFileSystemTestCase extends AbstractWritableFileSystemTestCase
  {
      public SmbFileSystemTestCase( String name )
      {
          super( name );
      }
  
      /**
       * Returns the URI for the base folder.
       */
      protected FileObject getBaseFolder() throws Exception
      {
          final String uri = System.getProperty( "test.smb.uri" ) + "/read-tests";
          m_manager.addProvider( "smb", new SmbFileSystemProvider() );
          return m_manager.resolveFile( uri );
      }
  
      /**
       * Returns the URI for the area to do tests in.
       */
      protected FileObject getWriteFolder() throws Exception
      {
          final String uri = System.getProperty( "test.smb.uri" ) + "/write-tests";
          return m_manager.resolveFile( uri );
      }
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/provider/zip/test/NestedZipFileSystemTestCase.java
  
  Index: NestedZipFileSystemTestCase.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.aut.vfs.provider.zip.test;
  
  import org.apache.aut.vfs.provider.zip.ZipFileSystemProvider;
  import org.apache.aut.vfs.test.AbstractReadOnlyFileSystemTestCase;
  import org.apache.aut.vfs.FileObject;
  
  /**
   * Tests for the Zip file system, using a zip file nested inside another zip file.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   */
  public class NestedZipFileSystemTestCase
      extends AbstractReadOnlyFileSystemTestCase
  {
      public NestedZipFileSystemTestCase( String name )
      {
          super( name );
      }
  
      /**
       * Returns the URI for the base folder.
       */
      protected FileObject getBaseFolder() throws Exception
      {
          m_manager.addProvider( "zip", new ZipFileSystemProvider() );
  
          // Locate the base Zip file
          final String zipFilePath = getTestResource( "nested.zip" ).getAbsolutePath();
          String uri = "zip:" + zipFilePath + "!/test.zip";
          final FileObject zipFile = m_manager.resolveFile( uri );
  
          // Now build the nested file system
          final FileObject nestedFS = m_manager.createFileSystem( "zip", zipFile );
          return nestedFS.resolveFile( "/basedir" );
      }
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/provider/zip/test/ZipFileSystemTestCase.java
  
  Index: ZipFileSystemTestCase.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.aut.vfs.provider.zip.test;
  
  import java.io.File;
  import org.apache.aut.vfs.provider.zip.ZipFileSystemProvider;
  import org.apache.aut.vfs.test.AbstractReadOnlyFileSystemTestCase;
  import org.apache.aut.vfs.FileObject;
  
  /**
   * Tests for the Zip file system.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   */
  public class ZipFileSystemTestCase extends AbstractReadOnlyFileSystemTestCase
  {
      public ZipFileSystemTestCase( String name )
      {
          super( name );
      }
  
      /**
       * Returns the URI for the base folder.
       */
      protected FileObject getBaseFolder() throws Exception
      {
          File zipFile = getTestResource( "test.zip" );
          String uri = "zip:" + zipFile.getAbsolutePath() + "!basedir";
          m_manager.addProvider( "zip", new ZipFileSystemProvider() );
          return m_manager.resolveFile( uri );
      }
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/provider/zip/test/nested.zip
  
  	<<Binary file>>
  
  
  1.1                  jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/provider/zip/test/test.zip
  
  	<<Binary file>>
  
  
  1.4       +15 -0     jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/test/AbstractFileSystemTestCase.java
  
  Index: AbstractFileSystemTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/test/AbstractFileSystemTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractFileSystemTestCase.java	10 Apr 2002 12:24:19 -0000	1.3
  +++ AbstractFileSystemTestCase.java	13 Apr 2002 04:30:57 -0000	1.4
  @@ -69,6 +69,21 @@
           return getTestResource( name, true );
       }
   
  +    protected File getTestDirectory( final String name )
  +    {
  +        File file = new File( m_testBaseDir, name );
  +        file = getCanonicalFile( file );
  +        if( file.exists() )
  +        {
  +            assertTrue( "Test directory \"" + file + "\" exists and is not a directory.",
file.isDirectory() );
  +        }
  +        else
  +        {
  +            assertTrue( "Could not create test directory \"" + file + "\".", file.mkdirs()
);
  +        }
  +        return file;
  +    }
  +
       /**
        * Returns the name of the package containing a class.
        *
  
  
  

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