summaryrefslogtreecommitdiff
path: root/src/testing/test_taler_exchange_aggregator.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-02-04 21:59:43 +0100
committerChristian Grothoff <christian@grothoff.org>2020-02-04 21:59:43 +0100
commit42bc31744b9810509aef344c54bfee2f4e2a7ccb (patch)
tree92ece6674b23f5e985755992a2ddb840cdd2de7f /src/testing/test_taler_exchange_aggregator.c
parente6d6987e5685b35f6c3137f59894a02a63d09766 (diff)
downloadexchange-42bc31744b9810509aef344c54bfee2f4e2a7ccb.tar.gz
exchange-42bc31744b9810509aef344c54bfee2f4e2a7ccb.tar.bz2
exchange-42bc31744b9810509aef344c54bfee2f4e2a7ccb.zip
implement /config in fakebank and taler_bank_lib.h (#6066)
Diffstat (limited to 'src/testing/test_taler_exchange_aggregator.c')
-rw-r--r--src/testing/test_taler_exchange_aggregator.c78
1 files changed, 42 insertions, 36 deletions
diff --git a/src/testing/test_taler_exchange_aggregator.c b/src/testing/test_taler_exchange_aggregator.c
index c709e5fe..2e8a35ce 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);