Search in sources :

Example 1 with SaveBlockConsumer

use of com.baremaps.osm.repository.SaveBlockConsumer in project baremaps by baremaps.

the class SaveBlockConsumerTest method test.

@Test
@Tag("integration")
void test() throws BlobStoreException, RepositoryException, URISyntaxException {
    // Import data
    SaveBlockConsumer dataImporter = new SaveBlockConsumer(headerRepository, nodeRepository, tableRepository, relationRepository);
    InputStream inputStream = new ResourceBlobStore().get(new URI("res://simple/data.osm.pbf")).getInputStream();
    new OsmPbfParser().blocks(inputStream).forEach(dataImporter);
    // Check node importation
    assertNull(nodeRepository.get(0l));
    assertNotNull(nodeRepository.get(1l));
    assertNotNull(nodeRepository.get(2l));
    assertNotNull(nodeRepository.get(3l));
    assertNull(nodeRepository.get(4l));
    // Check way importation
    assertNull(tableRepository.get(0l));
    assertNotNull(tableRepository.get(1l));
    assertNull(tableRepository.get(2l));
    // Check relation importation
    assertNull(relationRepository.get(0l));
    assertNotNull(relationRepository.get(1l));
    assertNull(relationRepository.get(2l));
}
Also used : SaveBlockConsumer(com.baremaps.osm.repository.SaveBlockConsumer) ResourceBlobStore(com.baremaps.blob.ResourceBlobStore) InputStream(java.io.InputStream) URI(java.net.URI) OsmPbfParser(com.baremaps.osm.pbf.OsmPbfParser) Test(org.junit.jupiter.api.Test) Tag(org.junit.jupiter.api.Tag)

Aggregations

ResourceBlobStore (com.baremaps.blob.ResourceBlobStore)1 OsmPbfParser (com.baremaps.osm.pbf.OsmPbfParser)1 SaveBlockConsumer (com.baremaps.osm.repository.SaveBlockConsumer)1 InputStream (java.io.InputStream)1 URI (java.net.URI)1 Tag (org.junit.jupiter.api.Tag)1 Test (org.junit.jupiter.api.Test)1