Skip to content

v0.2.52..v0.2.53 changeset OsmApiWriterTest.cpp

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiWriterTest.cpp b/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiWriterTest.cpp
index 69bf56c..5cc6906 100644
--- a/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiWriterTest.cpp
+++ b/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiWriterTest.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 //  hoot
@@ -61,6 +61,7 @@ class OsmApiWriterTest : public HootTestFixture
   CPPUNIT_TEST(runChangesetConflictTest);
   CPPUNIT_TEST(oauthTest);
 #endif
+  CPPUNIT_TEST(runApplyTestTest);
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -385,6 +386,33 @@ public:
 #endif
   }
 
+  void runApplyTestTest()
+  {
+    QString toyInputFilename = _inputPath + "ToyTestA.osc";
+    QString toyOutputFilename = _outputPath + "ApplyChangesetTest-Output-1.osc";
+    std::shared_ptr<OsmApiWriter> writer(new OsmApiWriter(toyOutputFilename, toyInputFilename));
+    QStringList files = writer->testApply();
+
+    CPPUNIT_ASSERT_EQUAL(1, files.size());
+    //  Check the changeset error file
+    HOOT_FILE_EQUALS( _inputPath + "ApplyChangesetTest-Expected-1-0001.osc",
+                     files[0]);
+
+    toyOutputFilename = _outputPath + "ApplyChangesetTest-Output-2.osc";
+    writer.reset(new OsmApiWriter(toyOutputFilename, toyInputFilename));
+    Settings s;
+    s.set(ConfigOptions::getChangesetApidbSizeMaxKey(), 20);
+    writer->setConfiguration(s);
+    files = writer->testApply();
+
+    CPPUNIT_ASSERT_EQUAL(2, files.size());
+    //  Check the changeset error file
+    HOOT_FILE_EQUALS( _inputPath + "ApplyChangesetTest-Expected-2-0001.osc",
+                     files[0]);
+    HOOT_FILE_EQUALS( _inputPath + "ApplyChangesetTest-Expected-2-0002.osc",
+                     files[1]);
+  }
+
   void checkStats(QList<SingleStat> stats,
                   int nodes, int ways, int relations,
                   int created, int modified, int deleted,
Clone this wiki locally