commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1360518 - in /commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2: provider/http/test/HttpProviderTestCase.java test/ProviderReadTests.java
Date Thu, 12 Jul 2012 02:58:25 GMT
Author: ggregory
Date: Thu Jul 12 02:58:24 2012
New Revision: 1360518

URL: http://svn.apache.org/viewvc?rev=1360518&view=rev
Log:
Test getContent() and getContent().getContentInfo() in isolation for VFS-427: NPE on HttpFileObject.getContent().getContentInfo().
No issue yet.

Modified:
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java?rev=1360518&r1=1360517&r2=1360518&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java
Thu Jul 12 02:58:24 2012
@@ -19,10 +19,14 @@ package org.apache.commons.vfs2.provider
 import java.io.File;
 import java.io.IOException;
 
+import junit.framework.Assert;
 import junit.framework.Test;
 
+import org.apache.commons.vfs2.FileContent;
 import org.apache.commons.vfs2.FileObject;
+import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileSystemManager;
+import org.apache.commons.vfs2.VFS;
 import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
 import org.apache.commons.vfs2.provider.http.HttpFileProvider;
 import org.apache.commons.vfs2.test.AbstractProviderTestConfig;
@@ -32,7 +36,7 @@ import org.apache.commons.vfs2.util.NHtt
 
 /**
  * Test cases for the HTTP provider.
- *
+ * 
  */
 public class HttpProviderTestCase extends AbstractProviderTestConfig
 {
@@ -54,7 +58,7 @@ public class HttpProviderTestCase extend
 
     /**
      * Creates and starts an embedded Apache HTTP Server (HttpComponents).
-     *
+     * 
      * @throws Exception
      */
     private static void setUpClass() throws Exception
@@ -68,7 +72,7 @@ public class HttpProviderTestCase extend
 
     /**
      * Creates a new test suite.
-     *
+     * 
      * @return a new test suite.
      * @throws Exception
      *             Thrown when the suite cannot be constructed.
@@ -98,7 +102,7 @@ public class HttpProviderTestCase extend
 
     /**
      * Stops the embedded Apache HTTP Server.
-     *
+     * 
      * @throws IOException
      */
     private static void tearDownClass() throws IOException
@@ -111,7 +115,7 @@ public class HttpProviderTestCase extend
 
     /**
      * Builds a new test case.
-     *
+     * 
      * @throws IOException
      *             Thrown if a free local socket port cannot be found.
      */
@@ -144,4 +148,18 @@ public class HttpProviderTestCase extend
     {
         manager.addProvider("http", new HttpFileProvider());
     }
+
+    public void testGetContent() throws FileSystemException
+    {
+        final FileObject file = VFS.getManager().resolveFile(ConnectionUri + "/read-tests/file1.txt");
+        Assert.assertNotNull(file.getContent());
+    }
+
+    public void testGetContentInfo() throws FileSystemException
+    {
+        final FileObject file = VFS.getManager().resolveFile(ConnectionUri + "/read-tests/file1.txt");
+        final FileContent content = file.getContent();
+        Assert.assertNotNull(content);
+        Assert.assertNotNull(content.getContentInfo());
+    }
 }

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java?rev=1360518&r1=1360517&r2=1360518&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
Thu Jul 12 02:58:24 2012
@@ -243,6 +243,24 @@ public class ProviderReadTests extends A
         Assert.assertTrue(folder.isReadable());
     }
     
+    public void testGetContent() throws Exception
+    {
+        final FileObject file = resolveFile1Txt();
+        assertTrue(file.exists());
+        final FileContent content = file.getContent();
+        assertNotNull(content);
+    }
+
+    public void testGetContentInfo() throws Exception
+    {
+        final FileObject file = resolveFile1Txt();
+        assertTrue(file.exists());
+        final FileContent content = file.getContent();
+        assertNotNull(content);
+        final FileContentInfo contentInfo = content.getContentInfo();
+        assertNotNull(contentInfo);
+    }
+    
     private FileObject resolveFile1Txt() throws FileSystemException
     {
         return getReadFolder().resolveFile("file1.txt");
@@ -272,24 +290,6 @@ public class ProviderReadTests extends A
         }
     }
 
-    public void testContent() throws Exception
-    {
-        final FileObject file = resolveFile1Txt();
-        assertTrue(file.exists());
-        final FileContent content = file.getContent();
-        assertNotNull(content);
-    }
-
-    public void testContentInfo() throws Exception
-    {
-        final FileObject file = resolveFile1Txt();
-        assertTrue(file.exists());
-        final FileContent content = file.getContent();
-        assertNotNull(content);
-        final FileContentInfo contentInfo = content.getContentInfo();
-        assertNotNull(contentInfo);
-    }
-    
     /**
      * Tests that findFiles() works.
      */



Mime
View raw message