geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstew...@apache.org
Subject [geode] branch develop updated: GEODE-3539: Add missing test coverage for 'describe config' command.
Date Fri, 22 Sep 2017 21:28:10 GMT
This is an automated email from the ASF dual-hosted git repository.

jstewart 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 1de8b77  GEODE-3539: Add missing test coverage for 'describe config' command.
1de8b77 is described below

commit 1de8b77fbf32568a8bf7092246b68b8c3a622faf
Author: Patrick Rhomberg <prhomberg@pivotal.io>
AuthorDate: Mon Sep 18 13:24:57 2017 -0700

    GEODE-3539: Add missing test coverage for 'describe config' command.
    
    This closes #800.
---
 .../commands/DescribeConfigCommandJUnitTest.java   | 90 ++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandJUnitTest.java
new file mode 100644
index 0000000..67063b3
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandJUnitTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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 static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.dunit.rules.GfshShellConnectionRule.PortType;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+
+@Category(IntegrationTest.class)
+public class DescribeConfigCommandJUnitTest {
+  private static final String[] EXPECTED_BASE_CONFIGURATION_DATA = {"Configuration of member
:",
+      "JVM command line arguments", "GemFire properties defined using the API"};
+
+  private static final String[] EXPECTED_EXPANDED_CONFIGURATION_DATA =
+      {"Cache attributes", "GemFire properties using default values"};
+
+  @Rule
+  public ServerStarterRule server = new ServerStarterRule().withJMXManager().withName("server")
+      .withRegion(RegionShortcut.PARTITION, "region").withAutoStart();
+
+  @Rule
+  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+
+  @Test
+  public void describeConfig() throws Exception {
+    gfsh.connectAndVerify(server.getJmxPort(), PortType.jmxManger);
+    String result = gfsh.execute("describe config --member=" + server.getName());
+    for (String datum : EXPECTED_BASE_CONFIGURATION_DATA) {
+      assertThat(result).contains(datum);
+    }
+  }
+
+  @Test
+  public void describeConfigAndShowDefaults() throws Exception {
+    gfsh.connectAndVerify(server.getJmxPort(), PortType.jmxManger);
+    String result =
+        gfsh.execute("describe config --hide-defaults=false --member=" + server.getName());
+    for (String datum : EXPECTED_BASE_CONFIGURATION_DATA) {
+      assertThat(result).contains(datum);
+    }
+    for (String datum : EXPECTED_EXPANDED_CONFIGURATION_DATA) {
+      assertThat(result).contains(datum);
+    }
+  }
+
+  @Test
+  public void describeConfigWhenNotConnected() throws Exception {
+    String result = gfsh.execute("describe config --member=" + server.getName());
+    assertThat(result).contains("was found but is not currently available");
+  }
+
+  @Test
+  public void describeConfigOnInvalidMember() throws Exception {
+    String invalidMemberName = "invalid-member-name";
+    String expectedErrorString = String.format("Member \"%s\" not found", invalidMemberName);
+
+    gfsh.connectAndVerify(server.getJmxPort(), PortType.jmxManger);
+    String result = gfsh.execute("describe config --member=" + invalidMemberName);
+    assertThat(result).contains(expectedErrorString);
+  }
+
+  @Test
+  public void describeConfigWithoutMemberName() throws Exception {
+    String expectedErrorString = String.format("You should specify option ");
+
+    gfsh.connectAndVerify(server.getJmxPort(), PortType.jmxManger);
+    String result = gfsh.execute("describe config");
+    assertThat(result).contains(expectedErrorString);
+  }
+}

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

Mime
View raw message