From a536317df14df490524b5a2a2d2ae59fa03daf87 Mon Sep 17 00:00:00 2001 From: Simon Paitrault Date: Sat, 11 Nov 2023 11:11:35 +0100 Subject: [PATCH] test: update chekov messaging tests Signed-off-by: Simon Paitrault --- Cargo.toml | 2 +- crates/chekov/src/message.rs | 28 +++++++++---------- crates/event_store-core/src/event/mod.rs | 2 +- crates/event_store-core/src/event_bus/mod.rs | 2 +- crates/event_store/src/connection/mod.rs | 2 +- crates/event_store/src/event/mod.rs | 2 +- .../event_store/src/subscriptions/pub_sub.rs | 6 ++-- .../src/subscriptions/subscription.rs | 4 +-- .../src/subscriptions/supervisor.rs | 6 ++-- 9 files changed, 26 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index beb8f2a3..eafe77df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ serde = { version = "1.0.117", features = ["derive"] } sqlx = { version = "0.6.2", features = ["chrono", "time", "uuid", "json", "offline", "runtime-actix-native-tls"] } async-trait = "0.1.51" serde_json = "1.0.68" -actix = "0.12.0" +actix = "0.13.0" futures = "0.3.17" log = "0.4.14" tokio = { version = "1.12.0", features = ["full"] } diff --git a/crates/chekov/src/message.rs b/crates/chekov/src/message.rs index c53c02a1..70c42138 100644 --- a/crates/chekov/src/message.rs +++ b/crates/chekov/src/message.rs @@ -48,7 +48,7 @@ pub struct EventMetadatas { #[doc(hidden)] #[derive(Debug, Clone, Message)] -#[rtype(result = "Result(), ()>")] +#[rtype(result = "Result<(), ()>")] pub struct EventEnvelope { pub event: E, pub meta: EventMetadatas, @@ -65,55 +65,53 @@ pub struct ResolveAndApply(pub RecordedEvent); pub struct ResolveAndApplyMany(pub Vec); #[derive(Message)] -#[rtype("Result, event_store::prelude::EventStoreError>")] +#[rtype(result = "Result, event_store::prelude::EventStoreError>")] pub(crate) struct ExecuteReader(pub(crate) event_store::prelude::Reader); #[derive(Message)] -#[rtype( - "Result< +#[rtype(result = "Result< std::pin::Pin< Box, EventStoreError>> + Send>, >, EventStoreError, - >" -)] + >")] pub(crate) struct ExecuteStreamForward(pub(crate) String); #[derive(Message)] -#[rtype("Result, event_store::prelude::EventStoreError>")] +#[rtype(result = "Result, event_store::prelude::EventStoreError>")] pub(crate) struct ExecuteAppender(pub(crate) event_store::prelude::Appender); #[derive(Message)] -#[rtype("Result")] +#[rtype(result = "Result")] pub(crate) struct ExecuteStreamInfo(pub(crate) String); #[derive(Message)] -#[rtype("u64")] +#[rtype(result = "u64")] pub(crate) struct AggregateVersion; #[derive(Message)] -#[rtype("A")] +#[rtype(result = "A")] pub(crate) struct AggregateState(pub(crate) PhantomData); #[derive(Message, Debug)] -#[rtype("()")] +#[rtype(result = "()")] pub(crate) struct StartListening; #[derive(Message)] -#[rtype("Addr>")] +#[rtype(result = "Addr>")] pub(crate) struct GetEventStoreAddr { pub(crate) _phantom: PhantomData, } #[derive(Message)] -#[rtype("Option>>")] +#[rtype(result = "Option>>")] pub(crate) struct GetAggregateAddr { pub(crate) identifier: String, pub(crate) _phantom: PhantomData, } #[derive(Message)] -#[rtype("Result>, ()>")] +#[rtype(result = "Result>, ()>")] pub(crate) struct StartAggregate { pub(crate) identifier: String, pub(crate) correlation_id: Option, @@ -122,7 +120,7 @@ pub(crate) struct StartAggregate { } #[derive(Message)] -#[rtype("Result<(), ()>")] +#[rtype(result = "Result<(), ()>")] pub(crate) struct ShutdownAggregate { pub(crate) identifier: String, } diff --git a/crates/event_store-core/src/event/mod.rs b/crates/event_store-core/src/event/mod.rs index 5e265f0f..39fbc287 100644 --- a/crates/event_store-core/src/event/mod.rs +++ b/crates/event_store-core/src/event/mod.rs @@ -27,7 +27,7 @@ pub trait Event: Serialize + Send + std::convert::TryFrom { /// A `RecordedEvent` represents an `Event` which have been append to a `Stream` #[derive(sqlx::FromRow, Debug, Clone, Message, Serialize)] -#[rtype("()")] +#[rtype(result = "()")] pub struct RecordedEvent { /// an incrementing and gapless integer used to order the event in a stream. #[sqlx(try_from = "i64")] diff --git a/crates/event_store-core/src/event_bus/mod.rs b/crates/event_store-core/src/event_bus/mod.rs index 3d2a0a31..5ac390a5 100644 --- a/crates/event_store-core/src/event_bus/mod.rs +++ b/crates/event_store-core/src/event_bus/mod.rs @@ -26,7 +26,7 @@ pub type BoxedStream = Pin< >; #[derive(Debug, Message)] -#[rtype("()")] +#[rtype(result = "()")] pub enum EventBusMessage { Notification(EventNotification), Events(String, Vec), diff --git a/crates/event_store/src/connection/mod.rs b/crates/event_store/src/connection/mod.rs index fc12c0d3..449967a0 100644 --- a/crates/event_store/src/connection/mod.rs +++ b/crates/event_store/src/connection/mod.rs @@ -21,7 +21,7 @@ mod messaging; pub use messaging::{Append, CreateStream, Read, StreamForward, StreamForwardResult, StreamInfo}; #[derive(Message)] -#[rtype("()")] +#[rtype(result = "()")] // TODO: Remove this by a better subscription channel pub struct OpenNotificationChannel { pub(crate) sender: mpsc::UnboundedSender, diff --git a/crates/event_store/src/event/mod.rs b/crates/event_store/src/event/mod.rs index a6fd2017..98758838 100644 --- a/crates/event_store/src/event/mod.rs +++ b/crates/event_store/src/event/mod.rs @@ -6,7 +6,7 @@ pub use crate::core::event::UnsavedEvent; pub use crate::core::event::UnsavedEventError; #[derive(Debug, Clone, Message)] -#[rtype("()")] +#[rtype(result = "()")] pub struct RecordedEvents { pub(crate) events: Vec, } diff --git a/crates/event_store/src/subscriptions/pub_sub.rs b/crates/event_store/src/subscriptions/pub_sub.rs index 1cf2e1a8..42f79eb3 100644 --- a/crates/event_store/src/subscriptions/pub_sub.rs +++ b/crates/event_store/src/subscriptions/pub_sub.rs @@ -37,15 +37,15 @@ impl PubSub { } #[derive(Message)] -#[rtype("()")] +#[rtype(result = "()")] struct Subscribe(Recipient, String); #[derive(Message)] -#[rtype("usize")] +#[rtype(result = "usize")] struct GetSubscriberCountForStream(String); #[derive(Message)] -#[rtype("()")] +#[rtype(result = "()")] pub struct PubSubNotification { pub(crate) stream: String, pub(crate) events: Vec, diff --git a/crates/event_store/src/subscriptions/subscription.rs b/crates/event_store/src/subscriptions/subscription.rs index 5ebc7b39..6c6bee31 100644 --- a/crates/event_store/src/subscriptions/subscription.rs +++ b/crates/event_store/src/subscriptions/subscription.rs @@ -14,11 +14,11 @@ use actix::prelude::*; use tracing::debug; #[derive(Debug, Message)] -#[rtype("()")] +#[rtype(result = "()")] struct Connect(pub Recipient, SubscriptionOptions); #[derive(Debug, Message)] -#[rtype("()")] +#[rtype(result = "()")] pub struct CatchUp; #[derive(Debug)] diff --git a/crates/event_store/src/subscriptions/supervisor.rs b/crates/event_store/src/subscriptions/supervisor.rs index fadd5220..f2bdba3e 100644 --- a/crates/event_store/src/subscriptions/supervisor.rs +++ b/crates/event_store/src/subscriptions/supervisor.rs @@ -85,7 +85,7 @@ impl Handler> for SubscriptionsSupervisor { } #[derive(Message)] -#[rtype("()")] +#[rtype(result = "()")] pub struct Started; impl Handler for SubscriptionsSupervisor { @@ -97,7 +97,7 @@ impl Handler for SubscriptionsSupervisor { } #[derive(Message)] -#[rtype("()")] +#[rtype(result = "()")] pub struct GoingDown; impl Handler for SubscriptionsSupervisor { @@ -109,7 +109,7 @@ impl Handler for SubscriptionsSupervisor { } #[derive(Message)] -#[rtype("()")] +#[rtype(result = "()")] pub struct Down; impl Handler for SubscriptionsSupervisor {