commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject cvs commit: jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test ProviderWriteTests.java
Date Fri, 26 Dec 2003 23:51:06 GMT
ggregory    2003/12/26 15:51:06

  Modified:    vfs/src/test/org/apache/commons/vfs/test
                        ProviderWriteTests.java
  Log:
  Tests overwriting a file on the same file system. Try to duplicate problem reported on the
commons-user, could not (yet), but we have an extra test.
  Tests create-delete-create-a-file sequence on the same file system.
  
  Revision  Changes    Path
  1.14      +43 -0     jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/ProviderWriteTests.java
  
  Index: ProviderWriteTests.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/ProviderWriteTests.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ProviderWriteTests.java	26 Dec 2003 23:35:03 -0000	1.13
  +++ ProviderWriteTests.java	26 Dec 2003 23:51:06 -0000	1.14
  @@ -407,6 +407,49 @@
       }
   
       /**
  +     * Tests create-delete-create-a-file sequence on the same file system.
  +     */
  +    public void testCreateDeleteCreateSameFileSystem() throws Exception
  +    {
  +        final FileObject scratchFolder = createScratchFolder();
  +
  +        // Create direct child of the test folder
  +        final FileObject file = scratchFolder.resolveFile( "file1.txt" );
  +        assertTrue( !file.exists() );
  +
  +        // Create the source file
  +        final String content = "Here is some sample content for the file.  Blah Blah Blah.";
  +        final OutputStream os = file.getContent().getOutputStream();
  +        try
  +        {
  +            os.write( content.getBytes( "utf-8" ) );
  +        }
  +        finally
  +        {
  +            os.close();
  +        }
  +
  +        assertSameContent( content, file );
  +
  +        // Make sure we can copy the new file to another file on the same filesystem
  +        FileObject fileCopy = scratchFolder.resolveFile( "file1copy.txt" );
  +        assertTrue( !fileCopy.exists() );
  +        fileCopy.copyFrom( file, Selectors.SELECT_SELF );
  +
  +        assertSameContent( content, fileCopy );
  +
  +        // Delete the file.
  +        assertTrue( fileCopy.exists() );
  +        fileCopy.delete();
  +        
  +        // Make sure we can copy the same new file to the same target file on the same
filesystem
  +        assertTrue( !fileCopy.exists() );
  +        fileCopy.copyFrom( file, Selectors.SELECT_SELF );
  +
  +        assertSameContent( content, fileCopy );
  +    }
  +
  +    /**
        * Test that children are handled correctly by create and delete.
        */
       public void testListChildren() throws Exception
  
  
  

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


Mime
View raw message