diff options
Diffstat (limited to 'src/bank-lib/test_bank_api_twisted.c')
-rw-r--r-- | src/bank-lib/test_bank_api_twisted.c | 172 |
1 files changed, 0 insertions, 172 deletions
diff --git a/src/bank-lib/test_bank_api_twisted.c b/src/bank-lib/test_bank_api_twisted.c deleted file mode 100644 index a8f60c5eb..000000000 --- a/src/bank-lib/test_bank_api_twisted.c +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of TALER | ||
3 | Copyright (C) 2014-2019 Taler Systems SA | ||
4 | |||
5 | TALER is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as | ||
7 | published by the Free Software Foundation; either version 3, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | TALER is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public | ||
16 | License along with TALER; see the file COPYING. If not, see | ||
17 | <http://www.gnu.org/licenses/> | ||
18 | */ | ||
19 | /** | ||
20 | * @file exchange/test_exchange_api_twister.c | ||
21 | * @brief testcase to test exchange's HTTP API interface | ||
22 | * @author Marcello Stanisci | ||
23 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "taler_util.h" | ||
28 | #include "taler_signatures.h" | ||
29 | #include "taler_exchange_service.h" | ||
30 | #include "taler_json_lib.h" | ||
31 | #include <gnunet/gnunet_util_lib.h> | ||
32 | #include <microhttpd.h> | ||
33 | #include "taler_bank_service.h" | ||
34 | #include "taler_fakebank_lib.h" | ||
35 | #include "taler_testing_lib.h" | ||
36 | #include <taler/taler_twister_testing_lib.h> | ||
37 | #include "taler_testing_bank_lib.h" | ||
38 | #include <taler/taler_twister_service.h> | ||
39 | |||
40 | /** | ||
41 | * Configuration file we use. One (big) configuration is used | ||
42 | * for the various components for this test. | ||
43 | */ | ||
44 | #define CONFIG_FILE "bank_twisted.conf" | ||
45 | |||
46 | /** | ||
47 | * (real) Twister URL. Used at startup time to check if it runs. | ||
48 | */ | ||
49 | static char *twister_url; | ||
50 | |||
51 | /** | ||
52 | * URL of the twister where all the connections to the | ||
53 | * bank that have to be proxied should be addressed to. | ||
54 | */ | ||
55 | #define TWISTED_BANK_URL twister_url | ||
56 | |||
57 | /** | ||
58 | * URL of the bank. | ||
59 | */ | ||
60 | static char *bank_url; | ||
61 | |||
62 | /** | ||
63 | * Bank process. | ||
64 | */ | ||
65 | static struct GNUNET_OS_Process *bankd; | ||
66 | |||
67 | /** | ||
68 | * Twister process. | ||
69 | */ | ||
70 | static struct GNUNET_OS_Process *twisterd; | ||
71 | |||
72 | /** | ||
73 | * Main function that will tell | ||
74 | * the interpreter what commands to run. | ||
75 | * | ||
76 | * @param cls closure | ||
77 | */ | ||
78 | static void | ||
79 | run (void *cls, | ||
80 | struct TALER_TESTING_Interpreter *is) | ||
81 | { | ||
82 | struct TALER_TESTING_Command commands[] = { | ||
83 | |||
84 | TALER_TESTING_cmd_wait_service ("wait-service", | ||
85 | "http://localhost:8888/"), | ||
86 | |||
87 | TALER_TESTING_cmd_bank_history ("history-0", | ||
88 | TWISTED_BANK_URL, | ||
89 | EXCHANGE_ACCOUNT_NUMBER, | ||
90 | TALER_BANK_DIRECTION_BOTH, | ||
91 | GNUNET_NO, | ||
92 | NULL, | ||
93 | 5), | ||
94 | TALER_TESTING_cmd_end () | ||
95 | }; | ||
96 | |||
97 | TALER_TESTING_run (is, | ||
98 | commands); | ||
99 | } | ||
100 | |||
101 | /** | ||
102 | * Kill, wait, and destroy convenience function. | ||
103 | * | ||
104 | * @param process process to purge. | ||
105 | */ | ||
106 | static void | ||
107 | purge_process (struct GNUNET_OS_Process *process) | ||
108 | { | ||
109 | GNUNET_OS_process_kill (process, | ||
110 | SIGINT); | ||
111 | GNUNET_OS_process_wait (process); | ||
112 | GNUNET_OS_process_destroy (process); | ||
113 | } | ||
114 | |||
115 | |||
116 | int | ||
117 | main (int argc, | ||
118 | char *const *argv) | ||
119 | { | ||
120 | unsigned int ret; | ||
121 | /* These environment variables get in the way... */ | ||
122 | unsetenv ("XDG_DATA_HOME"); | ||
123 | unsetenv ("XDG_CONFIG_HOME"); | ||
124 | |||
125 | GNUNET_log_setup ("test-bank-api-twisted", | ||
126 | "DEBUG", | ||
127 | NULL); | ||
128 | |||
129 | if (NULL == (bank_url = TALER_TESTING_prepare_bank | ||
130 | (CONFIG_FILE))) | ||
131 | return 77; | ||
132 | |||
133 | if (NULL == (bankd = TALER_TESTING_run_bank | ||
134 | (CONFIG_FILE, | ||
135 | bank_url))) | ||
136 | { | ||
137 | GNUNET_free (bank_url); | ||
138 | return 77; | ||
139 | } | ||
140 | |||
141 | if (NULL == (twister_url = TALER_TESTING_prepare_twister | ||
142 | (CONFIG_FILE))) | ||
143 | { | ||
144 | purge_process (bankd); | ||
145 | GNUNET_free (bank_url); | ||
146 | return 77; | ||
147 | } | ||
148 | |||
149 | if (NULL == (twisterd = TALER_TESTING_run_twister (CONFIG_FILE))) | ||
150 | { | ||
151 | GNUNET_free (twister_url); | ||
152 | purge_process (bankd); | ||
153 | GNUNET_free (bank_url); | ||
154 | return 77; | ||
155 | } | ||
156 | ret = TALER_TESTING_setup (&run, | ||
157 | NULL, | ||
158 | CONFIG_FILE, | ||
159 | NULL, | ||
160 | GNUNET_NO); | ||
161 | purge_process (twisterd); | ||
162 | GNUNET_free (twister_url); | ||
163 | purge_process (bankd); | ||
164 | GNUNET_free (bank_url); | ||
165 | |||
166 | if (GNUNET_OK == ret) | ||
167 | return 0; | ||
168 | |||
169 | return 1; | ||
170 | } | ||
171 | |||
172 | /* end of test_bank_api_twisted.c */ | ||