-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #369 from OpenHFT/issue/354
Add reproducing tests, Fix #354
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package net.openhft.chronicle.map; | ||
|
||
import net.openhft.chronicle.core.values.LongValue; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
public class Issue354Test { | ||
|
||
@Test | ||
public void reproduce() throws IOException { | ||
|
||
final File file = new File("/tmp/issue354-map"); | ||
|
||
final ChronicleMapBuilder<LongValue, LongValue> builder = ChronicleMapBuilder.of(LongValue.class, LongValue.class) | ||
.entries(5); | ||
|
||
try (ChronicleMap<LongValue, LongValue> map = builder.createOrRecoverPersistedTo(file)) { | ||
|
||
}; | ||
|
||
|
||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/test/java/net/openhft/chronicle/map/Issue354bTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package net.openhft.chronicle.map; | ||
|
||
import net.openhft.chronicle.core.values.LongValue; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
public class Issue354bTest { | ||
|
||
@Rule | ||
public TemporaryFolder testFolder = new TemporaryFolder(); | ||
|
||
@Test | ||
public void build_toFile() throws IOException { | ||
String baseDirectory = testFolder.getRoot().toString(); | ||
File file = new File(baseDirectory, "chronicle.dat"); | ||
ChronicleMap<LongValue, LongValue> map = ChronicleMapBuilder.of(LongValue.class, LongValue.class) | ||
.name("test") | ||
.entries(5) | ||
.createOrRecoverPersistedTo(file, true); | ||
|
||
assertTrue(file.isFile()); | ||
} | ||
|
||
} |