geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jche...@apache.org
Subject [geode] branch develop updated: GEODE-6066: Added error for no members found in CreateDataSourceCommand (#2913)
Date Tue, 04 Dec 2018 17:29:09 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/develop by this push:
     new 0f5570d  GEODE-6066: Added error for no members found in CreateDataSourceCommand
(#2913)
0f5570d is described below

commit 0f5570d9adedf45de8a46893f8157aea18fb5889
Author: BenjaminPerryRoss <39068135+BenjaminPerryRoss@users.noreply.github.com>
AuthorDate: Tue Dec 4 09:28:56 2018 -0800

    GEODE-6066: Added error for no members found in CreateDataSourceCommand (#2913)
    
    * Added error for no members found in CreateDataSourceCommand
    
    - Added an error case for when no servers are available when
    CreateDataSourceCommand is run and Cluster Config is not enabled
    
    * Fixed error output based on PR feedback
---
 .../jdbc/internal/cli/CreateDataSourceCommand.java          |  6 +++++-
 .../jdbc/internal/cli/CreateDataSourceCommandTest.java      | 13 ++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/cli/CreateDataSourceCommand.java
b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/cli/CreateDataSourceCommand.java
index 49ff2d6..f9939a9 100644
--- a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/cli/CreateDataSourceCommand.java
+++ b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/cli/CreateDataSourceCommand.java
@@ -138,7 +138,11 @@ public class CreateDataSourceCommand extends SingleGfshCommand {
       result.setConfigObject(configuration);
       return result;
     } else {
-      return ResultModel.createInfo("No members found.");
+      if (service != null) {
+        return ResultModel.createInfo("No members found, data source saved to cluster config.");
+      } else {
+        return ResultModel.createError("No members found and cluster configuration unavailable.");
+      }
     }
   }
 
diff --git a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/cli/CreateDataSourceCommandTest.java
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/cli/CreateDataSourceCommandTest.java
index f6fcdab..3d3ea54 100644
--- a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/cli/CreateDataSourceCommandTest.java
+++ b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/cli/CreateDataSourceCommandTest.java
@@ -84,12 +84,20 @@ public class CreateDataSourceCommandTest {
 
   @Test
   public void nonPooledWorks() {
+    InternalConfigurationPersistenceService clusterConfigService =
+        mock(InternalConfigurationPersistenceService.class);
+    doReturn(clusterConfigService).when(command).getConfigurationPersistenceService();
+
     gfsh.executeAndAssertThat(command, COMMAND + " --pooled=false --url=url --name=name")
         .statusIsSuccess();
   }
 
   @Test
   public void pooledWorks() {
+    InternalConfigurationPersistenceService clusterConfigService =
+        mock(InternalConfigurationPersistenceService.class);
+    doReturn(clusterConfigService).when(command).getConfigurationPersistenceService();
+
     gfsh.executeAndAssertThat(command, COMMAND + " --pooled=true --url=url --name=name")
         .statusIsSuccess();
   }
@@ -204,8 +212,7 @@ public class CreateDataSourceCommandTest {
 
     gfsh.executeAndAssertThat(command,
         COMMAND + " --name=name  --url=url")
-        .statusIsSuccess().containsOutput("No members found").containsOutput(
-            "Cluster configuration service is not running. Configuration change is not persisted.");
+        .statusIsError().containsOutput("No members found and cluster configuration unavailable.");
   }
 
   @Test
@@ -226,7 +233,7 @@ public class CreateDataSourceCommandTest {
 
     gfsh.executeAndAssertThat(command,
         COMMAND + " --name=name  --url=url")
-        .statusIsSuccess().containsOutput("No members found.")
+        .statusIsSuccess().containsOutput("No members found, data source saved to cluster
config.")
         .containsOutput("Changes to configuration for group 'cluster' are persisted.");
 
     verify(clusterConfigService).updateCacheConfig(any(), any());


Mime
View raw message