gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] annotated tag v0.5.0 updated (d0b2c53 -> 1


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] annotated tag v0.5.0 updated (d0b2c53 -> 1882565)
Date: Mon, 09 Apr 2018 00:44:42 +0200

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

dold pushed a change to annotated tag v0.5.0
in repository exchange.

*** WARNING: tag v0.5.0 was modified! ***

    from d0b2c53  (tag)
      to 1882565  (tag)
 tagging 1b3bf1a00126baffd016676ad1d668637b8b2efe (commit)
 replaces v0.3.0
      by Florian Dold
      on Mon Apr 9 00:44:31 2018 +0200

- Log -----------------------------------------------------------------
Official release v0.5.0
-----------------------------------------------------------------------

 discard 00f486b  change version number to 0.5
 discard 4074c69  fix compiler warnings
 discard db3bef9  fix compiler warning
     add 094af3b  Twisted tests scaffold.
     add c5c3c44  gitignore
     add 53cf576  bank-lib's twisted tests scaffold
     add c477064  bank-lib twisted tests scaffold done.
     add 27b0f37  gitignore
     add 5156de1  fix return code.
     add f819aef  mini testing of twister.
     add b67ae83  add fakebank-version of twisted tests.
     add 2d321c2  adding "with_fakebank_twisted" tests.
     add dbf82fb  fix makefile conditional.
     add 4eb9bcf  format output
     add 634db38  fix parenthesis.
     add 30aa3d4  set default HAVE_TWISTER.
     add e364aa7  fix segfault.
     add 7d4d3b3  address leaks.
     add 8fe985c  address leaks.
     add 9cc813a  build exchange url at (withdraw) command creation.
     add 0056cb6  addressing leaks.
     add 96a4aef  gently terminating the twister.
     add 3e191f3  still on gentle twister termination.
     add b48013b  fix compiler warning
     add df8ff68  fix compiler warnings
     add 1731f5d  change version number to 0.5
     add 081ffe9  expand logging of HARD errors in DB reserve inserts
     add f9a86ba  expand logging of wirewatch shutdown
     add 2e65fa8  fix comment
     add cb1548d  avoid dangling pointer
     add 1b3bf1a  disable /keys cherrypicking until #5315 is addressed

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
annotated tag are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d0b2c53)
            \
             N -- N -- N   refs/tags/v0.5.0 (1882565)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .gitignore                                         |   3 +
 configure.ac                                       |  25 ++-
 src/bank-lib/Makefile.am                           |  41 ++++
 src/bank-lib/bank_api_history.c                    |   2 +-
 src/bank-lib/bank_twisted.conf                     |  33 +++
 src/bank-lib/test_bank_api_new.c                   |   8 +-
 src/bank-lib/test_bank_api_twisted.c               | 155 +++++++++++++++
 src/bank-lib/test_bank_api_with_fakebank_twisted.c | 149 ++++++++++++++
 src/bank-lib/testing_api_helpers.c                 |   6 +-
 src/exchange-lib/Makefile.am                       |  32 ++-
 src/exchange-lib/exchange_api_handle.c             |   4 +-
 .../test_exchange_api_keys_cherry_picking.c        |   4 +
 .../test_exchange_api_keys_cherry_picking_new.c    |   7 +-
 src/exchange-lib/test_exchange_api_twisted.c       | 221 +++++++++++++++++++++
 ...nge_api.conf => test_exchange_api_twisted.conf} |  32 ++-
 src/exchange-lib/testing_api_cmd_withdraw.c        |  13 +-
 src/exchange-lib/testing_api_helpers.c             |  15 +-
 src/exchange-lib/testing_api_loop.c                |   8 +-
 src/exchange/taler-exchange-wirewatch.c            |  15 +-
 src/exchangedb/plugin_exchangedb_postgres.c        |   8 +-
 src/include/taler_exchange_service.h               |   7 +
 src/wire/plugin_wire_test.c                        |  12 +-
 22 files changed, 760 insertions(+), 40 deletions(-)
 create mode 100644 src/bank-lib/bank_twisted.conf
 create mode 100644 src/bank-lib/test_bank_api_twisted.c
 create mode 100644 src/bank-lib/test_bank_api_with_fakebank_twisted.c
 create mode 100644 src/exchange-lib/test_exchange_api_twisted.c
 copy src/exchange-lib/{test_exchange_api.conf => 
test_exchange_api_twisted.conf} (82%)

diff --git a/.gitignore b/.gitignore
index 2a1ce72..daf8589 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,6 +38,7 @@ src/bank-lib/test_bank_api
 src/bank-lib/test_bank_api_new
 src/bank-lib/test_bank_api_with_fakebank
 src/bank-lib/test_bank_api_with_fakebank_new
+src/bank-lib/test_bank_api_with_fakebank_twisted
 src/exchange-lib/test_exchange_api_new
 src/exchange-lib/test_exchange_api
 src/exchange-lib/test_exchange_api_home/.local/share/taler/exchange/live-keys/
@@ -45,6 +46,7 @@ 
src/exchange-lib/test_exchange_api_home/.local/share/taler/exchange/wirefees/
 src/exchange-lib/test_exchange_api_home/.local/share/taler/auditor/
 src/exchange-lib/test_exchange_api_home/.local/share/taler/auditors/
 src/exchange-lib/auditor.in
+src/exchange-lib/test_exchange_api_twisted
 src/exchange/taler-exchange-aggregator
 src/exchange/test_taler_exchange_aggregator-postgres
 
