Skip to content

Commit

Permalink
Updated to support 1.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
PLeVasseur committed May 30, 2024
1 parent 25cd045 commit 8400294
Show file tree
Hide file tree
Showing 11 changed files with 342 additions and 265 deletions.
39 changes: 36 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ prost = { version = "0.12" }
prost-types = { version = "0.12" }
serde_json = { version = "1.0.111" }
uuid = { version = "1.7.0" }
up-rust = { default-features = false, git = "https://github.com/eclipse-uprotocol/up-rust", rev = "1bb08ba7a3666e58c316489fbcf3da3e29dee611" }
up-rust = { default-features = false, git = "https://github.com/eclipse-uprotocol/up-rust", rev = "f5248a89cf1db6232f463ee3ce7b1cb20d79cfdb" }


[profile.dev]
Expand Down
16 changes: 13 additions & 3 deletions example-utils/integration-test-utils/src/integration_test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ pub struct ClientControl {
pub client_command: Arc<Mutex<ClientCommand>>,
}

fn any_uuri() -> UUri {
UUri {
authority_name: "*".to_string(),
ue_id: 0x0000_FFFF, // any instance, any service
ue_version_major: 0xFF, // any
resource_id: 0xFFFF, // any
..Default::default()
}
}

async fn configure_client(client_configuration: &ClientConfiguration) -> UPClientFoo {
let name = client_configuration.name.clone();
let rx = client_configuration.rx.clone();
Expand All @@ -149,7 +159,7 @@ async fn configure_client(client_configuration: &ClientConfiguration) -> UPClien
let client = UPClientFoo::new(&name, rx, tx).await;

let register_res = client
.register_listener(my_client_uuri.clone(), listener)
.register_listener(&any_uuri(), Some(&my_client_uuri.clone()), listener)
.await;
let Ok(_registration_string) = register_res else {
panic!("Unable to register!");
Expand Down Expand Up @@ -185,15 +195,15 @@ async fn poll_for_new_command(
ClientCommand::NoOp => {}
ClientCommand::ConnectedToStreamer(active_connections) => {
debug!("{} commmand: ConnectedToStreamer", &name);
*active_connection_listing = active_connections.clone();
active_connection_listing.clone_from(active_connections);
debug!(
"{} set connected_to_streamer to: {:?}",
&name, active_connection_listing
);
}
ClientCommand::DisconnectedFromStreamer(active_connections) => {
debug!("{} commmand: DisconnectedFromStreamer", &name);
*active_connection_listing = active_connections.clone();
active_connection_listing.clone_from(active_connections);
debug!(
"{} set connected_to_streamer to: {:?}",
&name, active_connection_listing
Expand Down
52 changes: 16 additions & 36 deletions example-utils/integration-test-utils/src/integration_test_uuris.rs
Original file line number Diff line number Diff line change
@@ -1,53 +1,33 @@
use up_rust::{Number, UAuthority, UEntity, UUri};
use up_rust::UUri;

pub fn local_authority() -> UAuthority {
UAuthority {
name: Some("local_authority".to_string()),
number: Number::Ip(vec![192, 168, 1, 100]).into(),
..Default::default()
}
pub fn local_authority() -> String {
"local_authority".to_string()
}

pub fn remote_authority_a() -> UAuthority {
UAuthority {
name: Some("remote_authority_a".to_string()),
number: Number::Ip(vec![192, 168, 1, 200]).into(),
..Default::default()
}
pub fn remote_authority_a() -> String {
"remote_authority_a".to_string()
}

pub fn remote_authority_b() -> UAuthority {
UAuthority {
name: Some("remote_authority_b".to_string()),
number: Number::Ip(vec![192, 168, 1, 201]).into(),
..Default::default()
}
pub fn remote_authority_b() -> String {
"remote_authority_b".to_string()
}

pub fn local_client_uuri(id: u32) -> UUri {
UUri {
authority: Some(local_authority()).into(),
entity: Some(UEntity {
name: format!("local_entity_{id}").to_string(),
id: Some(id),
version_major: Some(1),
..Default::default()
})
.into(),
authority_name: local_authority(),
ue_id: id,
ue_version_major: 1,
resource_id: 2,
..Default::default()
}
}

pub fn remote_client_uuri(authority: UAuthority, id: u32) -> UUri {
pub fn remote_client_uuri(authority: String, id: u32) -> UUri {
UUri {
authority: Some(authority).into(),
entity: Some(UEntity {
name: format!("remote_entity_{id}").to_string(),
id: Some(id),
version_major: Some(1),
..Default::default()
})
.into(),
authority_name: authority,
ue_id: id,
ue_version_major: 1,
resource_id: 2,
..Default::default()
}
}
Loading

0 comments on commit 8400294

Please sign in to comment.