[GitHub] geode pull request #665: GEODE-3254: Refactoring ConfigCommands and ConfigCo...

2017-08-11 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/geode/pull/665


---
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 #665: GEODE-3254: Refactoring ConfigCommands and ConfigCo...

2017-08-02 Thread YehEmily
Github user YehEmily commented on a diff in the pull request:

https://github.com/apache/geode/pull/665#discussion_r130965197
  
--- Diff: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/Interceptor.java
 ---
@@ -0,0 +1,79 @@
+/*
+ * 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.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Map;
+
+import org.apache.geode.management.cli.Result;
+import 
org.apache.geode.management.internal.cli.AbstractCliAroundInterceptor;
+import org.apache.geode.management.internal.cli.GfshParseResult;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+
+/**
+ * Interceptor used by gfsh to intercept execution of export config 
command at "shell".
+ */
+public class Interceptor extends AbstractCliAroundInterceptor {
--- End diff --

Oops - it seems that it's actually being used, but only in 
`ExportConfigCommand`, so I moved it there. Thanks for pointing this out!


---
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 #665: GEODE-3254: Refactoring ConfigCommands and ConfigCo...

2017-08-02 Thread YehEmily
Github user YehEmily commented on a diff in the pull request:

https://github.com/apache/geode/pull/665#discussion_r130960231
  
--- Diff: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/Interceptor.java
 ---
@@ -0,0 +1,79 @@
+/*
+ * 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.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Map;
+
+import org.apache.geode.management.cli.Result;
+import 
org.apache.geode.management.internal.cli.AbstractCliAroundInterceptor;
+import org.apache.geode.management.internal.cli.GfshParseResult;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+
+/**
+ * Interceptor used by gfsh to intercept execution of export config 
command at "shell".
+ */
+public class Interceptor extends AbstractCliAroundInterceptor {
--- End diff --

Ahh, not sure how I didn't notice that! I've deleted it - thanks for your 
feedback!


---
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 #665: GEODE-3254: Refactoring ConfigCommands and ConfigCo...

2017-08-01 Thread jaredjstewart
Github user jaredjstewart commented on a diff in the pull request:

https://github.com/apache/geode/pull/665#discussion_r130658877
  
--- Diff: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/Interceptor.java
 ---
@@ -0,0 +1,79 @@
+/*
+ * 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.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Map;
+
+import org.apache.geode.management.cli.Result;
+import 
org.apache.geode.management.internal.cli.AbstractCliAroundInterceptor;
+import org.apache.geode.management.internal.cli.GfshParseResult;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+
+/**
+ * Interceptor used by gfsh to intercept execution of export config 
command at "shell".
+ */
+public class Interceptor extends AbstractCliAroundInterceptor {
--- End diff --

This class appears to be unused.


---
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 #665: GEODE-3254: Refactoring ConfigCommands and ConfigCo...

2017-08-01 Thread jaredjstewart
Github user jaredjstewart commented on a diff in the pull request:

https://github.com/apache/geode/pull/665#discussion_r130661310
  
--- Diff: 
geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommandDUnitTest.java
 ---
@@ -0,0 +1,181 @@
+/*
+ * 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.commons.io.FileUtils.deleteDirectory;
+import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.SerializableRunnable;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class ExportConfigCommandDUnitTest extends CliCommandTestBase {
+  private File managerConfigFile;
+  private File managerPropsFile;
+  private File vm1ConfigFile;
+  private File vm1PropsFile;
+  private File vm2ConfigFile;
+  private File vm2PropsFile;
+  private File shellConfigFile;
+  private File shellPropsFile;
+  private File subDir;
+  private File subManagerConfigFile;
+
+  @Override
+  protected final void postSetUpCliCommandTestBase() throws Exception {
+this.managerConfigFile = 
this.temporaryFolder.newFile("Manager-cache.xml");
+this.managerPropsFile = 
this.temporaryFolder.newFile("Manager-gf.properties");
+this.vm1ConfigFile = this.temporaryFolder.newFile("VM1-cache.xml");
+this.vm1PropsFile = this.temporaryFolder.newFile("VM1-gf.properties");
+this.vm2ConfigFile = this.temporaryFolder.newFile("VM2-cache.xml");
+this.vm2PropsFile = this.temporaryFolder.newFile("VM2-gf.properties");
+this.shellConfigFile = this.temporaryFolder.newFile("Shell-cache.xml");
+this.shellPropsFile = 
this.temporaryFolder.newFile("Shell-gf.properties");
+this.subDir = this.temporaryFolder.newFolder(getName());
+this.subManagerConfigFile = new File(this.subDir, 
this.managerConfigFile.getName());
+  }
+
+  @Category(FlakyTest.class) // GEODE-1449
+  @Test
+  public void testExportConfig() throws Exception {
+Properties localProps = new Properties();
+localProps.setProperty(NAME, "Manager");
+localProps.setProperty(GROUPS, "Group1");
+setUpJmxManagerOnVm0ThenConnect(localProps);
+
+// Create a cache in another VM (VM1)
+Host.getHost(0).getVM(1).invoke(new SerializableRunnable() {
+  public void run() {
+Properties localProps = new Properties();
+localProps.setProperty(NAME, "VM1");
+localProps.setProperty(GROUPS, "Group2");
+getSystem(localProps);
+getCache();
+  }
+});
+
+// Create a cache in a 3rd VM (VM2)
+Host.getHost(0).getVM(2).invoke(new SerializableRunnable() {
+  public void run() {
+Properties localProps = new Properties();
+localProps.setProperty(NAME, "VM2");
+localProps.setProperty(GROUPS, "Group2");
+getSystem(localProps);
+getCache();
+  }
+});
+
+// Create a cache in the local VM
+localProps = new Properties();

[GitHub] geode pull request #665: GEODE-3254: Refactoring ConfigCommands and ConfigCo...

2017-07-28 Thread YehEmily
GitHub user YehEmily opened a pull request:

https://github.com/apache/geode/pull/665

GEODE-3254: Refactoring ConfigCommands and ConfigCommandsDUnitTest

[View the JIRA ticket 
here.](https://issues.apache.org/jira/browse/GEODE-3254)

`ConfigCommands.java` was a large class that contained multiple commands. 
Each command was refactored into a separate class. 
`ConfigCommandsDUnitTest.java` was also split into separate test classes.

- [x] JIRA ticket referenced

- [x] PR rebased

- [x] Single squashed commit

- [x] Builds cleanly

- [x] Tests updated

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/YehEmily/geode GEODE-3254

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/geode/pull/665.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #665


commit 11c88b725eee219e5ec90e546d6e6fa1709a1b16
Author: YehEmily 
Date:   2017-07-26T18:07:09Z

GEODE-3254: Refactoring ConfigCommands and ConfigCommandsDUnitTest




---
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.
---