ApidbFileReplicator implements RunnableChangeSource { @Override public void run() { try (DatabaseContext2 dbCtx = new DatabaseContext2(loginCredentials); DatabaseLocker locker = new DatabaseLocker(dbCtx.getDataSource(), false)) { locker.lockDatabase(this.getClass().getSimpleName()); runImpl(dbCtx); } catch (final Exception e) { throw new RuntimeException(e); } } ApidbFileReplicator(DatabaseLoginCredentials loginCredentials, DatabasePreferences preferences,
            int iterations, int minInterval, int maxInterval); @Override void setChangeSink(ChangeSink changeSink); @Override void run();  }
@Test public void testLoadAndDump() throws IOException { File authFile; File snapshotFile; File changesetFile; File outputFile; File workingDirectory; authFile = dbUtils.getAuthorizationFile(); snapshotFile = dataUtils.createDataFile("v0_6/db-snapshot.osm"); changesetFile = dataUtils.createDataFile("v0_6/db-replicate-changeset.osc"); outputFile = dataUtils.newFile(); workingDirectory = dataUtils.newFolder(); dbUtils.truncateDatabase(); Osmosis.run(new String[] { "-q", "--replicate-apidb-0.6", "authFile=" + authFile.getPath(), "allowIncorrectSchemaVersion=true", "--write-replication", "workingDirectory=" + workingDirectory.getPath() }); Osmosis.run(new String[] { "-q", "--read-xml-0.6", snapshotFile.getPath(), "--write-apidb-0.6", "authFile=" + authFile.getPath(), "allowIncorrectSchemaVersion=true" }); Osmosis.run(new String[] { "-q", "--replicate-apidb-0.6", "authFile=" + authFile.getPath(), "allowIncorrectSchemaVersion=true", "--write-replication", "workingDirectory=" + workingDirectory.getPath() }); Osmosis.run(new String[] { "-q", "--read-xml-change-0.6", changesetFile.getPath(), "--write-apidb-change-0.6", "authFile=" + authFile.getPath(), "allowIncorrectSchemaVersion=true" }); Osmosis.run(new String[] { "-q", "--replicate-apidb-0.6", "authFile=" + authFile.getPath(), "allowIncorrectSchemaVersion=true", "--write-replication", "workingDirectory=" + workingDirectory.getPath() }); Osmosis.run(new String[] { "-q", "--replicate-apidb-0.6", "authFile=" + authFile.getPath(), "allowIncorrectSchemaVersion=true", "--write-replication", "workingDirectory=" + workingDirectory.getPath() }); Osmosis.run(new String[] { "-q", "--replicate-apidb-0.6", "authFile=" + authFile.getPath(), "allowIncorrectSchemaVersion=true", "iterations=2", "--write-replication", "workingDirectory=" + workingDirectory.getPath() }); Osmosis.run(new String[] { "-q", "--read-xml-change-0.6", new File(workingDirectory, "000/000/002.osc.gz").getPath(), "--write-xml-change-0.6", outputFile.getPath() }); dataUtils.compareFiles(changesetFile, outputFile); }