Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.infinispan.lucene.impl;
 
Tests covering DirecotoryImplementor class.

Author(s):
Anna Manukyan
@Test(groups = "functional", testName = "lucene.DirectoryImplementerTests")
   private static final String INDEX_NAME = "index-A";
   private static final int BUFFER_SIZE = 1024;
   @Override
   protected EmbeddedCacheManager createCacheManager() throws Exception {
      ConfigurationBuilder configuration = CacheTestSupport.createLocalCacheConfiguration();
      return TestCacheManagerFactory.createCacheManager(configuration);
   }
   @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "chunkSize must be a positive integer")
   public void testInitWithInvalidChunkSize() throws IOException {
      Directory dir = null;
      try {
         dir = DirectoryBuilder.newDirectoryInstance().chunkSize(0).create();
      } finally {
         if (dir != nulldir.close();
      }
   }
   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testFailureOfOverrideWriteLocker() throws IOException {
      Directory dir = null;
      try {
         dir = DirectoryBuilder.newDirectoryInstance().chunkSize()
               .overrideWriteLocker(null)
               .create();
      } finally {
         if (dir != nulldir.close();
      }
   }
   public void testOverrideWriteLocker() throws IOException {
      Directory dir = null;
      try {
         dir = DirectoryBuilder.newDirectoryInstance().chunkSize()
               .overrideWriteLocker(new LockFactory() {
                  @Override
                  public Lock makeLock(String lockName) {
                     return null;
                  }
                  @Override
                  public void clearLock(String lockNamethrows IOException {
                  }
               })
               .create();
         AssertJUnit.assertEquals(0, dir.listAll().length);
      } finally {
         if (dir != nulldir.close();
      }
   }
   @Test
   public void testGetIndexNameAndToString() throws IOException {
      Cache cache = .getCache();
      Directory dir = null;
      try {
         dir = DirectoryBuilder.newDirectoryInstance(cachecachecache).chunkSize().create();
         AssertJUnit.assertEquals(, ((DirectoryLuceneV4dir).getIndexName());
         AssertJUnit.assertEquals("InfinispanDirectory{indexName=\'" +  + "\'}"dir.toString());
      } finally {
         if(dir != nulldir.close();
      }
   }
New to GrepCode? Check out our FAQ X