oa_gateway_testing/fixtures.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
//! Sample payloads. Paths stay valid when crates move; do not
//! `include_str!` from the workspace root.
//!
//! The XML and JSON documents are the same logical `PositionReport`
//! (UCI 2.5 / OMS). Integration tests send them over OWP, STOMP, and
//! loopback; `oa-gateway-uci` uses them as a codec round-trip.
/// Minimal UCI XML `PositionReport` used on the ASB / STOMP path.
///
/// Live broker tests rewrite the `<n>1</n>` field so concurrent
/// messages can be told apart.
pub const POSITION_REPORT_XML: &str = include_str!("../fixtures/PositionReport.xml");
/// Same document as bytes (loopback / STOMP SEND).
pub const POSITION_REPORT_XML_BYTES: &[u8] = POSITION_REPORT_XML.as_bytes();
/// OMS JSON `PositionReport` matching the sleet v2.5 fixture shape.
pub const POSITION_REPORT_JSON: &str = include_str!("../fixtures/PositionReport.json");
/// Filesystem path to the XML fixture (scripts / non-Rust tools).
///
/// Built from `CARGO_MANIFEST_DIR` so it does not depend on the
/// process working directory.
#[must_use]
pub fn position_report_xml_path() -> &'static str {
concat!(env!("CARGO_MANIFEST_DIR"), "/fixtures/PositionReport.xml")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn fixtures_are_nonempty() {
assert!(POSITION_REPORT_XML.contains("<PositionReport"));
assert!(POSITION_REPORT_JSON.contains("\"PositionReport\""));
assert_eq!(POSITION_REPORT_XML_BYTES, POSITION_REPORT_XML.as_bytes());
}
}