geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject geode git commit: GEODE-3140: Removed DiskDirRule and replaced use with TemporaryFolder rule
Date Thu, 29 Jun 2017 21:57:46 GMT
Repository: geode
Updated Branches:
  refs/heads/develop b5eeba30e -> 0698238a9


GEODE-3140: Removed DiskDirRule and replaced use with TemporaryFolder rule

This closes #608


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

Branch: refs/heads/develop
Commit: 0698238a9cb4d761b2e6b67c981993b14fc701eb
Parents: b5eeba3
Author: David Anuta <david.r.anuta@gmail.com>
Authored: Tue Jun 27 17:00:00 2017 -0700
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Thu Jun 29 14:21:52 2017 -0700

----------------------------------------------------------------------
 .../geode/test/junit/rules/DiskDirRule.java     | 60 --------------------
 .../geode/test/junit/rules/DiskDirRuleTest.java | 47 ---------------
 ...IndexCreationPersistenceIntegrationTest.java | 41 +++++++++----
 ...LuceneQueriesPersistenceIntegrationTest.java | 29 +++++-----
 .../RawLuceneRepositoryManagerJUnitTest.java    | 28 ++++-----
 .../DumpDirectoryFilesIntegrationTest.java      | 27 ++++-----
 .../filesystem/FileSystemJUnitTest.java         | 23 ++++----
 ...oncurrentParallelGatewaySenderDUnitTest.java | 22 +++----
 8 files changed, 90 insertions(+), 187 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/0698238a/geode-junit/src/main/java/org/apache/geode/test/junit/rules/DiskDirRule.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/org/apache/geode/test/junit/rules/DiskDirRule.java