src/exchange/test_taler_exchange_httpd_home/.local/share/taler/exchange/live-keys/
@@ -97,4 +99,5 @@ contrib/auditor-report.log
 contrib/auditor-report.tex
 contrib/auditor-report.pdf
 src/bank-lib/taler-bank-transfer
+src/bank-lib/test_bank_api_twisted
 src/exchange-lib/test_exchange_api_new
diff --git a/configure.ac b/configure.ac
index c7a5e48..d2254b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -274,7 +274,6 @@ AS_IF([test $microhttpd = 0],
 *** You need libmicrohttpd >= 0.9.39 to build this program.
 *** ]])])
 
-
 # check for libjansson (Jansson JSON library)
 jansson=0
 AC_MSG_CHECKING([for jansson])
@@ -379,6 +378,28 @@ CFLAGS=$CFLAGS_SAVE
 LDFLAGS=$LDFLAGS_SAVE
 LIBS=$LIBS_SAVE
 
+# check for libtalertwistertesting
+twistertesting=0
+AC_MSG_CHECKING([for talerwtistertesting])
+AC_ARG_WITH([twister],
+            [AS_HELP_STRING([--with-twister=PFX], [base of 
libtalertwistertesting])],
+            [AC_MSG_RESULT([given as $with_twister])],
+            [AC_MSG_RESULT([not given])
+             with_twister=yes])
+AS_CASE([$with_twister],
+        [yes], [],
+        [no], [AC_MSG_WARN([no twister-testing will be compiled])],
+        [LDFLAGS="-L$with_twister/lib $LDFLAGS"
+         CPPFLAGS="-I$with_twister/include $CPPFLAGS"])
+AC_CHECK_LIB(talertwistertesting,TALER_TESTING_run_twister,
+  [AC_CHECK_HEADER([taler/taler_twister_testing_lib.h],[twistertesting=1],,
+                   [#ifdef HAVE_GNUNET_PLATFORM_H
+                      #include <gnunet/platform.h>
+                    #endif
+                    ])]
+  ,,[-ltalerexchange -ltalerbank])
+
+AM_CONDITIONAL(HAVE_TWISTER, test x$twistertesting = x1)
 
 # should developer logic be compiled (not-for-production code)?
 AC_MSG_CHECKING(whether to compile developer logic)
@@ -493,7 +514,7 @@ AM_CONDITIONAL([HAVE_LIBGNURL], [false])
 AM_CONDITIONAL([HAVE_DEVELOPER], [false])
 AM_CONDITIONAL([USE_COVERAGE], [false])
 AM_CONDITIONAL([ENABLE_DOC], [true])
-
+AM_CONDITIONAL([HAVE_TWISTER], [false])
 
 # end of 'doc_only'
 fi
diff --git a/src/bank-lib/Makefile.am b/src/bank-lib/Makefile.am
index bd1c7e8..abe820a 100644
--- a/src/bank-lib/Makefile.am
+++ b/src/bank-lib/Makefile.am
@@ -88,6 +88,47 @@ check_PROGRAMS = \
   test_bank_api_with_fakebank \
   test_bank_api_with_fakebank_new
 
+if HAVE_TWISTER
+check_PROGRAMS += \
+  test_bank_api_twisted \
+  test_bank_api_with_fakebank_twisted
+
+test_bank_api_with_fakebank_twisted_SOURCES = \
+  test_bank_api_with_fakebank_twisted.c
+test_bank_api_with_fakebank_twisted_LDADD = \
+  $(LIBGCRYPT_LIBS) \
+  -ltalertesting \
+  -ltalertwistertesting \
+  -ltalerbanktesting \
+  -ltalerfakebank \
+  -ltalerbank \
+  -ltalerexchange \
+  -ltalerjson \
+  -ltalerutil \
+  -lgnunetjson \
+  -lgnunetcurl \
+  -lgnunetutil \
+  -ljansson
+endif
+
+test_bank_api_twisted_SOURCES = \
+  test_bank_api_twisted.c
+test_bank_api_twisted_LDADD = \
+  $(LIBGCRYPT_LIBS) \
+  -ltalertesting \
+  -ltalertwistertesting \
+  -ltalerbanktesting \
+  -ltalerfakebank \
+  -ltalerbank \
+  -ltalerexchange \
+  -ltalerjson \
+  -ltalerutil \
+  -lgnunetjson \
+  -lgnunetcurl \
+  -lgnunetutil \
+  -ljansson
+
+
 TESTS = \
   $(check_PROGRAMS)
 
