BundleFileSystem extends FileSystem { @Override public Iterable<Path> getRootDirectories() { return Collections.<Path> singleton(getRootDirectory()); } protected  BundleFileSystem(FileSystem origFS, URI baseURI); @Override void close(); URI getBaseURI(); @Override Iterable<FileStore> getFileStores(); @Override Path getPath(String first, String... more); @Override PathMatcher getPathMatcher(String syntaxAndPattern); @Override Iterable<Path> getRootDirectories(); BundlePath getRootDirectory(); @Override String getSeparator(); Path getSource(); @Override UserPrincipalLookupService getUserPrincipalLookupService(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override WatchService newWatchService(); @Override BundleFileSystemProvider provider(); @Override Set<String> supportedFileAttributeViews();  }
@Test public void setLastModifiedTime() throws Exception { Path root = fs.getRootDirectories().iterator().next(); Path folder = root.resolve("folder"); Files.createDirectory(folder); Path file = root.resolve("file"); Files.createFile(file); int manyDays = 365 * 12; FileTime someTimeAgo = FileTime.from(manyDays, TimeUnit.DAYS); Files.setLastModifiedTime(folder, someTimeAgo); Files.setLastModifiedTime(file, someTimeAgo); Files.setLastModifiedTime(root, someTimeAgo); assertEquals((double) someTimeAgo.toMillis(), Files .getLastModifiedTime(folder).toMillis(), 2001); assertEquals((double) someTimeAgo.toMillis(), Files .getLastModifiedTime(file).toMillis(), 2001); }
@Test public void creationTime() throws Exception { Path root = fs.getRootDirectories().iterator().next(); Path folder = root.resolve("folder"); Files.createDirectory(folder); Path file = root.resolve("file"); Files.createFile(file); int manyDays = 365 * 12; FileTime someTimeAgo = FileTime.from(manyDays, TimeUnit.DAYS); Files.getFileAttributeView(folder, BasicFileAttributeView.class) .setTimes(null, null, someTimeAgo); Files.getFileAttributeView(file, BasicFileAttributeView.class) .setTimes(null, null, someTimeAgo); Files.getFileAttributeView(root, BasicFileAttributeView.class) .setTimes(null, null, someTimeAgo); assertEquals((double) someTimeAgo.toMillis(), (double) ((FileTime) Files.getAttribute(file, "creationTime")) .toMillis(), 2001); assertEquals( (double) someTimeAgo.toMillis(), (double) ((FileTime) Files.getAttribute(folder, "creationTime")) .toMillis(), 2001); }