quantrs2-anneal 0.1.3

Quantum annealing support for the QuantRS2 framework
Documentation
//! Auto-generated module
//!
//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)

use crate::applications::{ApplicationError, ApplicationResult};
use std::collections::{BTreeMap, HashMap, VecDeque};
use std::time::{Duration, Instant, SystemTime};

use super::types::{
    EnterpriseMonitoringConfig, EnterpriseMonitoringSystem, LogLevel, SecurityEvent,
    SecurityEventType, SecurityOutcome, SecuritySeverity, ServiceLevelObjective,
};

/// Create example enterprise monitoring system
pub fn create_example_enterprise_monitoring() -> ApplicationResult<EnterpriseMonitoringSystem> {
    let config = EnterpriseMonitoringConfig::default();
    let system = EnterpriseMonitoringSystem::new(config);
    system.start()?;
    println!("Created enterprise monitoring system with comprehensive observability");
    Ok(system)
}
#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_enterprise_monitoring_creation() {
        let config = EnterpriseMonitoringConfig::default();
        let system = EnterpriseMonitoringSystem::new(config);
        assert!(system.config.enable_structured_logging);
        assert!(system.config.enable_distributed_tracing);
    }
    #[test]
    fn test_structured_logging() {
        let system = create_example_enterprise_monitoring()
            .expect("Enterprise monitoring system creation should succeed");
        let result = system.log(LogLevel::Info, "Test message", Some("corr-123".to_string()));
        assert!(result.is_ok());
    }
    #[test]
    fn test_slo_creation() {
        let system = create_example_enterprise_monitoring()
            .expect("Enterprise monitoring system creation should succeed");
        let slo = ServiceLevelObjective {
            id: "test-slo".to_string(),
            name: "Test SLO".to_string(),
            description: "Test service level objective".to_string(),
            sli_id: "test-sli".to_string(),
            target: 0.999,
            error_budget: 0.001,
            evaluation_window: Duration::from_secs(24 * 3600),
            alert_threshold: 0.95,
            created_at: SystemTime::now(),
            updated_at: SystemTime::now(),
        };
        let result = system.create_slo(slo);
        assert!(result.is_ok());
    }
    #[test]
    fn test_security_event_recording() {
        let system = create_example_enterprise_monitoring()
            .expect("Enterprise monitoring system creation should succeed");
        let event = SecurityEvent {
            id: "sec-001".to_string(),
            timestamp: SystemTime::now(),
            event_type: SecurityEventType::Authentication,
            severity: SecuritySeverity::Medium,
            source_ip: Some("192.168.1.100".to_string()),
            user_id: Some("user123".to_string()),
            resource: "quantum-api".to_string(),
            action: "login".to_string(),
            outcome: SecurityOutcome::Success,
            details: HashMap::new(),
            correlation_id: Some("corr-456".to_string()),
        };
        let result = system.record_security_event(event);
        assert!(result.is_ok());
    }
    #[test]
    fn test_dashboard_generation() {
        let system = create_example_enterprise_monitoring()
            .expect("Enterprise monitoring system creation should succeed");
        let dashboard = system.get_dashboard();
        assert!(dashboard.is_ok());
        let dashboard = dashboard.expect("Dashboard generation should succeed");
        assert!(dashboard.system_health.overall_health > 0.0);
    }
}