diff --git a/src/bank-lib/bank_api_history.c b/src/bank-lib/bank_api_history.c
index d2035e8..14a206a 100644
--- a/src/bank-lib/bank_api_history.c
+++ b/src/bank-lib/bank_api_history.c
@@ -156,7 +156,7 @@ parse_account_history (struct TALER_BANK_HistoryHandle *hh,
 
 /**
  * Function called when we're done processing the
- * HTTP /admin/add/incoming request.
+ * HTTP /history request.
  *
  * @param cls the `struct TALER_BANK_HistoryHandle`
  * @param response_code HTTP response code, 0 on error
diff --git a/src/bank-lib/bank_twisted.conf b/src/bank-lib/bank_twisted.conf
new file mode 100644
index 0000000..54e8c80
--- /dev/null
+++ b/src/bank-lib/bank_twisted.conf
@@ -0,0 +1,33 @@
+
+[twister]
+# HTTP listen port for twister
+HTTP_PORT = 8888
+
+# HTTP Destination for twister.  The test-Webserver needs
+# to listen on the port used here.  Note: no trailing '/'!
+DESTINATION_BASE_URL = "http://localhost:8081";
+
+# Control port for TCP
+# PORT = 8889
+HOSTNAME = localhost
+ACCEPT_FROM = 127.0.0.1;
+ACCEPT_FROM6 = ::1;
+
+# Control port for UNIX
+UNIXPATH = /tmp/taler-service-twister.sock
+UNIX_MATCH_UID = NO
+UNIX_MATCH_GID = YES
+
+# Launching of twister by ARM
+# BINARY = taler-service-twister
+# AUTOSTART = NO
+# FORCESTART = NO
+
+[taler]
+currency = KUDOS
+
+[bank]
+http_port = 8081
+
+[exchange-wire-test]
+bank_url = http://localhost:8081/
diff --git a/src/bank-lib/test_bank_api_new.c b/src/bank-lib/test_bank_api_new.c
index a43aa87..49d1fe8 100644
--- a/src/bank-lib/test_bank_api_new.c
+++ b/src/bank-lib/test_bank_api_new.c
@@ -164,12 +164,12 @@ main(int argc,
 
   if (NULL == (bankd =
       TALER_TESTING_run_bank (CONFIG_FILE)))
-    return 1;
+    return 77;
   
   ret = TALER_TESTING_setup (&run,
-                           NULL,
-                           CONFIG_FILE,
-                           NULL); // means no exchange.
+                             NULL,
+                             CONFIG_FILE,
+                             NULL); // means no exchange.
 
   GNUNET_OS_process_kill (bankd, SIGKILL); 
   GNUNET_OS_process_wait (bankd); 
diff --git a/src/bank-lib/test_bank_api_twisted.c 
b/src/bank-lib/test_bank_api_twisted.c
new file mode 100644
index 0000000..b11ccfd
--- /dev/null
+++ b/src/bank-lib/test_bank_api_twisted.c
@@ -0,0 +1,155 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2014-2018 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 3, or
+  (at your option) any later version.
+
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
+  <http://www.gnu.org/licenses/>
+*/
+
+/**
+ * @file exchange/test_exchange_api_twister.c
+ * @brief testcase to test exchange's HTTP API interface
+ * @author Marcello Stanisci
+ * @author Sree Harsha Totakura <address@hidden>
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include <taler/taler_util.h>
+#include <taler/taler_signatures.h>
+#include <taler/taler_exchange_service.h>
+#include <taler/taler_json_lib.h>
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include <taler/taler_bank_service.h>
+#include <taler/taler_fakebank_lib.h>
+#include <taler/taler_testing_lib.h>
+#include <taler/taler_twister_testing_lib.h>
+#include <taler/taler_testing_bank_lib.h>
+#include <taler/taler_twister_service.h>
+
+/**
+ * Configuration file we use.  One (big) configuration is used
+ * for the various components for this test.
+ */
+#define CONFIG_FILE "bank_twisted.conf"
+
+/**
+ * (real) Twister URL.  Used at startup time to check if it runs.
+ */
+static char *twister_url;
+
+/**
+ * URL of the twister where all the connections to the
+ * bank that have to be proxied should be addressed to.
+ */
+#define TWISTED_BANK_URL twister_url
+
+/**
+ * URL of the bank.
+ */
+static char *bank_url;
+
+/**
+ * Bank process.
+ */
+static struct GNUNET_OS_Process *bankd;
+
+/**
+ * Twister process.
+ */
+static struct GNUNET_OS_Process *twisterd;
+
+/**
+ * Main function that will tell
+ * the interpreter what commands to run.
+ *
+ * @param cls closure
+ */
+static void
+run (void *cls,
+     struct TALER_TESTING_Interpreter *is)
+{
+
+  struct TALER_TESTING_Command commands[] = {
+
+    TALER_TESTING_cmd_bank_history ("history-0",
+                                    bank_url,
+                                    EXCHANGE_ACCOUNT_NUMBER,
+                                    TALER_BANK_DIRECTION_BOTH,
+                                    NULL,
+                                    5),
+    /**
+     * End the suite.  Fixme: better to have a label for this
+     * too, as it shows a "(null)" token on logs.
+     */
+    TALER_TESTING_cmd_end ()
+  };
+
+  TALER_TESTING_run (is, commands);
+}
+
+/**
+ * Kill, wait, and destroy convenience function.
+ *
+ * @param process process to purge.
+ */
+static void
+purge_process (struct GNUNET_OS_Process *process)
+{
+  GNUNET_OS_process_kill (process, SIGINT);
+  GNUNET_OS_process_wait (process);
+  GNUNET_OS_process_destroy (process);
+}
+
+int
+main (int argc,
+      char * const *argv)
+{
+  unsigned int ret;
+  /* These environment variables get in the way... */
+  unsetenv ("XDG_DATA_HOME");
+  unsetenv ("XDG_CONFIG_HOME");
+  GNUNET_log_setup ("test-bank-api-twisted",
+                    "DEBUG", NULL);
+
+  if (NULL == (bank_url = TALER_TESTING_prepare_bank (CONFIG_FILE)))
+    return 77;
+
+  if (NULL == (bankd = TALER_TESTING_run_bank (CONFIG_FILE)))
+    return 77;
+
+  if (NULL == (twister_url = TALER_TESTING_prepare_twister
+      (CONFIG_FILE)))
+    return 77;
+  
+  if (NULL == (twisterd = TALER_TESTING_run_twister (CONFIG_FILE)))
+    return 77;
+
+  ret = TALER_TESTING_setup (&run,
+                             NULL,
+                             CONFIG_FILE,
+                             NULL);
+  purge_process (twisterd);
+  purge_process (bankd);
+  GNUNET_free (twister_url);
+  GNUNET_free (bank_url);
+
+  if (GNUNET_OK == ret)
+    return 0;
+
+  return 1;
+}
+
+/* end of test_bank_api_twisted.c */
diff --git a/src/bank-lib/test_bank_api_with_fakebank_twisted.c 
b/src/bank-lib/test_bank_api_with_fakebank_twisted.c
new file mode 100644
index 0000000..6465c03
--- /dev/null
+++ b/src/bank-lib/test_bank_api_with_fakebank_twisted.c
@@ -0,0 +1,149 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2014-2018 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 3, or
+  (at your option) any later version.
+
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
+  <http://www.gnu.org/licenses/>
+*/
+
+/**
+ * @file exchange/test_bank_api_with_fakebank_twisted.c
+ * @author Marcello Stanisci
+ * @author Sree Harsha Totakura <address@hidden>
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include <taler/taler_util.h>
+#include <taler/taler_signatures.h>
+#include <taler/taler_exchange_service.h>
+#include <taler/taler_json_lib.h>
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include <taler/taler_bank_service.h>
+#include <taler/taler_fakebank_lib.h>
+#include <taler/taler_testing_lib.h>
+#include <taler/taler_twister_testing_lib.h>
+#include <taler/taler_testing_bank_lib.h>
+#include <taler/taler_twister_service.h>
+
+/**
+ * Configuration file we use.  One (big) configuration is used
+ * for the various components for this test.
+ */
+#define CONFIG_FILE "bank_twisted.conf"
+
+/**
+ * (real) Twister URL.  Used at startup time to check if it runs.
+ */
+static char *twister_url;
+
+/**
+ * URL of the twister where all the connections to the
+ * bank that have to be proxied should be addressed to.
+ */
+#define TWISTED_BANK_URL twister_url
+
+/**
+ * URL of the bank.
+ */
+static char *fakebank_url;
+
+/**
+ * Twister process.
+ */
+static struct GNUNET_OS_Process *twisterd;
+
+/**
+ * Main function that will tell
+ * the interpreter what commands to run.
+ *
+ * @param cls closure
+ */
+static void
+run (void *cls,
+     struct TALER_TESTING_Interpreter *is)
+{
+
+  struct TALER_TESTING_Command commands[] = {
+
+    TALER_TESTING_cmd_bank_history ("history-0",
+                                    fakebank_url,
+                                    EXCHANGE_ACCOUNT_NUMBER,
+                                    TALER_BANK_DIRECTION_BOTH,
+                                    NULL,
+                                    5),
+    /**
+     * End the suite.  Fixme: better to have a label for this
+     * too, as it shows a "(null)" token on logs.
+     */
+    TALER_TESTING_cmd_end ()
+  };
+
+  TALER_TESTING_run_with_fakebank (is,
+                                   commands,
+                                   fakebank_url);
+}
+
+
+/**
+ * Kill, wait, and destroy convenience function.
+ *
+ * @param process process to purge.
+ */
+static void
+purge_process (struct GNUNET_OS_Process *process)
+{
+  GNUNET_OS_process_kill (process, SIGINT);
+  GNUNET_OS_process_wait (process);
+  GNUNET_OS_process_destroy (process);
+}
+
+int
+main (int argc,
+      char * const *argv)
+{
+  unsigned int ret;
+  /* These environment variables get in the way... */
+  unsetenv ("XDG_DATA_HOME");
+  unsetenv ("XDG_CONFIG_HOME");
+  GNUNET_log_setup ("test-bank-api-twisted",
+                    "DEBUG", NULL);
+
+  if (NULL == (fakebank_url = TALER_TESTING_prepare_fakebank
+      (CONFIG_FILE)))
+    return 77;
+
+  if (NULL == (twister_url = TALER_TESTING_prepare_twister
+      (CONFIG_FILE)))
+    return 77;
+  
+  if (NULL == (twisterd = TALER_TESTING_run_twister (CONFIG_FILE)))
+    return 77;
+
+  ret = TALER_TESTING_setup (&run,
+                             NULL,
+                             CONFIG_FILE,
+                             NULL);
+  purge_process (twisterd);
+  GNUNET_free (twister_url);
+  GNUNET_free (fakebank_url);
+
+  if (GNUNET_OK == ret)
+    return 0;
+
+  return 1;
+}
+
+/* end of test_bank_api_twisted.c */
diff --git a/src/bank-lib/testing_api_helpers.c 
b/src/bank-lib/testing_api_helpers.c
index 8446f95..99b0e8c 100644
--- a/src/bank-lib/testing_api_helpers.c
+++ b/src/bank-lib/testing_api_helpers.c
@@ -126,12 +126,12 @@ TALER_TESTING_prepare_bank (const char *config_filename)
 
   cfg = GNUNET_CONFIGURATION_create ();
 
-  if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, config_filename))
+  if (GNUNET_OK != GNUNET_CONFIGURATION_load
+      (cfg, config_filename))
     BANK_FAIL ();
 
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number
-    (cfg, "bank",
-     "HTTP_PORT", &port))
+    (cfg, "bank", "HTTP_PORT", &port))
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
                                "bank",
