|
PACS System 0.1.0
PACS DICOM system library
|
Mock network service for testing. More...
#include <test_support.h>


Public Member Functions | |
| MockNetwork ()=default | |
| ~MockNetwork () override=default | |
| std::unique_ptr< network::dicom_server > | create_server (const network::server_config &config, const integration::tls_config &) override |
| Create a DICOM server. | |
| integration::Result< integration::network_adapter::session_ptr > | connect (const integration::connection_config &config) override |
| Connect to a remote DICOM peer. | |
| integration::Result< integration::network_adapter::session_ptr > | connect (const std::string &host, uint16_t port, std::chrono::milliseconds) override |
| Connect to a remote DICOM peer (simplified) | |
| std::size_t | connection_attempt_count () const |
| Get connection attempt count. | |
| std::size_t | server_creation_count () const |
| Get server creation count. | |
| void | set_fail_connections (bool fail) |
| Configure connections to fail. | |
| void | clear () |
| Clear call history. | |
Public Member Functions inherited from kcenon::pacs::di::IDicomNetwork | |
| virtual | ~IDicomNetwork ()=default |
Private Attributes | |
| std::mutex | mutex_ |
| std::vector< std::pair< std::string, uint16_t > > | connection_attempts_ |
| std::vector< network::server_config > | server_configs_ |
| bool | fail_connections_ = false |
Additional Inherited Members | |
Protected Member Functions inherited from kcenon::pacs::di::IDicomNetwork | |
| IDicomNetwork ()=default | |
| IDicomNetwork (const IDicomNetwork &)=default | |
| IDicomNetwork & | operator= (const IDicomNetwork &)=default |
| IDicomNetwork (IDicomNetwork &&)=default | |
| IDicomNetwork & | operator= (IDicomNetwork &&)=default |
Mock network service for testing.
Provides a mock implementation of IDicomNetwork that records calls and can be configured to return specific results for testing.
Thread Safety: All methods are thread-safe.
Definition at line 186 of file test_support.h.
|
default |
|
overridedefault |
|
inline |
Clear call history.
Definition at line 246 of file test_support.h.
References connection_attempts_, mutex_, and server_configs_.
|
inlinenodiscardoverridevirtual |
Connect to a remote DICOM peer.
| config | Connection configuration |
Implements kcenon::pacs::di::IDicomNetwork.
Definition at line 202 of file test_support.h.
References connection_attempts_, fail_connections_, kcenon::pacs::integration::connection_config::host, mutex_, and kcenon::pacs::integration::connection_config::port.
Referenced by connect().

|
inlinenodiscardoverridevirtual |
Connect to a remote DICOM peer (simplified)
| host | Remote host address |
| port | Remote port |
| timeout | Connection timeout |
Implements kcenon::pacs::di::IDicomNetwork.
Definition at line 215 of file test_support.h.
References connect(), kcenon::pacs::integration::connection_config::host, and kcenon::pacs::integration::connection_config::port.

|
inlinenodiscard |
Get connection attempt count.
Definition at line 228 of file test_support.h.
References connection_attempts_, and mutex_.
|
inlinenodiscardoverridevirtual |
Create a DICOM server.
| config | Server configuration |
| tls_cfg | Optional TLS configuration |
Implements kcenon::pacs::di::IDicomNetwork.
Definition at line 191 of file test_support.h.
References mutex_, and server_configs_.
|
inlinenodiscard |
Get server creation count.
Definition at line 234 of file test_support.h.
References mutex_, and server_configs_.
|
inline |
Configure connections to fail.
Definition at line 240 of file test_support.h.
References fail_connections_, and mutex_.
|
private |
Definition at line 254 of file test_support.h.
Referenced by clear(), connect(), and connection_attempt_count().
|
private |
Definition at line 256 of file test_support.h.
Referenced by connect(), and set_fail_connections().
|
mutableprivate |
Definition at line 253 of file test_support.h.
Referenced by clear(), connect(), connection_attempt_count(), create_server(), server_creation_count(), and set_fail_connections().
|
private |
Definition at line 255 of file test_support.h.
Referenced by clear(), create_server(), and server_creation_count().