geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [2/2] geode git commit: GEODE-2456: change JUnit4CacheTestCase tearDown to use deleteQuietly
Date Thu, 09 Feb 2017 22:04:26 GMT
GEODE-2456: change JUnit4CacheTestCase tearDown to use deleteQuietly


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/7d23a89d
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/7d23a89d
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/7d23a89d

Branch: refs/heads/feature/GEODE-2456
Commit: 7d23a89d7b2b2ced893404cf517faa330ef5f888
Parents: 30341ec
Author: Kirk Lund <klund@apache.org>
Authored: Thu Feb 9 12:02:56 2017 -0800
Committer: Kirk Lund <klund@apache.org>
Committed: Thu Feb 9 14:04:12 2017 -0800

----------------------------------------------------------------------
 .../DescribeDiskStoreFunctionJUnitTest.java        | 17 +++++++++--------
 .../dunit/cache/internal/JUnit4CacheTestCase.java  | 10 +++-------
 2 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/7d23a89d/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
index 1dd504a..e0038ef 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
@@ -286,9 +286,9 @@ public class DescribeDiskStoreFunctionJUnitTest {
 
   @Test
   public void testAssertStateThrowsIllegalStateException() {
-    assertThatThrownBy(() ->
-      DescribeDiskStoreFunction.assertState(false, "Expected (%1$s) message!", "test"))
-      .isInstanceOf(IllegalStateException.class).hasMessage("Expected (test) message!");
+    assertThatThrownBy(
+        () -> DescribeDiskStoreFunction.assertState(false, "Expected (%1$s) message!",
"test"))
+            .isInstanceOf(IllegalStateException.class).hasMessage("Expected (test) message!");
   }
 
   private void setupEmptyRegionsPdxGatewaysCacheServersAndAsyncEventQueues(
@@ -644,9 +644,9 @@ public class DescribeDiskStoreFunctionJUnitTest {
     function.execute(mockFunctionContext);
 
     String expected = String.format("A disk store with name (%1$s) was not found on member
(%2$s).",
-      diskStoreName, memberName);
+        diskStoreName, memberName);
     assertThatThrownBy(() -> testResultSender.getResults())
-      .isInstanceOf(DiskStoreNotFoundException.class).hasMessage(expected);
+        .isInstanceOf(DiskStoreNotFoundException.class).hasMessage(expected);
   }
 
   @Test
@@ -686,8 +686,8 @@ public class DescribeDiskStoreFunctionJUnitTest {
 
     function.execute(mockFunctionContext);
 
-    assertThatThrownBy(() -> testResultSender.getResults())
-      .isInstanceOf(RuntimeException.class).hasMessage("ExpectedStrings");
+    assertThatThrownBy(() -> testResultSender.getResults()).isInstanceOf(RuntimeException.class)
+        .hasMessage("ExpectedStrings");
   }
 
   @Test
@@ -744,7 +744,8 @@ public class DescribeDiskStoreFunctionJUnitTest {
 
     function.execute(mockFunctionContext);
 
-    String expected = "The number of disk directories with a specified size (0) does not
match the number of disk directories (1)!";
+    String expected =
+        "The number of disk directories with a specified size (0) does not match the number
of disk directories (1)!";
     assertThatThrownBy(() -> testResultSender.getResults()).hasMessage(expected);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/7d23a89d/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
index a511995..f8b1415 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
@@ -22,6 +22,7 @@ import java.util.Arrays;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.AttributesFactory;
@@ -41,7 +42,6 @@ import org.apache.geode.cache.client.PoolManager;
 import org.apache.geode.cache30.CacheSerializableRunnable;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.DistributionMessageObserver;
-import org.apache.geode.internal.FileUtil;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalRegionArguments;
 import org.apache.geode.internal.cache.LocalRegion;
@@ -568,17 +568,13 @@ public abstract class JUnit4CacheTestCase extends JUnit4DistributedTestCase
   }
 
   public static final void cleanDiskDirs() throws IOException {
-    FileUtil.delete(getDiskDir());
+    FileUtils.deleteQuietly(getDiskDir());
     Arrays.stream(new File(".").listFiles()).forEach(file -> deleteBACKUPDiskStoreFile(file));
   }
 
   private static void deleteBACKUPDiskStoreFile(final File file) {
     if (file.getName().startsWith("BACKUPDiskStore-")) {
-      try {
-        FileUtil.delete(file);
-      } catch (IOException e) {
-        throw new RuntimeException("Unable to delete BACKUPDiskStore file", e);
-      }
+      FileUtils.deleteQuietly(file);
     }
   }
 


Mime
View raw message