2018-11-10 13:58:02 +01:00
|
|
|
/*
|
|
|
|
This file is part of TALER
|
|
|
|
(C) 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 include/taler_testing_auditor_lib.h
|
|
|
|
* @brief API for writing an interpreter to test Taler components
|
|
|
|
* @author Christian Grothoff <christian@grothoff.org>
|
|
|
|
* @author Marcello Stanisci
|
|
|
|
*/
|
|
|
|
#ifndef TALER_TESTING_AUDITOR_LIB_H
|
|
|
|
#define TALER_TESTING_AUDITOR_LIB_H
|
|
|
|
|
|
|
|
#include "taler_util.h"
|
|
|
|
#include "taler_exchange_service.h"
|
|
|
|
#include <gnunet/gnunet_json_lib.h>
|
|
|
|
#include "taler_json_lib.h"
|
|
|
|
#include <microhttpd.h>
|
|
|
|
|
|
|
|
|
2018-11-17 15:15:51 +01:00
|
|
|
/* ********************* Commands ********************* */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make the "exec-auditor" CMD.
|
|
|
|
*
|
|
|
|
* @param label command label.
|
|
|
|
* @param config_filename configuration filename.
|
|
|
|
* @return the command.
|
|
|
|
*/
|
|
|
|
struct TALER_TESTING_Command
|
|
|
|
TALER_TESTING_cmd_exec_auditor (const char *label,
|
|
|
|
const char *config_filename);
|
|
|
|
|
|
|
|
|
2018-11-18 11:53:37 +01:00
|
|
|
/**
|
|
|
|
* Make the "exec-auditor-dbinit" CMD. Always run with the "-r" option.
|
|
|
|
*
|
|
|
|
* @param label command label.
|
|
|
|
* @param config_filename configuration filename.
|
|
|
|
* @return the command.
|
|
|
|
*/
|
|
|
|
struct TALER_TESTING_Command
|
|
|
|
TALER_TESTING_cmd_exec_auditor_dbinit (const char *label,
|
|
|
|
const char *config_filename);
|
|
|
|
|
|
|
|
|
2018-11-17 15:15:51 +01:00
|
|
|
/**
|
|
|
|
* Make the "exec wire-auditor" CMD.
|
|
|
|
*
|
|
|
|
* @param label command label.
|
|
|
|
* @param config_filename configuration filename.
|
|
|
|
* @return the command.
|
|
|
|
*/
|
|
|
|
struct TALER_TESTING_Command
|
|
|
|
TALER_TESTING_cmd_exec_wire_auditor (const char *label,
|
|
|
|
const char *config_filename);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a "deposit-confirmation" command.
|
|
|
|
*
|
|
|
|
* @param label command label.
|
|
|
|
* @param auditor auditor connection.
|
|
|
|
* @param deposit_reference reference to any operation that can
|
|
|
|
* provide a coin.
|
|
|
|
* @param coin_index if @a deposit_reference offers an array of
|
|
|
|
* coins, this parameter selects which one in that array.
|
|
|
|
* This value is currently ignored, as only one-coin
|
|
|
|
* deposits are implemented.
|
2018-11-17 19:23:39 +01:00
|
|
|
* @param amount_without_fee deposited amount without the fee
|
2018-11-17 15:15:51 +01:00
|
|
|
* @param expected_response_code expected HTTP response code.
|
|
|
|
* @return the command.
|
|
|
|
*/
|
|
|
|
struct TALER_TESTING_Command
|
2019-08-25 16:18:24 +02:00
|
|
|
TALER_TESTING_cmd_deposit_confirmation (const char *label,
|
|
|
|
struct TALER_AUDITOR_Handle *auditor,
|
|
|
|
const char *deposit_reference,
|
|
|
|
unsigned int coin_index,
|
|
|
|
const char *amount_without_fee,
|
|
|
|
unsigned int expected_response_code);
|
2018-11-17 15:15:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Modify a deposit confirmation command to enable retries when we get
|
|
|
|
* transient errors from the auditor.
|
|
|
|
*
|
|
|
|
* @param cmd a deposit confirmation command
|
|
|
|
* @return the command with retries enabled
|
|
|
|
*/
|
|
|
|
struct TALER_TESTING_Command
|
2019-08-25 16:18:24 +02:00
|
|
|
TALER_TESTING_cmd_deposit_confirmation_with_retry (struct TALER_TESTING_Command
|
|
|
|
cmd);
|
2018-11-17 15:15:51 +01:00
|
|
|
|
|
|
|
|
2018-11-17 18:14:11 +01:00
|
|
|
/**
|
|
|
|
* Create a "list exchanges" command.
|
|
|
|
*
|
|
|
|
* @param label command label.
|
|
|
|
* @param auditor auditor connection.
|
|
|
|
* @param expected_response_code expected HTTP response code.
|
|
|
|
* @return the command.
|
|
|
|
*/
|
|
|
|
struct TALER_TESTING_Command
|
2019-08-25 16:18:24 +02:00
|
|
|
TALER_TESTING_cmd_exchanges (const char *label,
|
|
|
|
struct TALER_AUDITOR_Handle *auditor,
|
|
|
|
unsigned int expected_response_code);
|
2018-11-17 18:14:11 +01:00
|
|
|
|
|
|
|
|
2019-01-28 16:51:13 +01:00
|
|
|
/**
|
|
|
|
* Create a "list exchanges" command and check whether
|
|
|
|
* a particular exchange belongs to the returned bundle.
|
|
|
|
*
|
|
|
|
* @param label command label.
|
|
|
|
* @param auditor auditor connection.
|
|
|
|
* @param expected_response_code expected HTTP response code.
|
|
|
|
* @param exchange_url URL of the exchange supposed to
|
|
|
|
* be included in the response.
|
|
|
|
* @return the command.
|
|
|
|
*/
|
|
|
|
struct TALER_TESTING_Command
|
2019-08-25 16:18:24 +02:00
|
|
|
TALER_TESTING_cmd_exchanges_with_url (const char *label,
|
|
|
|
unsigned int expected_response_code,
|
|
|
|
const char *exchange_url);
|
2019-01-28 16:51:13 +01:00
|
|
|
|
2018-11-17 18:14:11 +01:00
|
|
|
/**
|
|
|
|
* Modify an exchanges command to enable retries when we get
|
|
|
|
* transient errors from the auditor.
|
|
|
|
*
|
|
|
|
* @param cmd a deposit confirmation command
|
|
|
|
* @return the command with retries enabled
|
|
|
|
*/
|
|
|
|
struct TALER_TESTING_Command
|
|
|
|
TALER_TESTING_cmd_exchanges_with_retry (struct TALER_TESTING_Command cmd);
|
|
|
|
|
|
|
|
|
2018-11-10 13:58:02 +01:00
|
|
|
/* ********************* Helper functions ********************* */
|
|
|
|
|
|
|
|
|
2018-11-11 16:45:09 +01:00
|
|
|
/**
|
|
|
|
* Install signal handlers plus schedules the main wrapper
|
|
|
|
* around the "run" method.
|
|
|
|
*
|
|
|
|
* @param main_cb the "run" method which contains all the
|
|
|
|
* commands.
|
|
|
|
* @param main_cb_cls a closure for "run", typically NULL.
|
|
|
|
* @param config_filename configuration filename.
|
|
|
|
* @return #GNUNET_OK if all is okay, != #GNUNET_OK otherwise.
|
|
|
|
* non-GNUNET_OK codes are #GNUNET_SYSERR most of the
|
|
|
|
* times.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
TALER_TESTING_AUDITOR_setup (TALER_TESTING_Main main_cb,
|
|
|
|
void *main_cb_cls,
|
|
|
|
const char *config_filename);
|
|
|
|
|
|
|
|
|
2018-11-10 13:58:02 +01:00
|
|
|
#endif
|