mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
changed to us File.createTempFile
Conflicts: src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java
This commit is contained in:
@@ -41,8 +41,8 @@ public class Builder {
|
||||
static String WIN_OS = "WINDOWS";
|
||||
|
||||
public static File getPersistenceFile() throws IOException {
|
||||
String TMP = System.getProperty("java.io.tmpdir");
|
||||
File file = new File(TMP + "/chm-test" + System.nanoTime() + (count++));
|
||||
|
||||
final File file = File.createTempFile("chm-test-", "map");
|
||||
|
||||
//Not Guaranteed to work on Windows, since OS file-lock takes precedence
|
||||
if (System.getProperty("os.name").indexOf(WIN_OS) > 0) {
|
||||
|
||||
@@ -40,8 +40,6 @@ import static org.junit.Assert.*;
|
||||
@RunWith(value = Parameterized.class)
|
||||
public class CHMUseCasesTest {
|
||||
|
||||
private static final String TMP = System.getProperty("java.io.tmpdir");
|
||||
|
||||
|
||||
enum TypeOfMap {STATELESS, SIMPLE, SIMPLE_PERSISTED, REPLICATED}
|
||||
|
||||
@@ -184,8 +182,13 @@ public class CHMUseCasesTest {
|
||||
|
||||
|
||||
private void checkJsonSerilization() {
|
||||
File file = null;
|
||||
try {
|
||||
file = File.createTempFile("chronicle-map-", ".json");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
File file = new File(TMP + "/chronicle-map-" + System.currentTimeMillis() + (i++) + System.nanoTime() + ".json");
|
||||
file.deleteOnExit();
|
||||
try {
|
||||
|
||||
@@ -232,9 +235,15 @@ public class CHMUseCasesTest {
|
||||
return map1;
|
||||
|
||||
case SIMPLE_PERSISTED:
|
||||
final File file = new File(TMP + "/chronicle-map-" +
|
||||
(i++) + System.nanoTime() + System.currentTimeMillis() + ".map");
|
||||
file.deleteOnExit();
|
||||
File file0 = null;
|
||||
try {
|
||||
file0 = File.createTempFile("chronicle-map-", ".map");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
file0.deleteOnExit();
|
||||
final File file = file0;
|
||||
map1 = builder.createPersistedTo(file);
|
||||
closeables.add(map1);
|
||||
closeables.add(new Closeable() {
|
||||
|
||||
@@ -47,8 +47,13 @@ public class PostChannelCreationTest {
|
||||
private ReplicationHub hubB;
|
||||
|
||||
public static File getPersistenceFile() {
|
||||
String TMP = System.getProperty("java.io.tmpdir");
|
||||
File file = new File(TMP + "/test" + System.nanoTime());
|
||||
File file = null;
|
||||
try {
|
||||
file = File.createTempFile("chm-test", "map");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
file.deleteOnExit();
|
||||
return file;
|
||||
}
|
||||
@@ -107,7 +112,8 @@ public class PostChannelCreationTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* sets up a 2 clusters ( notionally one for each host ), and replicates 2 Chronicle Maps between them
|
||||
* sets up a 2 clusters ( notionally one for each host ), and replicates 2 Chronicle Maps
|
||||
* between them
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
|
||||
@@ -23,7 +23,6 @@ import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig;
|
||||
import org.junit.*;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
@@ -44,12 +43,7 @@ public class SingleMapChannelTest {
|
||||
private ReplicationHub hubA;
|
||||
private ReplicationHub hubB;
|
||||
|
||||
public static File getPersistenceFile() {
|
||||
String TMP = System.getProperty("java.io.tmpdir");
|
||||
File file = new File(TMP + "/test" + System.nanoTime());
|
||||
file.deleteOnExit();
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public void setup() throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user