diff --git a/src/exchange-lib/Makefile.am b/src/exchange-lib/Makefile.am
index dee17b2..5e0833b 100644
--- a/src/exchange-lib/Makefile.am
+++ b/src/exchange-lib/Makefile.am
@@ -91,17 +91,35 @@ endif
 check_PROGRAMS = \
   test_exchange_api_keys_cherry_picking_new \
   test_exchange_api_new \
-  test_exchange_api \
-  test_exchange_api_keys_cherry_picking
+  test_exchange_api_keys_cherry_picking \
+  test_exchange_api
+
+if HAVE_TWISTER
+  check_PROGRAMS += \
+    test_exchange_api_twisted
+
+test_exchange_api_twisted_SOURCES = \
+  test_exchange_api_twisted.c
+test_exchange_api_twisted_LDADD = \
+  $(LIBGCRYPT_LIBS) \
+  -ltalertesting \
+  -ltalertwistertesting \
+  -ltalerfakebank \
+  -ltalerbank \
+  -ltalerexchange \
+  -ltalerjson \
+  -ltalerutil \
+  -lgnunetjson \
+  -lgnunetcurl \
+  -lgnunetutil \
+  -ljansson
+
+endif
 
 AM_TESTS_ENVIRONMENT=export 
TALER_PREFIX=$${TALER_PREFIX:address@hidden@};export 
PATH=$${TALER_PREFIX:address@hidden@}/bin:$$PATH;
 
