[GitHub] geode pull request #679: GEODE-3340: Refactor ConfigCommandsDUnitTest to use...
Github user YehEmily commented on a diff in the pull request: https://github.com/apache/geode/pull/679#discussion_r131003469 --- 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 { --- End diff -- I think this move made it possible to run this test over HTTP without needing to run it through `CommandOverHttpDUnitTest`, since we are trying to get rid of `CommandOverHttpDUnitTest` anyway. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] geode pull request #679: GEODE-3340: Refactor ConfigCommandsDUnitTest to use...
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! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is
[GitHub] geode pull request #679: GEODE-3340: Refactor ConfigCommandsDUnitTest to use...
Github user jaredjstewart commented on a diff in the pull request: https://github.com/apache/geode/pull/679#discussion_r130998820 --- 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 { --- End diff -- What was the motivation to move this test from :geode-core into :geode-web? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] geode pull request #679: GEODE-3340: Refactor ConfigCommandsDUnitTest to use...
Github user jaredjstewart commented on a diff in the pull request: https://github.com/apache/geode/pull/679#discussion_r130998592 --- 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 -- These assertions might read more cleanly with a regex rather than a hardcoded number of spaces, e.g. ``` assertThat(result).containsPattern("enable-time-statistics\\s+: true"); ``` --- If your project