Search in sources :

Example 6 with HeterogeneousLuceneSerializer

use of org.apache.geode.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer in project geode by apache.

the class IndexRepositoryImplJUnitTest method setUp.

@Before
public void setUp() throws IOException {
    ConcurrentHashMap fileAndChunkRegion = new ConcurrentHashMap();
    fileSystemStats = mock(FileSystemStats.class);
    RegionDirectory dir = new RegionDirectory(fileAndChunkRegion, fileSystemStats);
    IndexWriterConfig config = new IndexWriterConfig(analyzer);
    writer = new IndexWriter(dir, config);
    String[] indexedFields = new String[] { "s", "i", "l", "d", "f", "s2", "missing" };
    mapper = new HeterogeneousLuceneSerializer(indexedFields);
    region = Mockito.mock(Region.class);
    userRegion = Mockito.mock(BucketRegion.class);
    BucketAdvisor bucketAdvisor = Mockito.mock(BucketAdvisor.class);
    Mockito.when(bucketAdvisor.isPrimary()).thenReturn(true);
    Mockito.when(((BucketRegion) userRegion).getBucketAdvisor()).thenReturn(bucketAdvisor);
    Mockito.when(((BucketRegion) userRegion).getBucketAdvisor().isPrimary()).thenReturn(true);
    stats = Mockito.mock(LuceneIndexStats.class);
    Mockito.when(userRegion.isDestroyed()).thenReturn(false);
    repo = new IndexRepositoryImpl(region, writer, mapper, stats, userRegion, mock(DistributedLockService.class), "lockName");
}
Also used : LuceneIndexStats(org.apache.geode.cache.lucene.internal.LuceneIndexStats) HeterogeneousLuceneSerializer(org.apache.geode.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer) FileSystemStats(org.apache.geode.cache.lucene.internal.filesystem.FileSystemStats) BucketRegion(org.apache.geode.internal.cache.BucketRegion) IndexWriter(org.apache.lucene.index.IndexWriter) BucketRegion(org.apache.geode.internal.cache.BucketRegion) Region(org.apache.geode.cache.Region) BucketAdvisor(org.apache.geode.internal.cache.BucketAdvisor) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) RegionDirectory(org.apache.geode.cache.lucene.internal.directory.RegionDirectory) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig) Before(org.junit.Before)

Aggregations

HeterogeneousLuceneSerializer (org.apache.geode.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer)6 Before (org.junit.Before)4 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)2 PartitionedRegionDataStore (org.apache.geode.internal.cache.PartitionedRegionDataStore)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Region (org.apache.geode.cache.Region)1 LuceneIndexStats (org.apache.geode.cache.lucene.internal.LuceneIndexStats)1 RegionDirectory (org.apache.geode.cache.lucene.internal.directory.RegionDirectory)1 FileSystemStats (org.apache.geode.cache.lucene.internal.filesystem.FileSystemStats)1 DLockService (org.apache.geode.distributed.internal.locks.DLockService)1 BucketAdvisor (org.apache.geode.internal.cache.BucketAdvisor)1 BucketRegion (org.apache.geode.internal.cache.BucketRegion)1 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)1 IndexWriter (org.apache.lucene.index.IndexWriter)1 IndexWriterConfig (org.apache.lucene.index.IndexWriterConfig)1