gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] branch master updated: Fix lib testcase.


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: Fix lib testcase.
Date: Mon, 20 Mar 2017 16:09:16 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new b8f25a0  Fix lib testcase.
b8f25a0 is described below

commit b8f25a07e94cc9f421a547e8d6c9c8026d39f710
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Mar 20 16:09:18 2017 +0100

    Fix lib testcase.
---
 src/backend/taler-merchant-httpd_history.c | 43 ++++++++----------------------
 src/lib/merchant_api_history.c             |  5 +++-
 src/lib/merchant_api_track_transfer.c      |  4 ---
 src/lib/test_merchant_api.c                | 11 +++-----
 4 files changed, 19 insertions(+), 44 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_history.c 
b/src/backend/taler-merchant-httpd_history.c
index 44e8216..e7bd12d 100644
--- a/src/backend/taler-merchant-httpd_history.c
+++ b/src/backend/taler-merchant-httpd_history.c
@@ -36,12 +36,6 @@ static int start = -1;
 static unsigned int delta;
 
 /**
- * Index to the current row being processed.
- */
-static unsigned int current = 0;
-
-
-/**
  * Function called with information about a transaction.
  *
  * @param cls closure
@@ -60,33 +54,23 @@ pd_cb (void *cls,
   json_t *amount;
   json_t *timestamp;
   json_t *instance;
+  uint64_t r64 = (uint64_t) row_id;
 
   GNUNET_assert (-1 != json_unpack ((json_t *) proposal_data,
-                                    "{s:o, s:o, s:{s:o}, s:I}",
+                                    "{s:o, s:o, s:{s:o}}",
                                     "amount", &amount,
                                     "timestamp", &timestamp,
-                                    "merchant", "instance", &instance,
-                                    "row_id", (json_int_t) row_id));
+                                    "merchant", "instance", &instance));
 
-  if ( (current >= start) &&
-       (current < start + delta) )
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Adding history element. Current: %u, start: %u, delta: %u\n",
-                current,
-                start,
-                delta);
-    GNUNET_break (NULL != (entry = json_pack ("{s:s, s:O, s:O, s:O}",
-                                              "order_id", order_id,
-                                              "amount", amount,
-                                              "timestamp", timestamp,
-                                              "instance", instance)));
-
-    GNUNET_break (0 == json_array_append_new (response,
-                                              entry));
-  }
+  GNUNET_break (NULL != (entry = json_pack ("{s:I, s:s, s:O, s:O, s:O}",
+                                            "row_id", r64,
+                                            "order_id", order_id,
+                                            "amount", amount,
+                                            "timestamp", timestamp,
+                                            "instance", instance)));
 
-  current++;
+  GNUNET_break (0 == json_array_append_new (response,
+                                            entry));
 }
 
 
@@ -206,11 +190,6 @@ MH_handler_history (struct TMH_RequestHandler *rh,
                                                     delta,
                                                     pd_cb,
                                                     response);
-    
-
-
-
-  current = 0;
   if (GNUNET_SYSERR == ret)
   {
     json_decref (response);
diff --git a/src/lib/merchant_api_history.c b/src/lib/merchant_api_history.c
index 69d09b8..a2c2d5f 100644
--- a/src/lib/merchant_api_history.c
+++ b/src/lib/merchant_api_history.c
@@ -137,7 +137,8 @@ history_raw_cb (void *cls,
  * @param ctx execution context
  * @param backend_uri base URL of the merchant backend
  * @param instance which merchant instance is performing this call
- * @param start return `delta` records starting from position `start`
+ * @param start return `delta` records starting from position `start`.
+ * If given as zero, then no initial skip of `start` records is done.
  * @param delta return `delta` records starting from position `start`
  * @param date only transactions younger than/equals to date will be returned
  * @param history_cb callback which will work the response gotten from the 
backend
@@ -163,6 +164,7 @@ TALER_MERCHANT_history (struct GNUNET_CURL_Context *ctx,
   ho->cb = history_cb;
   ho->cb_cls = history_cb_cls;
   seconds = date.abs_value_us / 1000LL / 1000LL;
+
   GNUNET_asprintf (&ho->url,
                    "%s/history?date=%llu&instance=%s&start=%d&delta=%d",
                    backend_uri,
@@ -170,6 +172,7 @@ TALER_MERCHANT_history (struct GNUNET_CURL_Context *ctx,
                    instance,
                    start,
                    delta);
+
   eh = curl_easy_init ();
   if (CURLE_OK != curl_easy_setopt (eh,
                                     CURLOPT_URL,
diff --git a/src/lib/merchant_api_track_transfer.c 
b/src/lib/merchant_api_track_transfer.c
index 94dac1e..c73e155 100644
--- a/src/lib/merchant_api_track_transfer.c
+++ b/src/lib/merchant_api_track_transfer.c
@@ -124,10 +124,6 @@ check_track_transfer_response_ok (struct 
TALER_MERCHANT_TrackTransferHandle *wdh
         GNUNET_JSON_spec_end()
       };
 
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Extracting fields from: '%s'.\n",
-                  json_dumps (deposit, JSON_INDENT (1)));
-
       if (GNUNET_OK !=
           GNUNET_JSON_parse (deposit,
                              spec_detail,
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index 3688cd7..58075c0 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -1287,9 +1287,6 @@ track_transaction_cb (void *cls,
   }
   if (MHD_HTTP_OK != http_status)
     fail (is);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "/track/order response: %s\n",
-              json_dumps (json, JSON_INDENT (1)));
   next_command (is);
 }
 
@@ -1853,7 +1850,7 @@ interpreter_run (void *cls)
        (cmd->details.history.ho = TALER_MERCHANT_history (ctx,
                                                          MERCHANT_URI,
                                                           instance,
-                                                          0,
+                                                          20,
                                                           20,
                                                          
cmd->details.history.date,
                                                          history_cb,
@@ -2344,14 +2341,14 @@ run (void *cls)
       .label = "history-1",
       .expected_response_code = MHD_HTTP_OK,
       /*all records to be returned*/
-      .details.history.date.abs_value_us = 0,
+      .details.history.date.abs_value_us = 43 * 1000LL * 1000LL,
       .details.history.nresult = 2
     },
     { .oc = OC_HISTORY,
       .label = "history-2",
       .expected_response_code = MHD_HTTP_OK,
-      /*no records to be returned, as limit is in the future*/
-      .details.history.date.abs_value_us = 43 * 1000LL * 1000LL,
+      /*no records returned, time limit too ancient*/
+      .details.history.date.abs_value_us = 0,
       .details.history.nresult = 0
     },
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]