diff options
Diffstat (limited to 'crates/core/tedge_mapper/src/tests.rs')
-rw-r--r-- | crates/core/tedge_mapper/src/tests.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/crates/core/tedge_mapper/src/tests.rs b/crates/core/tedge_mapper/src/tests.rs index 637e3298..ce8f55f8 100644 --- a/crates/core/tedge_mapper/src/tests.rs +++ b/crates/core/tedge_mapper/src/tests.rs @@ -1,12 +1,15 @@ use std::time::Duration; +use c8y_api::http_proxy::FakeC8YHttpProxy; use mqtt_tests::with_timeout::{Maybe, WithTimeout}; use mqtt_tests::StreamExt; use serial_test::serial; use tokio::task::JoinHandle; use crate::{ - c8y_converter::CumulocityConverter, mapper::create_mapper, size_threshold::SizeThreshold, + c8y::converter::CumulocityConverter, + mapping::size_threshold::SizeThreshold, + mapping::{mapper::create_mapper, operations::Operations}, }; const MESSAGE_TIMEOUT_MS: Duration = Duration::from_millis(1000); @@ -40,7 +43,7 @@ async fn c8y_mapper_alarm_mapping_to_smartrest() { dbg!(&msg); // The first message could be SmartREST 114 for supported operations - if msg.contains("114") { + while !msg.contains("302") { // Fetch the next message which should be the alarm msg = messages .next() @@ -95,7 +98,7 @@ async fn c8y_mapper_syncs_pending_alarms_on_startup() { dbg!(&msg); // The first message could be SmartREST 114 for supported operations - if msg.contains("114") { + while !msg.contains("301") { // Fetch the next message which should be the alarm msg = messages .next() @@ -144,7 +147,7 @@ async fn c8y_mapper_syncs_pending_alarms_on_startup() { dbg!(&msg); // The first message could be SmartREST 114 for supported operations - if msg.contains("114") { + while !msg.contains("301") { // Fetch the next message which should be the alarm msg = messages .next() @@ -218,10 +221,15 @@ async fn start_c8y_mapper(mqtt_port: u16) -> Result<JoinHandle<()>, anyhow::Erro let device_name = "test-device".into(); let device_type = "test-device-type".into(); let size_threshold = SizeThreshold(16 * 1024); + let operations = Operations::new(); + let http_proxy = FakeC8YHttpProxy {}; + let converter = Box::new(CumulocityConverter::new( size_threshold, device_name, device_type, + operations, + http_proxy, )); let mut mapper = create_mapper("c8y-mapper-test", mqtt_port, converter).await?; |