You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2018/04/02 15:24:40 UTC

[geode] 02/02: Revert "GEODE-4386: Return 'not found' if the JNDI binding does not exist (#1710)"

This is an automated email from the ASF dual-hosted git repository.

jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 2d8d1a6db46bb039b56fcfbdd9f2ad6e34890495
Author: Jens Deppe <jd...@pivotal.io>
AuthorDate: Mon Apr 2 08:19:30 2018 -0700

    Revert "GEODE-4386: Return 'not found' if the JNDI binding does not exist (#1710)"
    
    This reverts commit 60614fb818363128e6fe4587973a11e87e98ed45.
---
 .../internal/cli/commands/CommandAvailabilityIndicator.java  |  3 +--
 .../internal/cli/commands/DescribeJndiBindingCommand.java    | 12 ++----------
 .../cli/commands/DescribeJndiBindingCommandDUnitTest.java    |  6 ------
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CommandAvailabilityIndicator.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CommandAvailabilityIndicator.java
index 02938c1..a38a9e1 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CommandAvailabilityIndicator.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CommandAvailabilityIndicator.java
@@ -50,8 +50,7 @@ public class CommandAvailabilityIndicator implements CommandMarker {
       CliStrings.STOP_GATEWAYRECEIVER, CliStrings.LIST_GATEWAY, CliStrings.STATUS_GATEWAYSENDER,
       CliStrings.STATUS_GATEWAYRECEIVER, CliStrings.LOAD_BALANCE_GATEWAYSENDER,
       CliStrings.DESTROY_GATEWAYSENDER, AlterAsyncEventQueueCommand.COMMAND_NAME,
-      CreateJndiBindingCommand.CREATE_JNDIBINDING, DestroyJndiBindingCommand.DESTROY_JNDIBINDING,
-      DescribeJndiBindingCommand.DESCRIBE_JNDI_BINDING})
+      CreateJndiBindingCommand.CREATE_JNDIBINDING, DestroyJndiBindingCommand.DESTROY_JNDIBINDING})
   public boolean clientCommandsAvailable() {
     Gfsh gfsh = Gfsh.getCurrentInstance();
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeJndiBindingCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeJndiBindingCommand.java
index 6174b02..963845c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeJndiBindingCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeJndiBindingCommand.java
@@ -26,7 +26,6 @@ import org.apache.geode.cache.configuration.JndiBindingsType;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.distributed.internal.InternalClusterConfigurationService;
 import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.functions.ListJndiBindingFunction;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
@@ -37,13 +36,12 @@ import org.apache.geode.security.ResourcePermission;
 public class DescribeJndiBindingCommand extends InternalGfshCommand {
   private static final Logger logger = LogService.getLogger();
 
-  static final String DESCRIBE_JNDI_BINDING = "describe jndi-binding";
+  private static final String DESCRIBE_JNDI_BINDING = "describe jndi-binding";
   private static final String DESCRIBE_JNDIBINDING__HELP =
-      "Describe the configuration of the given jndi binding.";
+      "Describe the given active jndi binding. An active binding is one that is bound to the server's jndi context.";
   private static final Function LIST_BINDING_FUNCTION = new ListJndiBindingFunction();
 
   @CliCommand(value = DESCRIBE_JNDI_BINDING, help = DESCRIBE_JNDIBINDING__HELP)
-  @CliMetaData
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.READ)
   public Result describeJndiBinding(@CliOption(key = "name", mandatory = true,
@@ -56,12 +54,6 @@ public class DescribeJndiBindingCommand extends InternalGfshCommand {
     if (ccService != null) {
       CacheConfig cacheConfig = ccService.getCacheConfig("cluster");
       List<JndiBindingsType.JndiBinding> jndiBindings = cacheConfig.getJndiBindings();
-
-      if (jndiBindings.size() == 0) {
-        return ResultBuilder
-            .createUserErrorResult(String.format("JNDI binding : %s not found", bindingName));
-      }
-
       for (JndiBindingsType.JndiBinding binding : jndiBindings) {
         if (binding.getJndiName().equals(bindingName)
             || binding.getJndiName().equals("java:" + bindingName)) {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeJndiBindingCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeJndiBindingCommandDUnitTest.java
index 92c046c..b15b08e 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeJndiBindingCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeJndiBindingCommandDUnitTest.java
@@ -137,10 +137,4 @@ public class DescribeJndiBindingCommandDUnitTest {
         .tableHasRowWithValues("Property", "Value", "login-timeout-seconds", "7")
         .tableHasRowWithValues("Property", "Value", "prop1", "value1");
   }
-
-  @Test
-  public void describeJndiBindingDoesNotExist() {
-    gfsh.executeAndAssertThat("describe jndi-binding --name=unknown").statusIsError()
-        .containsOutput("JNDI binding : unknown not found");
-  }
 }

-- 
To stop receiving notification emails like this one, please contact
jensdeppe@apache.org.