aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/taler_testing_lib.h1130
-rw-r--r--src/testing/Makefile.am23
-rw-r--r--src/testing/testing_api_trait_amount.c76
-rw-r--r--src/testing/testing_api_trait_blinding_key.c77
-rw-r--r--src/testing/testing_api_trait_cmd.c80
-rw-r--r--src/testing/testing_api_trait_coin_priv.c78
-rw-r--r--src/testing/testing_api_trait_contract.c74
-rw-r--r--src/testing/testing_api_trait_denom_pub.c77
-rw-r--r--src/testing/testing_api_trait_denom_sig.c79
-rw-r--r--src/testing/testing_api_trait_exchange_pub.c77
-rw-r--r--src/testing/testing_api_trait_exchange_sig.c77
-rw-r--r--src/testing/testing_api_trait_fresh_coin.c77
-rw-r--r--src/testing/testing_api_trait_json.c165
-rw-r--r--src/testing/testing_api_trait_merchant_key.c127
-rw-r--r--src/testing/testing_api_trait_number.c229
-rw-r--r--src/testing/testing_api_trait_process.c82
-rw-r--r--src/testing/testing_api_trait_reserve_history.c76
-rw-r--r--src/testing/testing_api_trait_reserve_priv.c76
-rw-r--r--src/testing/testing_api_trait_reserve_pub.c78
-rw-r--r--src/testing/testing_api_trait_string.c231
-rw-r--r--src/testing/testing_api_trait_time.c120
-rw-r--r--src/testing/testing_api_trait_uuid.c117
-rw-r--r--src/testing/testing_api_trait_wtid.c76
-rw-r--r--src/testing/testing_api_traits.c25
24 files changed, 156 insertions, 3171 deletions
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 7768a7f61..041ed3d07 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -574,6 +574,7 @@ const struct TALER_TESTING_Command *
TALER_TESTING_interpreter_lookup_command (struct TALER_TESTING_Interpreter *is,
const char *label);
+
/**
* Obtain main execution context for the main loop.
*
@@ -2190,6 +2191,14 @@ TALER_TESTING_cmd_auditor_add_denom_sig (const char *label,
/* *** Generic trait logic for implementing traits ********* */
+
+/**
+ * Opaque handle to fresh coins generated during refresh.
+ * Details are internal to the refresh logic.
+ */
+struct TALER_TESTING_FreshCoinData;
+
+
/**
* A trait.
*/
@@ -2232,7 +2241,7 @@ TALER_TESTING_trait_end (void);
* @param index index number of the trait to extract.
* @return #GNUNET_OK when the trait is found.
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
const void **ret,
const char *trait,
@@ -2243,991 +2252,140 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
/**
- * Obtain a bank transaction row value from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param[out] row set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_bank_row (const struct TALER_TESTING_Command *cmd,
- const uint64_t **row);
-
-
-/**
- * Offer bank transaction row trait.
- *
- * @param row number to offer.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_bank_row (const uint64_t *row);
-
-
-/**
- * Offer a reserve private key.
- *
- * @param index reserve priv's index number.
- * @param reserve_priv reserve private key to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_reserve_priv (
- unsigned int index,
- const struct TALER_ReservePrivateKeyP *reserve_priv);
-
-
-/**
- * Obtain a reserve private key from a @a cmd.
- *
- * @param cmd command to extract the reserve priv from.
- * @param index reserve priv's index number.
- * @param[out] reserve_priv set to the reserve priv.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_reserve_priv (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ReservePrivateKeyP **reserve_priv);
-
-
-/**
- * Offer a reserve public key.
- *
- * @param index reserve pubs's index number.
- * @param reserve_pub reserve public key to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_reserve_pub (
- unsigned int index,
- const struct TALER_ReservePublicKeyP *reserve_pub);
-
-
-/**
- * Obtain a reserve public key from a @a cmd.
- *
- * @param cmd command to extract the reserve pub from.
- * @param index reserve pub's index number.
- * @param[out] reserve_pub set to the reserve pub.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_reserve_pub (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ReservePublicKeyP **reserve_pub);
-
-
-/**
- * Offer a reserve history entry.
- *
- * @param index reserve pubs's index number.
- * @param rh reserve history entry to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_reserve_history (
- unsigned int index,
- const struct TALER_EXCHANGE_ReserveHistory *rh);
-
-
-/**
- * Obtain a reserve history entry from a @a cmd.
- *
- * @param cmd command to extract the reserve history from.
- * @param index reserve history's index number.
- * @param[out] rhp set to the reserve history.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_reserve_history (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_EXCHANGE_ReserveHistory **rhp);
-
-
-/**
- * Make a trait for a exchange signature.
- *
- * @param index index number to associate to the offered exchange pub.
- * @param exchange_sig exchange signature to offer with this trait.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_exchange_sig (
- unsigned int index,
- const struct TALER_ExchangeSignatureP *exchange_sig);
-
-
-/**
- * Obtain a exchange signature (online sig) from a @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index index number of the exchange to obtain.
- * @param[out] exchange_sig set to the offered exchange signature.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_exchange_sig (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ExchangeSignatureP **exchange_sig);
-
-
-/**
- * Make a trait for a exchange public key.
- *
- * @param index index number to associate to the offered exchange pub.
- * @param exchange_pub exchange pub to offer with this trait.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_exchange_pub (
- unsigned int index,
- const struct TALER_ExchangePublicKeyP *exchange_pub);
-
-
-/**
- * Obtain a exchange public key from a @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index index number of the exchange to obtain.
- * @param[out] exchange_pub set to the offered exchange pub.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_exchange_pub (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ExchangePublicKeyP **exchange_pub);
-
-
-/**
- * Obtain location where a command stores a pointer to a process.
- *
- * @param cmd command to extract trait from.
- * @param index which process to pick if @a cmd
- * has multiple on offer.
- * @param[out] processp set to the address of the pointer to the
- * process.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_process (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- struct GNUNET_OS_Process ***processp);
-
-
-/**
- * Offer location where a command stores a pointer to a process.
- *
- * @param index offered location index number, in case there are
- * multiple on offer.
- * @param processp process location to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_process (unsigned int index,
- struct GNUNET_OS_Process **processp);
-
-
-/**
- * Offer coin private key.
- *
- * @param index index number to associate with offered coin priv.
- * @param coin_priv coin private key to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_coin_priv (
- unsigned int index,
- const struct TALER_CoinSpendPrivateKeyP *coin_priv);
-
-/**
- * Obtain a coin private key from a @a cmd.
- *
- * @param cmd command to extract trait from.
- * @param index index of the coin priv to obtain.
- * @param[out] coin_priv set to the private key of the coin.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_coin_priv (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_CoinSpendPrivateKeyP **coin_priv);
-
-
-/**
- * Offer blinding key.
- *
- * @param index index number to associate to the offered key.
- * @param blinding_key blinding key to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_blinding_key (
- unsigned int index,
- const struct TALER_DenominationBlindingKeyP *blinding_key);
-
-
-/**
- * Obtain a blinding key from a @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index which coin to pick if @a cmd has multiple on offer.
- * @param[out] blinding_key set to the offered blinding key.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_blinding_key (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_DenominationBlindingKeyP **blinding_key);
-
-
-/**
- * Make a trait for a denomination public key.
- *
- * @param index index number to associate to the offered denom pub.
- * @param denom_pub denom pub to offer with this trait.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_denom_pub (
- unsigned int index,
- const struct TALER_EXCHANGE_DenomPublicKey *dpk);
-
-
-/**
- * Obtain a denomination public key from a @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index index number of the denom to obtain.
- * @param[out] denom_pub set to the offered denom pub.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_denom_pub (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_EXCHANGE_DenomPublicKey **dpk);
-
-
-/**
- * Obtain a denomination signature from a @a cmd.
- *
- * @param cmd command to extract the denom sig from.
- * @param index index number associated with the denom sig.
- * @param[out] denom_sig set to the offered signature.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_denom_sig (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_DenominationSignature **dpk);
-
-
-/**
- * Offer denom sig.
- *
- * @param index index number to associate to the signature on
- * offer.
- * @param denom_sig the denom sig on offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_denom_sig (
- unsigned int index,
- const struct TALER_DenominationSignature *sig);
-
-
-/**
- * Offer number trait, 32-bit version.
- *
- * @param index the number's index number.
- * @param n number to offer.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_uint32 (unsigned int index,
- const uint32_t *n);
-
-
-/**
- * Obtain a "number" value from @a cmd, 32-bit version.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] n set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_uint32 (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const uint32_t **n);
-
-
-/**
- * Offer number trait, 64-bit version.
- *
- * @param index the number's index number.
- * @param n number to offer.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_uint64 (unsigned int index,
- const uint64_t *n);
-
-
-/**
- * Obtain a "number" value from @a cmd, 64-bit version.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] n set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_uint64 (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const uint64_t **n);
-
-
-/**
- * Offer number trait, 64-bit signed version.
- *
- * @param index the number's index number.
- * @param n number to offer.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_int64 (unsigned int index,
- const int64_t *n);
-
-
-/**
- * Obtain a "number" value from @a cmd, 64-bit signed version.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] n set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_int64 (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const int64_t **n);
-
-
-/**
- * Offer a number.
- *
- * @param index the number's index number.
- * @param n the number to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_uint (unsigned int index,
- const unsigned int *i);
-
-
-/**
- * Obtain a number from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] n set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_uint (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const unsigned int **n);
-
-
-/**
- * Opaque handle to fresh coins generated during refresh.
- * Details are internal to the refresh logic.
- */
-struct TALER_TESTING_FreshCoinData;
-
-
-/**
- * Offer a _array_ of fresh coins.
- *
- * @param index which array of fresh coins to offer,
- * if there are multiple on offer. Typically passed as
- * zero.
- * @param fresh_coins the array of fresh coins to offer
- * @return the trait,
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_fresh_coins (
- unsigned int index,
- const struct TALER_TESTING_FreshCoinData *fresh_coins);
-
-
-/**
- * Get a array of fresh coins.
- *
- * @param cmd command to extract the fresh coin from.
- * @param index which array to pick if @a cmd has multiple
- * on offer.
- * @param[out] fresh_coins will point to the offered array.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_fresh_coins (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_TESTING_FreshCoinData **fresh_coins);
-
-
-/**
- * Obtain contract terms from @a cmd.
- *
- * @param cmd command to extract the contract terms from.
- * @param index contract terms index number.
- * @param[out] contract_terms where to write the contract
- * terms.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_contract_terms (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const json_t **contract_terms);
-
-
-/**
- * Offer contract terms.
- *
- * @param index contract terms index number.
- * @param contract_terms contract terms to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_contract_terms (unsigned int index,
- const json_t *contract_terms);
-
-
-/**
- * Obtain wire details from @a cmd.
- *
- * @param cmd command to extract the wire details from.
- * @param index index number associate with the wire details
- * on offer; usually zero, as one command sticks to
- * one bank account.
- * @param[out] wire_details where to write the wire details.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_wire_details (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const json_t **wire_details);
-
-
-/**
- * Offer wire details in a trait.
- *
- * @param index index number associate with the wire details
- * on offer; usually zero, as one command sticks to
- * one bank account.
- * @param wire_details wire details to offer.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_wire_details (unsigned int index,
- const json_t *wire_details);
-
-
-/**
- * Obtain serialized exchange keys from @a cmd.
- *
- * @param cmd command to extract the keys from.
- * @param index index number associate with the keys on offer.
- * @param[out] keys where to write the serialized keys.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_exchange_keys (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const json_t **keys);
-
-
-/**
- * Offer serialized keys in a trait.
- *
- * @param index index number associate with the serial keys
- * on offer.
- * @param keys serialized keys to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_exchange_keys (unsigned int index,
- const json_t *keys);
-
-
-/**
- * Obtain json from @a cmd.
- *
- * @param cmd command to extract the json from.
- * @param index index number associate with the json on offer.
- * @param[out] json where to write the json.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_json (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const json_t **json);
-
-
-/**
- * Offer json in a trait.
- *
- * @param index index number associate with the json
- * on offer.
- * @param json json to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_json (unsigned int index,
- const json_t *json);
-
-
-/**
- * Obtain a private key from a "merchant". Used e.g. to obtain
- * a merchant's priv to sign a /track request.
- *
- * @param cmd command that is offering the key.
- * @param index (typically zero) which key to return if there
- * are multiple on offer.
- * @param[out] priv set to the key coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_merchant_priv (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_MerchantPrivateKeyP **priv);
-
-
-/**
- * Offer private key of a merchant, typically done when CMD_1 needs it to
- * sign a request.
- *
- * @param index (typically zero) which key to return if there are
- * multiple on offer.
- * @param priv which object should be offered.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_merchant_priv (
- unsigned int index,
- const struct TALER_MerchantPrivateKeyP *priv);
-
-
-/**
- * Obtain a public key from a "merchant". Used e.g. to obtain
- * a merchant's public key to use backend's API.
- *
- * @param cmd command offering the key.
- * @param index (typically zero) which key to return if there
- * are multiple on offer.
- * @param[out] pub set to the key coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_merchant_pub (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_MerchantPublicKeyP **pub);
-
-
-/**
- * Offer public key.
- *
- * @param index (typically zero) which key to return if there
- * are multiple on offer. NOTE: if one key is offered, it
- * is mandatory to set this as zero.
- * @param pub which object should be returned.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_merchant_pub (
- unsigned int index,
- const struct TALER_MerchantPublicKeyP *pub);
-
-
-/**
- * Obtain a string from @a cmd.
- *
- * @param cmd command to extract the subject from.
- * @param index index number associated with the transfer
- * subject to offer.
- * @param[out] s where to write the offered
- * string.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_string (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const char **s);
-
-
-/**
- * Offer string subject.
- *
- * @param index index number associated with the transfer
- * subject being offered.
- * @param s string to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_string (unsigned int index,
- const char *s);
-
-
-/**
- * Obtain a WTID value from @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index which WTID to pick if @a cmd has multiple on
- * offer
- * @param[out] wtid set to the wanted WTID.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_wtid (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_WireTransferIdentifierRawP **wtid);
-
-
-/**
- * Offer a WTID.
- *
- * @param index associate the WTID with this index.
- * @param wtid pointer to the WTID to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_wtid (
- unsigned int index,
- const struct TALER_WireTransferIdentifierRawP *wtid);
-
-
-/**
- * Different types of URLs that appear in traits.
- */
-enum TALER_TESTING_URL_Type
-{
- /**
- * Category of last resort. Should not be used.
- */
- TALER_TESTING_UT_UNDEFINED = 0,
-
- /**
- * HTTP base URL of an exchange (API), as for example
- * given in wire transfers subjects made by the aggregator.
- */
- TALER_TESTING_UT_EXCHANGE_BASE_URL = 1,
-
- /**
- * HTTP URL of the exchange's bank account at the bank.
- */
- TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL = 2,
-
- /**
- * A taler://-URL.
- */
- TALER_TESTING_UT_TALER_URL = 3
-};
-
-
-/**
- * Offer HTTP url in a trait.
- *
- * @param index which url is to be picked,
- * in case multiple are offered.
- * @param url the url to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_url (enum TALER_TESTING_URL_Type index,
- const char *url);
-
-
-/**
- * Obtain a HTTP url from @a cmd.
- *
- * @param cmd command to extract the url from.
- * @param index which url is to be picked, in case
- * multiple are offered.
- * @param[out] url where to write the url.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_url (const struct TALER_TESTING_Command *cmd,
- enum TALER_TESTING_URL_Type index,
- const char **url);
-
-
-/**
- * Used as the "index" in payto traits, to identify what kind of
- * payto URL we are returning.
- */
-enum TALER_TESTING_PaytoType
-{
- /**
- * We don't know / not credit or debit.
- */
- TALER_TESTING_PT_NEUTRAL,
- /**
- * Credit side of a transaction.
- */
- TALER_TESTING_PT_CREDIT,
- /**
- * Debit side of a transaction.
- */
- TALER_TESTING_PT_DEBIT
-};
-
-
-/**
- * Offer a payto uri in a trait.
- *
- * @param pt which url is to be picked,
- * in case multiple are offered.
- * @param payto_uri the uri to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_payto (enum TALER_TESTING_PaytoType pt,
- const char *payto_uri);
-
-
-/**
- * Obtain a PAYTO url from @a cmd.
- *
- * @param cmd command to extract the url from.
- * @param pt which url is to be picked, in case
- * multiple are offered.
- * @param[out] url where to write the url.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_payto (const struct TALER_TESTING_Command *cmd,
- enum TALER_TESTING_PaytoType pt,
- const char **url);
-
-
-/**
- * Obtain a order id from @a cmd.
- *
- * @param cmd command to extract the order id from.
- * @param index which order id is to be picked, in case
- * multiple are offered.
- * @param[out] order_id where to write the order id.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_order_id (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const char **order_id);
-
-
-/**
- * Offer order id in a trait.
- *
- * @param index which order id is to be offered,
- * in case multiple are offered.
- * @param order_id the order id to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_order_id (unsigned int index,
- const char *order_id);
-
-
-/**
- * Obtain an amount from a @a cmd.
- *
- * @param cmd command to extract the amount from.
- * @param index which amount to pick if @a cmd has multiple
- * on offer
- * @param[out] amount set to the amount.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_amount_obj (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_Amount **amount);
-
-
-/**
- * Offer amount.
- *
- * @param index which amount to offer, in case there are
- * multiple available.
- * @param amount the amount to offer.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_amount_obj (unsigned int index,
- const struct TALER_Amount *amount);
-
-
-/**
- * Offer a command in a trait.
- *
- * @param index always zero. Commands offering this
- * kind of traits do not need this index. For
- * example, a "meta" CMD returns always the
- * CMD currently being executed.
- * @param cmd wire details to offer.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_cmd (unsigned int index,
- const struct TALER_TESTING_Command *cmd);
-
+ * Create headers for a trait with name @a name for
+ * statically allocated data of type @a type.
+ */
+#define TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT(name,type) \
+ enum GNUNET_GenericReturnValue \
+ TALER_TESTING_get_trait_ ## name ( \
+ const struct TALER_TESTING_Command *cmd, \
+ const type **ret); \
+ struct TALER_TESTING_Trait \
+ TALER_TESTING_make_trait_ ## name ( \
+ const type * value);
+
+
+/**
+ * Create C implementation for a trait with name @a name for statically
+ * allocated data of type @a type.
+ */
+#define TALER_TESTING_MAKE_IMPL_SIMPLE_TRAIT(name,type) \
+ enum GNUNET_GenericReturnValue \
+ TALER_TESTING_get_trait_ ## name ( \
+ const struct TALER_TESTING_Command *cmd, \
+ const type **ret) \
+ { \
+ return cmd->traits (cmd->cls, \
+ (const void **) ret, \
+ TALER_S (name), \
+ 0); \
+ } \
+ struct TALER_TESTING_Trait \
+ TALER_TESTING_make_trait_ ## name ( \
+ const type * value) \
+ { \
+ struct TALER_TESTING_Trait ret = { \
+ .trait_name = TALER_S (name), \
+ .ptr = (const void *) value \
+ }; \
+ return ret; \
+ }
+
+
+/**
+ * Create headers for a trait with name @a name for
+ * statically allocated data of type @a type.
+ */
+#define TALER_TESTING_MAKE_DECL_INDEXED_TRAIT(name,type) \
+ enum GNUNET_GenericReturnValue \
+ TALER_TESTING_get_trait_ ## name ( \
+ const struct TALER_TESTING_Command *cmd, \
+ unsigned int index, \
+ const type **ret); \
+ struct TALER_TESTING_Trait \
+ TALER_TESTING_make_trait_ ## name ( \
+ unsigned int index, \
+ const type * value);
+
+
+/**
+ * Create C implementation for a trait with name @a name for statically
+ * allocated data of type @a type.
+ */
+#define TALER_TESTING_MAKE_IMPL_INDEXED_TRAIT(name,type) \
+ enum GNUNET_GenericReturnValue \
+ TALER_TESTING_get_trait_ ## name ( \
+ const struct TALER_TESTING_Command *cmd, \
+ unsigned int index, \
+ const type **ret) \
+ { \
+ return cmd->traits (cmd->cls, \
+ (const void **) ret, \
+ TALER_S (name), \
+ index); \
+ } \
+ struct TALER_TESTING_Trait \
+ TALER_TESTING_make_trait_ ## name ( \
+ unsigned int index, \
+ const type * value) \
+ { \
+ struct TALER_TESTING_Trait ret = { \
+ .index = index, \
+ .trait_name = TALER_S (name), \
+ .ptr = (const void *) value \
+ }; \
+ return ret; \
+ }
+
+
+/**
+ * Call #op on all simple traits.
+ */
+#define TALER_TESTING_SIMPLE_TRAITS(op) \
+ op (exchange_pub, struct TALER_ExchangePublicKeyP) \
+ op (bank_row, uint64_t) \
+ op (reserve_priv, struct TALER_ReservePrivateKeyP) \
+ op (reserve_pub, struct TALER_ReservePublicKeyP) \
+ op (exchange_sig, struct TALER_ExchangeSignatureP) \
+ op (exchange_pub, struct TALER_ExchangePublicKeyP) \
+ op (merchant_priv, struct TALER_MerchantPrivateKeyP) \
+ op (merchant_pub, struct TALER_MerchantPublicKeyP) \
+ op (wtid, struct TALER_WireTransferIdentifierRawP) \
+ op (contract_terms, json_t) \
+ op (wire_details, json_t) \
+ op (exchange_keys, json_t) \
+ op (reserve_history, struct TALER_EXCHANGE_ReserveHistory) \
+ op (exchange_url, char *) \
+ op (exchange_bank_account_url, char *) \
+ op (taler_uri, char *) \
+ op (payto_uri, char *) \
+ op (credit_payto_uri, char *) \
+ op (debit_payto_uri, char *) \
+ op (order_id, char *) \
+ op (amount, struct TALER_Amount) \
+ op (cmd, struct TALER_TESTING_Command) \
+ op (uuid, struct GNUNET_Uuid) \
+ op (claim_token, struct TALER_ClaimTokenP) \
+ op (absolute_time, struct GNUNET_TIME_Absolute) \
+ op (relative_time, struct GNUNET_TIME_Relative) \
+ op (process, struct GNUNET_OS_Process *)
+
+
+/**
+ * Call #op on all indexed traits.
+ */
+#define TALER_TESTING_INDEXED_TRAITS(op) \
+ op (denom_pub, struct TALER_EXCHANGE_DenomPublicKey) \
+ op (denom_sig, struct TALER_EXCHANGE_DenominationKeySignature) \
+ op (coin_priv, struct TALER_CoinSpendPrivateKeyP) \
+ op (coin_pub, struct TALER_CoinSpendPublicKeyP) \
+ op (fresh_coin, struct TALER_TESTING_FreshCoinData) \
+ op (blinding_key, struct TALER_DenominationBlindingKeyP)
+
+
+TALER_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT)
+
+TALER_TESTING_INDEXED_TRAITS (TALER_TESTING_MAKE_DECL_INDEXED_TRAIT)
-/**
- * Obtain a command from @a cmd.
- *
- * @param cmd command to extract the command from.
- * @param index always zero. Commands offering this
- * kind of traits do not need this index. For
- * example, a "meta" CMD returns always the
- * CMD currently being executed.
- * @param[out] _cmd where to write the wire details.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_cmd (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- struct TALER_TESTING_Command **_cmd);
-
-
-/**
- * Obtain a uuid from @a cmd.
- *
- * @param cmd command to extract the uuid from.
- * @param index which amount to pick if @a cmd has multiple
- * on offer
- * @param[out] uuid where to write the uuid.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_uuid (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- struct GNUNET_Uuid **uuid);
-
-
-/**
- * Offer a uuid in a trait.
- *
- * @param index which uuid to offer, in case there are
- * multiple available.
- * @param uuid the uuid to offer.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_uuid (unsigned int index,
- const struct GNUNET_Uuid *uuid);
-
-
-/**
- * Obtain a claim token from @a cmd.
- *
- * @param cmd command to extract the token from.
- * @param index which amount to pick if @a cmd has multiple
- * on offer
- * @param[out] ct where to write the token.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_claim_token (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ClaimTokenP **ct);
-
-
-/**
- * Offer a claim token in a trait.
- *
- * @param index which token to offer, in case there are
- * multiple available.
- * @param ct the token to offer.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_claim_token (unsigned int index,
- const struct TALER_ClaimTokenP *ct);
-
-
-/**
- * Obtain a absolute time from @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index which time stamp to pick if
- * @a cmd has multiple on offer.
- * @param[out] time set to the wanted WTID.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_absolute_time (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_TIME_Absolute **time);
-
-
-/**
- * Offer a absolute time.
- *
- * @param index associate the object with this index
- * @param time which object should be returned
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_absolute_time (
- unsigned int index,
- const struct GNUNET_TIME_Absolute *time);
-
-
-/**
- * Obtain a relative time from @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index which time to pick if
- * @a cmd has multiple on offer.
- * @param[out] time set to the wanted WTID.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_relative_time (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_TIME_Relative **time);
-
-
-/**
- * Offer a relative time.
- *
- * @param index associate the object with this index
- * @param time which object should be returned
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_relative_time (
- unsigned int index,
- const struct GNUNET_TIME_Relative *time);
#endif
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 7fa7ef3d2..6fc30d0d4 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -86,28 +86,7 @@ libtalertesting_la_SOURCES = \
testing_api_helpers_bank.c \
testing_api_helpers_exchange.c \
testing_api_loop.c \
- testing_api_traits.c \
- testing_api_trait_amount.c \
- testing_api_trait_blinding_key.c \
- testing_api_trait_cmd.c \
- testing_api_trait_coin_priv.c \
- testing_api_trait_contract.c \
- testing_api_trait_denom_pub.c \
- testing_api_trait_denom_sig.c \
- testing_api_trait_exchange_pub.c \
- testing_api_trait_exchange_sig.c \
- testing_api_trait_fresh_coin.c \
- testing_api_trait_json.c \
- testing_api_trait_merchant_key.c \
- testing_api_trait_number.c \
- testing_api_trait_process.c \
- testing_api_trait_reserve_history.c \
- testing_api_trait_reserve_pub.c \
- testing_api_trait_reserve_priv.c \
- testing_api_trait_string.c \
- testing_api_trait_time.c \
- testing_api_trait_uuid.c \
- testing_api_trait_wtid.c
+ testing_api_traits.c
libtalertesting_la_LIBADD = \
$(top_builddir)/src/lib/libtalerauditor.la \
$(top_builddir)/src/lib/libtalerexchange.la \
diff --git a/src/testing/testing_api_trait_amount.c b/src/testing/testing_api_trait_amount.c
deleted file mode 100644
index 96698b49e..000000000
--- a/src/testing/testing_api_trait_amount.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_amount.c
- * @brief offer amounts as traits.
- * @author Marcello Stanisci
- */
-
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_AMOUNT "amount"
-
-/**
- * Obtain an amount from a @a cmd.
- *
- * @param cmd command to extract the amount from.
- * @param index which amount to pick if @a cmd has multiple
- * on offer
- * @param[out] amount set to the amount.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_amount_obj (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_Amount **amount)
-{
- return cmd->traits (cmd->cls,
- (const void **) amount,
- TALER_TESTING_TRAIT_AMOUNT,
- index);
-}
-
-
-/**
- * Offer amount.
- *
- * @param index which amount to offer, in case there are
- * multiple available.
- * @param amount the amount to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_amount_obj (unsigned int index,
- const struct TALER_Amount *amount)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_AMOUNT,
- .ptr = (const void *) amount
- };
-
- return ret;
-}
-
-
-/* end of testing_api_trait_amount.c */
diff --git a/src/testing/testing_api_trait_blinding_key.c b/src/testing/testing_api_trait_blinding_key.c
deleted file mode 100644
index ae1889a1f..000000000
--- a/src/testing/testing_api_trait_blinding_key.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_blinding_key.c
- * @brief offer blinding keys as traits.
- * @author Christian Grothoff
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_BLINDING_KEY "blinding-key"
-
-
-/**
- * Obtain a blinding key from a @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index which coin to pick if @a cmd has multiple on offer.
- * @param[out] blinding_key set to the offered blinding key.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_blinding_key
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_DenominationBlindingKeyP **blinding_key)
-{
- return cmd->traits (cmd->cls,
- (const void **) blinding_key,
- TALER_TESTING_TRAIT_BLINDING_KEY,
- index);
-}
-
-
-/**
- * Offer blinding key.
- *
- * @param index index number to associate to the offered key.
- * @param blinding_key blinding key to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_blinding_key
- (unsigned int index,
- const struct TALER_DenominationBlindingKeyP *blinding_key)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_BLINDING_KEY,
- .ptr = (const void *) blinding_key
- };
-
- return ret;
-}
-
-
-/* end of testing_api_trait_blinding_key.c */
diff --git a/src/testing/testing_api_trait_cmd.c b/src/testing/testing_api_trait_cmd.c
deleted file mode 100644
index f24054713..000000000
--- a/src/testing/testing_api_trait_cmd.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_cmd.c
- * @brief offers CMDs as traits.
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_CMD "cmd"
-
-
-/**
- * Obtain a command from @a cmd.
- *
- * @param cmd command to extract the command from.
- * @param index always zero. Commands offering this
- * kind of traits do not need this index. For
- * example, a "batch" CMD returns always the
- * CMD currently being executed.
- * @param[out] _cmd where to write the wire details.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_cmd (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- struct TALER_TESTING_Command **_cmd)
-{
- return cmd->traits (cmd->cls,
- (const void **) _cmd,
- TALER_TESTING_TRAIT_CMD,
- index);
-}
-
-
-/**
- * Offer a command in a trait.
- *
- * @param index always zero. Commands offering this
- * kind of traits do not need this index. For
- * example, a "meta" CMD returns always the
- * CMD currently being executed.
- * @param cmd wire details to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_cmd (unsigned int index,
- const struct TALER_TESTING_Command *cmd)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_CMD,
- .ptr = (const struct TALER_TESTING_Command *) cmd
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_cmd.c */
diff --git a/src/testing/testing_api_trait_coin_priv.c b/src/testing/testing_api_trait_coin_priv.c
deleted file mode 100644
index 61a770cf6..000000000
--- a/src/testing/testing_api_trait_coin_priv.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_coin_priv.c
- * @brief coin priv traits.
- * @author Christian Grothoff
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_COIN_PRIVATE_KEY "coin-private-key"
-
-
-/**
- * Obtain a coin private key from a @a cmd.
- *
- * @param cmd command to extract trait from.
- * @param index index of the coin priv to obtain.
- * @param[out] coin_priv set to the private key of the coin.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_coin_priv
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_CoinSpendPrivateKeyP **coin_priv)
-{
- return cmd->traits (cmd->cls,
- (const void **) coin_priv,
- TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
- index);
-}
-
-
-/**
- * Offer coin private key.
- *
- * @param index index number to associate with offered coin priv.
- * @param coin_priv coin private key to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_coin_priv
- (unsigned int index,
- const struct TALER_CoinSpendPrivateKeyP *coin_priv)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
- .ptr = (const void *) coin_priv
- };
-
- return ret;
-}
-
-
-/* end of testing_api_trait_coin_priv.c */
diff --git a/src/testing/testing_api_trait_contract.c b/src/testing/testing_api_trait_contract.c
deleted file mode 100644
index 1e88cb86f..000000000
--- a/src/testing/testing_api_trait_contract.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2018-2020 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 testing/testing_api_trait_contract.c
- * @brief offers contract term trait.
- * @author Marcello Stanisci
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_testing_lib.h"
-
-
-/**
- * Contains a contract terms object as a json_t.
- */
-#define TALER_TESTING_TRAIT_CONTRACT_TERMS "contract-terms"
-
-
-/**
- * Obtain contract terms from @a cmd.
- *
- * @param cmd command to extract the contract terms from.
- * @param index contract terms index number.
- * @param[out] contract_terms where to write the contract terms.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_contract_terms (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const json_t **contract_terms)
-{
- return cmd->traits (cmd->cls,
- (const void **) contract_terms,
- TALER_TESTING_TRAIT_CONTRACT_TERMS,
- index);
-}
-
-
-/**
- * Offer contract terms.
- *
- * @param index contract terms index number.
- * @param contract_terms contract terms to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_contract_terms (unsigned int index,
- const json_t *contract_terms)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_CONTRACT_TERMS,
- .ptr = (const void *) contract_terms
- };
- return ret;
-}
diff --git a/src/testing/testing_api_trait_denom_pub.c b/src/testing/testing_api_trait_denom_pub.c
deleted file mode 100644
index f866588db..000000000
--- a/src/testing/testing_api_trait_denom_pub.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_denom_pub.c
- * @brief denom pub traits.
- * @author Christian Grothoff
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_DENOM_PUB "denomination-public-key"
-
-
-/**
- * Obtain a denomination public key from a @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index index number of the denom to obtain.
- * @param[out] denom_pub set to the offered denom pub.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_denom_pub (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct
- TALER_EXCHANGE_DenomPublicKey **denom_pub)
-{
- return cmd->traits (cmd->cls,
- (const void **) denom_pub,
- TALER_TESTING_TRAIT_DENOM_PUB,
- index);
-}
-
-
-/**
- * Make a trait for a denomination public key.
- *
- * @param index index number to associate to the offered denom pub.
- * @param denom_pub denom pub to offer with this trait.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_denom_pub (unsigned int index,
- const struct
- TALER_EXCHANGE_DenomPublicKey *denom_pub)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_DENOM_PUB,
- .ptr = (const void *) denom_pub
- };
-
- return ret;
-}
-
-
-/* end of testing_api_trait_denom_pub.c */
diff --git a/src/testing/testing_api_trait_denom_sig.c b/src/testing/testing_api_trait_denom_sig.c
deleted file mode 100644
index 07e89440e..000000000
--- a/src/testing/testing_api_trait_denom_sig.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_denom_sig.c
- * @brief offer denomination signatures as traits
- * @author Christian Grothoff
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_DENOM_SIG "denomination-signature"
-
-
-/**
- * Obtain a denomination signature from a @a cmd.
- *
- * @param cmd command to extract the denom sig from.
- * @param index index number associated with the denom sig.
- * @param[out] denom_sig set to the offered signature.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_denom_sig
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_DenominationSignature **denom_sig)
-{
- return cmd->traits (cmd->cls,
- (const void **) denom_sig,
- TALER_TESTING_TRAIT_DENOM_SIG,
- index);
-}
-
-
-/**
- * Offer denom sig.
- *
- * @param index index number to associate to the signature on
- * offer.
- * @param denom_sig the denom sig on offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_denom_sig
- (unsigned int index,
- const struct TALER_DenominationSignature *denom_sig)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_DENOM_SIG,
- .ptr = (const void *) denom_sig
- };
-
- return ret;
-}
-
-
-/* end of testing_api_trait_denom_sig.c */
diff --git a/src/testing/testing_api_trait_exchange_pub.c b/src/testing/testing_api_trait_exchange_pub.c
deleted file mode 100644
index 8c7027260..000000000
--- a/src/testing/testing_api_trait_exchange_pub.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_exchange_pub.c
- * @brief exchange pub traits.
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_EXCHANGE_PUB "exchange-public-key"
-
-
-/**
- * Obtain a exchange public key from a @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index index number of the exchange to obtain.
- * @param[out] exchange_pub set to the offered exchange pub.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_exchange_pub
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ExchangePublicKeyP **exchange_pub)
-{
- return cmd->traits (cmd->cls,
- (const void **) exchange_pub,
- TALER_TESTING_TRAIT_EXCHANGE_PUB,
- index);
-}
-
-
-/**
- * Make a trait for a exchange public key.
- *
- * @param index index number to associate to the offered exchange pub.
- * @param exchange_pub exchange pub to offer with this trait.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_exchange_pub
- (unsigned int index,
- const struct TALER_ExchangePublicKeyP *exchange_pub)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_EXCHANGE_PUB,
- .ptr = (const void *) exchange_pub
- };
-
- return ret;
-}
-
-
-/* end of testing_api_trait_exchange_pub.c */
diff --git a/src/testing/testing_api_trait_exchange_sig.c b/src/testing/testing_api_trait_exchange_sig.c
deleted file mode 100644
index 349454ae7..000000000
--- a/src/testing/testing_api_trait_exchange_sig.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_exchange_sig.c
- * @brief exchange pub traits.
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_EXCHANGE_SIG "exchange-online-signature"
-
-
-/**
- * Obtain a exchange signature (online sig) from a @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index index number of the exchange to obtain.
- * @param[out] exchange_sig set to the offered exchange signature.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_exchange_sig
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ExchangeSignatureP **exchange_sig)
-{
- return cmd->traits (cmd->cls,
- (const void **) exchange_sig,
- TALER_TESTING_TRAIT_EXCHANGE_SIG,
- index);
-}
-
-
-/**
- * Make a trait for a exchange signature.
- *
- * @param index index number to associate to the offered exchange pub.
- * @param exchange_sig exchange signature to offer with this trait.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_exchange_sig
- (unsigned int index,
- const struct TALER_ExchangeSignatureP *exchange_sig)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_EXCHANGE_SIG,
- .ptr = (const void *) exchange_sig
- };
-
- return ret;
-}
-
-
-/* end of testing_api_trait_exchange_sig.c */
diff --git a/src/testing/testing_api_trait_fresh_coin.c b/src/testing/testing_api_trait_fresh_coin.c
deleted file mode 100644
index e5f1c6827..000000000
--- a/src/testing/testing_api_trait_fresh_coin.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_fresh_coin.c
- * @brief traits to offer fresh conins (after "melt" operations)
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_FRESH_COINS "fresh-coins"
-
-/**
- * Get a array of fresh coins.
- *
- * @param cmd command to extract the fresh coin from.
- * @param index which array to pick if @a cmd has multiple
- * on offer.
- * @param[out] fresh_coins will point to the offered array.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_fresh_coins
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_TESTING_FreshCoinData **fresh_coins)
-{
- return cmd->traits (cmd->cls,
- (const void **) fresh_coins,
- TALER_TESTING_TRAIT_FRESH_COINS,
- index);
-}
-
-
-/**
- * Offer a _array_ of fresh coins.
- *
- * @param index which array of fresh coins to offer,
- * if there are multiple on offer. Typically passed as
- * zero.
- * @param fresh_coins the array of fresh coins to offer
- * @return the trait,
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_fresh_coins
- (unsigned int index,
- const struct TALER_TESTING_FreshCoinData *fresh_coins)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_FRESH_COINS,
- .ptr = (const void *) fresh_coins
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_fresh_coin.c */
diff --git a/src/testing/testing_api_trait_json.c b/src/testing/testing_api_trait_json.c
deleted file mode 100644
index e12f1e9a1..000000000
--- a/src/testing/testing_api_trait_json.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_json.c
- * @brief offers JSON traits.
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_WIRE_DETAILS "wire-details"
-#define TALER_TESTING_TRAIT_EXCHANGE_KEYS "exchange-keys"
-#define TALER_TESTING_TRAIT_JSON "json"
-
-/**
- * Obtain serialized exchange keys from @a cmd.
- *
- * @param cmd command to extract the keys from.
- * @param index index number associate with the keys on offer.
- * @param[out] keys where to write the serialized keys.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_exchange_keys
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const json_t **keys)
-{
- return cmd->traits (cmd->cls,
- (const void **) keys,
- TALER_TESTING_TRAIT_EXCHANGE_KEYS,
- index);
-}
-
-
-/**
- * Offer serialized keys in a trait.
- *
- * @param index index number associate with the serial keys
- * on offer.
- * @param keys serialized keys to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_exchange_keys
- (unsigned int index,
- const json_t *keys)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_EXCHANGE_KEYS,
- .ptr = (const json_t *) keys
- };
- return ret;
-}
-
-
-/**
- * Obtain wire details from @a cmd.
- *
- * @param cmd command to extract the wire details from.
- * @param index index number associate with the wire details
- * on offer; usually zero, as one command sticks to
- * one bank account.
- * @param[out] wire_details where to write the wire details.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_wire_details
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const json_t **wire_details)
-{
- return cmd->traits (cmd->cls,
- (const void **) wire_details,
- TALER_TESTING_TRAIT_WIRE_DETAILS,
- index);
-}
-
-
-/**
- * Offer wire details in a trait.
- *
- * @param index index number associate with the wire details
- * on offer; usually zero, as one command sticks to
- * one bank account.
- * @param wire_details wire details to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_wire_details
- (unsigned int index,
- const json_t *wire_details)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_WIRE_DETAILS,
- .ptr = (const json_t *) wire_details
- };
- return ret;
-}
-
-
-/**
- * Obtain json from @a cmd.
- *
- * @param cmd command to extract the json from.
- * @param index index number associate with the json on offer.
- * @param[out] json where to write the json.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_json (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const json_t **json)
-{
- return cmd->traits (cmd->cls,
- (const void **) json,
- TALER_TESTING_TRAIT_JSON,
- index);
-}
-
-
-/**
- * Offer json in a trait.
- *
- * @param index index number associate with the json
- * on offer.
- * @param json json to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_json (unsigned int index,
- const json_t *json)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_JSON,
- .ptr = (const json_t *) json
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_json.c */
diff --git a/src/testing/testing_api_trait_merchant_key.c b/src/testing/testing_api_trait_merchant_key.c
deleted file mode 100644
index 41b6b8883..000000000
--- a/src/testing/testing_api_trait_merchant_key.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_merchant_key.c
- * @brief traits to offer peer's (private) keys
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_MERCHANT_PRIV "merchant-priv"
-#define TALER_TESTING_TRAIT_MERCHANT_PUB "merchant-pub-pub"
-
-/**
- * Obtain a private key from a "peer". Used e.g. to obtain
- * a merchant's priv to sign a /track request.
- *
- * @param cmd command that is offering the key.
- * @param index (typically zero) which key to return if there
- * are multiple on offer.
- * @param[out] priv set to the key coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_merchant_priv
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_MerchantPrivateKeyP **priv)
-{
- return cmd->traits (cmd->cls,
- (const void **) priv,
- TALER_TESTING_TRAIT_MERCHANT_PRIV,
- index);
-}
-
-
-/**
- * Offer private key, typically done when CMD_1 needs it to
- * sign a request.
- *
- * @param index (typically zero) which key to return if there are
- * multiple on offer.
- * @param priv which object should be offered.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_merchant_priv (unsigned int index,
- const struct
- TALER_MerchantPrivateKeyP *priv)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_MERCHANT_PRIV,
- .ptr = (const void *) priv
- };
-
- return ret;
-}
-
-
-/**
- * Obtain a public key from a "peer". Used e.g. to obtain
- * a merchant's public key to use backend's API.
- *
- * @param cmd command offering the key.
- * @param index (typically zero) which key to return if there
- * are multiple on offer.
- * @param[out] pub set to the key coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_merchant_pub
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_MerchantPublicKeyP **pub)
-{
- return cmd->traits (cmd->cls,
- (const void **) pub,
- TALER_TESTING_TRAIT_MERCHANT_PUB,
- index);
-}
-
-
-/**
- * Offer public key.
- *
- * @param index (typically zero) which key to return if there
- * are multiple on offer. NOTE: if one key is offered, it
- * is mandatory to set this as zero.
- * @param pub which object should be returned.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_merchant_pub (unsigned int index,
- const struct
- TALER_MerchantPublicKeyP *pub)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_MERCHANT_PUB,
- .ptr = (const void *) pub
- };
-
- return ret;
-}
-
-
-/* end of testing_api_trait_merchant_key.c */
diff --git a/src/testing/testing_api_trait_number.c b/src/testing/testing_api_trait_number.c
deleted file mode 100644
index ed25593ef..000000000
--- a/src/testing/testing_api_trait_number.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2018-2020 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 testing/testing_api_trait_number.c
- * @brief traits to offer numbers
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_UINT "uint"
-#define TALER_TESTING_TRAIT_UINT32 "uint-32"
-#define TALER_TESTING_TRAIT_UINT64 "uint-64"
-#define TALER_TESTING_TRAIT_INT64 "int-64"
-#define TALER_TESTING_TRAIT_BANK_ROW "bank-transaction-row"
-
-
-/**
- * Obtain a number from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] n set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_uint (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const unsigned int **n)
-{
- return cmd->traits (cmd->cls,
- (const void **) n,
- TALER_TESTING_TRAIT_UINT,
- index);
-}
-
-
-/**
- * Offer a number.
- *
- * @param index the number's index number.
- * @param n the number to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_uint (unsigned int index,
- const unsigned int *n)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_UINT,
- .ptr = (const void *) n
- };
- return ret;
-}
-
-
-/**
- * Obtain a "number" value from @a cmd, 32-bit version.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] n set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_uint32 (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const uint32_t **n)
-{
- return cmd->traits (cmd->cls,
- (const void **) n,
- TALER_TESTING_TRAIT_UINT32,
- index);
-}
-
-
-/**
- * Offer number trait, 32-bit version.
- *
- * @param index the number's index number.
- * @param n number to offer.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_uint32 (unsigned int index,
- const uint32_t *n)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_UINT32,
- .ptr = (const void *) n
- };
- return ret;
-}
-
-
-/**
- * Obtain a "number" value from @a cmd, 64-bit version.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] n set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_uint64 (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const uint64_t **n)
-{
- return cmd->traits (cmd->cls,
- (const void **) n,
- TALER_TESTING_TRAIT_UINT64,
- index);
-}
-
-
-/**
- * Offer number trait, 64-bit version.
- *
- * @param index the number's index number.
- * @param n number to offer.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_uint64 (unsigned int index,
- const uint64_t *n)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_UINT64,
- .ptr = (const void *) n
- };
- return ret;
-}
-
-
-/**
- * Obtain a "number" value from @a cmd, 64-bit signed version.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param[out] n set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_int64 (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const int64_t **n)
-{
- return cmd->traits (cmd->cls,
- (const void **) n,
- TALER_TESTING_TRAIT_INT64,
- index);
-}
-
-
-/**
- * Offer number trait, 64-bit signed version.
- *
- * @param index the number's index number.
- * @param n number to offer.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_int64 (unsigned int index,
- const int64_t *n)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_INT64,
- .ptr = (const void *) n
- };
- return ret;
-}
-
-
-/**
- * Obtain a bank transaction row value from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param[out] row set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_bank_row (const struct TALER_TESTING_Command *cmd,
- const uint64_t **row)
-{
- return cmd->traits (cmd->cls,
- (const void **) row,
- TALER_TESTING_TRAIT_BANK_ROW,
- 0);
-}
-
-
-/**
- * Offer bank transaction row trait.
- *
- * @param row number to offer.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_bank_row (const uint64_t *row)
-{
- struct TALER_TESTING_Trait ret = {
- .index = 0,
- .trait_name = TALER_TESTING_TRAIT_BANK_ROW,
- .ptr = (const void *) row
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_number.c */
diff --git a/src/testing/testing_api_trait_process.c b/src/testing/testing_api_trait_process.c
deleted file mode 100644
index 3d2af31fd..000000000
--- a/src/testing/testing_api_trait_process.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_process.c
- * @brief trait offering process handles.
- * @author Christian Grothoff
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_PROCESS "process"
-
-
-/**
- * Obtain location where a command stores a pointer to a process.
- *
- * @param cmd command to extract trait from.
- * @param index which process to pick if @a cmd
- * has multiple on offer.
- * @param[out] processp set to the address of the pointer to the
- * process.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_process
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- struct GNUNET_OS_Process ***processp)
-{
- return cmd->traits (cmd->cls,
- (const void **) processp,
- TALER_TESTING_TRAIT_PROCESS,
- index);
-}
-
-
-/**
- * Offer location where a command stores a pointer to a process.
- *
- * @param index offered location index number, in case there are
- * multiple on offer.
- * @param processp process location to offer.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_process
- (unsigned int index,
- struct GNUNET_OS_Process **processp)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_PROCESS,
- .ptr = (const void *) processp
- };
-
- return ret;
-}
-
-
-/* end of testing_api_trait_process.c */
diff --git a/src/testing/testing_api_trait_reserve_history.c b/src/testing/testing_api_trait_reserve_history.c
deleted file mode 100644
index b458dbd66..000000000
--- a/src/testing/testing_api_trait_reserve_history.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2018-2020 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 testing/testing_api_trait_reserve_history.c
- * @brief implements reserve hostry trait
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_RESERVE_HISTORY \
- "reserve-history-entry"
-
-
-/**
- * Obtain a reserve history entry from a @a cmd.
- *
- * @param cmd command to extract the reserve history from.
- * @param index reserve history's index number.
- * @param[out] rhp set to the reserve history.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_reserve_history (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_EXCHANGE_ReserveHistory **rhp)
-{
- return cmd->traits (cmd->cls,
- (const void **) rhp,
- TALER_TESTING_TRAIT_RESERVE_HISTORY,
- index);
-}
-
-
-/**
- * Offer a reserve history entry.
- *
- * @param index reserve pubs's index number.
- * @param rh reserve history entry to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_reserve_history (
- unsigned int index,
- const struct TALER_EXCHANGE_ReserveHistory *rh)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_RESERVE_HISTORY,
- .ptr = (const void *) rh
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_reserve_history.c */
diff --git a/src/testing/testing_api_trait_reserve_priv.c b/src/testing/testing_api_trait_reserve_priv.c
deleted file mode 100644
index f4a4ef500..000000000
--- a/src/testing/testing_api_trait_reserve_priv.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_reserve_priv.c
- * @brief implements reserve private key trait
- * @author Christian Grothoff
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_RESERVE_PRIVATE_KEY \
- "reserve-private-key"
-
-/**
- * Obtain a reserve private key from a @a cmd.
- *
- * @param cmd command to extract the reserve priv from.
- * @param index reserve priv's index number.
- * @param[out] reserve_priv set to the reserve priv.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_reserve_priv
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ReservePrivateKeyP **reserve_priv)
-{
- return cmd->traits (cmd->cls,
- (const void **) reserve_priv,
- TALER_TESTING_TRAIT_RESERVE_PRIVATE_KEY,
- index);
-}
-
-
-/**
- * Offer a reserve private key.
- *
- * @param index reserve priv's index number.
- * @param reserve_priv reserve private key to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_reserve_priv
- (unsigned int index,
- const struct TALER_ReservePrivateKeyP *reserve_priv)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_RESERVE_PRIVATE_KEY,
- .ptr = (const void *) reserve_priv
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_reserve_priv.c */
diff --git a/src/testing/testing_api_trait_reserve_pub.c b/src/testing/testing_api_trait_reserve_pub.c
deleted file mode 100644
index 743a10e96..000000000
--- a/src/testing/testing_api_trait_reserve_pub.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2018-2020 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 testing/testing_api_trait_reserve_pub.c
- * @brief implements reserve public key trait
- * @author Christian Grothoff
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_RESERVE_PUBLIC_KEY \
- "reserve-public-key"
-
-/**
- * Obtain a reserve public key from a @a cmd.
- *
- * @param cmd command to extract the reserve pub from.
- * @param index reserve pub's index number.
- * @param[out] reserve_pub set to the reserve pub.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_reserve_pub
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ReservePublicKeyP **reserve_pub)
-{
- if (NULL == cmd->traits)
- return GNUNET_SYSERR;
- return cmd->traits (cmd->cls,
- (const void **) reserve_pub,
- TALER_TESTING_TRAIT_RESERVE_PUBLIC_KEY,
- index);
-}
-
-
-/**
- * Offer a reserve public key.
- *
- * @param index reserve pub's index number.
- * @param reserve_pub reserve public key to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_reserve_pub
- (unsigned int index,
- const struct TALER_ReservePublicKeyP *reserve_pub)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_RESERVE_PUBLIC_KEY,
- .ptr = (const void *) reserve_pub
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_reserve_pub.c */
diff --git a/src/testing/testing_api_trait_string.c b/src/testing/testing_api_trait_string.c
deleted file mode 100644
index b102265e8..000000000
--- a/src/testing/testing_api_trait_string.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2018-2020 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 testing/testing_api_trait_string.c
- * @brief offers strings traits.
- * @author Marcello Stanisci
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-/**
- * Some string. Avoid, use something more precise!
- */
-#define TALER_TESTING_TRAIT_STRING "string"
-
-/**
- * An HTTP-URL.
- */
-#define TALER_TESTING_TRAIT_URL "url"
-
-/**
- * A PAYTO-URL.
- */
-#define TALER_TESTING_TRAIT_PAYTO "payto"
-
-/**
- * String identifying an order.
- */
-#define TALER_TESTING_TRAIT_ORDER_ID "order-id"
-
-
-/**
- * Obtain a string from @a cmd.
- *
- * @param cmd command to extract the subject from.
- * @param index index number associated with the transfer
- * subject to offer.
- * @param[out] s where to write the offered
- * string
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_string (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const char **s)
-{
- return cmd->traits (cmd->cls,
- (const void **) s,
- TALER_TESTING_TRAIT_STRING,
- index);
-}
-
-
-/**
- * Offer string.
- *
- * @param index index number associated with the transfer
- * subject being offered.
- * @param s transfer subject to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_string (unsigned int index,
- const char *s)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_STRING,
- .ptr = (const void *) s
- };
- return ret;
-}
-
-
-/**
- * Obtain a HTTP url from @a cmd.
- *
- * @param cmd command to extract the url from.
- * @param index which url is to be picked, in case
- * multiple are offered.
- * @param[out] url where to write the url.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_url (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const char **url)
-{
- return cmd->traits (cmd->cls,
- (const void **) url,
- TALER_TESTING_TRAIT_URL,
- index);
-}
-
-
-/**
- * Offer HTTP url in a trait.
- *
- * @param index which url is to be picked,
- * in case multiple are offered.
- * @param url the url to offer.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_url (unsigned int index,
- const char *url)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_URL,
- .ptr = (const void *) url
- };
-
- GNUNET_assert ( (NULL == url) ||
- (0 != strncasecmp (url,
- "payto://",
- strlen ("payto://"))) );
- return ret;
-}
-
-
-/**
- * Obtain a order id from @a cmd.
- *
- * @param cmd command to extract the order id from.
- * @param index which order id is to be picked, in case
- * multiple are offered.
- * @param[out] order_id where to write the order id.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_order_id (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const char **order_id)
-{
- return cmd->traits (cmd->cls,
- (const void **) order_id,
- TALER_TESTING_TRAIT_ORDER_ID,
- index);
-}
-
-
-/**
- * Offer order id in a trait.
- *
- * @param index which order id is to be offered,
- * in case multiple are offered.
- * @param order_id the order id to offer.
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_order_id (unsigned int index,
- const char *order_id)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_ORDER_ID,
- .ptr = (const void *) order_id
- };
- return ret;
-}
-
-
-/**
- * Obtain a PAYTO-url from @a cmd.
- *
- * @param cmd command to extract the url from.
- * @param pt which url is to be picked, in case
- * multiple are offered.
- * @param[out] url where to write the url.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_payto (const struct TALER_TESTING_Command *cmd,
- enum TALER_TESTING_PaytoType pt,
- const char **url)
-{
- return cmd->traits (cmd->cls,
- (const void **) url,
- TALER_TESTING_TRAIT_PAYTO,
- (unsigned int) pt);
-}
-
-
-/**
- * Offer a "payto" URL reference.
- *
- * @param pt which reference is to be offered,
- * in case multiple are offered.
- * @param payto_uri the payto URI
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_payto (enum TALER_TESTING_PaytoType pt,
- const char *payto_uri)
-{
- struct TALER_TESTING_Trait ret = {
- .index = (unsigned int) pt,
- .trait_name = TALER_TESTING_TRAIT_PAYTO,
- .ptr = (const void *) payto_uri,
- };
-
- GNUNET_assert (0 == strncasecmp (payto_uri,
- "payto://",
- strlen ("payto://")));
- return ret;
-}
-
-
-/* end of testing_api_trait_string.c */
diff --git a/src/testing/testing_api_trait_time.c b/src/testing/testing_api_trait_time.c
deleted file mode 100644
index 207246bed..000000000
--- a/src/testing/testing_api_trait_time.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_time.c
- * @brief traits to offer time stamps.
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_TIME_ABS "time-abs"
-#define TALER_TESTING_TRAIT_TIME_REL "time-rel"
-
-/**
- * Obtain a absolute time from @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index which time stamp to pick if
- * @a cmd has multiple on offer.
- * @param[out] time set to the wanted WTID.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_absolute_time
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_TIME_Absolute **time)
-{
- return cmd->traits (cmd->cls,
- (const void **) time,
- TALER_TESTING_TRAIT_TIME_ABS,
- index);
-}
-
-
-/**
- * Offer a absolute time.
- *
- * @param index associate the object with this index
- * @param time which object should be returned
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_absolute_time
- (unsigned int index,
- const struct GNUNET_TIME_Absolute *time)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_TIME_ABS,
- .ptr = (const void *) time
- };
- return ret;
-}
-
-
-/**
- * Obtain a relative time from @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index which time to pick if
- * @a cmd has multiple on offer.
- * @param[out] time set to the wanted WTID.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_relative_time (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_TIME_Relative **time)
-{
- return cmd->traits (cmd->cls,
- (const void **) time,
- TALER_TESTING_TRAIT_TIME_REL,
- index);
-}
-
-
-/**
- * Offer a relative time.
- *
- * @param index associate the object with this index
- * @param time which object should be returned
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_relative_time (
- unsigned int index,
- const struct GNUNET_TIME_Relative *time)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_TIME_REL,
- .ptr = (const void *) time
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_time.c */
diff --git a/src/testing/testing_api_trait_uuid.c b/src/testing/testing_api_trait_uuid.c
deleted file mode 100644
index 4d5003ecd..000000000
--- a/src/testing/testing_api_trait_uuid.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2020 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 testing/testing_api_trait_uuid.c
- * @brief offer any trait that is passed over as a uuid.
- * @author Jonathan Buchanan
- */
-#include "platform.h"
-#include "taler_signatures.h"
-#include "taler_exchange_service.h"
-#include "taler_testing_lib.h"
-
-
-#define TALER_TESTING_TRAIT_UUID "uuid"
-#define TALER_TESTING_TRAIT_CLAIM_TOKEN "claim_token"
-
-
-/**
- * Obtain a uuid from @a cmd.
- *
- * @param cmd command to extract the uuid from.
- * @param index which amount to pick if @a cmd has multiple
- * on offer
- * @param[out] uuid where to write the uuid.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_uuid (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- struct GNUNET_Uuid **uuid)
-{
- return cmd->traits (cmd->cls,
- (const void **) uuid,
- TALER_TESTING_TRAIT_UUID,
- index);
-}
-
-
-/**
- * Offer a uuid in a trait.
- *
- * @param index which uuid to offer, in case there are
- * multiple available.
- * @param uuid the uuid to offer.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_uuid (unsigned int index,
- const struct GNUNET_Uuid *uuid)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_UUID,
- .ptr = (const void *) uuid
- };
- return ret;
-}
-
-
-/**
- * Obtain a claim token from @a cmd.
- *
- * @param cmd command to extract the token from.
- * @param index which amount to pick if @a cmd has multiple
- * on offer
- * @param[out] ct where to write the token.
- * @return #GNUNET_OK on success.
- */
-int
-TALER_TESTING_get_trait_claim_token (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_ClaimTokenP **ct)
-{
- return cmd->traits (cmd->cls,
- (const void **) ct,
- TALER_TESTING_TRAIT_CLAIM_TOKEN,
- index);
-}
-
-
-/**
- * Offer a claim token in a trait.
- *
- * @param index which token to offer, in case there are
- * multiple available.
- * @param ct the token to offer.
- *
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_claim_token (unsigned int index,
- const struct TALER_ClaimTokenP *ct)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_CLAIM_TOKEN,
- .ptr = (const void *) ct
- };
- return ret;
-}
diff --git a/src/testing/testing_api_trait_wtid.c b/src/testing/testing_api_trait_wtid.c
deleted file mode 100644
index 5c7e7060e..000000000
--- a/src/testing/testing_api_trait_wtid.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- This file is part of TALER
- Copyright (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 testing/testing_api_trait_number.c
- * @brief traits to offer numbers
- * @author Marcello Stanisci
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
-
-#define TALER_TESTING_TRAIT_WTID "wtid"
-
-/**
- * Obtain a WTID value from @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index which WTID to pick if @a cmd has multiple on
- * offer
- * @param[out] wtid set to the wanted WTID.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_wtid
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_WireTransferIdentifierRawP **wtid)
-{
- return cmd->traits (cmd->cls,
- (const void **) wtid,
- TALER_TESTING_TRAIT_WTID,
- index);
-}
-
-
-/**
- * Offer a WTID.
- *
- * @param index associate the object with this index
- * @param wtid which object should be returned
- * @return the trait.
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_wtid
- (unsigned int index,
- const struct TALER_WireTransferIdentifierRawP *wtid)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = TALER_TESTING_TRAIT_WTID,
- .ptr = (const void *) wtid
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_number.c */
diff --git a/src/testing/testing_api_traits.c b/src/testing/testing_api_traits.c
index 6d623af7a..db94e81a5 100644
--- a/src/testing/testing_api_traits.c
+++ b/src/testing/testing_api_traits.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2018 Taler Systems SA
+ Copyright (C) 2018, 2021 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
@@ -29,6 +29,11 @@
#include "taler_testing_lib.h"
+TALER_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_IMPL_SIMPLE_TRAIT)
+
+TALER_TESTING_INDEXED_TRAITS (TALER_TESTING_MAKE_IMPL_INDEXED_TRAIT)
+
+
/**
* End a trait array. Usually, commands offer several traits,
* and put them in arrays.
@@ -46,16 +51,7 @@ TALER_TESTING_trait_end ()
}
-/**
- * Pick the chosen trait from the traits array.
- *
- * @param traits the traits array.
- * @param ret where to store the result.
- * @param trait type of the trait to extract.
- * @param index index number of the object to extract.
- * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
- */
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
const void **ret,
const char *trait,
@@ -63,7 +59,8 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
{
for (unsigned int i = 0; NULL != traits[i].trait_name; i++)
{
- if ( (0 == strcmp (trait, traits[i].trait_name)) &&
+ if ( (0 == strcmp (trait,
+ traits[i].trait_name)) &&
(index == traits[i].index) )
{
*ret = (void *) traits[i].ptr;
@@ -72,8 +69,8 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Trait %s/%u not found.\n",
- trait, index);
-
+ trait,
+ index);
return GNUNET_SYSERR;
}