aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/test_taler_exchange_aggregator.c393
1 files changed, 0 insertions, 393 deletions
diff --git a/src/lib/test_taler_exchange_aggregator.c b/src/lib/test_taler_exchange_aggregator.c
index 01203ab86..3ad14d34f 100644
--- a/src/lib/test_taler_exchange_aggregator.c
+++ b/src/lib/test_taler_exchange_aggregator.c
@@ -40,179 +40,6 @@ static struct TALER_TESTING_ExchangeConfiguration ec;
static struct TALER_TESTING_BankConfiguration bc;
/**
- * Commands for the interpreter.
- */
-enum OpCode
-{
-
- /**
- * Terminate testcase with 'skipped' result.
- */
- OPCODE_TERMINATE_SKIP,
-
- /**
- * Run taler-exchange-aggregator.
- */
- OPCODE_RUN_AGGREGATOR,
-
- /**
- * Expect that we have exhaustively gone over all transactions.
- */
- OPCODE_EXPECT_TRANSACTIONS_EMPTY,
-
- /**
- * Execute deposit operation against database.
- */
- OPCODE_DATABASE_DEPOSIT,
-
- /**
- * Wait a certain amount of time.
- */
- OPCODE_WAIT,
-
- /**
- * Expect that we have received the specified transaction.
- */
- OPCODE_EXPECT_TRANSACTION,
-
- /**
- * Finish testcase with success.
- */
- OPCODE_TERMINATE_SUCCESS
-};
-
-/**
- * Command state for the interpreter.
- */
-struct Command
-{
-
- /**
- * What instruction should we run?
- */
- enum OpCode opcode;
-
- /**
- * Human-readable label for the command.
- */
- const char *label;
-
- union
- {
-
- /**
- * If @e opcode is #OPCODE_EXPECT_TRANSACTION, this
- * specifies which transaction we expected. Note that
- * the WTID will be set, not checked!
- */
- struct
- {
-
- /**
- * Amount to be transferred.
- */
- const char *amount;
-
- /**
- * Account to debit.
- */
- uint64_t debit_account;
-
- /**
- * Account to credit.
- */
- uint64_t credit_account;
-
- /**
- * Base URL of the exchange.
- */
- const char *exchange_base_url;
-
- /**
- * Subject of the transfer, set by the command.
- */
- struct TALER_WireTransferIdentifierRawP wtid;
-
- } expect_transaction;
-
- /**
- * If @e opcode is #OPCODE_DATABASE_DEPOST, this
- * specifies which deposit operation we should fake.
- */
- struct
- {
-
- /**
- * Each merchant name is automatically mapped to a unique
- * merchant public key.
- */
- const char *merchant_name;
-
- /**
- * Merchant account number, is mapped to wire details.
- */
- uint64_t merchant_account;
-
- /**
- * By when does the merchant request the funds to be wired.
- */
- struct GNUNET_TIME_Relative wire_deadline;
-
- /**
- * What is the total amount (including exchange fees).
- */
- const char *amount_with_fee;
-
- /**
- * How high are the exchange fees? Must be smaller than @e amount_with_fee.
- */
- const char *deposit_fee;
-
- } deposit;
-
- /**
- * How long should we wait if the opcode is #OPCODE_WAIT.
- */
- struct GNUNET_TIME_Relative wait_delay;
-
- } details;
-
-};
-
-
-/**
- * State of the interpreter.
- */
-struct State
-{
- /**
- * Array of commands to run.
- */
- struct Command*commands;
-
- /**
- * Offset of the next command to be run.
- */
- unsigned int ioff;
-};
-
-
-/**
- * Pipe used to communicate child death via signal.
- */
-static struct GNUNET_DISK_PipeHandle *sigpipe;
-
-/**
- * ID of task called whenever we get a SIGCHILD.
- */
-static struct GNUNET_SCHEDULER_Task *child_death_task;
-
-/**
- * ID of task called whenever we time out.
- */
-static struct GNUNET_SCHEDULER_Task *timeout_task;
-
-/**
* Return value from main().
*/
static int result;
@@ -233,22 +60,6 @@ static struct TALER_EXCHANGEDB_Plugin *plugin;
static struct TALER_EXCHANGEDB_Session *session;
/**
- * The handle for the aggregator process that we are testing.
- */
-static struct GNUNET_OS_Process *aggregator_proc;
-
-/**
- * State of our interpreter while we are running the aggregator
- * process.
- */
-static struct State *aggregator_state;
-
-/**
- * Task running the interpreter().
- */
-static struct GNUNET_SCHEDULER_Task *int_task;
-
-/**
* Private key we use for fake coins.
*/
static struct GNUNET_CRYPTO_RsaPrivateKey *coin_pk;
@@ -259,101 +70,6 @@ static struct GNUNET_CRYPTO_RsaPrivateKey *coin_pk;
static struct GNUNET_CRYPTO_RsaPublicKey *coin_pub;
/**
- * Handle for our fake bank.
- */
-static struct TALER_FAKEBANK_Handle *fb;
-
-/**
- * Task triggered whenever we are to shutdown.
- *
- * @param cls closure, NULL if we need to self-restart
- */
-static void
-timeout_action (void *cls)
-{
- timeout_task = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Test failed: timeout\n");
- result = 2;
- GNUNET_SCHEDULER_shutdown ();
-}
-
-
-/**
- * Task triggered whenever we are to shutdown.
- *
- * @param cls closure, NULL if we need to self-restart
- */
-static void
-shutdown_action (void *cls)
-{
- if (NULL != timeout_task)
- {
- GNUNET_SCHEDULER_cancel (timeout_task);
- timeout_task = NULL;
- }
- if (NULL != int_task)
- {
- GNUNET_SCHEDULER_cancel (int_task);
- int_task = NULL;
- }
- if (NULL != fb)
- {
- TALER_FAKEBANK_stop (fb);
- fb = NULL;
- }
- if (NULL != child_death_task)
- {
- GNUNET_SCHEDULER_cancel (child_death_task);
- child_death_task = NULL;
- }
- if (NULL != aggregator_proc)
- {
- GNUNET_break (0 == GNUNET_OS_process_kill (aggregator_proc,
- SIGKILL));
- GNUNET_OS_process_wait (aggregator_proc);
- GNUNET_OS_process_destroy (aggregator_proc);
- aggregator_proc = NULL;
- }
- plugin->drop_tables (plugin->cls);
- TALER_EXCHANGEDB_plugin_unload (plugin);
- plugin = NULL;
-}
-
-#if 0
-
-/**
- * Task triggered whenever we receive a SIGCHLD (child
- * process died).
- *
- * @param cls closure, NULL if we need to self-restart
- */
-static void
-maint_child_death (void *cls)
-{
- const struct GNUNET_DISK_FileHandle *pr;
- char c[16];
- struct State *state;
-
- child_death_task = NULL;
- pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
- GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
- GNUNET_OS_process_wait (aggregator_proc);
- GNUNET_OS_process_destroy (aggregator_proc);
- aggregator_proc = NULL;
- aggregator_state->ioff++;
- state = aggregator_state;
- aggregator_state = NULL;
- child_death_task = GNUNET_SCHEDULER_add_read_file (
- GNUNET_TIME_UNIT_FOREVER_REL,
- pr,
- &maint_child_death, NULL);
-
- interpreter (state);
-}
-#endif
-
-/**
* Setup (fake) information about a coin used in deposit.
*
* @param[out] issue information to initialize with "valid" data
@@ -493,21 +209,6 @@ do_deposit (struct Command *cmd)
return ret;
}
-
-/**
- * Fail the testcase at the current command.
- */
-static void
-fail (struct Command *cmd)
-{
- fprintf (stderr,
- "Testcase failed at command `%s'\n",
- cmd->label);
- result = 2;
- GNUNET_SCHEDULER_shutdown ();
-}
-
-
/**
* Interprets the commands from the test program.
*
@@ -1204,100 +905,6 @@ run (void *cls,
}
-/**
- * Main function that will be run by the scheduler.
- *
- * @param cls closure with configuration
- */
-#if 0
-static void
-OLDrun (void *cls)
-{
- struct GNUNET_CONFIGURATION_Handle *cfg = cls;
- struct TALER_EXCHANGEDB_DenominationKeyInformationP issue;
- struct TALER_DenominationPublicKey dpk;
-
- plugin = TALER_EXCHANGEDB_plugin_load (cfg);
- if (NULL == plugin)
- {
- GNUNET_break (0);
- result = 77;
- return;
- }
- if (GNUNET_OK !=
- plugin->create_tables (plugin->cls))
- {
- GNUNET_break (0);
- TALER_EXCHANGEDB_plugin_unload (plugin);
- plugin = NULL;
- result = 77;
- return;
- }
- session = plugin->get_session (plugin->cls);
- GNUNET_assert (NULL != session);
- fake_issue (&issue);
- dpk.rsa_public_key = coin_pub;
- GNUNET_CRYPTO_rsa_public_key_hash (dpk.rsa_public_key,
- &issue.properties.denom_hash);
- if ( (GNUNET_OK !=
- plugin->start (plugin->cls,
- session,
- "aggregator-test-2")) ||
- (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->insert_denomination_info (plugin->cls,
- session,
- &dpk,
- &issue)) ||
- (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
- plugin->commit (plugin->cls,
- session)) )
- {
- GNUNET_break (0);
- TALER_EXCHANGEDB_plugin_unload (plugin);
- plugin = NULL;
- result = 77;
- return;
- }
- child_death_task =
- GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_DISK_pipe_handle (sigpipe,
- GNUNET_DISK_PIPE_END_READ),
- &maint_child_death,
- NULL);
- GNUNET_SCHEDULER_add_shutdown (&shutdown_action,
- NULL);
- timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
- &timeout_action,
- NULL);
- result = 1; /* test failed for undefined reason */
- fb = TALER_FAKEBANK_start (8082);
- if (NULL == fb)
- {
- GNUNET_SCHEDULER_shutdown ();
- result = 77;
- return;
- }
- run_test ();
-}
-#endif
-
-/**
- * Signal handler called for SIGCHLD. Triggers the
- * respective handler by writing to the trigger pipe.
- */
-static void
-sighandler_child_death ()
-{
- static char c;
- int old_errno = errno; /* back-up errno */
-
- GNUNET_break (1 ==
- GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle
- (sigpipe, GNUNET_DISK_PIPE_END_WRITE),
- &c, sizeof (c)));
- errno = old_errno; /* restore errno */
-}
-
int
main (int argc,
char *const argv[])