MvStoreAlleleIndexer extends AbstractAlleleIndexer { @Override public void close() { mvStore.close(); } MvStoreAlleleIndexer(MVStore mvStore); @Override void writeAllele(Allele allele); @Override long count(); @Override void close();  }
@Test @ExtendWith(TempDirectory.class) public void processAndWriteToDisk(@TempDir Path tempDir) throws Exception { AlleleResource dbSnpResource = new DbSnpAlleleResource("test_first_ten_dbsnp", new URL("http: File mvTestFile = tempDir.resolve("test.mv.db").toFile(); logger.info("Writing allele data to file {}", mvTestFile); MVStore mvStore = new MVStore.Builder() .fileName(mvTestFile.getAbsolutePath()) .compress() .open(); MvStoreAlleleIndexer instance = new MvStoreAlleleIndexer(mvStore); instance.index(dbSnpResource); MVMap<AlleleKey, AlleleProperties> alleleMap = mvStore.openMap("alleles"); int originalMapSize = alleleMap.size(); logger.info("Map contains {} entries:", originalMapSize); assertThat(originalMapSize, equalTo(10)); logger.info("Closing map"); mvStore.close(); logger.info("Re-opening map"); MVStore reOpened = new MVStore.Builder() .fileName(mvTestFile.getAbsolutePath()) .readOnly() .open(); MVMap<AlleleKey, AlleleProperties> reOpenedAlleleMap = reOpened.openMap("alleles", MvStoreUtil.alleleMapBuilder()); logger.info("Re-opened map contains {} entries:", reOpenedAlleleMap.size()); assertThat(reOpenedAlleleMap.size(), equalTo(originalMapSize)); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10019, "TA", "T").getRsId(), equalTo("rs775809821")); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10039, "A", "C").getRsId(), equalTo("rs978760828")); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10043, "T", "A").getRsId(), equalTo("rs1008829651")); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10051, "A", "G").getRsId(), equalTo("rs1052373574")); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10055, "T", "A").getRsId(), equalTo("rs892501864")); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10055, "T", "TA").getRsId(), equalTo("rs768019142")); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10063, "A", "C").getRsId(), equalTo("rs1010989343")); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10077, "C", "G").getRsId(), equalTo("rs1022805358")); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10109, "A", "T").getRsId(), equalTo("rs376007522")); assertThat(getAlleleProperties(reOpenedAlleleMap, 1, 10108, "C", "T").getRsId(), equalTo("rs62651026")); reOpened.close(); }