/** * The entry point to the application. * * @param args * The command line arguments. */ public static void main(String[] args) { try { run(args); System.exit(0); } catch (Throwable t) { LOG.log(Level.SEVERE, "Execution aborted.", t); } System.exit(1); }
/** * The entry point to the application. * * @param args * The command line arguments. */ public static void main(String[] args) { try { run(args); System.exit(0); } catch (Throwable t) { LOG.log(Level.SEVERE, "Execution aborted.", t); } System.exit(1); }
/** * Removes all data from the database. */ public void truncateDatabase() { // Remove all existing data from the database. Osmosis.run(new String[] { "-q", "--truncate-apidb-0.6", "authFile=" + getAuthorizationFile().getPath(), "allowIncorrectSchemaVersion=true" }); }
/** * Removes all data from the database. */ public void truncateDatabase() { // Remove all existing data from the database. Osmosis.run(new String[] { "-q", "--truncate-apidb-0.6", "authFile=" + getAuthorizationFile().getPath(), "allowIncorrectSchemaVersion=true" }); }
private void testWayKeyValueFilter(String keyValueListOption) throws IOException { File inputFile = dataUtils.createDataFile("v0_6/way-key-value-filter-snapshot.osm"); File expectedResultFile = dataUtils.createDataFile("v0_6/way-key-value-filter-expected.osm"); File outputFile = dataUtils.newFile(); // filter by key-value pairs Osmosis.run( new String[] { "-q", "--read-xml-0.6", inputFile.getPath(), "--way-key-value", keyValueListOption, "--write-xml-0.6", outputFile.getPath() } ); // Validate that the output file matches the expected file dataUtils.compareFiles(expectedResultFile, outputFile); } }
private void testNodeKeyValueFilter(String keyValueListOption) throws IOException { File inputFile = dataUtils.createDataFile("v0_6/node-key-value-filter-snapshot.osm"); File expectedResultFile = dataUtils.createDataFile("v0_6/node-key-value-filter-expected.osm"); File outputFile = dataUtils.newFile(); // filter by key-value pairs Osmosis.run( new String[] { "-q", "--read-xml-0.6", inputFile.getPath(), "--node-key-value", keyValueListOption, "--write-xml-0.6", outputFile.getPath() } ); // Validate that the output file matches the expected file dataUtils.compareFiles(expectedResultFile, outputFile); } }
private void applyChange(String sourceFileName, String changeFileName, String expectedOutputFileName) throws IOException { File sourceFile; File changeFile; File expectedOutputFile; File actualOutputFile; sourceFile = dataUtils.createDataFile(sourceFileName); changeFile = dataUtils.createDataFile(changeFileName); expectedOutputFile = dataUtils.createDataFile(expectedOutputFileName); actualOutputFile = dataUtils.newFile(); Osmosis.run( new String[] { "-q", "--read-xml-change-0.6", changeFile.getPath(), "--read-xml-0.6", sourceFile.getPath(), "--apply-change-0.6", "--write-xml-0.6", actualOutputFile.getPath() } ); dataUtils.compareFiles(expectedOutputFile, actualOutputFile); } }
private void deriveChange(String leftFileName, String rightFileName, String expectedOutputFileName) throws IOException { File leftFile; File rightFile; File expectedOutputFile; File actualOutputFile; leftFile = dataUtils.createDataFile(leftFileName); rightFile = dataUtils.createDataFile(rightFileName); expectedOutputFile = dataUtils.createDataFile(expectedOutputFileName); actualOutputFile = dataUtils.newFile(); Osmosis.run( new String[] { "-q", "--read-xml-0.6", rightFile.getPath(), "--read-xml-0.6", leftFile.getPath(), "--derive-change-0.6", "--write-xml-change-0.6", actualOutputFile.getPath() } ); dataUtils.compareFiles(expectedOutputFile, actualOutputFile); } }
Osmosis.run( new String[] { "-q",
/** * Tests appending two change files into a single file. * * @throws IOException * if any file operations fail. */ @Test public void testConvert() throws IOException { File sourceFile; File expectedOutputFile; File actualOutputFile; // Generate files. sourceFile = dataUtils.createDataFile("v0_6/change-to-full-history-in.osc"); expectedOutputFile = dataUtils.createDataFile("v0_6/change-to-full-history-out.osm"); actualOutputFile = dataUtils.newFile(); // Append the two source files into the destination file. Osmosis.run(new String[] {"-q", "--read-xml-change-0.6", sourceFile.getPath(), "--convert-change-to-full-history-0.6", "--write-xml-0.6", actualOutputFile.getPath() }); // Validate that the output file matches the expected result. dataUtils.compareFiles(expectedOutputFile, actualOutputFile); }
/** * Tests that simplifying an empty change successfully * yields an empty change. * * @throws Exception * if anything fails. */ @Test public void empty() throws Exception { File expectedOutputFile; File actualOutputFile; expectedOutputFile = dataUtils.createDataFile("v0_6/empty-change.osc"); actualOutputFile = dataUtils.newFile(); Osmosis.run( new String[] { "-q", "--read-empty-change-0.6", "--simplify-change-0.6", "--write-xml-change-0.6", actualOutputFile.getPath() } ); dataUtils.compareFiles(expectedOutputFile, actualOutputFile); }
/** * Tests that simplifying an already simple change successfully * yields the same change. * * @throws Exception * if anything fails. */ @Test public void alreadyFlattened() throws Exception { File sourceFile; File expectedOutputFile; File actualOutputFile; sourceFile = dataUtils.createDataFile("v0_6/flatten-out.osm"); expectedOutputFile = dataUtils.createDataFile("v0_6/flatten-out.osm"); actualOutputFile = dataUtils.newFile(); Osmosis.run( new String[] { "-q", "--read-xml-0.6", sourceFile.getPath(), "--flatten-0.6", "--write-xml-0.6", actualOutputFile.getPath() } ); dataUtils.compareFiles(expectedOutputFile, actualOutputFile); }
/** * Tests that simplifying an already simple change successfully * yields the same change. * * @throws Exception * if anything fails. */ @Test public void alreadySimple() throws Exception { File sourceFile; File expectedOutputFile; File actualOutputFile; sourceFile = dataUtils.createDataFile("v0_6/simplify-change-out.osc"); expectedOutputFile = dataUtils.createDataFile("v0_6/simplify-change-out.osc"); actualOutputFile = dataUtils.newFile(); Osmosis.run( new String[] { "-q", "--read-xml-change-0.6", sourceFile.getPath(), "--simplify-change-0.6", "--write-xml-change-0.6", actualOutputFile.getPath() } ); dataUtils.compareFiles(expectedOutputFile, actualOutputFile); }
/** * Tests that simplifying an empty change successfully * yields an empty change. * * @throws Exception * if anything fails. */ @Test public void empty() throws Exception { File expectedOutputFile; File actualOutputFile; expectedOutputFile = dataUtils.createDataFile("v0_6/empty-entity.osm"); actualOutputFile = dataUtils.newFile(); Osmosis.run( new String[] { "-q", "--read-empty-0.6", "--flatten-0.6", "--write-xml-0.6", actualOutputFile.getPath() } ); dataUtils.compareFiles(expectedOutputFile, actualOutputFile); } }
/** * Tests that a set of changes is simplified correctly. * * @throws IOException * if any file operations fail. */ @Test public void commonCase() throws IOException { File sourceFile; File expectedOutputFile; File actualOutputFile; // Generate files. sourceFile = dataUtils.createDataFile("v0_6/flatten-in.osm"); expectedOutputFile = dataUtils.createDataFile("v0_6/flatten-out.osm"); actualOutputFile = dataUtils.newFile(); Osmosis.run( new String[] { "-q", "--read-xml-0.6", sourceFile.getPath(), "--flatten-0.6", "--write-xml-0.6", actualOutputFile.getPath() } ); // Validate that the output file matches the expected result. dataUtils.compareFiles(expectedOutputFile, actualOutputFile); }
Osmosis.run( new String[] { "-q",
actualOutputFile = dataUtils.newFile(); Osmosis.run( new String[] { "-q",
Osmosis.run( new String[] { "-q",
Osmosis.run( new String[] { "-q",
Osmosis.run( new String[] { "-q",