-# FIXME: uncomment those.
 TESTS = \
-  test_exchange_api_keys_cherry_picking_new \
-  test_exchange_api_new \
-  test_exchange_api \
-  test_exchange_api_keys_cherry_picking
+  $(check_PROGRAMS)
 
 test_exchange_api_SOURCES = \
   test_exchange_api.c
diff --git a/src/exchange-lib/exchange_api_handle.c 
b/src/exchange-lib/exchange_api_handle.c
index e3f8314..026fa87 100644
--- a/src/exchange-lib/exchange_api_handle.c
+++ b/src/exchange-lib/exchange_api_handle.c
@@ -867,7 +867,7 @@ keys_completed_cb (void *cls,
       {
         /* offsets will map 1:1 */
         unsigned int off = aold->denom_keys[j] - kd_old.denom_keys;
-
+        /* FIXME(#5315): this should not be an assert! */
         GNUNET_assert (off < kd_old.num_denom_keys);
         anew->denom_keys[j] = &kd.denom_keys[off];
       }
@@ -1127,7 +1127,7 @@ request_keys (struct TALER_EXCHANGE_Handle *exchange)
   GNUNET_assert (NULL == exchange->kr);
   kr = GNUNET_new (struct KeysRequest);
   kr->exchange = exchange;
-  if (GNUNET_YES == MAH_handle_is_ready (exchange))
+  if (GNUNET_YES == MAH_handle_is_ready (exchange) && 
!TALER_EXCHANGE_API_DISABLE_CHERRYPICKING)
   {
     char *arg;
 
diff --git a/src/exchange-lib/test_exchange_api_keys_cherry_picking.c 
b/src/exchange-lib/test_exchange_api_keys_cherry_picking.c
index 0fbf172..e5fd22a 100644
--- a/src/exchange-lib/test_exchange_api_keys_cherry_picking.c
+++ b/src/exchange-lib/test_exchange_api_keys_cherry_picking.c
@@ -579,7 +579,11 @@ run (void *cls)
     /* Re-download and check /keys */
     { .oc = OC_CHECK_KEYS,
       .details.check_keys.generation = 2,
+#if TALER_EXCHANGE_API_DISABLE_CHERRYPICKING
+      .details.check_keys.num_denom_keys = 12
+#else
       .details.check_keys.num_denom_keys = 8
+#endif
     },
     { .oc = OC_END }
   };
diff --git a/src/exchange-lib/test_exchange_api_keys_cherry_picking_new.c 
b/src/exchange-lib/test_exchange_api_keys_cherry_picking_new.c
index 41d5dac..aa71143 100644
--- a/src/exchange-lib/test_exchange_api_keys_cherry_picking_new.c
+++ b/src/exchange-lib/test_exchange_api_keys_cherry_picking_new.c
@@ -84,7 +84,12 @@ run (void *cls,
                               SIGUSR1),
 
     TALER_TESTING_cmd_check_keys ("check-keys-2",
-                                  2, 8,
+                                  2,
+#if TALER_EXCHANGE_API_DISABLE_CHERRYPICKING
+                                  12,
+#else
+                                  8,
+#endif
                                   is->exchange),
 
 
diff --git a/src/exchange-lib/test_exchange_api_twisted.c 
b/src/exchange-lib/test_exchange_api_twisted.c
new file mode 100644
index 0000000..6032417
--- /dev/null
+++ b/src/exchange-lib/test_exchange_api_twisted.c
@@ -0,0 +1,221 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2014-2018 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 3, or
+  (at your option) any later version.
+
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
+  <http://www.gnu.org/licenses/>
+*/
+
+/**
+ * @file exchange/test_exchange_api_twister.c
+ * @brief testcase to test exchange's HTTP API interface
+ * @author Marcello Stanisci
+ * @author Sree Harsha Totakura <address@hidden>
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include <taler/taler_util.h>
+#include <taler/taler_signatures.h>
+#include <taler/taler_exchange_service.h>
+#include <taler/taler_json_lib.h>
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include <taler/taler_bank_service.h>
+#include <taler/taler_fakebank_lib.h>
+#include <taler/taler_testing_lib.h>
+#include <taler/taler_twister_testing_lib.h>
+#include <taler/taler_twister_service.h>
+
+/**
+ * Configuration file we use.  One (big) configuration is used
+ * for the various components for this test.
+ */
+#define CONFIG_FILE "test_exchange_api_twisted.conf"
+
+/**
+ * (real) Twister URL.  Used at startup time to check if it runs.
+ */
+static char *twister_url;
+
+/**
+ * URL of the fakebank.  Obtained from CONFIG_FILE's
+ * "exchange-wire-test:BANK_URI" option.
+ */
+static char *fakebank_url;
+
+/**
+ * Exchange base URL.
+ */
+static char *exchange_url;
+
+/**
+ * Twister process.
+ */
+static struct GNUNET_OS_Process *twisterd;
+
+/**
+ * Account number of the exchange at the bank.
+ */
+#define EXCHANGE_ACCOUNT_NO 2
+
+/**
+ * Account number of some user.
+ */
+#define USER_ACCOUNT_NO 62
+
+/**
+ * User name. Never checked by fakebank.
+ */
+#define USER_LOGIN_NAME "user42"
+
+/**
+ * User password. Never checked by fakebank.
+ */
+#define USER_LOGIN_PASS "pass42"
+
+/**
+ * Execute the taler-exchange-wirewatch command with
+ * our configuration file.
+ *
+ * @param label label to use for the command.
+ */
+#define CMD_EXEC_WIREWATCH(label) \
+   TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE)
+
+/**
+ * Execute the taler-exchange-aggregator command with
+ * our configuration file.
+ *
+ * @param label label to use for the command.
+ */
+#define CMD_EXEC_AGGREGATOR(label) \
+   TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE)
+
+/**
+ * Run wire transfer of funds from some user's account to the
+ * exchange.
+ *
+ * @param label label to use for the command.
+ * @param amount amount to transfer, i.e. "EUR:1"
+ * @param url exchange_url
+ */
+#define CMD_TRANSFER_TO_EXCHANGE(label,amount) \
+   TALER_TESTING_cmd_fakebank_transfer (label, amount, \
+     fakebank_url, USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO, \
+     USER_LOGIN_NAME, USER_LOGIN_PASS, EXCHANGE_URL)
+
+/**
+ * Run wire transfer of funds from some user's account to the
+ * exchange.
+ *
+ * @param label label to use for the command.
+ * @param amount amount to transfer, i.e. "EUR:1"
+ */
+#define CMD_TRANSFER_TO_EXCHANGE_SUBJECT(label,amount,subject) \
+   TALER_TESTING_cmd_fakebank_transfer_with_subject \
+     (label, amount, fakebank_url, USER_ACCOUNT_NO, \
+      EXCHANGE_ACCOUNT_NO, USER_LOGIN_NAME, USER_LOGIN_PASS, \
+      subject)
+
+/**
+ * Main function that will tell the interpreter what commands to
+ * run.
+ *
+ * @param cls closure
+ */
+static void
+run (void *cls,
+     struct TALER_TESTING_Interpreter *is)
+{
+
+  struct TALER_TESTING_Command commands[] = {
+
+    /**
+     * End the suite.  Fixme: better to have a label for this
+     * too, as it shows a "(null)" token on logs.
+     */
+    TALER_TESTING_cmd_end ()
+  };
+
+  TALER_TESTING_run_with_fakebank (is,
+                                   commands,
+                                   fakebank_url);
+}
+
+/**
+ * Kill, wait, and destroy convenience function.
+ *
+ * @param process process to purge.
+ */
+static void
+purge_process (struct GNUNET_OS_Process *process)
+{
+  GNUNET_OS_process_kill (process, SIGINT);
+  GNUNET_OS_process_wait (process);
+  GNUNET_OS_process_destroy (process);
+}
+
+int
+main (int argc,
+      char * const *argv)
+{
+  unsigned int ret;
+  /* These environment variables get in the way... */
+  unsetenv ("XDG_DATA_HOME");
+  unsetenv ("XDG_CONFIG_HOME");
+  GNUNET_log_setup ("test-exchange-api-new-twisted",
+                    "DEBUG", NULL);
+
+  if (NULL == (fakebank_url = TALER_TESTING_prepare_fakebank
+      (CONFIG_FILE)))
+    return 77;
+
+  if (NULL == (twister_url = TALER_TESTING_prepare_twister
+      (CONFIG_FILE)))
+    return 77;
+
+  TALER_TESTING_cleanup_files (CONFIG_FILE);
+
+  switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
+                                          &exchange_url))
+  {
+  case GNUNET_SYSERR:
+    GNUNET_break (0);
+    return 1;
+  case GNUNET_NO:
+    return 77;
+
+  case GNUNET_OK:
+
+    if (NULL == (twisterd = TALER_TESTING_run_twister
+        (CONFIG_FILE)))
+      return 77;
+
+    ret = TALER_TESTING_setup_with_exchange (&run, NULL,
+                                             CONFIG_FILE);
+    purge_process (twisterd);
+    GNUNET_free (twister_url);
+
+    if (GNUNET_OK != ret)
+      return 1;
+    break;
+  default:
+    GNUNET_break (0);
+    return 1;
+  }
+  return 0;
+}
+
+/* end of test_exchange_api_new.c */
diff --git a/src/exchange-lib/test_exchange_api.conf 
b/src/exchange-lib/test_exchange_api_twisted.conf
similarity index 82%
copy from src/exchange-lib/test_exchange_api.conf
copy to src/exchange-lib/test_exchange_api_twisted.conf
index 7d8761f..b04d9f4 100644
--- a/src/exchange-lib/test_exchange_api.conf
+++ b/src/exchange-lib/test_exchange_api_twisted.conf
@@ -1,5 +1,30 @@
 # This file is in the public domain.
 #
