[ 
https://issues.apache.org/jira/browse/GEODE-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16242815#comment-16242815
 ] 

ASF GitHub Bot commented on GEODE-3539:
---------------------------------------

jinmeiliao commented on a change in pull request #1024: GEODE-3539: Restore 
test coverage for 'describe connection' command.
URL: https://github.com/apache/geode/pull/1024#discussion_r149493281
 
 

 ##########
 File path: 
geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConnectionCommandJUnitTest.java
 ##########
 @@ -0,0 +1,103 @@
+/*
+ * 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.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.Collections;
+import java.util.Enumeration;
+
+import org.apache.logging.log4j.Logger;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.LocatorStarterRule;
+
+/**
+ * The GfshCommandJUnitTest class is a test suite of test cases testing the 
contract and
+ * functionality of the GfshCommand class for implementing GemFire shell 
(Gfsh) commands.
+ *
+ * @see org.apache.geode.management.internal.cli.commands.GfshCommand
+ * @see org.jmock.Expectations
+ * @see org.jmock.Mockery
+ * @see org.jmock.lib.legacy.ClassImposteriser
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since GemFire 7.0
+ */
+
+@Category(IntegrationTest.class)
+public class DescribeConnectionCommandJUnitTest {
+  public static Logger logger = LogService.getLogger();
+
+  @ClassRule
+  public static LocatorStarterRule locator = new 
LocatorStarterRule().withAutoStart();
+
+  @Rule
+  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+
+  @Test
+  public void executeWhileConnected() throws Exception {
+    // Depending on configuration, the host may resolve its local IP
+    // to the alias present in /etc/hosts or use its internal host name.
+    // Check for these first.
+    gfsh.connectAndVerify(locator);
+    try {
 
 Review comment:
   I ran the command with different connection type, and the results shows up 
differently:
   
   > connect --locator=localhost[60303]
   Connecting to Locator at [host=localhost, port=60303] ..
   Connecting to Manager at [host=10.118.33.214, port=21535] ..
   Successfully connected to: [host=10.118.33.214, port=21535]
   
   
   > describe connection 
   Connection Endpoints
   --------------------
   10.118.33.214[21535]
   
   > disconnect
   Disconnecting from: 10.118.33.214[21535]
   Disconnected from : 10.118.33.214[21535]
   
   
   > connect --jmx-manager=localhost[21535]
   Connecting to Manager at [host=localhost, port=21535] ..
   Successfully connected to: [host=localhost, port=21535]
   
   > describe connection
   Connection Endpoints
   --------------------
   localhost[21535]
   
   > disconnect
   Disconnecting from: localhost[21535]
   Disconnected from : localhost[21535]
   
   > connect --use-http
   Successfully connected to: GemFire Manager HTTP service @ 
http://localhost:28478/geode-mgmt/v1
   
   > describe connection
   Connection Endpoints
   -------------------------------------------------------------------
   GemFire Manager HTTP service @ http://localhost:28478/geode-mgmt/v1
   
   
   we will need to have tests for each of these case.
   It probably would be better if we would just assert with 
gfsh.getInvoker().toString (which gives us the connection string).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add more test coverage for p2p commands
> ---------------------------------------
>
>                 Key: GEODE-3539
>                 URL: https://issues.apache.org/jira/browse/GEODE-3539
>             Project: Geode
>          Issue Type: Improvement
>          Components: gfsh
>            Reporter: Jinmei Liao
>
> Add more command tests that would eventually get rid of the legacy tests.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to