/** * Tests FileSystem#getLastModTimeAccuracy for sane values. * * @throws FileSystemException if error occurred */ public void testGetAccurary() throws FileSystemException { final FileObject file = getReadFolder().resolveFile("file1.txt"); final long lastModTimeAccuracy = (long) file.getFileSystem().getLastModTimeAccuracy(); // System.out.println("Accuracy on " + file.getFileSystem().getRootURI() + " is " + lastModTimeAccuracy + " as // told by " + file.getFileSystem().getClass().getCanonicalName()); assertTrue("Accuracy must be positive", lastModTimeAccuracy >= 0); assertTrue("Accuracy must be < 2m", lastModTimeAccuracy < 2 * 60 * 1000); // just any sane limit }
/** * Tests FileSystem#getLastModTimeAccuracy for sane values. * * @throws FileSystemException if error occurred */ public void testGetAccurary() throws FileSystemException { final FileObject file = getReadFolder().resolveFile("file1.txt"); final long lastModTimeAccuracy = (long) file.getFileSystem().getLastModTimeAccuracy(); // System.out.println("Accuracy on " + file.getFileSystem().getRootURI() + " is " + lastModTimeAccuracy + " as // told by " + file.getFileSystem().getClass().getCanonicalName()); assertTrue("Accuracy must be positive", lastModTimeAccuracy >= 0); assertTrue("Accuracy must be < 2m", lastModTimeAccuracy < 2 * 60 * 1000); // just any sane limit }
/** * Tests setting the last modified time of a folder. * * @throws FileSystemException if error occurred */ public void testSetLastModifiedFolder() throws FileSystemException { final long yesterday = System.currentTimeMillis() - 24 * 60 * 60 * 1000; if (getReadFolder().getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FOLDER)) { // Try a folder final FileObject folder = getReadFolder().resolveFile("dir1"); folder.getContent().setLastModifiedTime(yesterday); final long lastModTimeAccuracy = (long) folder.getFileSystem().getLastModTimeAccuracy(); // folder.refresh(); TODO: does not work with SSH VFS-563 final long lastModifiedTime = folder.getContent().getLastModifiedTime(); assertDelta("set/getLastModified on Folder", yesterday, lastModifiedTime, lastModTimeAccuracy); } }
/** * Tests setting the last modified time of file. * * @throws FileSystemException if error occurred */ public void testSetLastModifiedFile() throws FileSystemException { final long yesterday = System.currentTimeMillis() - 24 * 60 * 60 * 1000; if (getReadFolder().getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE)) { // Try a file final FileObject file = getReadFolder().resolveFile("file1.txt"); file.getContent().setLastModifiedTime(yesterday); final long lastModTimeAccuracy = (long) file.getFileSystem().getLastModTimeAccuracy(); // folder.refresh(); TODO: does not work with SSH VFS-563 final long lastModifiedTime = file.getContent().getLastModifiedTime(); assertDelta("set/getLastModified on File", yesterday, lastModifiedTime, lastModTimeAccuracy); } } }
/** * Tests setting the last modified time of a folder. * * @throws FileSystemException if error occurred */ public void testSetLastModifiedFolder() throws FileSystemException { final long yesterday = System.currentTimeMillis() - 24 * 60 * 60 * 1000; if (getReadFolder().getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FOLDER)) { // Try a folder final FileObject folder = getReadFolder().resolveFile("dir1"); folder.getContent().setLastModifiedTime(yesterday); final long lastModTimeAccuracy = (long) folder.getFileSystem().getLastModTimeAccuracy(); // folder.refresh(); TODO: does not work with SSH VFS-563 final long lastModifiedTime = folder.getContent().getLastModifiedTime(); assertDelta("set/getLastModified on Folder", yesterday, lastModifiedTime, lastModTimeAccuracy); } }
/** * Tests setting the last modified time of file. * * @throws FileSystemException if error occurred */ public void testSetLastModifiedFile() throws FileSystemException { final long yesterday = System.currentTimeMillis() - 24 * 60 * 60 * 1000; if (getReadFolder().getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE)) { // Try a file final FileObject file = getReadFolder().resolveFile("file1.txt"); file.getContent().setLastModifiedTime(yesterday); final long lastModTimeAccuracy = (long) file.getFileSystem().getLastModTimeAccuracy(); // folder.refresh(); TODO: does not work with SSH VFS-563 final long lastModifiedTime = file.getContent().getLastModifiedTime(); assertDelta("set/getLastModified on File", yesterday, lastModifiedTime, lastModTimeAccuracy); } } }
final double lastModTimeAccuracy = file.getFileSystem().getLastModTimeAccuracy(); final long lastModifiedTime = file.getContent().getLastModifiedTime(false); try final double lastModTimeAccuracy = folder.getFileSystem().getLastModTimeAccuracy(); final long lastModifiedTime = folder.getContent().getLastModifiedTime(false); try