+
+[twister]
+# HTTP listen port for twister
+HTTP_PORT = 8888
+
+# HTTP Destination for twister.  The test-Webserver needs
+# to listen on the port used here.  Note: no trailing '/'!
+DESTINATION_BASE_URL = "http://localhost:8081";
+
+# Control port for TCP
+# PORT = 8889
+HOSTNAME = localhost
+ACCEPT_FROM = 127.0.0.1;
+ACCEPT_FROM6 = ::1;
+
+# Control port for UNIX
+UNIXPATH = /tmp/taler-service-twister.sock
+UNIX_MATCH_UID = NO
+UNIX_MATCH_GID = YES
+
+# Launching of twister by ARM
+# BINARY = taler-service-twister
+# AUTOSTART = NO
+# FORCESTART = NO
+
 [PATHS]
 # Persistant data storage for the testcase
 TALER_TEST_HOME = test_exchange_api_home/
@@ -19,8 +44,11 @@ MASTER_PUBLIC_KEY = 
98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
 # How to access our database
 DB = postgres
 
-# Base URL of the exchange. Must be set to a URL where the
-# exchange (or the twister) is actually listening.
+# Base URL of the exchange ('S PROXY).  This URL is where the
+# twister listens at, so that it will be able to get all the
+# connection addressed to the exchange.  In fact, the presence
+# of the twister is 100% transparent to the test case, as it
+# only seeks the exchange/BASE_URL URL to connect to the exchange.
 BASE_URL = "http://localhost:8081/";
 
 [exchangedb-postgres]
