kopia lustrzana https://github.com/onthegomap/planetiler
Test for freeing input file after read (#107)
rodzic
0ddba6e9a7
commit
f051178b46
|
@ -1,10 +1,7 @@
|
|||
package com.onthegomap.planetiler;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import com.onthegomap.planetiler.collection.FeatureGroup;
|
||||
import com.onthegomap.planetiler.collection.LongLongMap;
|
||||
|
@ -1575,8 +1572,14 @@ public class PlanetilerTests {
|
|||
|
||||
@Test
|
||||
public void testPlanetilerRunner(@TempDir Path tempDir) throws Exception {
|
||||
Path originalOsm = TestUtils.pathToResource("monaco-latest.osm.pbf");
|
||||
Path mbtiles = tempDir.resolve("output.mbtiles");
|
||||
Planetiler.create(Arguments.of("tmpdir", tempDir))
|
||||
Path tempOsm = tempDir.resolve("monaco-temp.osm.pbf");
|
||||
Files.copy(originalOsm, tempOsm);
|
||||
Planetiler.create(Arguments.fromArgs(
|
||||
"--tmpdir", tempDir.toString(),
|
||||
"--free-osm-after-read"
|
||||
))
|
||||
.setProfile(new Profile.NullProfile() {
|
||||
@Override
|
||||
public void processFeature(SourceFeature source, FeatureCollector features) {
|
||||
|
@ -1585,12 +1588,15 @@ public class PlanetilerTests {
|
|||
}
|
||||
}
|
||||
})
|
||||
.addOsmSource("osm", TestUtils.pathToResource("monaco-latest.osm.pbf"))
|
||||
.addOsmSource("osm", tempOsm)
|
||||
.addNaturalEarthSource("ne", TestUtils.pathToResource("natural_earth_vector.sqlite"))
|
||||
.addShapefileSource("shapefile", TestUtils.pathToResource("shapefile.zip"))
|
||||
.setOutput("mbtiles", mbtiles)
|
||||
.run();
|
||||
|
||||
// make sure it got deleted after write
|
||||
assertFalse(Files.exists(tempOsm));
|
||||
|
||||
try (Mbtiles db = Mbtiles.newReadOnlyDatabase(mbtiles)) {
|
||||
int features = 0;
|
||||
var tileMap = TestUtils.getTileMap(db);
|
||||
|
|
Ładowanie…
Reference in New Issue