final long now = System.currentTimeMillis();
if (getReadFolder().getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE))
{
// Try a file
final FileObject file = getReadFolder().resolveFile("file1.txt");
file.getContent().setLastModifiedTime(now);
try
{
assertEquals(now, file.getContent().getLastModifiedTime(), file.getFileSystem().getLastModTimeAccuracy());
}
catch (AssertionFailedError e)
{
// on linux ext3 the above check is not necessarily true
if (file.getFileSystem().getLastModTimeAccuracy() < 1000L)
{
assertEquals(now, file.getContent().getLastModifiedTime(), 1000L);
}
else
{
throw e;
}
}
}
if (getReadFolder().getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FOLDER))
{
// Try a folder
final FileObject folder = getReadFolder().resolveFile("dir1");
folder.getContent().setLastModifiedTime(now);
try
{
assertEquals(now, folder.getContent().getLastModifiedTime(), folder.getFileSystem().getLastModTimeAccuracy());
}
catch (AssertionFailedError e)
{
// on linux ext3 the above check is not necessarily true
if (folder.getFileSystem().getLastModTimeAccuracy() < 1000L)
{
assertEquals(now, folder.getContent().getLastModifiedTime(), 1000L);
}
else
{
throw e;
}