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 (010847f -> ebf0531)


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated (010847f -> ebf0531)
Date: Wed, 27 Jun 2018 11:20:27 +0200

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

marcello pushed a change to branch master
in repository merchant.

    from 010847f  Splitting CMDs for twisted test cases.
     new bf739c9  Corner case generator, first draft.
     new ebf0531  Make "alt" generator compile.

The 2 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:
 src/merchant-tools/Makefile.am                     |  23 ++-
 ...ts.c => taler-merchant-generate-payments-alt.c} | 191 ++++++++-------------
 2 files changed, 92 insertions(+), 122 deletions(-)
 copy src/merchant-tools/{taler-merchant-generate-payments.c => 
taler-merchant-generate-payments-alt.c} (75%)

diff --git a/src/merchant-tools/Makefile.am b/src/merchant-tools/Makefile.am
index 3464763..24337c8 100644
--- a/src/merchant-tools/Makefile.am
+++ b/src/merchant-tools/Makefile.am
@@ -3,7 +3,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include
 
 bin_PROGRAMS = \
   taler-merchant-dbinit \
-  taler-merchant-generate-payments
+  taler-merchant-generate-payments \
+  taler-merchant-generate-payments-alt
 
 taler_merchant_dbinit_SOURCES = \
   taler-merchant-dbinit.c
@@ -15,6 +16,26 @@ taler_merchant_dbinit_LDADD = \
   -ltalerutil \
   -ltalerpq
 
+taler_merchant_generate_payments_alt_SOURCES = \
+  taler-merchant-generate-payments-alt.c
+
+taler_merchant_generate_payments_alt_LDADD = \
+  $(top_srcdir)/src/backenddb/libtalermerchantdb.la \
+  $(top_srcdir)/src/lib/libtalermerchant.la \
+  $(top_srcdir)/src/lib/libtalermerchanttesting.la \
+  $(LIBGCRYPT_LIBS) \
+  -ltalertesting \
+  -ltalerfakebank \
+  -ltalerbank \
+  -ltalerbanktesting \
+  -ltalerexchange \
+  -ltalerjson \
+  -ltalerutil \
+  -lgnunetjson \
+  -lgnunetcurl \
+  -lgnunetutil \
+  -ljansson
+
 taler_merchant_generate_payments_SOURCES = \
   taler-merchant-generate-payments.c
 
