/**
* Test the on_resolve strategy
*/
public void testOnResolveCache() throws Exception
{
FileObject scratchFolder = getWriteFolder();
if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class) ||
scratchFolder.getFileSystem() instanceof VirtualFileSystem)
{
// cant check ram filesystem as every manager holds its own ram filesystem data
return;
}
scratchFolder.delete(Selectors.EXCLUDE_SELF);
DefaultFileSystemManager fs = createManager();
fs.setCacheStrategy(CacheStrategy.ON_RESOLVE);
fs.init();
FileObject foBase2 = getBaseTestFolder(fs);
FileObject cachedFolder = foBase2.resolveFile(scratchFolder.getName().getPath());
FileObject[] fos = cachedFolder.getChildren();
assertContainsNot(fos, "file1.txt");
scratchFolder.resolveFile("file1.txt").createFile();
fos = cachedFolder.getChildren();
assertContainsNot(fos, "file1.txt");
cachedFolder = foBase2.resolveFile(scratchFolder.getName().getPath());
fos = cachedFolder.getChildren();
assertContains(fos, "file1.txt");
}