DATAGEODE-210 - Run forked Locator in temporary directory and clean up log files in Locator working diretory.

This commit is contained in:
John Blum
2019-07-19 18:42:44 -07:00
parent 5c06019210
commit 635afb160c

View File

@@ -23,8 +23,10 @@ import static org.junit.Assert.fail;
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newRuntimeException;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -54,6 +56,7 @@ import org.springframework.data.gemfire.test.support.FileUtils;
import org.springframework.data.gemfire.test.support.ThreadUtils;
import org.springframework.data.gemfire.test.support.ThrowableUtils;
import org.springframework.data.gemfire.test.support.ZipUtils;
import org.springframework.data.gemfire.util.ArrayUtils;
import org.springframework.util.FileSystemUtils;
import org.springframework.util.StringUtils;
@@ -137,7 +140,7 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
String locatorName = "ClusterConfigLocator";
locatorWorkingDirectory = new File(System.getProperty("user.dir"), locatorName.toLowerCase());
locatorWorkingDirectory = new File(System.getProperty("java.io.tmpdir"), locatorName.toLowerCase());
assertTrue(locatorWorkingDirectory.isDirectory() || locatorWorkingDirectory.mkdirs());
@@ -189,6 +192,12 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
FileSystemUtils.deleteRecursively(locatorWorkingDirectory);
}
FilenameFilter logFileFilter = (directory, name) -> name.endsWith(".log");
File[] logFiles = ArrayUtils.nullSafeArray(locatorWorkingDirectory.listFiles(logFileFilter), File.class);
Arrays.stream(logFiles).forEach(File::delete);
}
private Region assertRegion(Region actualRegion, String expectedRegionName) {