diff --git a/src/exchange-lib/testing_api_cmd_withdraw.c 
b/src/exchange-lib/testing_api_cmd_withdraw.c
index 07dad69..8ab5e1d 100644
--- a/src/exchange-lib/testing_api_cmd_withdraw.c
+++ b/src/exchange-lib/testing_api_cmd_withdraw.c
@@ -58,6 +58,11 @@ struct WithdrawState
   struct TALER_EXCHANGE_Handle *exchange;
 
   /**
+   * Exchange base URL.
+   */
+  char *exchange_url;
+
+  /**
    * Interpreter state (during command).
    */
   struct TALER_TESTING_Interpreter *is;
@@ -229,6 +234,7 @@ withdraw_cleanup (void *cls,
     GNUNET_CRYPTO_rsa_signature_free (ws->sig.rsa_signature);
     ws->sig.rsa_signature = NULL;
   }
+  GNUNET_free_non_null (ws->exchange_url);
   GNUNET_free (ws);
 }
 
@@ -288,8 +294,7 @@ withdraw_traits (void *cls,
                                            reserve_priv),
     TALER_TESTING_make_trait_amount_obj (0,
                                          &ws->amount),
-    TALER_TESTING_make_trait_url (
-      0, MAH_path_to_url (ws->exchange, "/")),
+    TALER_TESTING_make_trait_url (0, ws->exchange_url),
 
     TALER_TESTING_trait_end ()
   };
@@ -349,6 +354,8 @@ TALER_TESTING_cmd_withdraw_amount
   }
   ws->expected_response_code = expected_response_code;
   ws->exchange = exchange;
+  ws->exchange_url = MAH_path_to_url (exchange, "/");
+
   cmd.cls = ws;
   cmd.label = label;
   cmd.run = &withdraw_run;
@@ -385,6 +392,8 @@ TALER_TESTING_cmd_withdraw_denomination
   ws->pk = dk;
   ws->expected_response_code = expected_response_code;
   ws->exchange = exchange;
+  ws->exchange_url = MAH_path_to_url (exchange, "/");
+
   cmd.cls = ws;
   cmd.label = label;
   cmd.run = &withdraw_run;
diff --git a/src/exchange-lib/testing_api_helpers.c 
b/src/exchange-lib/testing_api_helpers.c
index 50ee5e2..a942b65 100644
--- a/src/exchange-lib/testing_api_helpers.c
+++ b/src/exchange-lib/testing_api_helpers.c
@@ -142,7 +142,7 @@ TALER_TESTING_prepare_exchange (const char *config_filename,
   GNUNET_asprintf (&signed_keys_out,
                    "%s/.local/share/taler/auditors/auditor.out",
                    test_home_dir);
-
+  GNUNET_free (test_home_dir);
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (cfg,
                                              "exchange",
@@ -174,8 +174,14 @@ TALER_TESTING_prepare_exchange (const char 
*config_filename,
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "Failed to run `taler-auditor-sign`,"
                 " is your PATH correct?\n");
+    GNUNET_free (signed_keys_out);
+    GNUNET_free (exchange_master_pub);
     return GNUNET_NO;
   }
+
+
+  GNUNET_free (exchange_master_pub);
+  GNUNET_free (signed_keys_out);
   GNUNET_OS_process_wait (proc);
   GNUNET_OS_process_destroy (proc);
 
@@ -192,6 +198,7 @@ TALER_TESTING_prepare_exchange (const char *config_filename,
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "Failed to run `taler-exchange-dbinit`,"
                 " is your PATH correct?\n");
+
     return GNUNET_NO;
   }
   if (GNUNET_SYSERR ==
@@ -219,6 +226,7 @@ TALER_TESTING_prepare_exchange (const char *config_filename,
              " `taler-exchange-dbinit'!\n");
     return GNUNET_SYSERR;
   }
+
   return GNUNET_OK;
 }
 
