pub struct MockBridgeService {Show 30 fields
pub read_response: ReadResponse,
pub write_response: WriteResponse,
pub browse_response: BrowsePage,
pub browse_continuation_response: Option<BrowsePage>,
pub list_servers_response: ListServersResponse,
pub capabilities_response: GetCapabilitiesResponse,
pub gateway_info_response: GetGatewayInfoResponse,
pub search_events: Vec<SearchEvent>,
pub search_index_status_response: SearchIndexStatus,
pub search_index_response: SearchIndexResponse,
pub search_error: Option<Status>,
pub fail_read_from_call: Option<u32>,
pub read_calls: Arc<AtomicU32>,
pub write_calls: Arc<AtomicU32>,
pub close_browse_session_calls: Arc<AtomicU32>,
pub list_servers_error: Option<Status>,
pub browse_error: Option<Status>,
pub capabilities_error: Option<Status>,
pub gateway_info_error: Option<Status>,
pub search_index_status_requests: Arc<Mutex<Vec<GetSearchIndexStatusRequest>>>,
pub search_index_status_error: Option<Status>,
pub search_index_requests: Arc<Mutex<Vec<SearchIndexRequest>>>,
pub search_index_error: Option<Status>,
pub refresh_search_index_requests: Arc<Mutex<Vec<RefreshSearchIndexRequest>>>,
pub refresh_search_index_error: Option<Status>,
pub control_search_index_requests: Arc<Mutex<Vec<ControlSearchIndexRequest>>>,
pub control_search_index_error: Option<Status>,
pub read_error: Option<Status>,
pub write_error: Option<Status>,
pub close_error: Option<Status>,
}Expand description
Configurable mock Bridge service.
Every field is public so a test can set one value and fill the rest with
..Default::default(). Counters and request logs are shared Arcs so a test can
observe them after the service has moved into the server task.
Fields§
§read_response: ReadResponseReturned by read unless Self::read_error or Self::fail_read_from_call fires.
A single value whose tag_id is ignored is cloned once per requested tag id.
write_response: WriteResponseReturned by write unless Self::write_error is set. success: false is a rejected
write, not an RPC error.
browse_response: BrowsePageReturned by browse when the request has no page token, and as the fallback when a
continuation page was not configured.
browse_continuation_response: Option<BrowsePage>Returned by browse when the request carries a page token.
list_servers_response: ListServersResponseReturned by list_servers unless Self::list_servers_error is set.
capabilities_response: GetCapabilitiesResponseReturned by get_capabilities unless Self::capabilities_error is set.
gateway_info_response: GetGatewayInfoResponseReturned by get_gateway_info unless Self::gateway_info_error is set.
search_events: Vec<SearchEvent>Events forwarded, in order, by search.
search_index_status_response: SearchIndexStatusReturned by the indexed-search status, refresh, and control RPCs on success.
search_index_response: SearchIndexResponseReturned by search_index on success.
search_error: Option<Status>RPC error for search, checked before any event is sent.
fail_read_from_call: Option<u32>1-based read call number at which later reads fail. Earlier reads still succeed.
read_calls: Arc<AtomicU32>Count of read calls, including calls that then fail.
write_calls: Arc<AtomicU32>Count of write calls, including calls that then fail.
close_browse_session_calls: Arc<AtomicU32>Count of close_browse_session calls that did not return Self::close_error.
list_servers_error: Option<Status>RPC error for list_servers.
browse_error: Option<Status>RPC error for browse, checked before page-token selection.
capabilities_error: Option<Status>RPC error for get_capabilities.
gateway_info_error: Option<Status>RPC error for get_gateway_info.
search_index_status_requests: Arc<Mutex<Vec<GetSearchIndexStatusRequest>>>Recorded get_search_index_status requests, including calls that then fail.
search_index_status_error: Option<Status>RPC error for get_search_index_status, returned after the request is recorded.
search_index_requests: Arc<Mutex<Vec<SearchIndexRequest>>>Recorded search_index requests, including calls that then fail.
search_index_error: Option<Status>RPC error for search_index, returned after the request is recorded.
refresh_search_index_requests: Arc<Mutex<Vec<RefreshSearchIndexRequest>>>Recorded refresh_search_index requests, including calls that then fail.
refresh_search_index_error: Option<Status>RPC error for refresh_search_index, returned after the request is recorded.
control_search_index_requests: Arc<Mutex<Vec<ControlSearchIndexRequest>>>Recorded control_search_index requests, including calls that then fail.
control_search_index_error: Option<Status>RPC error for control_search_index, returned after the request is recorded.
read_error: Option<Status>RPC error for read. Checked before Self::fail_read_from_call, so both can be set.
write_error: Option<Status>RPC error for write. Distinct from a success: false Self::write_response.
close_error: Option<Status>RPC error for close_browse_session. A failed close is not counted.
Implementations§
Source§impl MockBridgeService
impl MockBridgeService
Sourcepub fn failing_read_from_call(self, n: u32) -> Self
pub fn failing_read_from_call(self, n: u32) -> Self
Fails read on the 1-based call n and every call after it.
Trait Implementations§
Source§impl Bridge for MockBridgeService
impl Bridge for MockBridgeService
Source§type SearchStream = ReceiverStream<Result<SearchEvent, Status>>
type SearchStream = ReceiverStream<Result<SearchEvent, Status>>
fn get_gateway_info<'life0, 'async_trait>(
&'life0 self,
_request: Request<GetGatewayInfoRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<GetGatewayInfoResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_capabilities<'life0, 'async_trait>(
&'life0 self,
_request: Request<GetCapabilitiesRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<GetCapabilitiesResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_servers<'life0, 'async_trait>(
&'life0 self,
_request: Request<ListServersRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<ListServersResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn browse<'life0, 'async_trait>(
&'life0 self,
request: Request<BrowseRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<BrowsePage>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close_browse_session<'life0, 'async_trait>(
&'life0 self,
_request: Request<CloseBrowseSessionRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn search<'life0, 'async_trait>(
&'life0 self,
_request: Request<SearchRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::SearchStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_search_index_status<'life0, 'async_trait>(
&'life0 self,
request: Request<GetSearchIndexStatusRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<SearchIndexStatus>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn refresh_search_index<'life0, 'async_trait>(
&'life0 self,
request: Request<RefreshSearchIndexRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<SearchIndexStatus>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn control_search_index<'life0, 'async_trait>(
&'life0 self,
request: Request<ControlSearchIndexRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<SearchIndexStatus>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn search_index<'life0, 'async_trait>(
&'life0 self,
request: Request<SearchIndexRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<SearchIndexResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read<'life0, 'async_trait>(
&'life0 self,
request: Request<ReadRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<ReadResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write<'life0, 'async_trait>(
&'life0 self,
_request: Request<WriteRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<WriteResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl Clone for MockBridgeService
impl Clone for MockBridgeService
Source§fn clone(&self) -> MockBridgeService
fn clone(&self) -> MockBridgeService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for MockBridgeService
impl !UnwindSafe for MockBridgeService
impl Freeze for MockBridgeService
impl Send for MockBridgeService
impl Sync for MockBridgeService
impl Unpin for MockBridgeService
impl UnsafeUnpin for MockBridgeService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].