geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject geode git commit: Revert "GEODE-2733: Server name is displayed in lucene index stats."
Date Wed, 18 Jan 2017 20:06:44 GMT
Repository: geode
Updated Branches:
  refs/heads/develop d735be604 -> d43910d95


Revert "GEODE-2733: Server name is displayed in lucene index stats."

This reverts commit d735be6043b88871e86e91266ee35039a596ac7f.


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d43910d9
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d43910d9
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d43910d9

Branch: refs/heads/develop
Commit: d43910d95a837df19ca629a0a891c1e77d44bcc8
Parents: d735be6
Author: nabarun <nnag@pivotal.io>
Authored: Wed Jan 18 12:06:25 2017 -0800
Committer: nabarun <nnag@pivotal.io>
Committed: Wed Jan 18 12:06:25 2017 -0800

----------------------------------------------------------------------
 .../internal/cli/LuceneIndexCommands.java       |  1 -
 .../lucene/internal/cli/LuceneIndexDetails.java | 17 +++-------
 .../functions/LuceneDescribeIndexFunction.java  |  9 ++++--
 .../cli/functions/LuceneListIndexFunction.java  |  6 ++--
 .../cli/LuceneIndexCommandsJUnitTest.java       | 33 +++++++++-----------
 .../LuceneDescribeIndexFunctionJUnitTest.java   |  8 +++--
 .../LuceneListIndexFunctionJUnitTest.java       |  6 ++--
 7 files changed, 38 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/d43910d9/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
index 8f5a3d6..6a5a1e0 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
@@ -131,7 +131,6 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
       for (final LuceneIndexDetails indexDetails : indexDetailsList) {
         indexData.accumulate("Index Name", indexDetails.getIndexName());
         indexData.accumulate("Region Path", indexDetails.getRegionPath());
-        indexData.accumulate("Server Name", indexDetails.getServerName());
         indexData.accumulate("Indexed Fields", indexDetails.getSearchableFieldNamesString());
         indexData.accumulate("Field Analyzer", indexDetails.getFieldAnalyzersString());
         indexData.accumulate("Status",

http://git-wip-us.apache.org/repos/asf/geode/blob/d43910d9/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexDetails.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexDetails.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexDetails.java
index 02a19a1..cc96df2 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexDetails.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexDetails.java
@@ -21,8 +21,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.lucene.internal.LuceneIndexCreationProfile;
 import org.apache.geode.cache.lucene.internal.LuceneIndexImpl;
 import org.apache.geode.cache.lucene.internal.LuceneIndexStats;
@@ -33,7 +31,6 @@ public class LuceneIndexDetails implements Comparable<LuceneIndexDetails>,
Seria
   private static final long serialVersionUID = 1L;
   private final String indexName;
   private final String regionPath;
-  private final String serverName;
   private final String[] searchableFieldNames;
   private Map<String, String> fieldAnalyzers = null;
   private final Map<String, Integer> indexStats;
@@ -41,24 +38,23 @@ public class LuceneIndexDetails implements Comparable<LuceneIndexDetails>,
Seria
 
   public LuceneIndexDetails(final String indexName, final String regionPath,
       final String[] searchableFieldNames, final Map<String, Analyzer> fieldAnalyzers,
-      LuceneIndexStats indexStats, boolean initialized, final String serverName) {
+      LuceneIndexStats indexStats, boolean initialized) {
     this.indexName = indexName;
     this.regionPath = regionPath;
-    this.serverName = serverName;
     this.searchableFieldNames = searchableFieldNames;
     this.fieldAnalyzers = getFieldAnalyzerStrings(fieldAnalyzers);
     this.indexStats = getIndexStatsMap(indexStats);
     this.initialized = initialized;
   }
 
-  public LuceneIndexDetails(LuceneIndexImpl index, final String serverName) {
+  public LuceneIndexDetails(LuceneIndexImpl index) {
     this(index.getName(), index.getRegionPath(), index.getFieldNames(), index.getFieldAnalyzers(),
-        index.getIndexStats(), true, serverName);
+        index.getIndexStats(), true);
   }
 
-  public LuceneIndexDetails(LuceneIndexCreationProfile indexProfile, final String serverName)
{
+  public LuceneIndexDetails(LuceneIndexCreationProfile indexProfile) {
     this(indexProfile.getIndexName(), indexProfile.getRegionPath(), indexProfile.getFieldNames(),
-        null, null, false, serverName);
+        null, null, false);
     this.fieldAnalyzers = getFieldAnalyzerStringsFromProfile(indexProfile.getFieldAnalyzers());
   }
 
@@ -161,7 +157,4 @@ public class LuceneIndexDetails implements Comparable<LuceneIndexDetails>,
Seria
         : compare(getRegionPath(), indexDetails.getRegionPath()));
   }
 