diff --git a/src/merchant-tools/taler-merchant-generate-payments.c 
b/src/merchant-tools/taler-merchant-generate-payments-alt.c
similarity index 75%
copy from src/merchant-tools/taler-merchant-generate-payments.c
copy to src/merchant-tools/taler-merchant-generate-payments-alt.c
index 29cddd8..d37d45b 100644
--- a/src/merchant-tools/taler-merchant-generate-payments.c
+++ b/src/merchant-tools/taler-merchant-generate-payments-alt.c
@@ -61,7 +61,7 @@ enum PaymentGeneratorError {
 #define EXCHANGE_URL "http://example.com/";
 
 #define FIRST_INSTRUCTION -1
-#define TRACKS_INSTRUCTION 9
+#define TWOCOINS_INSTRUCTION 5
 
 #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \
    TALER_TESTING_cmd_fakebank_transfer (label, amount, \
@@ -84,14 +84,14 @@ static struct GNUNET_OS_Process *bankd;
 static struct GNUNET_OS_Process *merchantd;
 
 /**
- * How many payments we want to generate.
+ * How many unaggregated payments we want to generate.
  */
-static unsigned int payments_number = 1;
+static unsigned int unaggregated_number = 1;
 
 /**
- * How many /tracks operation we want to perform.
+ * How many payments that use two coins we want to generate.
  */
-static unsigned int tracks_number = 1;
+static unsigned int twocoins_number = 1;
 
 
 /**
@@ -137,8 +137,8 @@ static char *currency;
  */
 
 #define ALLOCATE_AMOUNTS(...) \
-  GNUNET_asprintf (&CURRENCY_25_05, \
-                   "%s:25.05", \
+  GNUNET_asprintf (&CURRENCY_10_02, \
+                   "%s:10.02", \
                    currency); \
   GNUNET_asprintf (&CURRENCY_10, \
                    "%s:10", \
@@ -146,8 +146,11 @@ static char *currency;
   GNUNET_asprintf (&CURRENCY_9_98, \
                    "%s:9.98", \
                    currency); \
+  GNUNET_asprintf (&CURRENCY_5_01, \
+                   "%s:5.01", \
+                   currency); \
   GNUNET_asprintf (&CURRENCY_5, \
-                   "%s:5", \
+                   "%s:5.01", \
                    currency); \
   GNUNET_asprintf (&CURRENCY_4_99, \
                    "%s:4.99", \
@@ -161,20 +164,20 @@ static char *currency;
 
 #define ALLOCATE_ORDERS(...) \
   GNUNET_asprintf \
-    (&order_worth_5, \
+    (&order_worth_5_unaggregated, \
      "{\"max_fee\":\
        {\"currency\":\"%s\",\
         \"value\":0,\
         \"fraction\":50000000},\
-       \"refund_deadline\":\"\\/Date(0)\\/\",\
+       \"refund_deadline\":\"\\/Date(99999999999)\\/\",\
        \"pay_deadline\":\"\\/Date(99999999999)\\/\",\
        \"amount\":\
          {\"currency\":\"%s\",\
           \"value\":5,\
           \"fraction\":0},\
-        \"summary\": \"merchant-lib testcase\",\
+        \"summary\": \"unaggregated deposit!\",\
         \"fulfillment_url\": \"https://example.com/\",\
-        \"products\": [ {\"description\":\"ice cream\",\
+        \"products\": [ {\"description\":\"unaggregated cream\",\
                          \"value\":\"{%s:5}\"} ] }", \
      currency, \
      currency, \
@@ -191,50 +194,12 @@ static char *currency;
          {\"currency\":\"%s\",\
           \"value\":10,\
           \"fraction\":0},\
-        \"summary\": \"2-coins untracked payment\",\
+        \"summary\": \"2-coins payment\",\
         \"fulfillment_url\": \"https://example.com/\",\
         \"products\": [ {\"description\":\"2-coins payment\",\
                          \"value\":\"{%s:10}\"} ] }", \
      currency, \
      currency, \
-     currency); \
-  GNUNET_asprintf \
-    (&order_worth_5_track, \
-     "{\"max_fee\":\
-       {\"currency\":\"%s\",\
-        \"value\":0,\
-        \"fraction\":50000000},\
-       \"refund_deadline\":\"\\/Date(0)\\/\",\
-       \"pay_deadline\":\"\\/Date(99999999999)\\/\",\
-       \"amount\":\
-         {\"currency\":\"%s\",\
-          \"value\":5,\
-          \"fraction\":0},\
-        \"summary\": \"ice track cream!\",\
-        \"fulfillment_url\": \"https://example.com/\",\
-        \"products\": [ {\"description\":\"ice track cream\",\
-                         \"value\":\"{%s:5}\"} ] }", \
-     currency, \
-     currency, \
-     currency); \
-  GNUNET_asprintf \
-    (&order_worth_5_unaggregated, \
-     "{\"max_fee\":\
-       {\"currency\":\"%s\",\
-        \"value\":0,\
-        \"fraction\":50000000},\
-       \"refund_deadline\":\"\\/Date(0)\\/\",\
-       \"pay_deadline\":\"\\/Date(99999999999)\\/\",\
-       \"amount\":\
-         {\"currency\":\"%s\",\
-          \"value\":5,\
-          \"fraction\":0},\
-        \"summary\": \"unaggregated deposit!\",\
-        \"fulfillment_url\": \"https://example.com/\",\
-        \"products\": [ {\"description\":\"unaggregated cream\",\
-                         \"value\":\"{%s:5}\"} ] }", \
-     currency, \
-     currency, \
      currency);
 
 /**
@@ -246,35 +211,31 @@ run (void *cls,
 {
 
   /* Currency strings.  */
-  char *CURRENCY_25_05;
+  char *CURRENCY_10_02;
   char *CURRENCY_10;
   char *CURRENCY_9_98;
+  char *CURRENCY_5_01;
   char *CURRENCY_5;
   char *CURRENCY_4_99;
   char *CURRENCY_0_02;
   char *CURRENCY_0_01;
 
   ALLOCATE_AMOUNTS
-    (CURRENCY_25_05,
-     CURRENCY_10,
+    (CURRENCY_10_02,
      CURRENCY_9_98,
+     CURRENCY_5_01,
      CURRENCY_5,
      CURRENCY_4_99,
      CURRENCY_0_02,
      CURRENCY_0_01);
 
-
   /* Orders.  */
-  char *order_worth_5;
-  char *order_worth_10_2coins;
-  char *order_worth_5_track;
   char *order_worth_5_unaggregated;
+  char *order_worth_10_2coins;
 
   ALLOCATE_ORDERS
-    (order_worth_5,
-     order_worth_10_2coins,
-     order_worth_5_track,
-     order_worth_5_unaggregated);
+    (order_worth_5_unaggregated,
+     order_worth_10_2coins);
 
   /* Will be freed by testing-lib.  */
   GNUNET_assert
@@ -285,7 +246,7 @@ run (void *cls,
 
     CMD_TRANSFER_TO_EXCHANGE
       ("create-reserve-1",
-       CURRENCY_25_05),
+       CURRENCY_5_01),
 
     TALER_TESTING_cmd_exec_wirewatch
       ("wirewatch-1",
@@ -293,92 +254,80 @@ run (void *cls,
 
     TALER_TESTING_cmd_withdraw_amount
       ("withdraw-coin-1",
-       is->exchange, // picks port from config's [exchange].
-       "create-reserve-1",
-       CURRENCY_5,
-       MHD_HTTP_OK),
-
-    TALER_TESTING_cmd_withdraw_amount
-      ("withdraw-coin-2",
        is->exchange,
        "create-reserve-1",
        CURRENCY_5,
        MHD_HTTP_OK),
 
     TALER_TESTING_cmd_proposal
-      ("create-proposal-1",
+      ("create-unaggregated-proposal",
        merchant_url,
        is->ctx,
        MHD_HTTP_OK,
-       order_worth_5,
+       order_worth_5_unaggregated,
        NULL),
 
     TALER_TESTING_cmd_pay
-      ("deposit-simple",
+      ("deposit-unaggregated",
        merchant_url,
        is->ctx,
        MHD_HTTP_OK,
-       "create-proposal-1",
+       "create-unaggregated-proposal",
        "withdraw-coin-1",
        CURRENCY_5,
        CURRENCY_4_99,
        CURRENCY_0_01),
 
     TALER_TESTING_cmd_rewind_ip
-      ("rewind-payments",
+      ("rewind-unaggregated",
        FIRST_INSTRUCTION,
-       &payments_number),
+       &unaggregated_number),
+
+    CMD_TRANSFER_TO_EXCHANGE
+      ("create-reserve-2",
+       CURRENCY_10_02),
+
+    TALER_TESTING_cmd_withdraw_amount
+      ("withdraw-coin-2",
+       is->exchange,
+       "create-reserve-1",
+       CURRENCY_5,
+       MHD_HTTP_OK),
 
-    /* Next proposal-pay cycle will be used by /track CMDs
-     * and so it will not have to be looped over, only /track
-     * CMDs will have to.  */
+    TALER_TESTING_cmd_withdraw_amount
+      ("withdraw-coin-3",
+       is->exchange,
+       "create-reserve-1",
+       CURRENCY_5,
+       MHD_HTTP_OK),
 
     TALER_TESTING_cmd_proposal
-      ("create-proposal-2",
+      ("create-twocoins-proposal",
        merchant_url,
        is->ctx,
        MHD_HTTP_OK,
-       order_worth_5_track,
+       order_worth_10_2coins,
        NULL),
 
     TALER_TESTING_cmd_pay
-      ("deposit-simple-2",
+      ("deposit-twocoins",
        merchant_url,
        is->ctx,
        MHD_HTTP_OK,
-       "create-proposal-2",
-       "withdraw-coin-2",
-       CURRENCY_5,
-       CURRENCY_4_99,
-       CURRENCY_0_01),
-
-    /* /track/transaction over deposit-simple-2 */
+       "create-twocoins-proposal",
+       "withdraw-coin-2;withdraw-coin-3",
+       CURRENCY_10,
+       CURRENCY_9_98,
+       CURRENCY_0_02),
 
     TALER_TESTING_cmd_exec_aggregator
-      ("aggregate-1",
+      ("aggregate-twocoins",
        cfg_filename),
 
-    TALER_TESTING_cmd_merchant_track_transaction
-      ("track-transaction-1",
-       merchant_url,
-       is->ctx,
-       MHD_HTTP_OK,
-       "dummy", // "check bank" CMD, never used, to be deleted.
-       "deposit-simple-2",
-       CURRENCY_0_01),
-
-    TALER_TESTING_cmd_merchant_track_transfer
-      ("track-transfer-1",
-       merchant_url,
-       is->ctx,
-       MHD_HTTP_OK,
-       "track-transaction-1",
-       "deposit-simple-2"),
-
     TALER_TESTING_cmd_rewind_ip
-      ("rewind-tracks",
-       TRACKS_INSTRUCTION,
-       &tracks_number),
+      ("rewind-twocoins",
+       TWOCOINS_INSTRUCTION,
+       &twocoins_number),
 
     TALER_TESTING_cmd_end ()
   };
@@ -431,18 +380,18 @@ main (int argc,
       (&loglev),
 
     GNUNET_GETOPT_option_uint
-      ('p',
-       "payments-number",
-       "PN",
-       "will generate PN payments, defaults to 1",
-       &payments_number),
+      ('u',
+       "unaggregated-number",
+       "UN",
+       "will generate UN unaggregated payments, defaults to 1",
+       &unaggregated_number),
 
     GNUNET_GETOPT_option_uint
       ('t',
-       "tracks-number",
-       "TN",
-       "will perform TN /track operations, defaults to 1",
-       &tracks_number),
+       "two-coins",
+       "TC",
+       "will perform TC 2-coins payments, defaults to 1",
+       &twocoins_number),
 
     /**
      * NOTE: useful when the setup serves merchant
@@ -476,7 +425,7 @@ main (int argc,
   };
 
   result = GNUNET_GETOPT_run
-    ("taler-merchant-generate-payments-new",
+    ("taler-merchant-generate-payments-alt",
      options,
      argc,
      argv);
@@ -489,7 +438,7 @@ main (int argc,
 
   GNUNET_assert (GNUNET_SYSERR != result);
   loglev = NULL;
-  GNUNET_log_setup ("taler-merchant-generate-payments-new",
+  GNUNET_log_setup ("taler-merchant-generate-payments-alt",
                     loglev,
                     logfile);
 

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



reply via email to

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