[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS

alesj do-not-reply at jboss.com
Tue Nov 6 07:20:26 EST 2007


What needs to be closed here

  |    public void testFileExists()
  |       throws Exception
  |    {
  |       File tmpRoot = File.createTempFile("vfs", ".root");
  |       tmpRoot.delete();
  |       tmpRoot.mkdir();
  |       File tmp = File.createTempFile("testFileExists", null, tmpRoot);
  |       log.info("+++ testFileExists, tmp="+tmp.getCanonicalPath());
  | 
  |       URL rootURL = tmpRoot.toURL();
  |       VFS vfs = VFS.getVFS(rootURL);
  |       VirtualFile tmpVF = vfs.findChild(tmp.getName());
  |       assertTrue(tmpVF.getPathName()+".exists()", tmpVF.exists());
  |       assertTrue("tmp.delete()", tmp.delete());
  |       assertFalse(tmpVF.getPathName()+".exists()", tmpVF.exists());
  |       assertTrue(tmpRoot+".delete()", tmpRoot.delete());
  |    }
  | 
in order to be able to delete tmp file on Winz?

This worked for the URLConnection test case:

  |       InputStream in = conn.getInputStream();
  |       long lastModified;
  |       try
  |       {
  |          lastModified = conn.getLastModified();
  |          System.out.println("lastModified, "+lastModified);
  |          assertNotSame("lastModified", 0, lastModified);
  |       }
  |       finally
  |       {
  |          in.close();
  |       }
  |       assertTrue(tmp.getAbsolutePath()+" deleted", tmp.delete());
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102184#4102184

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102184



More information about the jboss-dev-forums mailing list