@Test public void fileCreationFromFileTest() { final File temp = File.temporaryFolder(); // Run AtlasJoinerSubCommand final String[] args = { "log-diff", String.format("-source=%s", GEO_11), String.format("-target=%s", GEO_21), String.format("-output=%s", temp.getPath()) }; new AtlasChecksCommand(args).runWithoutQuitting(args); final List<File> outputFiles = temp.listFilesRecursively(); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("additions-\\d+-1.log"))); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("changes-\\d+-1.log"))); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("subtractions-\\d+-1.log"))); temp.deleteRecursively(); }
@Test public void fileCreationFromFileTest() { final File temp = File.temporaryFolder(); // Run AtlasJoinerSubCommand final String[] args = { "geojson-diff", String.format("-source=%s", GEO_11), String.format("-target=%s", GEO_21), String.format("-output=%s", temp.getPath()) }; new AtlasChecksCommand(args).runWithoutQuitting(args); final List<File> outputFiles = temp.listFilesRecursively(); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("additions-\\d+-1.geojson"))); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("changes-\\d+-1.geojson"))); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("subtractions-\\d+-1.geojson"))); temp.deleteRecursively(); }
@Test public void fileCreationFromDirectoryTest() { final File temp = File.temporaryFolder(); // Run AtlasJoinerSubCommand final String[] args = { "geojson-diff", String.format("-source=%s", SOURCE_DIRECTORY), String.format("-target=%s", TARGET_DIRECTORY), String.format("-output=%s", temp.getPath()) }; new AtlasChecksCommand(args).runWithoutQuitting(args); final List<File> outputFiles = temp.listFilesRecursively(); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("additions-\\d+-1.geojson"))); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("changes-\\d+-2.geojson"))); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("subtractions-\\d+-3.geojson"))); temp.deleteRecursively(); } }
@Test public void fileCreationFromDirectoryTest() { final File temp = File.temporaryFolder(); // Run AtlasJoinerSubCommand final String[] args = { "log-diff", String.format("-source=%s", SOURCE_DIRECTORY), String.format("-target=%s", TARGET_DIRECTORY), String.format("-output=%s", temp.getPath()) }; new AtlasChecksCommand(args).runWithoutQuitting(args); final List<File> outputFiles = temp.listFilesRecursively(); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("additions-\\d+-1.log"))); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("changes-\\d+-2.log"))); Assert.assertTrue(outputFiles.stream() .anyMatch(file -> file.getName().matches("subtractions-\\d+-3.log"))); temp.deleteRecursively(); } }
@Test public void testNoWaysConversion() { final File temp = File.temporaryFolder(); try { // Run OsmPbfToAtlasSubCommand final String[] args = { "pbf-to-atlas", String.format("-pbf=%s", PBF), String.format("-output=%s/%s", temp, ATLAS_NAME), "-load-ways=false" }; new AtlasReader(args).runWithoutQuitting(args); // Load new atlas final Atlas atlas = new AtlasResourceLoader() .load(new File(String.format("%s/%s", temp, ATLAS_NAME))); // Test no load ways Assert.assertFalse(atlas.areas().iterator().hasNext()); Assert.assertFalse(atlas.edges().iterator().hasNext()); Assert.assertFalse(atlas.lines().iterator().hasNext()); } finally { temp.deleteRecursively(); } } }
@Test public void testNoSlicingNoRelationsConversion() { final File temp = File.temporaryFolder(); try { // Run OsmPbfToAtlasSubCommand final String[] args = { "pbf-to-atlas", String.format("-pbf=%s", PBF), String.format("-output=%s/%s", temp, ATLAS_NAME), String.format("-country-boundary-map=%s", COUNTRY_BOUNDARY_MAP_TEXT), "-country-codes=NAM,EUR", "-country-slicing=false", "-load-relations=false" }; new AtlasReader(args).runWithoutQuitting(args); // Load new atlas final Atlas atlas = new AtlasResourceLoader() .load(new File(String.format("%s/%s", temp, ATLAS_NAME))); // Test for country slicing Assert.assertFalse(atlas.edge(87185039000000L) .containsKey(Collections.singleton("iso_country_code"))); // Test no load relation Assert.assertFalse(atlas.relations().iterator().hasNext()); } finally { temp.deleteRecursively(); } }
@Test public void testFiltersTextMapCountryCodesConversion() final File temp = File.temporaryFolder();
@Test public void multipleFiles() { final File parent = File.temporaryFolder(); try { final File atlas1 = parent.child("iAmAn.atlas"); atlas1.writeAndClose("1"); final File atlas2 = parent.child("iTooAmAn.atlas"); atlas2.writeAndClose("2"); final File other = parent.child("iAmNotAnAtlas.txt"); other.writeAndClose("3"); final List<Resource> selected = new AtlasFileSelector().select(parent); // This one does not filter on an Atlas. Assert.assertEquals(3, selected.size()); } finally { parent.deleteRecursively(); } }
@BeforeClass public static void prepareAtlasesOnDisk() throws IOException { final File temp = File.temporaryFolder(); setup.getFirstAtlas().save(temp.child("first.atlas")); setup.getSecondAtlas().save(temp.child("second.atlas")); setup.getThirdAtlas().save(temp.child("third.atlas")); setup.getFourthAtlas().save(temp.child("fourth.atlas")); temporaryFolder = temp; }
@Test public void testDefaultConversion() final File temp = File.temporaryFolder();