gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated (61fbc32 -> 4eb9bcf)


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (61fbc32 -> 4eb9bcf)
Date: Sat, 17 Mar 2018 02:10:43 +0100

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

marcello pushed a change to branch master
in repository exchange.

    from 61fbc32  zero out last_row_off_size when we NULL last_row_off, 
cosmetics; remove bogus GNUNET_break: last_row_off size is allowed to be 0 here
     new 094af3b  Twisted tests scaffold.
     new c5c3c44  gitignore
     new 53cf576  bank-lib's twisted tests scaffold
     new c477064  bank-lib twisted tests scaffold done.
     new 27b0f37  gitignore
     new 5156de1  fix return code.
     new f819aef  mini testing of twister.
     new b67ae83  add fakebank-version of twisted tests.
     new 2d321c2  adding "with_fakebank_twisted" tests.
     new dbf82fb  fix makefile conditional.
     new 4eb9bcf  format output

The 11 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                                         |   2 +
 configure.ac                                       |  22 +-
 src/bank-lib/Makefile.am                           |  41 ++++
 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/exchange-lib/Makefile.am                       |  32 ++-
 src/exchange-lib/test_exchange_api_twisted.c       | 221 +++++++++++++++++++++
 ...nge_api.conf => test_exchange_api_twisted.conf} |  32 ++-
 src/exchange-lib/testing_api_helpers.c             |   5 +-
 11 files changed, 683 insertions(+), 17 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..cd8d658 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,6 +45,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 +98,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 2f4cdaa..a35e997 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,27 @@ 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)
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_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..fdc7349
--- /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, SIGKILL);
+  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..4eef827
--- /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, SIGKILL);
+  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/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/test_exchange_api_twisted.c 
b/src/exchange-lib/test_exchange_api_twisted.c
new file mode 100644
index 0000000..902969c
--- /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, SIGKILL);
+  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_helpers.c 
b/src/exchange-lib/testing_api_helpers.c
index 50ee5e2..6880315 100644
--- a/src/exchange-lib/testing_api_helpers.c
+++ b/src/exchange-lib/testing_api_helpers.c
@@ -344,7 +344,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 +359,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,

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



reply via email to

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