From 42bc31744b9810509aef344c54bfee2f4e2a7ccb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 4 Feb 2020 21:59:43 +0100 Subject: implement /config in fakebank and taler_bank_lib.h (#6066) --- src/testing/test_taler_exchange_aggregator.c | 78 +++++++++++++++------------- 1 file changed, 42 insertions(+), 36 deletions(-) (limited to 'src/testing/test_taler_exchange_aggregator.c') diff --git a/src/testing/test_taler_exchange_aggregator.c b/src/testing/test_taler_exchange_aggregator.c index c709e5fe9..2e8a35ce2 100644 --- a/src/testing/test_taler_exchange_aggregator.c +++ b/src/testing/test_taler_exchange_aggregator.c @@ -57,36 +57,6 @@ static char *config_filename; #define USER42_ACCOUNT "42" -/** - * @return GNUNET_NO if database could not be prepared, - * otherwise GNUNET_OK - */ -static int -prepare_database (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) -{ - dbc.plugin = TALER_EXCHANGEDB_plugin_load (cfg); - if (NULL == dbc.plugin) - { - GNUNET_break (0); - result = 77; - return GNUNET_NO; - } - if (GNUNET_OK != - dbc.plugin->create_tables (dbc.plugin->cls)) - { - GNUNET_break (0); - TALER_EXCHANGEDB_plugin_unload (dbc.plugin); - dbc.plugin = NULL; - result = 77; - return GNUNET_NO; - } - dbc.session = dbc.plugin->get_session (dbc.plugin->cls); - GNUNET_assert (NULL != dbc.session); - - return GNUNET_OK; -} - /** * Collects all the tests. @@ -454,6 +424,48 @@ run (void *cls, } +/** + * Prepare database an launch the test. + * + * @param cls unused + * @param cfg our configuration + * @return #GNUNET_NO if database could not be prepared, + * otherwise #GNUNET_OK + */ +static int +prepare_database (void *cls, + const struct GNUNET_CONFIGURATION_Handle *cfg) +{ + dbc.plugin = TALER_EXCHANGEDB_plugin_load (cfg); + if (NULL == dbc.plugin) + { + GNUNET_break (0); + result = 77; + return GNUNET_NO; + } + if (GNUNET_OK != + dbc.plugin->create_tables (dbc.plugin->cls)) + { + GNUNET_break (0); + TALER_EXCHANGEDB_plugin_unload (dbc.plugin); + dbc.plugin = NULL; + result = 77; + return GNUNET_NO; + } + dbc.session = dbc.plugin->get_session (dbc.plugin->cls); + GNUNET_assert (NULL != dbc.session); + + result = TALER_TESTING_setup (&run, + NULL, + cfg, + NULL, // no exchange process handle. + GNUNET_NO); // do not try to connect to the exchange + + + return GNUNET_OK; +} + + int main (int argc, char *const argv[]) @@ -507,12 +519,6 @@ main (int argc, return result; } - result = TALER_TESTING_setup (&run, - NULL, - config_filename, - NULL, // no exchange process handle. - GNUNET_NO); // do not try to connect to the exchange - GNUNET_free (config_filename); GNUNET_free (testname); dbc.plugin->drop_tables (dbc.plugin->cls); -- cgit v1.2.3