This content has been marked as final.
Show 12 replies
-
1. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
alesj Nov 3, 2007 10:49 AM (in response to alesj)But this then breaks AbstractVFSContextTest.testGetVFS:
public void testGetVFS() throws Exception { VFSContext context = getVFSContext("simple"); URI rootURI = context.getRootURI(); VFS vfs = context.getVFS(); VirtualFile rootFile = vfs.getRoot(); URI uri = new URI("vfs" + rootURI); URI rfUri = rootFile.toURI(); assertEquals(uri, rfUri); }
What's the deal here?
Are both tests OK?
Fixing transformation between uri/url?
Or adding simple vfs* context factories? -
2. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
starksm64 Nov 3, 2007 12:18 PM (in response to alesj) -
3. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
alesj Nov 3, 2007 12:21 PM (in response to alesj)"scott.stark@jboss.org" wrote:
This is http://jira.jboss.com/jira/browse/JBMICROCONT-155.
Uf, I need to start looking at the JIRA issues first. Specially if they are assigned to me. :-)
I'm almost done with '..', getting the first simple tests to pass. -
4. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
alesj Nov 3, 2007 12:48 PM (in response to alesj)What can be the reason my File.delete() doesn't return true == doesn't really delete the file?
Security issues?
Getting all those tests that should delete to fail ... -
5. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
starksm64 Nov 3, 2007 1:04 PM (in response to alesj)Permissions on the file system, a directory that is not empty are the main reasons.
-
6. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
alesj Nov 3, 2007 1:37 PM (in response to alesj)"scott.stark@jboss.org" wrote:
Permissions on the file system, a directory that is not empty are the main reasons.
Even for a temp file?public void testFileURLs() throws Exception { File tmp = File.createTempFile("testFileURLs", null); URL tmpURL = tmp.toURL(); URLConnection conn = tmpURL.openConnection(); long lastModified = conn.getLastModified(); System.out.println("lastModified, "+lastModified); assertNotSame("lastModified", 0, lastModified); assertTrue(tmp.getAbsolutePath()+" deleted", tmp.delete()); conn = tmpURL.openConnection(); lastModified = conn.getLastModified(); System.out.println("lastModified after delete, "+lastModified); assertEquals("lastModified", 0, lastModified); }
-
7. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
starksm64 Nov 3, 2007 4:28 PM (in response to alesj)I imagine its because of the URLConnection having the file open. This is one of the problems with the url handler apis, no way to close/disconnect. Try getting the InputStream and closing that before deleting the file.
-
8. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
alesj Nov 4, 2007 9:51 AM (in response to alesj)This - JBMICROCONT-155 - is fixed in the trunk.
Will see what I can do with these open/undeletable files. -
9. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
alesj Nov 6, 2007 7:20 AM (in response to alesj)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());
-
10. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
starksm64 Nov 6, 2007 1:39 PM (in response to alesj)What delete fails? I can't see how the testFileExists delete should fail.
-
11. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
alesj Nov 6, 2007 1:43 PM (in response to alesj)"scott.stark@jboss.org" wrote:
What delete fails? I can't see how the testFileExists delete should fail.
If you run this test case on Winz, the file is not deleted, so File.delete (tmp.delete()) doesn't return true. -
12. Re: Failing FileVFSUnitTestCase.testVFSFileURIFactory in VFS
alesj Nov 6, 2007 2:21 PM (in response to alesj)"alesj" wrote:
"scott.stark@jboss.org" wrote:
What delete fails? I can't see how the testFileExists delete should fail.
If you run this test case on Winz, the file is not deleted, so File.delete (tmp.delete()) doesn't return true.
Since, similar to URLExistsUnitTestCase, looks like something is again holding the resources.3500 DEBUG [FileVFSUnitTestCase] ==== Starting testFileExists ==== 3500 INFO [FileVFSUnitTestCase] +++ testFileExists, tmp=C:\tmp\vfs\vfs33660.root\testFileExists33661.tmp 3500 DEBUG [FileVFSUnitTestCase] testFileExists took 0ms 3500 DEBUG [FileVFSUnitTestCase] ==== Stopping testFileExists ==== junit.framework.AssertionFailedError: tmp.delete() at org.jboss.test.virtual.test.FileVFSUnitTestCase.testFileExists(FileVFSUnitTestCase.java:1287) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)