-  public String getServerName() {
-    return serverName;
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/d43910d9/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
index 9788c4a..0ec5b4d 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunction.java
@@ -15,11 +15,15 @@
 
 package org.apache.geode.cache.lucene.internal.cli.functions;
 
+import java.util.HashSet;
+import java.util.Set;
+
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.execute.FunctionAdapter;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.lucene.LuceneIndex;
+import org.apache.geode.cache.lucene.LuceneService;
 import org.apache.geode.cache.lucene.LuceneServiceProvider;
 import org.apache.geode.cache.lucene.internal.LuceneIndexCreationProfile;
 import org.apache.geode.cache.lucene.internal.LuceneIndexImpl;
@@ -56,16 +60,15 @@ public class LuceneDescribeIndexFunction extends FunctionAdapter implements
Inte
     LuceneIndexDetails result = null;
 
     final Cache cache = getCache();
-    final String serverName = cache.getDistributedSystem().getDistributedMember().getName();
     final LuceneIndexInfo indexInfo = (LuceneIndexInfo) context.getArguments();
     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, serverName);
+      result = new LuceneIndexDetails((LuceneIndexImpl) index);
     } else if (profile != null) {
-      result = new LuceneIndexDetails(profile, serverName);
+      result = new LuceneIndexDetails(profile);
     }
     context.getResultSender().lastResult(result);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/d43910d9/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
index 033b162..8732bba 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunction.java
@@ -23,6 +23,7 @@ import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.execute.FunctionAdapter;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.lucene.LuceneIndex;
+import org.apache.geode.cache.lucene.LuceneService;
 import org.apache.geode.cache.lucene.LuceneServiceProvider;
 import org.apache.geode.cache.lucene.internal.LuceneIndexCreationProfile;
 import org.apache.geode.cache.lucene.internal.LuceneIndexImpl;
