geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [22/47] geode git commit: GEODE-3436: Restore refactoring of StatusCommands
Date Thu, 31 Aug 2017 01:25:59 GMT
GEODE-3436: Restore refactoring of StatusCommands

* See initial commit GEODE-3270 (359e3fff6482ecfb375939d387f4dad3a636246b)


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

Branch: refs/heads/feature/GEODE-3543
Commit: 851932ec10ea3146308710f274aa9b7a17d4dbab
Parents: 18f65de
Author: YehEmily <emilyyeh1997@gmail.com>
Authored: Mon Aug 28 10:08:26 2017 -0700
Committer: Jinmei Liao <jiliao@pivotal.io>
Committed: Tue Aug 29 09:27:28 2017 -0700

----------------------------------------------------------------------
 .../StatusClusterConfigServiceCommand.java      | 82 ++++++++++++++++++++
 .../internal/cli/commands/StatusCommands.java   | 82 --------------------
 .../internal/security/TestCommand.java          |  2 +-
 3 files changed, 83 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/851932ec/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusClusterConfigServiceCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusClusterConfigServiceCommand.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusClusterConfigServiceCommand.java
new file mode 100644
index 0000000..6a0fc1e
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusClusterConfigServiceCommand.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information
regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version
2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain
a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under
the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express
+ * or implied. See the License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.shell.core.annotation.CliCommand;
+
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.cli.Result.Status;
+import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
+import org.apache.geode.management.internal.cli.functions.FetchSharedConfigurationStatusFunction;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission.Operation;
+import org.apache.geode.security.ResourcePermission.Resource;
+
+public class StatusClusterConfigServiceCommand implements GfshCommand {
+  private static final FetchSharedConfigurationStatusFunction fetchSharedConfigStatusFunction
=
+      new FetchSharedConfigurationStatusFunction();
+
+  @SuppressWarnings("unchecked")
+  @CliCommand(value = CliStrings.STATUS_SHARED_CONFIG, help = CliStrings.STATUS_SHARED_CONFIG_HELP)
+  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_LOCATOR)
+  @ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
+  public Result statusSharedConfiguration() {
+    final InternalCache cache = GemFireCacheImpl.getInstance();
+    final Set<DistributedMember> locators = new HashSet<DistributedMember>(
+        cache.getDistributionManager().getAllHostedLocatorsWithSharedConfiguration().keySet());
+    if (locators.isEmpty()) {
+      return ResultBuilder.createInfoResult(CliStrings.NO_LOCATORS_WITH_SHARED_CONFIG);
+    } else {
+      return ResultBuilder.buildResult(getSharedConfigurationStatus(locators));
+    }
+  }
+
+  private TabularResultData getSharedConfigurationStatus(Set<DistributedMember> locators)
{
+    boolean isSharedConfigRunning = false;
+    ResultCollector<?, ?> rc =
+        CliUtil.executeFunction(fetchSharedConfigStatusFunction, null, locators);
+    List<CliFunctionResult> results = (List<CliFunctionResult>) rc.getResult();
+    TabularResultData table = ResultBuilder.createTabularResultData();
+    table.setHeader("Status of shared configuration on locators");
+
+    for (CliFunctionResult result : results) {
+      table.accumulate(CliStrings.STATUS_SHARED_CONFIG_NAME_HEADER, result.getMemberIdOrName());
+      String status = (String) result.getSerializables()[0];
+      table.accumulate(CliStrings.STATUS_SHARED_CONFIG_STATUS, status);
+      if (SharedConfigurationStatus.RUNNING.name().equals(status)) {
+        isSharedConfigRunning = true;
+      }
+    }
+
+    if (!isSharedConfigRunning) {
+      table.setStatus(Status.ERROR);
+    }
+    return table;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/851932ec/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusCommands.java
deleted file mode 100644
index 0b0b78b..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusCommands.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information
regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version
2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain
a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under
the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express
- * or implied. See the License for the specific language governing permissions and limitations
under
- * the License.
- */
-package org.apache.geode.management.internal.cli.commands;
-
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.cli.Result.Status;
-import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
-import org.apache.geode.management.internal.cli.functions.FetchSharedConfigurationStatusFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.cli.result.TabularResultData;
-import org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus;
-import org.apache.geode.management.internal.security.ResourceOperation;
-import org.apache.geode.security.ResourcePermission.Operation;
-import org.apache.geode.security.ResourcePermission.Resource;
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliCommand;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class StatusCommands implements GfshCommand {
-  static final FetchSharedConfigurationStatusFunction fetchSharedConfigStatusFunction =
-      new FetchSharedConfigurationStatusFunction();
-
-  @SuppressWarnings("unchecked")
-  @CliCommand(value = CliStrings.STATUS_SHARED_CONFIG, help = CliStrings.STATUS_SHARED_CONFIG_HELP)
-  @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_LOCATOR)
-  @ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
-  public Result statusSharedConfiguration() {
-    final InternalCache cache = GemFireCacheImpl.getInstance();
-    final Set<DistributedMember> locators = new HashSet<DistributedMember>(
-        cache.getDistributionManager().getAllHostedLocatorsWithSharedConfiguration().keySet());
-    if (locators.isEmpty()) {
-      return ResultBuilder.createInfoResult(CliStrings.NO_LOCATORS_WITH_SHARED_CONFIG);
-    } else {
-      return ResultBuilder.buildResult(getSharedConfigurationStatus(locators));
-    }
-  }
-
-  private TabularResultData getSharedConfigurationStatus(Set<DistributedMember> locators)
{
-    boolean isSharedConfigRunning = false;
-    ResultCollector<?, ?> rc =
-        CliUtil.executeFunction(fetchSharedConfigStatusFunction, null, locators);
-    List<CliFunctionResult> results = (List<CliFunctionResult>) rc.getResult();
-    TabularResultData table = ResultBuilder.createTabularResultData();
-    table.setHeader("Status of shared configuration on locators");
-
-    for (CliFunctionResult result : results) {
-      table.accumulate(CliStrings.STATUS_SHARED_CONFIG_NAME_HEADER, result.getMemberIdOrName());
-      String status = (String) result.getSerializables()[0];
-      table.accumulate(CliStrings.STATUS_SHARED_CONFIG_STATUS, status);
-      if (SharedConfigurationStatus.RUNNING.name().equals(status)) {
-        isSharedConfigRunning = true;
-      }
-    }
-
-    if (!isSharedConfigRunning) {
-      table.setStatus(Status.ERROR);
-    }
-    return table;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/851932ec/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
b/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
index 4efa93f..5c91ca6 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
@@ -258,7 +258,7 @@ public class TestCommand {
     createTestCommand("describe region --name=value", clusterRead);
     createTestCommand("list regions", clusterRead);
 
-    // StatusCommands
+    // StatusClusterConfigServiceCommand
     createTestCommand("status cluster-config-service", clusterRead);
 
     // Shell Commands


Mime
View raw message