From 6340266cfafeb9002396116caa22756653ea49c6 Mon Sep 17 00:00:00 2001 From: leventov Date: Fri, 24 Jun 2016 19:15:57 +0700 Subject: [PATCH] Add Chronicle Map 3.8.0 Compatibility test --- ...hronicleMap3_8FormatCompatibilityTest.java | 50 ++++++++++++++++++ src/test/resources/chronicle-map-3-8-file.dat | Bin 0 -> 8192 bytes 2 files changed, 50 insertions(+) create mode 100644 src/test/java/net/openhft/chronicle/map/ChronicleMap3_8FormatCompatibilityTest.java create mode 100644 src/test/resources/chronicle-map-3-8-file.dat diff --git a/src/test/java/net/openhft/chronicle/map/ChronicleMap3_8FormatCompatibilityTest.java b/src/test/java/net/openhft/chronicle/map/ChronicleMap3_8FormatCompatibilityTest.java new file mode 100644 index 000000000..4a4a54f9d --- /dev/null +++ b/src/test/java/net/openhft/chronicle/map/ChronicleMap3_8FormatCompatibilityTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2015 higherfrequencytrading.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package net.openhft.chronicle.map; + +import com.google.common.io.Files; +import net.openhft.chronicle.set.Builder; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class ChronicleMap3_8FormatCompatibilityTest { + + @Test + public void testChronicleMap3_8FormatCompatibility() throws URISyntaxException, IOException { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL fileUrl = cl.getResource("chronicle-map-3-8-file.dat"); + File file = new File(fileUrl.toURI()); + File persistenceFile = Builder.getPersistenceFile(); + Files.copy(file, persistenceFile); + try (ChronicleMap map = ChronicleMap.of(Integer.class, String.class) + .averageValue("1") + .entries(1) + .createPersistedTo(persistenceFile)) { + assertEquals(1, map.size()); + assertEquals("1", map.get(1)); + assertNull(map.put(2, "2")); + assertEquals("2", map.remove(2)); + } + } +} diff --git a/src/test/resources/chronicle-map-3-8-file.dat b/src/test/resources/chronicle-map-3-8-file.dat new file mode 100644 index 0000000000000000000000000000000000000000..d83b092f6a503016ed986f45d4c2fe951ed8349e GIT binary patch literal 8192 zcmeH{!EVz)5QbABgp?B?At6p~#SvLaXhZO=35^=jstAXO1DBOEu~*rwt=%y+MMb;< zSDt_aPsN>AK@GjxMU z#GD2U+yzP83E`A6GAM$lBym1A9cN0A3@L*N2uWk^IeSmtp4-}cqH=Rs4j7Trb9Ql= zfI~UvVV_>WDG@RvjDb-3`o?=={Ijw$i7er4ub&9pno?=E?p{ArGp59xl9*F90dhM5k(4m6cS)c zm=ECsII4JC2Q@1{VHA<_a5GWE@VI*Z@h}#?s$-C=uKP&&T%%Srb*BY6A4Do7UxCox zmU%q0wMykmW2%vxLYX-}HrJ2|wx4&jB&tK&&`BK6(_}(e3Vo_atI58EWtQt+t@K%J zmLhMsE;}Fz2`DPN-C~X$ts124?l}hr=z8&pb5Mvhgw8=t=d%=R@Bfeuulz!#w7u&4NBV3wlYpMnDzwXdt$Kc$`^Jm9&ZBb_WUSg2%cL#zQ)X^` z#QRIs>-VhPU76QO<1A}Ej`Ql31F6c?8MU0oG>gNIIZ}kp4ZPPEz4k=-YSnqD$1pi< zwEXWjZ*|Q(;bWYrU0GMDuC{5i<+G4k)!Nfc;fiqiTW{f9b9jTZUMW)5FCICzGzQFl zd(Mn7nY|Ee~N>xR#;t^Ir37XAlycdj{u-kY8FuXhg~UQ@`HTLPAVC143y0+xU!U