mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
https://github.com/OpenHFT/Chronicle-Map/issues/214, added net.openhft.chronicle.map.AutoResizeTest
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package net.openhft.chronicle.map;
|
||||
|
||||
import net.openhft.chronicle.core.Jvm;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class AutoResizeTest {
|
||||
|
||||
static {
|
||||
Jvm.setExceptionHandlers(null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that the auto resizes are not zero upon a restart
|
||||
*
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
@Test
|
||||
public void testAutoResizeNotZeroUponRestart() throws IOException {
|
||||
|
||||
File cmap = File.createTempFile("chron", "cmap");
|
||||
|
||||
try (ChronicleMap<String, String> map = ChronicleMapBuilder
|
||||
.of(String.class, String.class)
|
||||
.averageKeySize(10).averageValueSize(10)
|
||||
.entries(100).actualSegments(10).maxBloatFactor(10).replication((byte) 1)
|
||||
.createOrRecoverPersistedTo(cmap)) {
|
||||
|
||||
int actual = map.remainingAutoResizes();
|
||||
Assert.assertNotEquals(0.0, actual);
|
||||
System.out.println(actual);
|
||||
}
|
||||
|
||||
// if the file already exists it will reuse the existing settings, set above
|
||||
|
||||
try (ChronicleMap<String, String> map = ChronicleMapBuilder
|
||||
.of(String.class, String.class)
|
||||
.createOrRecoverPersistedTo(cmap)) {
|
||||
int actual = map.remainingAutoResizes();
|
||||
Assert.assertNotEquals(0.0, map.remainingAutoResizes());
|
||||
System.out.println(actual);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoResizeNotZeroUponRestart2() throws IOException {
|
||||
|
||||
try (ChronicleMap<String, String> map = ChronicleMapBuilder
|
||||
.of(String.class, String.class)
|
||||
.averageKeySize(10).averageValueSize(10)
|
||||
.entries(100).actualSegments(10).maxBloatFactor(10).replication((byte) 1)
|
||||
.create()) {
|
||||
|
||||
int actual = map.remainingAutoResizes();
|
||||
Assert.assertNotEquals(0.0, actual);
|
||||
System.out.println(actual);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user