summaryrefslogtreecommitdiff
path: root/src/testing/test_taler_exchange_aggregator.c
diff options
context:
space:
mode:
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 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);