@@ -344,7 +352,7 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main 
main_cb,
                                        NULL);
   /* give child time to start and bind against the socket */
   fprintf (stderr,
-           "Waiting for `taler-exchange-httpd' to be ready");
+           "Waiting for `taler-exchange-httpd' to be ready\n");
   iter = 0;
   do
     {
@@ -359,14 +367,13 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main 
main_cb,
        GNUNET_OS_process_destroy (exchanged);
        return 77;
       }
-      fprintf (stderr, ".");
+      fprintf (stderr, ".\n");
       sleep (1);
       iter++;
     }
   while (0 != system
     ("wget -q -t 1 -T 1 http://127.0.0.1:8081/keys";
      " -o /dev/null -O /dev/null"));
-  fprintf (stderr, "\n");
 
   result = TALER_TESTING_setup (main_cb,
                                 main_cb_cls,
diff --git a/src/exchange-lib/testing_api_loop.c 
b/src/exchange-lib/testing_api_loop.c
index e179c20..592843b 100644
--- a/src/exchange-lib/testing_api_loop.c
+++ b/src/exchange-lib/testing_api_loop.c
@@ -475,10 +475,10 @@ cert_cb (void *cls,
                 "Got NULL response for /keys\n");
   
   }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Got %d DK from /keys\n",
-              keys->num_denom_keys);
+  else
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Got %d DK from /keys\n",
+                keys->num_denom_keys);
 
   main_ctx->is->key_generation++;
   main_ctx->is->keys = keys;
diff --git a/src/exchange/taler-exchange-wirewatch.c 
b/src/exchange/taler-exchange-wirewatch.c
index e098536..508f8c3 100644
--- a/src/exchange/taler-exchange-wirewatch.c
+++ b/src/exchange/taler-exchange-wirewatch.c
@@ -246,10 +246,10 @@ reject_cb (void *cls,
   rt = NULL;
   if (TALER_EC_NONE != ec)
   {
-    fprintf (stderr,
-             "Failed to wire back transfer `%s': %d\n",
-             rtc->wtid_s,
-             ec);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to wire back transfer `%s': %d\n",
+                rtc->wtid_s,
+                ec);
     GNUNET_free (rtc->wtid_s);
     db_plugin->rollback (db_plugin->cls,
                         rtc->session);
@@ -292,8 +292,8 @@ history_cb (void *cls,
   struct TALER_ReservePublicKeyP reserve_pub;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Got history callback, direction %u!\n", (unsigned int) dir);
-
+              "Got history callback, direction %u!\n",
+              (unsigned int) dir);
   if (TALER_BANK_DIRECTION_NONE == dir)
   {
     hh = NULL;
@@ -308,9 +308,12 @@ history_cb (void *cls,
                 "End of list. Committing progress!\n");
     qs = db_plugin->commit (db_plugin->cls,
                            session);
+    GNUNET_break (0 <= qs);
     if ( (GNUNET_YES == delay) &&
          (test_mode) )
     {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Shutdown due to test mode!\n");
       GNUNET_SCHEDULER_shutdown ();
       return GNUNET_OK;
     }
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 6c63305..63ed887 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1912,7 +1912,10 @@ postgres_reserves_in_insert (void *cls,
                                             "reserve_create",
                                             params);
     if (0 > qs)
+    {
+      GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
       return qs;
+    }
     if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
     {
       /* Maybe DB did not detect serializiability error already,
@@ -1938,7 +1941,10 @@ postgres_reserves_in_insert (void *cls,
                                             "reserves_in_add_transaction",
                                             params);
     if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
+    {
+      GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
       return qs;
+    }
   }
 
   if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == reserve_exists)
@@ -1957,7 +1963,7 @@ postgres_reserves_in_insert (void *cls,
                           balance))
     {
       /* currency overflow or incompatible currency */
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   "Attempt to deposit incompatible amount into reserve\n");
       return GNUNET_DB_STATUS_HARD_ERROR;
     }
diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index 30ea4ce..54188e3 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -32,6 +32,13 @@
 
 
 /**
+ * Temporarily disable cherrypicking until it's fixed.
+ * See #5315.
+ */
+#define TALER_EXCHANGE_API_DISABLE_CHERRYPICKING 1
+
+
+/**
  * List of possible options to be passed to
  * #TALER_EXCHANGE_connect().
  */
diff --git a/src/wire/plugin_wire_test.c b/src/wire/plugin_wire_test.c
index 11feaea..a81ccda 100644
--- a/src/wire/plugin_wire_test.c
+++ b/src/wire/plugin_wire_test.c
@@ -869,6 +869,12 @@ bhist_cb (void *cls,
       GNUNET_free (subject);
       wd.account_details = details->account_details;
 
+      GNUNET_break (NULL != whh->hh);
+
+      /* Once we get the sentinel element, the handle becomes invalid. */
+      if (TALER_BANK_DIRECTION_NONE == dir)
+        whh->hh = NULL;
+
       if ( (NULL != whh->hres_cb) &&
            (GNUNET_OK !=
             whh->hres_cb (whh->hres_cb_cls,
@@ -1007,7 +1013,11 @@ static void
 test_get_history_cancel (void *cls,
                         struct TALER_WIRE_HistoryHandle *whh)
 {
-  TALER_BANK_history_cancel (whh->hh);
+  if (NULL != whh->hh)
+  {
+    TALER_BANK_history_cancel (whh->hh);
+    whh->hh = NULL;
+  }
   GNUNET_free (whh);
 }
 

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



reply via email to

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