pub mod auto_generator;
pub mod config;
pub mod detector;
pub use auto_generator::AutoGenerator;
pub use config::RuntimeDaemonConfig;
pub use detector::NotFoundDetector;
pub struct RuntimeDaemon {
config: RuntimeDaemonConfig,
}
impl RuntimeDaemon {
pub fn new(config: RuntimeDaemonConfig) -> Self {
Self { config }
}
pub fn is_enabled(&self) -> bool {
self.config.enabled
}
pub fn config(&self) -> &RuntimeDaemonConfig {
&self.config
}
pub fn spawn_federation_scenario_poller(
&self,
) -> Result<Option<tokio::task::JoinHandle<()>>, String> {
mockforge_scenarios::spawn_federation_scenario_poller(
mockforge_scenarios::LoggingApplicator,
)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_daemon_creation() {
let config = RuntimeDaemonConfig::default();
let daemon = RuntimeDaemon::new(config);
assert!(!daemon.is_enabled()); }
#[tokio::test]
async fn spawn_federation_scenario_poller_returns_none_when_env_missing() {
let daemon = RuntimeDaemon::new(RuntimeDaemonConfig::default());
let handle = daemon.spawn_federation_scenario_poller().unwrap();
assert!(handle.is_none(), "expected None when MOCKFORGE_FEDERATION_POLL_URL unset");
}
}