Island: Subscribe set_island_mode to IslandEventTopic.SET_MODE

This commit is contained in:
Shreya Malviya 2022-09-21 16:07:00 +05:30
parent f20f11265b
commit 8b87783998
1 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,7 @@ from monkey_island.cc.event_queue import IIslandEventQueue, IslandEventTopic
from monkey_island.cc.island_event_handlers import (
reset_agent_configuration,
reset_machine_repository,
set_island_mode,
)
from monkey_island.cc.repository import (
IAgentEventRepository,
@ -20,6 +21,7 @@ def setup_island_event_handlers(container: DIContainer):
_subscribe_reset_agent_configuration_events(island_event_queue, container)
_subscribe_clear_simulation_data_events(island_event_queue, container)
_subscribe_set_island_mode_events(island_event_queue, container)
def _subscribe_reset_agent_configuration_events(
@ -52,3 +54,9 @@ def _subscribe_clear_simulation_data_events(
]:
repository = container.resolve(i_repository)
island_event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, repository.reset)
def _subscribe_set_island_mode_events(
island_event_queue: IIslandEventQueue, container: DIContainer
):
island_event_queue.subscribe(IslandEventTopic.SET_MODE, container.resolve(set_island_mode))