b/geode-junit/src/main/java/org/apache/geode/test/junit/rules/DiskDirRule.java
deleted file mode 100644
index 0386396..0000000
--- a/geode-junit/src/main/java/org/apache/geode/test/junit/rules/DiskDirRule.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.test.junit.rules;
-
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-
-import org.junit.rules.ExternalResource;
-
-/**
- * A rule that creates a temporary directory and cleans it up after the test.
- */
-public class DiskDirRule extends ExternalResource {
-  private File diskDir;
-
-  @Override
-  protected void before() throws Throwable {
-    diskDir = new File(".", "DiskDirRule-" + System.nanoTime());
-  }
-
-  @Override
-  protected void after() {
-    if (!diskDir.exists()) {
-      return;
-    }
-
-    try {
-      Files.walk(diskDir.toPath()).forEach((path) -> {
-        try {
-          Files.delete(path);
-        } catch (IOException e) {
-          // Ignore
-        }
-      });
-    } catch (IOException e) {
-      throw new RuntimeException("Could not delete disk dir: " + diskDir, e);
-    }
-    diskDir.delete();
-  }
-
-  public File get() {
-    diskDir.mkdirs();
-    return diskDir;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/0698238a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/DiskDirRuleTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/DiskDirRuleTest.java
b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/DiskDirRuleTest.java
deleted file mode 100644
index 13c4218..0000000
--- a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/DiskDirRuleTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.test.junit.rules;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.util.Arrays;
-
-import org.apache.geode.test.junit.categories.UnitTest;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(UnitTest.class)
-public class DiskDirRuleTest {
-  @Test
-  public void shouldDeleteDirInAfter() throws Throwable {
-    DiskDirRule diskDirRule = new DiskDirRule();
-    diskDirRule.before();
-    final File dir = diskDirRule.get();
-    assertTrue(dir.exists());
-    final File file1 = new File(dir, "file1");
-    final File subdir = new File(dir, "subdir");
-    final File file2 = new File(dir, "file2");
-    subdir.mkdir();
-    Files.write(file1.toPath(), Arrays.asList("abc"));
-    Files.write(file2.toPath(), Arrays.asList("stuff"));
-    diskDirRule.after();
-    assertFalse(dir.exists());
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/0698238a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
index a8ab8d3..ea41a5b 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
@@ -14,23 +14,40 @@
  */
 package org.apache.geode.cache.lucene;
 
-import static org.apache.geode.cache.RegionShortcut.*;
-import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.*;
-import static junitparams.JUnitParamsRunner.*;
-import static org.junit.Assert.*;
+import static junitparams.JUnitParamsRunner.$;
+import static org.apache.geode.cache.RegionShortcut.PARTITION;
+import static org.apache.geode.cache.RegionShortcut.PARTITION_OVERFLOW;
+import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT;
+import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT_OVERFLOW;
+import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT;
+import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_OVERFLOW;
+import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT;
+import static org.apache.geode.cache.RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.DEFAULT_FIELD;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.createIndex;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.getIndexQueue;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.pauseSender;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.verifyIndexFinishFlushing;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Consumer;
 
-import org.awaitility.Awaitility;
 import junitparams.JUnitParamsRunner;
 import junitparams.Parameters;
-
+import org.awaitility.Awaitility;
 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.cache.PartitionAttributesFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionShortcut;
@@ -40,7 +57,6 @@ import org.apache.geode.cache.lucene.test.TestObject;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.DiskDirRule;
 
 /**
  * Tests of lucene index creation that use persistence
@@ -50,13 +66,13 @@ import org.apache.geode.test.junit.rules.DiskDirRule;
 public class LuceneIndexCreationPersistenceIntegrationTest extends LuceneIntegrationTest
{
 
   @Rule
-  public DiskDirRule diskDirRule = new DiskDirRule();
+  public TemporaryFolder tempFolderRule = new TemporaryFolder();
 
   @Override
   public void createCache() {
     super.createCache();
-    cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDirRule.get()}).setMaxOplogSize(1)
-        .create(GemFireCacheImpl.getDefaultDiskStoreName());
+    cache.createDiskStoreFactory().setDiskDirs(new File[] {tempFolderRule.getRoot()})
+        .setMaxOplogSize(1).create(GemFireCacheImpl.getDefaultDiskStoreName());
   }
 
   @Test
@@ -100,7 +116,7 @@ public class LuceneIndexCreationPersistenceIntegrationTest extends LuceneIntegra
   public void shouldNotUseDiskStoreWhenUserRegionIsNotPersistent() {
     createIndex(cache, "text");
     String diskStoreName = "diskStore";
-    cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDirRule.get()})
+    cache.createDiskStoreFactory().setDiskDirs(new File[] {tempFolderRule.getRoot()})
         .create(diskStoreName);
     cache.createRegionFactory(RegionShortcut.PARTITION_OVERFLOW).setDiskStoreName(diskStoreName)
         .create(REGION_NAME);
@@ -196,7 +212,8 @@ public class LuceneIndexCreationPersistenceIntegrationTest extends LuceneIntegra
   @Test
   public void shouldStoreIndexAndQueueInTheSameDiskStoreAsTheRegion() {
     createIndex(cache, "text");
-    cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDirRule.get()}).create("DiskStore");
+    cache.createDiskStoreFactory().setDiskDirs(new File[] {tempFolderRule.getRoot()})
+        .create("DiskStore");
     cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT).setDiskStoreName("DiskStore")
         .create(REGION_NAME);
     final String diskStoreName = cache.getRegion(REGION_NAME).getAttributes().getDiskStoreName();

http://git-wip-us.apache.org/repos/asf/geode/blob/0698238a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPersistenceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPersistenceIntegrationTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPersistenceIntegrationTest.java
index 65b250c..e9822aa 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPersistenceIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPersistenceIntegrationTest.java
@@ -14,12 +14,22 @@
  */
 package org.apache.geode.cache.lucene;
 
-import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.*;
-import static org.junit.Assert.*;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.DEFAULT_FIELD;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME;
+import static org.junit.Assert.assertNotNull;
 
 import java.io.File;
 import java.util.concurrent.TimeUnit;
 
+import junitparams.JUnitParamsRunner;
+import org.junit.Assert;
+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.cache.EvictionAction;
 import org.apache.geode.cache.EvictionAlgorithm;
 import org.apache.geode.cache.RegionFactory;
@@ -30,15 +40,6 @@ import org.apache.geode.internal.cache.EvictionAttributesImpl;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.DiskDirRule;
-
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-
-import junitparams.JUnitParamsRunner;
 
 /**
  * Tests of lucene index creation that use persistence
@@ -48,13 +49,13 @@ import junitparams.JUnitParamsRunner;
 public class LuceneQueriesPersistenceIntegrationTest extends LuceneIntegrationTest {
 
   @Rule
-  public DiskDirRule diskDirRule = new DiskDirRule();
+  public TemporaryFolder tempFolderRule = new TemporaryFolder();
 
   @Override
   public void createCache() {
     super.createCache();
-    cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDirRule.get()}).setMaxOplogSize(1)
-        .create(GemFireCacheImpl.getDefaultDiskStoreName());
+    cache.createDiskStoreFactory().setDiskDirs(new File[] {tempFolderRule.getRoot()})
+        .setMaxOplogSize(1).create(GemFireCacheImpl.getDefaultDiskStoreName());
   }
 
 

http://git-wip-us.apache.org/repos/asf/geode/blob/0698238a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java
index df31bb9..86a5535 100755
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/RawLuceneRepositoryManagerJUnitTest.java
@@ -14,21 +14,13 @@
  */
 package org.apache.geode.cache.lucene.internal;
 
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.mockito.Matchers.any;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
 
-import org.apache.geode.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer;
-import org.apache.geode.distributed.internal.locks.DLockService;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.PartitionedRegion;
-import org.apache.geode.internal.cache.PartitionedRegionDataStore;
-import org.apache.geode.internal.cache.PartitionedRegionHelper;
-import org.apache.geode.test.fake.Fakes;
-import org.apache.geode.test.junit.rules.DiskDirRule;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.store.Directory;
@@ -37,19 +29,19 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 import org.mockito.Mockito;
 
 import org.apache.geode.cache.lucene.internal.repository.IndexRepositoryImpl;
+import org.apache.geode.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer;
 import org.apache.geode.internal.cache.BucketNotFoundException;
 import org.apache.geode.internal.cache.BucketRegion;
-
-import java.io.File;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.PartitionedRegionDataStore;
+import org.apache.geode.test.fake.Fakes;
 
 public class RawLuceneRepositoryManagerJUnitTest extends PartitionedRepositoryManagerJUnitTest
{
 
-  @Rule
-  public DiskDirRule diskDirRule = new DiskDirRule();
-
   @Before
   public void setUp() {
     cache = Fakes.cache();

http://git-wip-us.apache.org/repos/asf/geode/blob/0698238a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/directory/DumpDirectoryFilesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/directory/DumpDirectoryFilesIntegrationTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/directory/DumpDirectoryFilesIntegrationTest.java
index 93f1aff..3fcc722 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/directory/DumpDirectoryFilesIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/directory/DumpDirectoryFilesIntegrationTest.java
@@ -14,20 +14,13 @@
  */
 package org.apache.geode.cache.lucene.internal.directory;
 
-import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.*;
-import static org.junit.Assert.*;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME;
+import static org.junit.Assert.assertEquals;
 
 import java.io.File;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.lucene.LuceneIntegrationTest;
-import org.apache.geode.cache.lucene.internal.InternalLuceneIndex;
-import org.apache.geode.cache.lucene.test.TestObject;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.DiskDirRule;
-
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.IndexSearcher;
@@ -37,11 +30,19 @@ import org.apache.lucene.store.FSDirectory;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.cache.lucene.LuceneIntegrationTest;
+import org.apache.geode.cache.lucene.internal.InternalLuceneIndex;
+import org.apache.geode.cache.lucene.test.TestObject;
+import org.apache.geode.test.junit.categories.IntegrationTest;
 
 @Category(IntegrationTest.class)
 public class DumpDirectoryFilesIntegrationTest extends LuceneIntegrationTest {
   @Rule
-  public DiskDirRule diskDirRule = new DiskDirRule();
+  public TemporaryFolder tempFolderRule = new TemporaryFolder();
 
   @Test
   public void shouldDumpReadableLuceneIndexFile() throws Exception {
@@ -59,10 +60,10 @@ public class DumpDirectoryFilesIntegrationTest extends LuceneIntegrationTest
{
 
     luceneService.waitUntilFlushed(INDEX_NAME, REGION_NAME, 60000, TimeUnit.MILLISECONDS);
 
-    index.dumpFiles(diskDirRule.get().getAbsolutePath());
+    index.dumpFiles(tempFolderRule.getRoot().getAbsolutePath());
 
     // Find the directory for the first bucket
-    File bucket0 = diskDirRule.get().listFiles(file -> file.getName().endsWith("_0"))[0];
+    File bucket0 = tempFolderRule.getRoot().listFiles(file -> file.getName().endsWith("_0"))[0];
 
     // Test that we can read the lucene index from the dump
     final FSDirectory directory = FSDirectory.open(bucket0.toPath());

http://git-wip-us.apache.org/repos/asf/geode/blob/0698238a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemJUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemJUnitTest.java
index 600c819..044e78a 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemJUnitTest.java
@@ -14,8 +14,15 @@
  */
 package org.apache.geode.cache.lucene.internal.filesystem;
 
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.atLeast;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -23,10 +30,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.reflect.Method;
 import java.nio.file.Files;
-import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
 import java.util.Random;
 import java.util.concurrent.ConcurrentHashMap;
@@ -35,6 +39,7 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
@@ -42,7 +47,6 @@ import org.mockito.stubbing.Answer;
 
 import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.test.junit.categories.UnitTest;
-import org.apache.geode.test.junit.rules.DiskDirRule;
 
 @Category(UnitTest.class)
 public class FileSystemJUnitTest {
@@ -53,9 +57,8 @@ public class FileSystemJUnitTest {
   private FileSystem system;
   private Random rand = new Random();
   private ConcurrentHashMap fileAndChunkRegion;
-
   @Rule
-  public DiskDirRule dirRule = new DiskDirRule();
+  public TemporaryFolder tempFolderRule = new TemporaryFolder();
   private FileSystemStats fileSystemStats;
 
   @Before
@@ -417,8 +420,8 @@ public class FileSystemJUnitTest {
     File file2 = system.createFile(name2);
     byte[] file2Data = writeRandomBytes(file2);
 
-    java.io.File parentDir = dirRule.get();
-    system.export(dirRule.get());
+    java.io.File parentDir = tempFolderRule.getRoot();
+    system.export(parentDir);
     String[] foundFiles = parentDir.list();
     Arrays.sort(foundFiles);
     assertArrayEquals(new String[] {"testFile1", "testFile2"}, foundFiles);

http://git-wip-us.apache.org/repos/asf/geode/blob/0698238a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
index c109ea2..529d25e 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java
@@ -14,20 +14,20 @@
  */
 package org.apache.geode.internal.cache.wan.concurrent;
 
+import static org.junit.Assert.assertEquals;
+
+import java.net.SocketException;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
 import org.awaitility.Awaitility;
-import org.junit.experimental.categories.Category;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
-import static org.junit.Assert.*;
-
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
 import org.apache.geode.cache.EntryExistsException;
 import org.apache.geode.cache.client.ServerOperationException;
-import org.apache.geode.cache.wan.GatewaySender.OrderPolicy;
 import org.apache.geode.cache.wan.GatewaySender;
+import org.apache.geode.cache.wan.GatewaySender.OrderPolicy;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
 import org.apache.geode.internal.cache.wan.BatchException70;
 import org.apache.geode.internal.cache.wan.WANTestBase;
@@ -35,11 +35,7 @@ import org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySen
 import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.LogWriterUtils;
-import org.apache.geode.test.dunit.Wait;
-
-import java.net.SocketException;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
+import org.apache.geode.test.junit.categories.DistributedTest;
 
 /**
  * Test the functionality of ParallelGatewaySender with multiple dispatchers.


Mime
View raw message