[
https://issues.apache.org/jira/browse/GEODE-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16111762#comment-16111762
]
ASF GitHub Bot commented on GEODE-3340:
---------------------------------------
Github user YehEmily commented on a diff in the pull request:
https://github.com/apache/geode/pull/679#discussion_r131003075
--- Diff:
geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java
---
@@ -0,0 +1,242 @@
+/*
+ * 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.apache.geode.distributed.ConfigurationProperties.ENABLE_TIME_STATISTICS;
+import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static
org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static
org.apache.geode.distributed.ConfigurationProperties.STATISTIC_SAMPLING_ENABLED;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import java.util.stream.Collectors;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+
+import org.apache.geode.distributed.internal.ClusterConfigurationService;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.logging.LogWriterImpl;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
+import org.apache.geode.test.dunit.IgnoredException;
+import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+@RunWith(JUnitParamsRunner.class)
+public class ConfigCommandDUnitTest {
+ @Rule
+ public LocatorServerStartupRule startupRule = new
LocatorServerStartupRule();
+
+ @Rule
+ public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Test
+ @Parameters({"true", "false"})
+ public void testDescribeConfig(final boolean connectOverHttp) throws
Exception {
+ Properties localProps = new Properties();
+ localProps.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
+ localProps.setProperty(ENABLE_TIME_STATISTICS, "true");
+ localProps.setProperty(GROUPS, "G1");
+ MemberVM server0 = startupRule.startServerAsJmxManager(0, localProps);
+
+ if (connectOverHttp) {
+ gfsh.connectAndVerify(server0.getHttpPort(),
GfshShellConnectionRule.PortType.http);
+ } else {
+ gfsh.connectAndVerify(server0.getJmxPort(),
GfshShellConnectionRule.PortType.jmxManger);
+ }
+
+ server0.invoke(() -> {
+ InternalCache cache =
LocatorServerStartupRule.serverStarter.getCache();
+ InternalDistributedSystem system =
cache.getInternalDistributedSystem();
+ DistributionConfig config = system.getConfig();
+ config.setArchiveFileSizeLimit(1000);
+ });
+
+ gfsh.executeAndVerifyCommand("describe config --member=" +
server0.getName());
+ String result = gfsh.getGfshOutput();
+
+ assertThat(result).contains("enable-time-statistics
: true");
--- End diff --
Fixed! Thank you!
> Refactor ConfigCommandsDUnitTest to use test rules
> --------------------------------------------------
>
> Key: GEODE-3340
> URL: https://issues.apache.org/jira/browse/GEODE-3340
> Project: Geode
> Issue Type: Sub-task
> Components: tests
> Reporter: Emily Yeh
> Assignee: Emily Yeh
>
> {{ConfigCommandsDUnitTest}} is using {{CliCommandTestBase}}, which is a
> deprecated class. It should be refactored to use more current test rules.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)