FileDocCategorySizeDatePackage
RemoteCachingWrapperFilterHelper.javaAPI DocApache Lucene 2.2.02150Sat Jun 16 22:20:28 BST 2007org.apache.lucene.search

RemoteCachingWrapperFilterHelper

public class RemoteCachingWrapperFilterHelper extends RemoteCachingWrapperFilter
A unit test helper class to help with RemoteCachingWrapperFilter testing and assert that it is working correctly.
author
Matt Ericson

Fields Summary
private boolean
shouldHaveCache
Constructors Summary
public RemoteCachingWrapperFilterHelper(Filter filter, boolean shouldHaveCache)

    super(filter);
    this.shouldHaveCache = shouldHaveCache;
  
Methods Summary
public java.util.BitSetbits(org.apache.lucene.index.IndexReader reader)

    Filter cachedFilter = FilterManager.getInstance().getFilter(filter);
    
    TestCase.assertNotNull("Filter should not be null", cachedFilter);
    if (!shouldHaveCache) {
      TestCase.assertSame("First time filter should be the same ", filter, cachedFilter);
    } else {
      TestCase.assertNotSame("We should have a cached version of the filter", filter, cachedFilter);
    }
    
    if (filter instanceof CachingWrapperFilterHelper) {
      ((CachingWrapperFilterHelper)cachedFilter).setShouldHaveCache(shouldHaveCache);
    }
    return cachedFilter.bits(reader);
  
public voidshouldHaveCache(boolean shouldHaveCache)

    this.shouldHaveCache = shouldHaveCache;