Skip to main content

camel_core/lifecycle/domain/
route.rs

1/// Minimal domain value object representing a route's identity.
2/// No framework dependencies — pure domain type.
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct RouteSpec {
5    route_id: String,
6    from_uri: String,
7}
8
9impl RouteSpec {
10    pub fn new(route_id: impl Into<String>, from_uri: impl Into<String>) -> Self {
11        Self {
12            route_id: route_id.into(),
13            from_uri: from_uri.into(),
14        }
15    }
16
17    pub fn route_id(&self) -> &str {
18        &self.route_id
19    }
20
21    pub fn from_uri(&self) -> &str {
22        &self.from_uri
23    }
24}
25
26#[cfg(test)]
27mod tests {
28    use super::*;
29
30    #[test]
31    fn route_spec_new_sets_fields() {
32        let spec = RouteSpec::new("r1", "direct:start");
33        assert_eq!(spec.route_id(), "r1");
34        assert_eq!(spec.from_uri(), "direct:start");
35    }
36}