@Test
public void should_parse_and_save_snapshot() throws Exception {

    final TrustAnchor trustAnchor = TestObjects.newTrustAnchor();
    wtx0(tx -> this.getTrustAnchors().add(tx, trustAnchor));
    final Ref<TrustAnchor> trustAnchorRef = rtx(tx -> this.getTrustAnchors().makeRef(tx, trustAnchor.key()));
    RpkiRepository rpkiRepository = wtx(tx -> this.getRpkiRepositories().register(tx,
            trustAnchorRef, RRDP_RIPE_NET_NOTIFICATION_XML, RpkiRepository.Type.RRDP));
    Ref<RpkiRepository> rpkiRepositoryRef = rtx(tx ->
            this.getRpkiRepositories().makeRef(tx, rpkiRepository.key()));
    final RrdpRepositoryValidationRun validationRun = wtx(tx ->
            this.getValidationRuns().add(tx, new RrdpRepositoryValidationRun(rpkiRepositoryRef)));
    new RrdpParser().parseSnapshot(
            Objects.fileIS("rrdp/snapshot2.xml"),
            (snapshotInfo) -> {
            },
            (snapshotObject) -> {
                subject.storeSnapshotObjects(Collections.singletonList(snapshotObject), validationRun);
            }
    );
    final List<RpkiObject> objects = rtx(tx -> this.getRpkiObjects().values(tx));
    assertEquals(3, objects.size());
    rtx0(tx -> {
        final String uri1 = "rsync://rpki.ripe.net/repository/DEFAULT/61/fdce4c-2ea5-47eb-94bc-5b50ea88eeab/1/phQ5JfV8llJoaGylcrBcVa7oPfI.roa";
        assertTrue(objects.stream().anyMatch(o -> uri1.equals(getLocations(tx, o).first())));
        final String uri2 = "rsync://rpki.ripe.net/repository/DEFAULT/a0/bf69c4-d64a-4340-9bf1-364854cbc0e8/1/Xt2pFufQkzxVnLyxgKKC8x5dVsw.mft";
        assertTrue(objects.stream().anyMatch(o -> uri2.equals(getLocations(tx, o).first())));
        final String uri3 = "rsync://rpki.ripe.net/repository/DEFAULT/8f/db5787-c2c8-429b-8137-cbf6c1849c44/1/s70Ab2nV-TCWnoHVAM4QdNgMolQ.mft";
        assertTrue(objects.stream().anyMatch(o -> uri3.equals(getLocations(tx, o).first())));
    });
}