mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Exclude tests on Windows, work on #229
This commit is contained in:
@@ -26,7 +26,7 @@ public class FileLockUtilTest {
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
// Do not run these test on Windows
|
||||
Assume.assumeFalse(OS.isWindows());
|
||||
doNotRunOnWindows();
|
||||
|
||||
canonicalFile = new File("file.lock").getCanonicalFile();
|
||||
canonicalFile.delete();
|
||||
@@ -37,12 +37,14 @@ public class FileLockUtilTest {
|
||||
|
||||
@After
|
||||
public void cleanup() throws IOException {
|
||||
doNotRunOnWindows();
|
||||
fileChannel.close();
|
||||
CanonicalRandomAccessFiles.release(canonicalFile);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShared() {
|
||||
doNotRunOnWindows();
|
||||
FileLockUtil.acquireSharedFileLock(canonicalFile, fileChannel);
|
||||
FileLockUtil.acquireSharedFileLock(canonicalFile, fileChannel);
|
||||
FileLockUtil.releaseFileLock(canonicalFile);
|
||||
@@ -51,6 +53,7 @@ public class FileLockUtilTest {
|
||||
|
||||
@Test
|
||||
public void testExclusiveNormalCase() {
|
||||
doNotRunOnWindows();
|
||||
FileLockUtil.acquireExclusiveFileLock(canonicalFile, fileChannel);
|
||||
FileLockUtil.releaseFileLock(canonicalFile);
|
||||
FileLockUtil.acquireExclusiveFileLock(canonicalFile, fileChannel);
|
||||
@@ -59,6 +62,7 @@ public class FileLockUtilTest {
|
||||
|
||||
@Test
|
||||
public void testTryExclusiveButWasShared() {
|
||||
doNotRunOnWindows();
|
||||
FileLockUtil.acquireSharedFileLock(canonicalFile, fileChannel);
|
||||
try {
|
||||
FileLockUtil.acquireExclusiveFileLock(canonicalFile, fileChannel);
|
||||
@@ -70,6 +74,7 @@ public class FileLockUtilTest {
|
||||
|
||||
@Test
|
||||
public void testTrySharedButWasExclusive() {
|
||||
doNotRunOnWindows();
|
||||
FileLockUtil.acquireExclusiveFileLock(canonicalFile, fileChannel);
|
||||
try {
|
||||
FileLockUtil.acquireSharedFileLock(canonicalFile, fileChannel);
|
||||
@@ -81,6 +86,7 @@ public class FileLockUtilTest {
|
||||
|
||||
@Test
|
||||
public void testComplicated() {
|
||||
doNotRunOnWindows();
|
||||
FileLockUtil.acquireExclusiveFileLock(canonicalFile, fileChannel);
|
||||
FileLockUtil.releaseFileLock(canonicalFile);
|
||||
FileLockUtil.acquireSharedFileLock(canonicalFile, fileChannel);
|
||||
@@ -93,7 +99,7 @@ public class FileLockUtilTest {
|
||||
|
||||
@Test
|
||||
public void testRunExclusively() {
|
||||
FileLockUtil.dump();
|
||||
doNotRunOnWindows();
|
||||
final AtomicInteger cnt = new AtomicInteger();
|
||||
FileLockUtil.runExclusively(canonicalFile, fileChannel, cnt::incrementAndGet);
|
||||
assertEquals(1, cnt.get());
|
||||
@@ -101,6 +107,7 @@ public class FileLockUtilTest {
|
||||
|
||||
@Test
|
||||
public void testRunExclusivelyButUsed() {
|
||||
doNotRunOnWindows();
|
||||
FileLockUtil.acquireSharedFileLock(canonicalFile, fileChannel);
|
||||
try {
|
||||
FileLockUtil.runExclusively(canonicalFile, fileChannel, () -> {});
|
||||
@@ -110,4 +117,8 @@ public class FileLockUtilTest {
|
||||
}
|
||||
}
|
||||
|
||||
private void doNotRunOnWindows() {
|
||||
Assume.assumeFalse(OS.isWindows());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
package net.openhft.chronicle.map;
|
||||
|
||||
import net.openhft.chronicle.core.OS;
|
||||
import net.openhft.chronicle.hash.ChronicleHashRecoveryFailedException;
|
||||
import org.junit.After;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -40,6 +42,7 @@ public class Issue229Test {
|
||||
|
||||
@Test(expected = ChronicleHashRecoveryFailedException.class)
|
||||
public void assureExclusiveAccess() throws IOException {
|
||||
Assume.assumeFalse(OS.isWindows());
|
||||
|
||||
try (ChronicleMap<Long, Long> readMap = ChronicleMap
|
||||
.of(Long.class, Long.class)
|
||||
|
||||
Reference in New Issue
Block a user