You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2016/07/27 21:38:45 UTC
incubator-geode git commit: GEODE-11: defined index will be saved and
can be found.
Repository: incubator-geode
Updated Branches:
refs/heads/develop a6e9569f5 -> de3f90e03
GEODE-11: defined index will be saved and can be found.
This closes #217
GEODE-11: Adding a defined index field in LuceneServiceImpl
Added a definedIndexMap field in LuceneServiceImpl to store the uninitialized lucene indexes
Signed-off-by: Gester Zhou <gz...@pivotal.io>
GEODE-11: Added status to gfsh commands
Added a field status(initialized/defined wrt region creation) to list and describe lucene commands.
Added a dunit test for create index command to verify that the created index is stored in definedIndexMap.
Signed-off-by: Gester Zhou <gz...@pivotal.io>
GEODE-11: Removed methods from LuceneService interface
Removed methods accessing definedIndexMap from the LuceneServiceInterface.
Made few other method and field name changes as per review comments.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/de3f90e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/de3f90e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/de3f90e0
Branch: refs/heads/develop
Commit: de3f90e03472818079e6a0892c6ff3d221298c8e
Parents: a6e9569
Author: Aparna Dharmakkan <ad...@pivotal.io>
Authored: Mon Jul 25 12:21:21 2016 -0700
Committer: zhouxh <gz...@pivotal.io>
Committed: Wed Jul 27 14:30:08 2016 -0700
----------------------------------------------------------------------
.../gemfire/cache/lucene/LuceneService.java | 4 +-
.../internal/LuceneIndexCreationProfile.java | 15 ++++
.../lucene/internal/LuceneServiceImpl.java | 25 +++++-
.../internal/cli/LuceneIndexCommands.java | 26 +++---
.../lucene/internal/cli/LuceneIndexDetails.java | 40 +++++++--
.../functions/LuceneDescribeIndexFunction.java | 8 +-
.../cli/functions/LuceneListIndexFunction.java | 9 +-
.../LuceneIndexCreationIntegrationTest.java | 29 ++++++
.../cli/LuceneIndexCommandsDUnitTest.java | 94 +++++++++++++++-----
.../cli/LuceneIndexCommandsJUnitTest.java | 60 +++++--------
.../LuceneDescribeIndexFunctionJUnitTest.java | 3 +-
.../LuceneListIndexFunctionJUnitTest.java | 3 +-
12 files changed, 229 insertions(+), 87 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
index 8a94959..cf1f735 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
@@ -23,6 +23,7 @@ import org.apache.lucene.analysis.Analyzer;
import com.gemstone.gemfire.annotations.Experimental;
import com.gemstone.gemfire.cache.GemFireCache;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
/**
* LuceneService instance is a singleton for each cache.
@@ -124,4 +125,5 @@ public interface LuceneService {
* @return LuceneQueryFactory object
*/
public LuceneQueryFactory createLuceneQueryFactory();
-}
+
+ }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
index ceb7aa9..12f4ae5 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
@@ -38,6 +38,8 @@ public class LuceneIndexCreationProfile implements CacheServiceProfile, DataSeri
private Map<String, Class<? extends Analyzer>> fieldAnalyzers;
+ private String regionPath;
+
/* Used by DataSerializer */
public LuceneIndexCreationProfile() {}
@@ -49,6 +51,15 @@ public class LuceneIndexCreationProfile implements CacheServiceProfile, DataSeri
initializeFieldAnalyzers(fieldAnalyzers);
}
+ public LuceneIndexCreationProfile(String indexName, String regionPath, String[] fieldNames, Analyzer analyzer,
+ Map<String, Analyzer> fieldAnalyzers) {
+ this.indexName = indexName;
+ this.regionPath = regionPath;
+ this.fieldNames = fieldNames;
+ this.analyzerClass = analyzer.getClass();
+ initializeFieldAnalyzers(fieldAnalyzers);
+ }
+
public String getIndexName() {
return this.indexName;
}
@@ -186,4 +197,8 @@ public class LuceneIndexCreationProfile implements CacheServiceProfile, DataSeri
.append("]")
.toString();
}
+
+ public String getRegionPath() {
+ return this.regionPath;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
index 410b27b..5cce2f8 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
@@ -69,7 +69,8 @@ public class LuceneServiceImpl implements InternalLuceneService {
private static final Logger logger = LogService.getLogger();
private GemFireCacheImpl cache;
- private final HashMap<String, LuceneIndex> indexMap = new HashMap<String, LuceneIndex>();;
+ private final HashMap<String, LuceneIndex> indexMap = new HashMap<String, LuceneIndex>();
+ private final HashMap<String, LuceneIndexCreationProfile> definedIndexMap = new HashMap<>();
public LuceneServiceImpl() {
@@ -136,6 +137,10 @@ public class LuceneServiceImpl implements InternalLuceneService {
if(!regionPath.startsWith("/")) {
regionPath = "/" + regionPath;
}
+
+ registerDefinedIndex(LuceneServiceImpl.getUniqueIndexName(indexName, regionPath),
+ new LuceneIndexCreationProfile(indexName, regionPath, fields, analyzer, fieldAnalyzers));
+
Region region = cache.getRegion(regionPath);
if(region != null) {
throw new IllegalStateException("The lucene index must be created before region");
@@ -172,7 +177,8 @@ public class LuceneServiceImpl implements InternalLuceneService {
});
}
-
+
+
/**
* Finish creating the lucene index after the data region is created .
*
@@ -218,6 +224,12 @@ public class LuceneServiceImpl implements InternalLuceneService {
return index;
}
+ private void registerDefinedIndex(final String regionAndIndex, final LuceneIndexCreationProfile luceneIndexCreationProfile) {
+ if (definedIndexMap.containsKey(regionAndIndex) || indexMap.containsKey(regionAndIndex))
+ throw new IllegalArgumentException("Lucene index already exists in region");
+ definedIndexMap.put(regionAndIndex, luceneIndexCreationProfile);
+ }
+
@Override
public LuceneIndex getIndex(String indexName, String regionPath) {
Region region = cache.getRegion(regionPath);
@@ -265,6 +277,7 @@ public class LuceneServiceImpl implements InternalLuceneService {
if( !indexMap.containsKey( regionAndIndex )) {
indexMap.put(regionAndIndex, index);
}
+ definedIndexMap.remove(regionAndIndex);
}
public void unregisterIndex(final String region){
@@ -305,4 +318,12 @@ public class LuceneServiceImpl implements InternalLuceneService {
DataSerializableFixedID.LUCENE_TOP_ENTRIES_COLLECTOR,
TopEntriesCollector.class);
}
+
+ public Collection<LuceneIndexCreationProfile> getAllDefinedIndexes() {
+ return definedIndexMap.values();
+ }
+
+ public LuceneIndexCreationProfile getDefinedIndex(String indexName, String regionPath) {
+ return definedIndexMap.get(getUniqueIndexName(indexName , regionPath));
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommands.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommands.java
index 5942d19..ad00a8b 100755
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommands.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommands.java
@@ -16,9 +16,6 @@
*/
package com.gemstone.gemfire.cache.lucene.internal.cli;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@@ -34,8 +31,6 @@ import com.gemstone.gemfire.cache.execute.Execution;
import com.gemstone.gemfire.cache.execute.FunctionAdapter;
import com.gemstone.gemfire.cache.execute.FunctionInvocationTargetException;
import com.gemstone.gemfire.cache.execute.ResultCollector;
-import com.gemstone.gemfire.cache.lucene.LuceneResultStruct;
-import com.gemstone.gemfire.cache.lucene.PageableLuceneQueryResults;
import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneCreateIndexFunction;
import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneDescribeIndexFunction;
import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneListIndexFunction;
@@ -124,12 +119,21 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
indexData.accumulate("Region Path", indexDetails.getRegionPath());
indexData.accumulate("Indexed Fields", indexDetails.getSearchableFieldNamesString());
indexData.accumulate("Field Analyzer", indexDetails.getFieldAnalyzersString());
-
- if (stats==true) {
- indexData.accumulate("Query Executions",indexDetails.getIndexStats().get("queryExecutions"));
- indexData.accumulate("Updates",indexDetails.getIndexStats().get("updates"));
- indexData.accumulate("Commits",indexDetails.getIndexStats().get("commits"));
- indexData.accumulate("Documents",indexDetails.getIndexStats().get("documents"));
+ indexData.accumulate("Status", indexDetails.getInitialized() == true ? "Initialized" : "Defined");
+
+ if (stats == true) {
+ if (!indexDetails.getInitialized()) {
+ indexData.accumulate("Query Executions", "NA");
+ indexData.accumulate("Updates", "NA");
+ indexData.accumulate("Commits", "NA");
+ indexData.accumulate("Documents", "NA");
+ }
+ else {
+ indexData.accumulate("Query Executions", indexDetails.getIndexStats().get("queryExecutions"));
+ indexData.accumulate("Updates", indexDetails.getIndexStats().get("updates"));
+ indexData.accumulate("Commits", indexDetails.getIndexStats().get("commits"));
+ indexData.accumulate("Documents", indexDetails.getIndexStats().get("documents"));
+ }
}
}
return ResultBuilder.buildResult(indexData);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexDetails.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexDetails.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexDetails.java
index 7526425..cab4c03 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexDetails.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexDetails.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexStats;
@@ -30,23 +31,29 @@ import org.apache.lucene.analysis.Analyzer;
public class LuceneIndexDetails implements Comparable<LuceneIndexDetails>, Serializable {
private static final long serialVersionUID = 1L;
-
private final String indexName;
private final String regionPath;
private final String[] searchableFieldNames;
- private final Map<String, String> fieldAnalyzers;
+ private Map<String, String> fieldAnalyzers=null;
private final Map<String,Integer> indexStats;
+ private boolean initialized;
- public LuceneIndexDetails(final String indexName, final String regionPath, final String[] searchableFieldNames, Map<String, Analyzer> fieldAnalyzers, LuceneIndexStats indexStats) {
+ public LuceneIndexDetails(final String indexName, final String regionPath, final String[] searchableFieldNames, final Map<String, Analyzer> fieldAnalyzers, LuceneIndexStats indexStats, boolean initialized) {
this.indexName = indexName;
this.regionPath = regionPath;
this.searchableFieldNames = searchableFieldNames;
- this.fieldAnalyzers = getAnalyzerStrings(fieldAnalyzers);
+ this.fieldAnalyzers = getFieldAnalyzerStrings(fieldAnalyzers);
this.indexStats=getIndexStatsMap(indexStats);
+ this.initialized = initialized;
}
public LuceneIndexDetails(LuceneIndexImpl index) {
- this(index.getName(), index.getRegionPath(), index.getFieldNames(), index.getFieldAnalyzers(),index.getIndexStats());
+ this(index.getName(), index.getRegionPath(), index.getFieldNames(),index.getFieldAnalyzers(),index.getIndexStats(), true);
+ }
+
+ public LuceneIndexDetails(LuceneIndexCreationProfile indexProfile) {
+ this(indexProfile.getIndexName(), indexProfile.getRegionPath(), indexProfile.getFieldNames(), null, null, false);
+ this.fieldAnalyzers=getFieldAnalyzerStringsFromProfile(indexProfile.getFieldAnalyzers());
}
public Map<String,Integer> getIndexStats() {
@@ -66,7 +73,7 @@ public class LuceneIndexDetails implements Comparable<LuceneIndexDetails>, Seria
return indexStats.toString();
}
- private Map<String, String> getAnalyzerStrings(Map<String, Analyzer> fieldAnalyzers) {
+ private Map<String, String> getFieldAnalyzerStrings(Map<String, Analyzer> fieldAnalyzers) {
if(fieldAnalyzers == null) {
return Collections.emptyMap();
}
@@ -82,6 +89,23 @@ public class LuceneIndexDetails implements Comparable<LuceneIndexDetails>, Seria
return results;
}
+ private Map<String, String> getFieldAnalyzerStringsFromProfile(Map<String, Class <? extends Analyzer>> fieldAnalyzers) {
+ if(fieldAnalyzers == null) {
+ return Collections.emptyMap();
+
+ }
+
+ Map<String, String> results = new HashMap<>();
+
+ for (Entry<String, Class<? extends Analyzer>> entry : fieldAnalyzers.entrySet()) {
+ final String analyzer = entry.getValue().getSimpleName();
+ if(analyzer != null) {
+ results.put(entry.getKey(), analyzer);
+ }
+ }
+ return results;
+ }
+
public String getSearchableFieldNamesString() {
return Arrays.asList(searchableFieldNames).toString();
}
@@ -98,11 +122,15 @@ public class LuceneIndexDetails implements Comparable<LuceneIndexDetails>, Seria
buffer.append(",\tRegion Path = "+regionPath);
buffer.append(",\tIndexed Fields = "+getSearchableFieldNamesString());
buffer.append(",\tField Analyzer = "+getFieldAnalyzersString());
+ buffer.append(",\tStatus =\n\t"+ getInitialized());
buffer.append(",\tIndex Statistics =\n\t"+getIndexStatsString());
buffer.append("\n}\n");
return buffer.toString();
}
+ public boolean getInitialized() {
+ return initialized;
+ }
public String getIndexName() {
return indexName;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
index b91db60..015828a 100755
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
@@ -27,7 +27,9 @@ import com.gemstone.gemfire.cache.execute.FunctionContext;
import com.gemstone.gemfire.cache.lucene.LuceneIndex;
import com.gemstone.gemfire.cache.lucene.LuceneService;
import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexInfo;
import com.gemstone.gemfire.internal.InternalEntity;
@@ -56,12 +58,16 @@ public class LuceneDescribeIndexFunction extends FunctionAdapter implements Inte
public void execute(final FunctionContext context) {
LuceneIndexDetails result = null;
+
final Cache cache = getCache();
final LuceneIndexInfo indexInfo = (LuceneIndexInfo) context.getArguments();
- LuceneService service = LuceneServiceProvider.get(cache);
+ LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache);
LuceneIndex index = service.getIndex(indexInfo.getIndexName(), indexInfo.getRegionPath());
+ LuceneIndexCreationProfile profile = service.getDefinedIndex(indexInfo.getIndexName(),indexInfo.getRegionPath());
if (index != null) {
result = new LuceneIndexDetails((LuceneIndexImpl) index);
+ } else if (profile != null) {
+ result = new LuceneIndexDetails(profile);
}
context.getResultSender().lastResult(result);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
index 4460d57..bb74410 100755
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
@@ -27,7 +27,9 @@ import com.gemstone.gemfire.cache.execute.FunctionContext;
import com.gemstone.gemfire.cache.lucene.LuceneIndex;
import com.gemstone.gemfire.cache.lucene.LuceneService;
import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
import com.gemstone.gemfire.internal.InternalEntity;
@@ -56,11 +58,14 @@ public class LuceneListIndexFunction extends FunctionAdapter implements Internal
public void execute(final FunctionContext context) {
final Set<LuceneIndexDetails> indexDetailsSet = new HashSet<>();
final Cache cache = getCache();
- LuceneService service = LuceneServiceProvider.get(cache);
+ LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache);
for (LuceneIndex index : service.getAllIndexes()) {
indexDetailsSet.add(new LuceneIndexDetails((LuceneIndexImpl) index));
}
+
+ for(LuceneIndexCreationProfile profile : service.getAllDefinedIndexes()) {
+ indexDetailsSet.add(new LuceneIndexDetails(profile));
+ }
context.getResultSender().lastResult(indexDetailsSet);
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
index dc08f69..dd9fd57 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
@@ -27,11 +27,15 @@ import static org.junit.Assert.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
import com.gemstone.gemfire.cache.EvictionAction;
import com.gemstone.gemfire.cache.EvictionAttributes;
@@ -41,6 +45,8 @@ import com.gemstone.gemfire.cache.PartitionAttributesFactory;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
import com.gemstone.gemfire.cache.lucene.test.LuceneTestUtilities;
import com.gemstone.gemfire.cache.lucene.test.TestObject;
import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
@@ -176,6 +182,29 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
regionFactory.create(REGION_NAME);
}
+ @Test
+ public void cannotCreateLuceneIndexWithExistingIndexName()
+ {
+ expectedException.expect(IllegalArgumentException.class);
+ createIndex("field1","field2","field3");
+ createIndex("field4","field5","field6");
+ }
+
+ @Test
+ public void shouldReturnAllDefinedIndexes()
+ {
+ LuceneServiceImpl luceneServiceImpl = (LuceneServiceImpl) luceneService;
+ luceneServiceImpl.createIndex(INDEX_NAME,REGION_NAME,"field1","field2","field3");
+ luceneServiceImpl.createIndex("index2", "region2", "field4","field5","field6");
+ final Collection<LuceneIndexCreationProfile> indexList = luceneServiceImpl.getAllDefinedIndexes();
+
+ assertEquals(Arrays.asList(INDEX_NAME,"index2"), indexList.stream().map(LuceneIndexCreationProfile::getIndexName)
+ .sorted().collect(Collectors.toList()));
+ createRegion();
+ assertEquals(Collections.singletonList("index2"), indexList.stream().map(LuceneIndexCreationProfile::getIndexName)
+ .collect(Collectors.toList()));
+ }
+
private void verifyInternalRegions(Consumer<LocalRegion> verify) {
LuceneTestUtilities.verifyInternalRegions(luceneService, cache, verify);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java
index 422b340..32de8e4 100755
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java
@@ -22,7 +22,9 @@ import com.gemstone.gemfire.cache.lucene.LuceneIndex;
import com.gemstone.gemfire.cache.lucene.LuceneQuery;
import com.gemstone.gemfire.cache.lucene.LuceneService;
import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexCreationProfile;
import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
import com.gemstone.gemfire.distributed.ConfigurationProperties;
import com.gemstone.gemfire.management.cli.Result.Status;
import com.gemstone.gemfire.management.internal.cli.CommandManager;
@@ -37,6 +39,7 @@ import com.jayway.awaitility.Awaitility;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.core.KeywordAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.search.Collector;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -47,6 +50,7 @@ import static com.gemstone.gemfire.test.dunit.Assert.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -104,6 +108,50 @@ public class LuceneIndexCommandsDUnitTest extends CliCommandTestBase {
}
@Test
+ public void listIndexShouldReturnCorrectStatus() throws Exception {
+ final VM vm1 = Host.getHost(0).getVM(1);
+
+ vm1.invoke(() -> {
+ LuceneService luceneService = LuceneServiceProvider.get(getCache());
+ Map<String, Analyzer> fieldAnalyzers = new HashMap();
+ fieldAnalyzers.put("field1", new StandardAnalyzer());
+ luceneService.createIndex(INDEX_NAME, REGION_NAME, fieldAnalyzers);
+ });
+ CommandManager.getInstance().add(LuceneIndexCommands.class.newInstance());
+
+ CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_LIST_INDEX);
+ csb.addOption(LuceneCliStrings.LUCENE_LIST_INDEX__STATS,"true");
+ TabularResultData data = (TabularResultData) executeCommandAndGetResult(csb).getResultData();
+ assertEquals(Collections.singletonList(INDEX_NAME), data.retrieveAllValues("Index Name"));
+ assertEquals(Collections.singletonList("Defined"), data.retrieveAllValues("Status"));
+ }
+
+ @Test
+ public void listIndexWithStatsShouldReturnCorrectStats() throws Exception {
+ final VM vm1 = Host.getHost(0).getVM(1);
+
+ createIndex(vm1);
+ Map<String,TestObject> entries=new HashMap<>();
+ entries.put("A",new TestObject("field1:value1","field2:value2","field3:value3"));
+ entries.put("B",new TestObject("ABC","EFG","HIJ"));
+
+ putEntries(vm1,entries,2);
+ queryAndVerify(vm1, "field1:value1", "field1", Collections.singletonList("A"));
+
+ CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_LIST_INDEX);
+ csb.addOption(LuceneCliStrings.LUCENE_LIST_INDEX__STATS,"true");
+ TabularResultData data = (TabularResultData) executeCommandAndGetResult(csb).getResultData();
+
+ assertEquals(Collections.singletonList(INDEX_NAME), data.retrieveAllValues("Index Name"));
+ assertEquals(Collections.singletonList("Initialized"), data.retrieveAllValues("Status"));
+ assertEquals(Collections.singletonList("/region"), data.retrieveAllValues("Region Path"));
+ assertEquals(Collections.singletonList("113"), data.retrieveAllValues("Query Executions"));
+ assertEquals(Collections.singletonList("2"), data.retrieveAllValues("Commits"));
+ assertEquals(Collections.singletonList("2"), data.retrieveAllValues("Updates"));
+ assertEquals(Collections.singletonList("2"), data.retrieveAllValues("Documents"));
+ }
+
+ @Test
public void createIndexShouldCreateANewIndex() throws Exception {
final VM vm1 = Host.getHost(0).getVM(1);
vm1.invoke(() -> {getCache();});
@@ -199,56 +247,54 @@ public class LuceneIndexCommandsDUnitTest extends CliCommandTestBase {
}
@Test
- public void describeIndexShouldReturnExistingIndex() throws Exception {
+ public void createIndexWithoutRegionShouldReturnCorrectResults() throws Exception{
final VM vm1 = Host.getHost(0).getVM(1);
+ vm1.invoke(() -> {getCache();});
- createIndex(vm1);
CommandManager.getInstance().add(LuceneIndexCommands.class.newInstance());
- CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_DESCRIBE_INDEX);
+ CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_CREATE_INDEX);
csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME,INDEX_NAME);
csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH,REGION_NAME);
+ csb.addOption(LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD,"field1,field2,field3");
+
String resultAsString = executeCommandAndLogResult(csb);
- assertTrue(resultAsString.contains(INDEX_NAME));
+
+ vm1.invoke(() -> {
+ LuceneServiceImpl luceneService = (LuceneServiceImpl) LuceneServiceProvider.get(getCache());
+ final ArrayList<LuceneIndexCreationProfile> profiles= new ArrayList<> (luceneService.getAllDefinedIndexes());
+ assertEquals(1, profiles.size());
+ assertEquals(INDEX_NAME, profiles.get(0).getIndexName());
+ });
}
@Test
- public void describeIndexShouldNotReturnResultWhenIndexNotFound() throws Exception {
+ public void describeIndexShouldReturnExistingIndex() throws Exception {
final VM vm1 = Host.getHost(0).getVM(1);
createIndex(vm1);
CommandManager.getInstance().add(LuceneIndexCommands.class.newInstance());
CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_DESCRIBE_INDEX);
- csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME,"notAnIndex");
+ csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME,INDEX_NAME);
csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH,REGION_NAME);
String resultAsString = executeCommandAndLogResult(csb);
-
- assertTrue(resultAsString.contains("No lucene indexes found"));
+ assertTrue(resultAsString.contains(INDEX_NAME));
}
@Test
- public void listIndexWithStatsShouldReturnCorrectStats() throws Exception {
+ public void describeIndexShouldNotReturnResultWhenIndexNotFound() throws Exception {
final VM vm1 = Host.getHost(0).getVM(1);
createIndex(vm1);
- Map<String,TestObject> entries=new HashMap<>();
- entries.put("A",new TestObject("field1:value1","field2:value2","field3:value3"));
- entries.put("B",new TestObject("ABC","EFG","HIJ"));
-
- putEntries(vm1,entries,2);
- queryAndVerify(vm1, "field1:value1", "field1", Collections.singletonList("A"));
+ CommandManager.getInstance().add(LuceneIndexCommands.class.newInstance());
- CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_LIST_INDEX);
- csb.addOption(LuceneCliStrings.LUCENE_LIST_INDEX__STATS,"true");
- TabularResultData data = (TabularResultData) executeCommandAndGetResult(csb).getResultData();
+ CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_DESCRIBE_INDEX);
+ csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME,"notAnIndex");
+ csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH,REGION_NAME);
+ String resultAsString = executeCommandAndLogResult(csb);
- assertEquals(Collections.singletonList(INDEX_NAME), data.retrieveAllValues("Index Name"));
- assertEquals(Collections.singletonList("/region"), data.retrieveAllValues("Region Path"));
- assertEquals(Collections.singletonList("113"), data.retrieveAllValues("Query Executions"));
- assertEquals(Collections.singletonList("2"), data.retrieveAllValues("Commits"));
- assertEquals(Collections.singletonList("2"), data.retrieveAllValues("Updates"));
- assertEquals(Collections.singletonList("2"), data.retrieveAllValues("Documents"));
+ assertTrue(resultAsString.contains("No lucene indexes found"));
}
@Test
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
index 493e76a..b9e4e86 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
@@ -15,7 +15,6 @@
* limitations under the License.
*/
package com.gemstone.gemfire.cache.lucene.internal.cli;
-import static com.gemstone.gemfire.internal.lang.StringUtils.trim;
import static org.junit.Assert.*;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;
@@ -31,7 +30,6 @@ import java.util.Set;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.core.KeywordAnalyzer;
-import org.apache.lucene.analysis.payloads.FloatEncoder;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.junit.Assert;
import org.junit.Test;
@@ -48,15 +46,10 @@ import com.gemstone.gemfire.cache.lucene.internal.cli.functions.LuceneSearchInde
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.internal.cache.execute.AbstractExecution;
import com.gemstone.gemfire.internal.util.CollectionUtils;
-import com.gemstone.gemfire.management.cli.Result;
import com.gemstone.gemfire.management.cli.Result.Status;
import com.gemstone.gemfire.management.internal.cli.functions.CliFunctionResult;
-import com.gemstone.gemfire.management.internal.cli.functions.CreateIndexFunction;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.result.CommandResultException;
-import com.gemstone.gemfire.management.internal.cli.result.InfoResultData;
-import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
import com.gemstone.gemfire.test.junit.categories.UnitTest;
@@ -89,17 +82,11 @@ public class LuceneIndexCommandsJUnitTest {
fieldAnalyzers.put("field1", new StandardAnalyzer());
fieldAnalyzers.put("field2", new KeywordAnalyzer());
fieldAnalyzers.put("field3", null);
- final LuceneIndexDetails indexDetails1 = createIndexDetails("memberFive", "/Employees", searchableFields, fieldAnalyzers);
- final LuceneIndexDetails indexDetails2 = createIndexDetails("memberSix", "/Employees", searchableFields, fieldAnalyzers);
- final LuceneIndexDetails indexDetails3 = createIndexDetails("memberTen", "/Employees", searchableFields, fieldAnalyzers);
+ final LuceneIndexDetails indexDetails1 = createIndexDetails("memberFive", "/Employees", searchableFields, fieldAnalyzers, true);
+ final LuceneIndexDetails indexDetails2 = createIndexDetails("memberSix", "/Employees", searchableFields, fieldAnalyzers, false);
+ final LuceneIndexDetails indexDetails3 = createIndexDetails("memberTen", "/Employees", searchableFields, fieldAnalyzers, true);
-
- final List<LuceneIndexDetails> expectedIndexDetails = new ArrayList<>(3);
- expectedIndexDetails.add(indexDetails1);
- expectedIndexDetails.add(indexDetails2);
- expectedIndexDetails.add(indexDetails3);
-
- final List<Set<LuceneIndexDetails>> results = new ArrayList<Set<LuceneIndexDetails>>();
+ final List<Set<LuceneIndexDetails>> results = new ArrayList<>();
results.add(CollectionUtils.asSet(indexDetails2, indexDetails1,indexDetails3));
@@ -117,6 +104,7 @@ public class LuceneIndexCommandsJUnitTest {
assertEquals(Arrays.asList("/Employees", "/Employees", "/Employees"), data.retrieveAllValues("Region Path"));
assertEquals(Arrays.asList("[field1, field2, field3]", "[field1, field2, field3]", "[field1, field2, field3]"), data.retrieveAllValues("Indexed Fields"));
assertEquals(Arrays.asList("{field1=StandardAnalyzer, field2=KeywordAnalyzer}", "{field1=StandardAnalyzer, field2=KeywordAnalyzer}", "{field1=StandardAnalyzer, field2=KeywordAnalyzer}"), data.retrieveAllValues("Field Analyzer"));
+ assertEquals(Arrays.asList("Initialized", "Defined", "Initialized"), data.retrieveAllValues("Status"));
}
@Test
@@ -133,15 +121,10 @@ public class LuceneIndexCommandsJUnitTest {
fieldAnalyzers.put("field1", new StandardAnalyzer());
fieldAnalyzers.put("field2", new KeywordAnalyzer());
fieldAnalyzers.put("field3", null);
- final LuceneIndexDetails indexDetails1 = createIndexDetails("memberFive", "/Employees", searchableFields, fieldAnalyzers,mockIndexStats1);
- final LuceneIndexDetails indexDetails2 = createIndexDetails("memberSix", "/Employees", searchableFields, fieldAnalyzers,mockIndexStats2);
- final LuceneIndexDetails indexDetails3 = createIndexDetails("memberTen", "/Employees", searchableFields, fieldAnalyzers,mockIndexStats3);
-
+ final LuceneIndexDetails indexDetails1 = createIndexDetails("memberFive", "/Employees", searchableFields, fieldAnalyzers,mockIndexStats1, true);
+ final LuceneIndexDetails indexDetails2 = createIndexDetails("memberSix", "/Employees", searchableFields, fieldAnalyzers,mockIndexStats2, true);
+ final LuceneIndexDetails indexDetails3 = createIndexDetails("memberTen", "/Employees", searchableFields, fieldAnalyzers,mockIndexStats3, true);
- final List<LuceneIndexDetails> expectedIndexDetails = new ArrayList<>(3);
- expectedIndexDetails.add(indexDetails1);
- expectedIndexDetails.add(indexDetails2);
- expectedIndexDetails.add(indexDetails3);
final List<Set<LuceneIndexDetails>> results = new ArrayList<>();
@@ -207,7 +190,7 @@ public class LuceneIndexCommandsJUnitTest {
fieldAnalyzers.put("field3", null);
final LuceneIndexStats mockIndexStats=getMockIndexStats(1,10,5,1);
final List<LuceneIndexDetails> indexDetails = new ArrayList<>();
- indexDetails.add(createIndexDetails("memberFive", "/Employees", searchableFields, fieldAnalyzers,mockIndexStats));
+ indexDetails.add(createIndexDetails("memberFive", "/Employees", searchableFields, fieldAnalyzers,mockIndexStats, true));
doReturn(mockResultCollector).when(commands).executeFunctionOnGroups(isA(LuceneDescribeIndexFunction.class),any(),any(LuceneIndexInfo.class));
doReturn(indexDetails).when(mockResultCollector).getResult();
@@ -215,14 +198,15 @@ public class LuceneIndexCommandsJUnitTest {
CommandResult result = (CommandResult) commands.describeIndex("memberFive","/Employees");
TabularResultData data = (TabularResultData) result.getResultData();
- assertEquals(Arrays.asList("memberFive"), data.retrieveAllValues("Index Name"));
- assertEquals(Arrays.asList("/Employees"), data.retrieveAllValues("Region Path"));
- assertEquals(Arrays.asList("[field1, field2, field3]"), data.retrieveAllValues("Indexed Fields"));
- assertEquals(Arrays.asList("{field1=StandardAnalyzer, field2=KeywordAnalyzer}"), data.retrieveAllValues("Field Analyzer"));
- assertEquals(Arrays.asList("1"), data.retrieveAllValues("Query Executions"));
- assertEquals(Arrays.asList("10"), data.retrieveAllValues("Commits"));
- assertEquals(Arrays.asList("5"), data.retrieveAllValues("Updates"));
- assertEquals(Arrays.asList("1"), data.retrieveAllValues("Documents"));
+ assertEquals(Collections.singletonList("memberFive"), data.retrieveAllValues("Index Name"));
+ assertEquals(Collections.singletonList("/Employees"), data.retrieveAllValues("Region Path"));
+ assertEquals(Collections.singletonList("[field1, field2, field3]"), data.retrieveAllValues("Indexed Fields"));
+ assertEquals(Collections.singletonList("{field1=StandardAnalyzer, field2=KeywordAnalyzer}"), data.retrieveAllValues("Field Analyzer"));
+ assertEquals(Collections.singletonList("Initialized"), data.retrieveAllValues("Status"));
+ assertEquals(Collections.singletonList("1"), data.retrieveAllValues("Query Executions"));
+ assertEquals(Collections.singletonList("10"), data.retrieveAllValues("Commits"));
+ assertEquals(Collections.singletonList("5"), data.retrieveAllValues("Updates"));
+ assertEquals(Collections.singletonList("1"), data.retrieveAllValues("Documents"));
}
@Test
@@ -268,12 +252,12 @@ public class LuceneIndexCommandsJUnitTest {
return new LuceneTestIndexCommands(cache, functionExecutor);
}
- private LuceneIndexDetails createIndexDetails(final String indexName, final String regionPath, final String[] searchableFields, final Map<String, Analyzer> fieldAnalyzers, LuceneIndexStats indexStats) {
- return new LuceneIndexDetails(indexName, regionPath, searchableFields, fieldAnalyzers,indexStats);
+ private LuceneIndexDetails createIndexDetails(final String indexName, final String regionPath, final String[] searchableFields, final Map<String, Analyzer> fieldAnalyzers, LuceneIndexStats indexStats, boolean status) {
+ return new LuceneIndexDetails(indexName, regionPath, searchableFields, fieldAnalyzers,indexStats, status);
}
- private LuceneIndexDetails createIndexDetails(final String indexName, final String regionPath, final String[] searchableFields, final Map<String, Analyzer> fieldAnalyzers) {
- return new LuceneIndexDetails(indexName, regionPath, searchableFields, fieldAnalyzers,null);
+ private LuceneIndexDetails createIndexDetails(final String indexName, final String regionPath, final String[] searchableFields, final Map<String, Analyzer> fieldAnalyzers, boolean status) {
+ return new LuceneIndexDetails(indexName, regionPath, searchableFields, fieldAnalyzers, null, status);
}
private LuceneSearchResults createQueryResults(final String key, final String value, final float score) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java
index 3669b90..e9b3224 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java
@@ -30,6 +30,7 @@ import com.gemstone.gemfire.cache.execute.ResultSender;
import com.gemstone.gemfire.cache.lucene.LuceneIndex;
import com.gemstone.gemfire.cache.lucene.internal.InternalLuceneService;
import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexInfo;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
@@ -52,7 +53,7 @@ public class LuceneDescribeIndexFunctionJUnitTest {
@SuppressWarnings("unchecked")
public void testExecute() throws Throwable {
GemFireCacheImpl cache = Fakes.cache();
- InternalLuceneService service = mock(InternalLuceneService.class);
+ LuceneServiceImpl service = mock(LuceneServiceImpl.class);
when(cache.getService(InternalLuceneService.class)).thenReturn(service);
FunctionContext context = mock(FunctionContext.class);
ResultSender resultSender = mock(ResultSender.class);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de3f90e0/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java
index cb22cf8..650a0c1 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java
@@ -39,6 +39,7 @@ import com.gemstone.gemfire.cache.execute.ResultSender;
import com.gemstone.gemfire.cache.lucene.LuceneIndex;
import com.gemstone.gemfire.cache.lucene.internal.InternalLuceneService;
import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
import com.gemstone.gemfire.cache.lucene.internal.cli.LuceneIndexDetails;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.test.fake.Fakes;
@@ -52,7 +53,7 @@ public class LuceneListIndexFunctionJUnitTest {
@SuppressWarnings("unchecked")
public void testExecute() throws Throwable {
GemFireCacheImpl cache = Fakes.cache();
- InternalLuceneService service = mock(InternalLuceneService.class);
+ LuceneServiceImpl service = mock(LuceneServiceImpl.class);
when(cache.getService(InternalLuceneService.class)).thenReturn(service);
FunctionContext context = mock(FunctionContext.class);