You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kh...@apache.org on 2018/06/18 20:42:12 UTC

[geode] branch develop updated: Create temp folder in two places (#2062)

This is an automated email from the ASF dual-hosted git repository.

khowe 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 8bab21a  Create temp folder in two places (#2062)
8bab21a is described below

commit 8bab21ae9a7c4be2eda42205d5fd6084e333e5c9
Author: Helena Bales <hb...@pivotal.io>
AuthorDate: Mon Jun 18 13:42:07 2018 -0700

    Create temp folder in two places (#2062)
    
    GEODE-5327: Refactor GfshCommandRule
    
    Move creation of temp folder to a helper method and call from no-arg
    constructor and before. The creation of the folder is idempotent so it
    can be called multiple times. Calling this method in before() allows
    tests to be run multiple times in IntelliJ.
---
 .../apache/geode/test/junit/rules/GfshCommandRule.java | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
index fb249df..12cb989 100644
--- a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
@@ -82,7 +82,9 @@ public class GfshCommandRule extends DescribedExternalResource {
   private File workingDir;
   private CommandResult commandResult;
 
-  public GfshCommandRule() {}
+  public GfshCommandRule() {
+    createTempFolder();
+  }
 
   public GfshCommandRule(Supplier<Integer> portSupplier, PortType portType) {
     this();
@@ -93,11 +95,7 @@ public class GfshCommandRule extends DescribedExternalResource {
   @Override
   protected void before(Description description) throws Throwable {
     LogWrapper.close();
-    try {
-      temporaryFolder.create();
-    } catch (IOException e) {
-      throw new UncheckedIOException(e);
-    }
+    createTempFolder();
     workingDir = temporaryFolder.newFolder("gfsh_files");
     this.gfsh = new HeadlessGfsh(getClass().getName(), gfshTimeout, workingDir.getAbsolutePath());
     ignoredException =
@@ -118,6 +116,14 @@ public class GfshCommandRule extends DescribedExternalResource {
     }
   }
 
+  private void createTempFolder() {
+    try {
+      temporaryFolder.create();
+    } catch (IOException e) {
+      throw new UncheckedIOException(e);
+    }
+  }
+
   @Override
   protected void after(Description description) throws Throwable {
     close();