@@ -241,15 +241,7 @@ mod tests {
241241 use bittorrent_http_tracker_core:: container:: HttpTrackerCoreContainer ;
242242 use bittorrent_http_tracker_core:: services:: announce:: AnnounceService ;
243243 use bittorrent_http_tracker_core:: services:: scrape:: ScrapeService ;
244- use bittorrent_tracker_core:: announce_handler:: AnnounceHandler ;
245- use bittorrent_tracker_core:: authentication:: key:: repository:: in_memory:: InMemoryKeyRepository ;
246- use bittorrent_tracker_core:: authentication:: service;
247- use bittorrent_tracker_core:: databases:: setup:: initialize_database;
248- use bittorrent_tracker_core:: scrape_handler:: ScrapeHandler ;
249- use bittorrent_tracker_core:: torrent:: repository:: in_memory:: InMemoryTorrentRepository ;
250- use bittorrent_tracker_core:: torrent:: repository:: persisted:: DatabasePersistentTorrentRepository ;
251- use bittorrent_tracker_core:: whitelist:: authorization:: WhitelistAuthorization ;
252- use bittorrent_tracker_core:: whitelist:: repository:: in_memory:: InMemoryWhitelist ;
244+ use bittorrent_tracker_core:: container:: TrackerCoreContainer ;
253245 use torrust_axum_server:: tsl:: make_rust_tls;
254246 use torrust_server_lib:: registar:: Registar ;
255247 use torrust_tracker_configuration:: { logging, Configuration } ;
@@ -275,48 +267,25 @@ mod tests {
275267 let http_stats_event_sender = Arc :: new ( http_stats_event_sender) ;
276268 let http_stats_repository = Arc :: new ( http_stats_repository) ;
277269
278- let database = initialize_database ( & configuration. core ) ;
279- let in_memory_whitelist = Arc :: new ( InMemoryWhitelist :: default ( ) ) ;
280- let whitelist_authorization = Arc :: new ( WhitelistAuthorization :: new ( & configuration. core , & in_memory_whitelist. clone ( ) ) ) ;
281- let in_memory_key_repository = Arc :: new ( InMemoryKeyRepository :: default ( ) ) ;
282- let authentication_service = Arc :: new ( service:: AuthenticationService :: new (
283- & configuration. core ,
284- & in_memory_key_repository,
285- ) ) ;
286- let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
287- let db_torrent_repository = Arc :: new ( DatabasePersistentTorrentRepository :: new ( & database) ) ;
288-
289- let announce_handler = Arc :: new ( AnnounceHandler :: new (
290- & configuration. core ,
291- & whitelist_authorization,
292- & in_memory_torrent_repository,
293- & db_torrent_repository,
294- ) ) ;
295-
296- let scrape_handler = Arc :: new ( ScrapeHandler :: new ( & whitelist_authorization, & in_memory_torrent_repository) ) ;
270+ let tracker_core_container = Arc :: new ( TrackerCoreContainer :: initialize ( & core_config) ) ;
297271
298272 let announce_service = Arc :: new ( AnnounceService :: new (
299- core_config. clone ( ) ,
300- announce_handler. clone ( ) ,
301- authentication_service. clone ( ) ,
302- whitelist_authorization. clone ( ) ,
273+ tracker_core_container . core_config . clone ( ) ,
274+ tracker_core_container . announce_handler . clone ( ) ,
275+ tracker_core_container . authentication_service . clone ( ) ,
276+ tracker_core_container . whitelist_authorization . clone ( ) ,
303277 http_stats_event_sender. clone ( ) ,
304278 ) ) ;
305279
306280 let scrape_service = Arc :: new ( ScrapeService :: new (
307- core_config. clone ( ) ,
308- scrape_handler. clone ( ) ,
309- authentication_service. clone ( ) ,
281+ tracker_core_container . core_config . clone ( ) ,
282+ tracker_core_container . scrape_handler . clone ( ) ,
283+ tracker_core_container . authentication_service . clone ( ) ,
310284 http_stats_event_sender. clone ( ) ,
311285 ) ) ;
312286
313287 HttpTrackerCoreContainer {
314- core_config,
315- announce_handler,
316- scrape_handler,
317- whitelist_authorization,
318- authentication_service,
319-
288+ tracker_core_container,
320289 http_tracker_config,
321290 http_stats_event_sender,
322291 http_stats_repository,
0 commit comments