@@ -56,14 +57,13 @@ public class LuceneListIndexFunction extends FunctionAdapter implements
Internal
   public void execute(final FunctionContext context) {
     final Set<LuceneIndexDetails> indexDetailsSet = new HashSet<>();
     final Cache cache = getCache();
-    final String serverName = cache.getDistributedSystem().getDistributedMember().getName();
     LuceneServiceImpl service = (LuceneServiceImpl) LuceneServiceProvider.get(cache);
     for (LuceneIndex index : service.getAllIndexes()) {
-      indexDetailsSet.add(new LuceneIndexDetails((LuceneIndexImpl) index, serverName));
+      indexDetailsSet.add(new LuceneIndexDetails((LuceneIndexImpl) index));
     }
 
     for (LuceneIndexCreationProfile profile : service.getAllDefinedIndexes()) {
-      indexDetailsSet.add(new LuceneIndexDetails(profile, serverName));
+      indexDetailsSet.add(new LuceneIndexDetails(profile));
     }
     context.getResultSender().lastResult(indexDetailsSet);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/d43910d9/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
index 6ddef9e..dbb80dc 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
@@ -48,6 +48,7 @@ import org.apache.geode.internal.util.CollectionUtils;
 import org.apache.geode.management.cli.Result.Status;
 import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
 import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.CommandResultException;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
@@ -75,7 +76,6 @@ public class LuceneIndexCommandsJUnitTest {
   public void testListIndexWithoutStats() {
 
     final Cache mockCache = mock(Cache.class, "Cache");
-    final String serverName = "mockServer";
     final AbstractExecution mockFunctionExecutor =
         mock(AbstractExecution.class, "Function Executor");
     final ResultCollector mockResultCollector = mock(ResultCollector.class, "ResultCollector");
@@ -85,12 +85,12 @@ 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, true, serverName);
-    final LuceneIndexDetails indexDetails2 = createIndexDetails("memberSix", "/Employees",
-        searchableFields, fieldAnalyzers, false, serverName);
-    final LuceneIndexDetails indexDetails3 = createIndexDetails("memberTen", "/Employees",
-        searchableFields, fieldAnalyzers, true, serverName);
+    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<Set<LuceneIndexDetails>> results = new ArrayList<>();
 
@@ -124,7 +124,6 @@ public class LuceneIndexCommandsJUnitTest {
   public void testListIndexWithStats() {
 
     final Cache mockCache = mock(Cache.class, "Cache");
-    final String serverName = "mockServer";
     final AbstractExecution mockFunctionExecutor =
         mock(AbstractExecution.class, "Function Executor");
     final ResultCollector mockResultCollector = mock(ResultCollector.class, "ResultCollector");
@@ -137,11 +136,11 @@ public class LuceneIndexCommandsJUnitTest {
     fieldAnalyzers.put("field2", new KeywordAnalyzer());
     fieldAnalyzers.put("field3", null);
     final LuceneIndexDetails indexDetails1 = createIndexDetails("memberFive", "/Employees",
-        searchableFields, fieldAnalyzers, mockIndexStats1, true, serverName);
+        searchableFields, fieldAnalyzers, mockIndexStats1, true);
     final LuceneIndexDetails indexDetails2 = createIndexDetails("memberSix", "/Employees",
-        searchableFields, fieldAnalyzers, mockIndexStats2, true, serverName);
+        searchableFields, fieldAnalyzers, mockIndexStats2, true);
     final LuceneIndexDetails indexDetails3 = createIndexDetails("memberTen", "/Employees",
-        searchableFields, fieldAnalyzers, mockIndexStats3, true, serverName);
+        searchableFields, fieldAnalyzers, mockIndexStats3, true);
 
     final List<Set<LuceneIndexDetails>> results = new ArrayList<>();
 
@@ -207,7 +206,6 @@ public class LuceneIndexCommandsJUnitTest {
   public void testDescribeIndex() throws Exception {
 
     final Cache mockCache = mock(Cache.class, "Cache");
-    final String serverName = "mockServer";
     final ResultCollector mockResultCollector = mock(ResultCollector.class, "ResultCollector");
     final LuceneIndexCommands commands = spy(createIndexCommands(mockCache, null));
 
@@ -219,7 +217,7 @@ public class LuceneIndexCommandsJUnitTest {
     final LuceneIndexStats mockIndexStats = getMockIndexStats(1, 10, 5, 1);
     final List<LuceneIndexDetails> indexDetails = new ArrayList<>();
     indexDetails.add(createIndexDetails("memberFive", "/Employees", searchableFields,
-        fieldAnalyzers, mockIndexStats, true, serverName));
+        fieldAnalyzers, mockIndexStats, true));
 
     doReturn(mockResultCollector).when(commands).executeFunctionOnGroups(
         isA(LuceneDescribeIndexFunction.class), any(), any(LuceneIndexInfo.class));
@@ -441,16 +439,15 @@ public class LuceneIndexCommandsJUnitTest {
 
   private LuceneIndexDetails createIndexDetails(final String indexName, final String regionPath,
       final String[] searchableFields, final Map<String, Analyzer> fieldAnalyzers,
-      LuceneIndexStats indexStats, boolean status, final String serverName) {
+      LuceneIndexStats indexStats, boolean status) {
     return new LuceneIndexDetails(indexName, regionPath, searchableFields, fieldAnalyzers,
-        indexStats, status, serverName);
+        indexStats, status);
   }
 
   private LuceneIndexDetails createIndexDetails(final String indexName, final String regionPath,
-      final String[] searchableFields, final Map<String, Analyzer> fieldAnalyzers,
boolean status,
-      final String serverName) {
+      final String[] searchableFields, final Map<String, Analyzer> fieldAnalyzers,
boolean status) {
     return new LuceneIndexDetails(indexName, regionPath, searchableFields, fieldAnalyzers,
null,
-        status, serverName);
+        status);
   }
 
   private LuceneSearchResults createQueryResults(final String key, final String value,

http://git-wip-us.apache.org/repos/asf/geode/blob/d43910d9/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java
index 35e28ea..7330e2c 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneDescribeIndexFunctionJUnitTest.java
@@ -17,11 +17,15 @@ package org.apache.geode.cache.lucene.internal.cli.functions;
 import static org.junit.Assert.*;
 import static org.mockito.Mockito.*;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
 
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.ResultSender;
+import org.apache.geode.cache.lucene.LuceneIndex;
 import org.apache.geode.cache.lucene.internal.InternalLuceneService;
 import org.apache.geode.cache.lucene.internal.LuceneIndexImpl;
 import org.apache.geode.cache.lucene.internal.LuceneServiceImpl;
@@ -37,6 +41,7 @@ import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
 
 @Category(UnitTest.class)
 
@@ -46,7 +51,6 @@ public class LuceneDescribeIndexFunctionJUnitTest {
   @SuppressWarnings("unchecked")
   public void testExecute() throws Throwable {
     GemFireCacheImpl cache = Fakes.cache();
-    final String serverName = "mockServer";
     LuceneServiceImpl service = mock(LuceneServiceImpl.class);
     when(cache.getService(InternalLuceneService.class)).thenReturn(service);
     FunctionContext context = mock(FunctionContext.class);
@@ -65,7 +69,7 @@ public class LuceneDescribeIndexFunctionJUnitTest {
         ArgumentCaptor.forClass(LuceneIndexDetails.class);
     verify(resultSender).lastResult(resultCaptor.capture());
     LuceneIndexDetails result = resultCaptor.getValue();
-    LuceneIndexDetails expected = new LuceneIndexDetails(index1, "mockServer");
+    LuceneIndexDetails expected = new LuceneIndexDetails(index1);
 
     assertEquals(expected.getIndexName(), result.getIndexName());
     assertEquals(expected.getRegionPath(), result.getRegionPath());

http://git-wip-us.apache.org/repos/asf/geode/blob/d43910d9/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java
index 2d282a3..3adc030 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneListIndexFunctionJUnitTest.java
@@ -19,6 +19,7 @@ import static org.mockito.Mockito.*;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
@@ -50,7 +51,6 @@ public class LuceneListIndexFunctionJUnitTest {
   @SuppressWarnings("unchecked")
   public void testExecute() throws Throwable {
     GemFireCacheImpl cache = Fakes.cache();
-    final String serverName = "mockServer";
     LuceneServiceImpl service = mock(LuceneServiceImpl.class);
     when(cache.getService(InternalLuceneService.class)).thenReturn(service);
 
@@ -62,8 +62,8 @@ public class LuceneListIndexFunctionJUnitTest {
     LuceneIndexImpl index2 = getMockLuceneIndex("index2");
 
     TreeSet expectedResult = new TreeSet();
-    expectedResult.add(new LuceneIndexDetails(index1, serverName));
-    expectedResult.add(new LuceneIndexDetails(index2, serverName));
+    expectedResult.add(new LuceneIndexDetails(index1));
+    expectedResult.add(new LuceneIndexDetails(index2));
 
     ArrayList<LuceneIndex> allIndexes = new ArrayList();
     allIndexes.add(index1);


Mime
View raw message