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 2017/10/04 22:08:08 UTC

[geode] branch develop updated (22b02c7 -> 51bcce5)

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

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


    from 22b02c7  GEODE-3539: refactored to reduce code duplication
     new a29f546  GEODE-3542: Add null guards in the case of invalid commands
     new 51bcce5  GEODE-3542: Make sure that gfsh is stopped properly at the end of tests

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../internal/cli/shell/GfshInitFileJUnitTest.java  |  2 +
 .../geode/test/junit/rules/GfshParserRule.java     | 49 ++++++++++++----------
 2 files changed, 29 insertions(+), 22 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].

[geode] 02/02: GEODE-3542: Make sure that gfsh is stopped properly at the end of tests

Posted by je...@apache.org.
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 51bcce5f7121b35a4ab8a3d2bc6525411fa620de
Author: Jens Deppe <jd...@pivotal.io>
AuthorDate: Wed Oct 4 14:53:07 2017 -0700

    GEODE-3542: Make sure that gfsh is stopped properly at the end of tests
    
    - This was causing subsequent tests to fail
---
 .../geode/management/internal/cli/shell/GfshInitFileJUnitTest.java      | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshInitFileJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshInitFileJUnitTest.java
index 5d61333..ca89f06 100755
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshInitFileJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshInitFileJUnitTest.java
@@ -110,6 +110,8 @@ public class GfshInitFileJUnitTest {
       System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, saveLog4j2Config);
       ((LoggerContext) LogManager.getContext(false)).reconfigure();
     }
+
+    Gfsh.getCurrentInstance().stop();
   }
 
   @Before

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.

[geode] 01/02: GEODE-3542: Add null guards in the case of invalid commands

Posted by je...@apache.org.
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 a29f5466b736ee0aedd581fb817472d1b68742b2
Author: Jens Deppe <jd...@pivotal.io>
AuthorDate: Wed Oct 4 13:36:37 2017 -0700

    GEODE-3542: Add null guards in the case of invalid commands
    
    - Prior commits seem to have introduced some instability
---
 .../geode/test/junit/rules/GfshParserRule.java     | 49 ++++++++++++----------
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshParserRule.java b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshParserRule.java
index db6b20d..ba0be92 100644
--- a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshParserRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshParserRule.java
@@ -16,25 +16,23 @@ package org.apache.geode.test.junit.rules;
 
 import static org.mockito.Mockito.spy;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
 import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.CliAroundInterceptor;
+import org.apache.geode.management.internal.cli.CommandManager;
+import org.apache.geode.management.internal.cli.GfshParseResult;
+import org.apache.geode.management.internal.cli.GfshParser;
+import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.junit.rules.ExternalResource;
 import org.springframework.shell.core.Completion;
 import org.springframework.shell.core.Converter;
-import org.springframework.shell.event.ParseResult;
 import org.springframework.util.ReflectionUtils;
 
-import org.apache.geode.management.internal.cli.CommandManager;
-import org.apache.geode.management.internal.cli.GfshParseResult;
-import org.apache.geode.management.internal.cli.GfshParser;
-import org.apache.geode.management.internal.cli.result.CommandResult;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
 
 public class GfshParserRule extends ExternalResource {
 
@@ -54,20 +52,27 @@ public class GfshParserRule extends ExternalResource {
   public <T> CommandResult executeCommandWithInstance(T instance, String command) {
     GfshParseResult parseResult = parse(command);
 
-    CliAroundInterceptor interceptor = null;
-    String interceptorClass =
-        parseResult.getMethod().getAnnotation(CliMetaData.class).interceptor();
-    if (!CliMetaData.ANNOTATION_NULL_VALUE.equals(interceptorClass)) {
-      try {
-        interceptor = (CliAroundInterceptor) ClassPathLoader.getLatest().forName(interceptorClass)
-            .newInstance();
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
+    if (parseResult == null) {
+      return ResultBuilder.createUserErrorResult("Invalid command: " + command);
+    }
 
-      Result preExecResult = interceptor.preExecution(parseResult);
-      if (Result.Status.ERROR.equals(preExecResult.getStatus())) {
-        return (CommandResult) preExecResult;
+    CliAroundInterceptor interceptor = null;
+    CliMetaData cliMetaData = parseResult.getMethod().getAnnotation(CliMetaData.class);
+
+    if (cliMetaData != null) {
+      String interceptorClass = cliMetaData.interceptor();
+      if (!CliMetaData.ANNOTATION_NULL_VALUE.equals(interceptorClass)) {
+        try {
+          interceptor = (CliAroundInterceptor) ClassPathLoader.getLatest().forName(interceptorClass)
+              .newInstance();
+        } catch (Exception e) {
+          throw new RuntimeException(e);
+        }
+
+        Result preExecResult = interceptor.preExecution(parseResult);
+        if (Result.Status.ERROR.equals(preExecResult.getStatus())) {
+          return (CommandResult) preExecResult;
+        }
       }
     }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.