Skip to content

v0.2.54..v0.2.55 changeset OsmApiWriterTestServer.h

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiWriterTestServer.h b/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiWriterTestServer.h
index 19c7deb..21e0553 100644
--- a/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiWriterTestServer.h
+++ b/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiWriterTestServer.h
@@ -41,7 +41,7 @@ public:
 
 protected:
   /** respond() function that responds once to the OSM API Capabilities request */
-  virtual bool respond(HttpConnection::HttpConnectionPtr& connection) override;
+  bool respond(HttpConnection::HttpConnectionPtr& connection) override;
 };
 
 class PermissionsTestServer : public HttpTestServer
@@ -52,7 +52,7 @@ public:
 
 protected:
   /** respond() function that responds once to the OSM API Permissions request */
-  virtual bool respond(HttpConnection::HttpConnectionPtr &connection) override;
+  bool respond(HttpConnection::HttpConnectionPtr &connection) override;
 };
 
 class RetryConflictsTestServer : public HttpTestServer
@@ -71,7 +71,7 @@ protected:
    *   - Changeset Upload - responding with an HTTP 405 error for the test
    *   - Changeset Close
    */
-  virtual bool respond(HttpConnection::HttpConnectionPtr& connection) override;
+  bool respond(HttpConnection::HttpConnectionPtr& connection) override;
 };
 
 class RetryVersionTestServer : public HttpTestServer
@@ -92,7 +92,7 @@ protected:
    *  - Changeset 1 Upload - respond with updated version
    *  - Changeset Close
    */
-  virtual bool respond(HttpConnection::HttpConnectionPtr &connection) override;
+  bool respond(HttpConnection::HttpConnectionPtr &connection) override;
 
 private:
   /** Flag set to false until the first changeset has failed once */
@@ -107,7 +107,7 @@ public:
 
 protected:
   /** respond() function that responds to a series of OSM API requests
-   *  to simulate a
+   *  to simulate a changeset upload.
    *  Requests, in order:
    *   - Capabilities
    *   - Permissions
@@ -116,7 +116,44 @@ protected:
    *   - Changeset Upload - responds with HTTP 200
    *   - Changeset Close
    */
-  virtual bool respond(HttpConnection::HttpConnectionPtr& connection) override;
+  bool respond(HttpConnection::HttpConnectionPtr& connection) override;
+};
+
+class ChangesetCreateFailureTestServer : public HttpTestServer
+{
+public:
+  /** Constructor */
+  ChangesetCreateFailureTestServer(int port) : HttpTestServer(port) { }
+
+protected:
+  /** respond() function that responds to a series of OSM API requests
+   *  to simulate a changeset create failure over and over.
+   *  Requests, in order:
+   *   - Capabilities
+   *   - Permissions
+   *   - Changeset Create Failure x6
+   */
+  bool respond(HttpConnection::HttpConnectionPtr &connection) override;
+};
+
+class CreateWaysFailNodesTestServer : public HttpTestServer
+{
+public:
+  /** Constructor */
+  CreateWaysFailNodesTestServer(int port) : HttpTestServer(port) { }
+
+protected:
+  /** respond() function that responds to a series of OSM API requests
+   *  to simulate a changeset create failure over and over.
+   *  Requests, in order:
+   *   - Capabilities
+   *   - Permissions
+   *   - Changeset Create
+   *   - Changeset Upload Failure - responds with HTTP
+   *   - Changeset Upload - responds with HTTP 200
+   *   - Changeset Close
+   */
+  bool respond(HttpConnection::HttpConnectionPtr &connection) override;
 };
 
 class OsmApiSampleRequestResponse
@@ -141,6 +178,9 @@ public:
   /** Sample Changeset upload response bodies from '/api/0.6/changeset/1/upload' divided into two responses */
   static const char* SAMPLE_CHANGESET_SUCCESS_1_RESPONSE;
   static const char* SAMPLE_CHANGESET_SUCCESS_2_RESPONSE;
+  /** Sample Changeset upload response bodies for a failed response to '/api/0.6/changeset/1/upload' */
+  static const char* SAMPLE_CHANGESET_FAILURE_RESPONSE_1;
+  static const char* SAMPLE_CHANGESET_FAILURE_RESPONSE_2;
 };
 
 }
Clone this wiki locally