Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions tests/service_schema_dual_transport_proof_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//! One service, `transports = ["amqp_rpc", "http_rest"]`, driven both ways in one crate: the
//! `http_rest` dispatcher and client joined through an in-memory plain-terms loop, and the
//! `amqp_rpc` dispatcher and client joined through the headers-capable seam. One implementation
//! answers every call on both loops, which is the whole of what this harness proves — the
//! published surface of every transport task this crate closed is enough to build a working pair
//! of loops, with no name reached that those tasks did not publish.
//!
//! Gated on the `serde` feature, which `#[service_schema]` requires: a build without it is
//! refused at the declaration, so a harness declaring a service would not compile at all.
//!
//! The `use` at the foot is what `$crate` reaches inside every macro this crate expands: the
//! service's own module, which every message and fault is reached through, and the trait the
//! dispatchers bind.

#![cfg(feature = "serde")]

#[cfg(test)]
#[macro_use]
#[path = "service_schema_dual_transport_proof_tests/tests.rs"]
mod tests;

#[cfg(all(test, feature = "serde"))]
#[path = "service_schema_dual_transport_proof_tests/amqp_transport.rs"]
mod amqp_transport;

#[cfg(all(test, feature = "serde"))]
#[path = "service_schema_dual_transport_proof_tests/amqp_client.rs"]
mod amqp_client;

#[cfg(all(test, feature = "serde"))]
#[path = "service_schema_dual_transport_proof_tests/http_rest_transport.rs"]
mod http_rest_transport;

#[cfg(all(test, feature = "serde"))]
#[path = "service_schema_dual_transport_proof_tests/http_rest_client.rs"]
mod http_rest_client;

#[cfg(all(test, feature = "serde"))]
use tests::{DocumentService, document_service_schema};
11 changes: 11 additions & 0 deletions tests/service_schema_dual_transport_proof_tests/amqp_client.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//! The `amqp_rpc` client, expanded out of the transport's macro into a module this harness names.
//!
//! The `use` is what resolves the types the author declared: the macro spells them exactly as they
//! were written, no crate prefix.

use crate::tests::{
ArchiveError, GetVersionError, GetVersionRequest, SweepError, SweepReport, ThumbnailError,
VersionResponse,
};

document_service_amqp_rpc_client!();
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//! The `amqp_rpc` dispatcher, expanded out of the transport's macro into a module this harness
//! names.

document_service_amqp_rpc_dispatcher!();
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//! The `http_rest` client, expanded out of the transport's macro into a module this harness names.
//!
//! Unlike `amqp_rpc`'s client, which decodes generically and so never spells a success or an error
//! type by name, this one reads a response body straight into the operation's own declared types,
//! both spelled bare — the author's own types, resolved where this macro is invoked rather than
//! where the service was declared.

use crate::tests::{
ArchiveError, GetVersionError, GetVersionRequest, SweepError, SweepReport, ThumbnailError,
VersionResponse,
};

document_service_http_rest_client!();
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//! The `http_rest` dispatcher, expanded out of the transport's macro into a module this harness
//! names.
//!
//! Unlike `amqp_rpc`'s dispatcher, which never spells an operation's error type by name, this one
//! builds each declared error's own status table, and that table names the error type exactly as
//! the author wrote it — bare, since it is the author's own type rather than one this crate
//! generated. A bare name resolves where the macro is *invoked*, so every operation's error type
//! carrying an `error_status` table (or falling back to the fixed default binding) has to be in
//! scope here.

use crate::tests::{ArchiveError, GetVersionError, ThumbnailError};

document_service_http_rest_dispatcher!();
Loading
Loading