Package org.apache.lucene.store

Examples of org.apache.lucene.store.Directory.fileModified()


         long lastModifiedDate = dir.fileModified(fileName);

         Thread.sleep(100);

         dir.touchFile(fileName);
         assert lastModifiedDate != dir.fileModified(fileName);
      } finally {
         if (dir != null) dir.close();
      }
   }
View Full Code Here


         Cache cache = cacheManager.getCache();
         String fileName = "nonExistent.txt";

         dir = new InfinispanDirectory(cache, "index");

         long lastModifiedDate = dir.fileModified(fileName);
         Thread.sleep(100);

         dir.touchFile(fileName);
         AssertJUnit.assertEquals(lastModifiedDate, dir.fileModified(fileName));
      } finally {
View Full Code Here

         long lastModifiedDate = dir.fileModified(fileName);
         Thread.sleep(100);

         dir.touchFile(fileName);
         AssertJUnit.assertEquals(lastModifiedDate, dir.fileModified(fileName));
      } finally {
         dir.close();
      }
   }
View Full Code Here

      try {
         dir = DirectoryBuilder.newDirectoryInstance(cache, cache, cache, INDEX_NAME).chunkSize(BUFFER_SIZE).create();
         createFile(fileName, dir);

         assert dir.fileExists(fileName);
         assert dir.fileModified(fileName) != 0;

         AssertJUnit.assertEquals(0, dir.fileModified("nonExistentFileName.txt"));
      } finally {
         if (dir != null) dir.close();
      }
View Full Code Here

         createFile(fileName, dir);

         assert dir.fileExists(fileName);
         assert dir.fileModified(fileName) != 0;

         AssertJUnit.assertEquals(0, dir.fileModified("nonExistentFileName.txt"));
      } finally {
         if (dir != null) dir.close();
      }
   }
View Full Code Here

      Directory dir = null;
      try {
         dir = DirectoryBuilder.newDirectoryInstance(cache, cache, cache, INDEX_NAME).chunkSize(BUFFER_SIZE).create();
         createFile(fileName, dir);

         long lastModifiedDate = dir.fileModified(fileName);

         Thread.sleep(1);

         dir.touchFile(fileName);
         assert lastModifiedDate != dir.fileModified(fileName);
View Full Code Here

         long lastModifiedDate = dir.fileModified(fileName);

         Thread.sleep(1);

         dir.touchFile(fileName);
         assert lastModifiedDate != dir.fileModified(fileName);
      } finally {
         if (dir != null) dir.close();
      }
   }
View Full Code Here

      Directory dir = null;

      try {
         dir = DirectoryBuilder.newDirectoryInstance(cache, cache, cache, INDEX_NAME).chunkSize(BUFFER_SIZE).create();
         long lastModifiedDate = dir.fileModified(fileName);
         AssertJUnit.assertEquals(0L, lastModifiedDate);
         Thread.sleep(1);

         dir.touchFile(fileName);
         AssertJUnit.assertEquals(lastModifiedDate, dir.fileModified(fileName));
View Full Code Here

         long lastModifiedDate = dir.fileModified(fileName);
         AssertJUnit.assertEquals(0L, lastModifiedDate);
         Thread.sleep(1);

         dir.touchFile(fileName);
         AssertJUnit.assertEquals(lastModifiedDate, dir.fileModified(fileName));
      } finally {
         if (dir != null) dir.close();
      }
   }
View Full Code Here

                                                         gen);

        // if we are on a filesystem that seems to have only
        // 1 second resolution, allow +1 second in commit
        // age tolerance:
        long modTime = dir.fileModified(fileName);
        oneSecondResolution &= (modTime % 1000) == 0;
        final long leeway = (long) ((SECONDS + (oneSecondResolution ? 1.0:0.0))*1000);

        assertTrue("commit point was older than " + SECONDS + " seconds (" + (lastDeleteTime - modTime) + " msec) but did not get deleted ", lastDeleteTime - modTime <= leeway);
      } catch (IOException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.