Quick Links: |
#include <bmqa_mocksession.h>
Classes | |
struct | Call |
struct | Job |
Public Types | |
typedef bsl::function< void(const char *description, const char *file, int line) | FailureCb ) |
typedef bsl::function< void(const bmqa::OpenQueueStatus &result)> | OpenQueueCallback |
typedef bsl::function< void(const bmqa::ConfigureQueueStatus &result)> | ConfigureQueueCallback |
typedef bsl::function< void(const bmqa::CloseQueueStatus &result)> | CloseQueueCallback |
Public Member Functions | |
MockSession (const bmqt::SessionOptions &options=bmqt::SessionOptions(), bslma::Allocator *allocator=0) | |
MockSession (bslma::ManagedPtr< SessionEventHandler > eventHandler, const bmqt::SessionOptions &options=bmqt::SessionOptions(), bslma::Allocator *allocator=0) | |
~MockSession () BSLS_KEYWORD_OVERRIDE | |
void | enqueueEvent (const bmqa::Event &event) |
bool | emitEvent (int numEvents=1) |
Call & | expect_start (const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_startAsync (const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_stop () |
Call & | expect_stopAsync () |
Call & | expect_finalizeStop () |
Call & | expect_openQueue (QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_openQueueSync (QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_openQueueAsync (QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_openQueueAsync (QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const OpenQueueCallback &callback, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_closeQueue (QueueId *queueId, const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_closeQueueSync (QueueId *queueId, const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_closeQueueAsync (QueueId *queueId, const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_closeQueueAsync (QueueId *queueId, const CloseQueueCallback &callback, const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_configureQueue (QueueId *queueId, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_configureQueueSync (QueueId *queueId, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_configureQueueAsync (QueueId *queueId, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_configureQueueAsync (QueueId *queueId, const bmqt::QueueOptions &options, const ConfigureQueueCallback &callback, const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_nextEvent (const bsls::TimeInterval &timeout=bsls::TimeInterval()) |
Call & | expect_post (const MessageEvent &messageEvent) |
Call & | expect_confirmMessage (const Message &message) |
Call & | expect_confirmMessage (const MessageConfirmationCookie &cookie) |
Call & | expect_confirmMessages (ConfirmEventBuilder *builder) |
int | start (const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
int | startAsync (const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
void | stop () BSLS_KEYWORD_OVERRIDE |
void | stopAsync () BSLS_KEYWORD_OVERRIDE |
void | finalizeStop () BSLS_KEYWORD_OVERRIDE |
void | loadMessageEventBuilder (MessageEventBuilder *builder) BSLS_KEYWORD_OVERRIDE |
void | loadConfirmEventBuilder (ConfirmEventBuilder *builder) BSLS_KEYWORD_OVERRIDE |
void | loadMessageProperties (MessageProperties *buffer) BSLS_KEYWORD_OVERRIDE |
int | getQueueId (QueueId *queueId, const bmqt::Uri &uri) const BSLS_KEYWORD_OVERRIDE |
int | getQueueId (QueueId *queueId, const bmqt::CorrelationId &correlationId) const BSLS_KEYWORD_OVERRIDE |
int | openQueue (QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
OpenQueueStatus | openQueueSync (QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
int | openQueueAsync (QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
void | openQueueAsync (QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const OpenQueueCallback &callback, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
int | configureQueue (QueueId *queueId, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
ConfigureQueueStatus | configureQueueSync (const QueueId *queueId, const bmqt::QueueOptions &options, const bsls::TimeInterval &timeout) BSLS_KEYWORD_OVERRIDE |
int | configureQueueAsync (QueueId *queueId, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
void | configureQueueAsync (const QueueId *queueId, const bmqt::QueueOptions &options, const ConfigureQueueCallback &callback, const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
int | closeQueue (QueueId *queueId, const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
CloseQueueStatus | closeQueueSync (const QueueId *queueId, const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
int | closeQueueAsync (QueueId *queueId, const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
void | closeQueueAsync (const QueueId *queueId, const CloseQueueCallback &callback, const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
Event | nextEvent (const bsls::TimeInterval &timeout=bsls::TimeInterval()) BSLS_KEYWORD_OVERRIDE |
int | post (const MessageEvent &messageEvent) BSLS_KEYWORD_OVERRIDE |
int | confirmMessage (const Message &message) BSLS_KEYWORD_OVERRIDE |
int | confirmMessage (const MessageConfirmationCookie &cookie) BSLS_KEYWORD_OVERRIDE |
int | confirmMessages (ConfirmEventBuilder *builder) BSLS_KEYWORD_OVERRIDE |
int | configureMessageDumping (const bslstl::StringRef &command) BSLS_KEYWORD_OVERRIDE |
void | setFailureCallback (const FailureCb &failureCb) |
bool | popPostedEvent (bmqa::MessageEvent *event) |
size_t | unconfirmedMessages () const |
Static Public Member Functions | |
static void | initialize (bslma::Allocator *allocator=0) |
static void | shutdown () |
Mechanism to mock a bmqa::Session
See Component bmqa_mocksession
typedef bsl::function<void (const char *description, const char *file, int line) bmqa::MockSession::FailureCb) |
Callback used to inform the test driver of an assertion failure. The application test driver using the MockSession
may provide an implementation that makes the test driver fail (for instance, calling BDE's test driver ASSERT macro).
typedef bsl::function<void(const bmqa::OpenQueueStatus& result)> bmqa::AbstractSession::OpenQueueCallback [inherited] |
Invoked as a response to an asynchronous open queue operation, OpenQueueCallback
is an alias for a callback function object (functor) that takes as an argument the specified result
, providing the result and context of the requested operation.
Reimplemented in bmqa::Session.
typedef bsl::function<void(const bmqa::ConfigureQueueStatus& result)> bmqa::AbstractSession::ConfigureQueueCallback [inherited] |
Invoked as a response to an asynchronous configure queue operation, ConfigureQueueCallback
is an alias for a callback function object (functor) that takes as an argument the specified result
, providing the result and context of the requested operation.
Reimplemented in bmqa::Session.
typedef bsl::function<void(const bmqa::CloseQueueStatus& result)> bmqa::AbstractSession::CloseQueueCallback [inherited] |
Invoked as a response to an asynchronous close queue operation, CloseQueueCallback
is an alias for a callback function object (functor) that takes as an argument the specified result
, providing the result and context of the requested operation.
Reimplemented in bmqa::Session.
bmqa::MockSession::MockSession | ( | const bmqt::SessionOptions & | options = bmqt::SessionOptions() , |
|
bslma::Allocator * | allocator = 0 | |||
) | [explicit] |
Create a new MockSession
in synchronous mode using the optionally specified options
. In such mode, events have to be fetched by the application using the nextEvent()
method. Optionally specify an allocator
used to supply memory. If allocator
is 0, the currently installed default allocator is used.
bmqa::MockSession::MockSession | ( | bslma::ManagedPtr< SessionEventHandler > | eventHandler, | |
const bmqt::SessionOptions & | options = bmqt::SessionOptions() , |
|||
bslma::Allocator * | allocator = 0 | |||
) | [explicit] |
Create a MockSession
in asynchronous mode using the specified eventHandler
as callback for event processing and the optionally specified options
. Optionally specify an allocator
used to supply memory. If the optionally specified allocator
is 0, the currently installed default allocator is used.
bmqa::MockSession::~MockSession | ( | ) |
Stop the MockSession
and destroy this object.
static void bmqa::MockSession::initialize | ( | bslma::Allocator * | allocator = 0 |
) | [static] |
Perform a one time initialization needed by components used in MockSession
and MockSessionUtil
. This method only needs to be called once before any other method, but can be called multiple times provided that for each call to initialize
there is a corresponding call to shutdown
. Use the optionally specified allocator
for any memory allocation, or the global
allocator if none is provided. Note that specifying the allocator is provided for test drivers only, and therefore users should let it default to the global allocator. NOTE: This method will need to be invoked only if the application needs to use MockSessionUtil
outside the scope of MockSession
.
static void bmqa::MockSession::shutdown | ( | ) | [static] |
Pendant operation of the initialize
one. The number of calls to shutdown
must equal the number of calls to initialize
, without corresponding shutdown
calls, to fully destroy the objects. It is safe to call initialize
after calling shutdown
. The behaviour is undefined if shutdown
is called without initialize
first being called.
void bmqa::MockSession::enqueueEvent | ( | const bmqa::Event & | event | ) |
Enqueue the specified event
in the queue of events to be emitted. NOTE: This method is unique to MockSession
and is valid only in unit tests.
bool bmqa::MockSession::emitEvent | ( | int | numEvents = 1 |
) |
Emit the specified number of numEvents
from the queue of events to be emitted. Return true if at least one event was emitted, and false otherwise. NOTE: This method is unique to MockSession
and is valid only in unit tests.
Call& bmqa::MockSession::expect_start | ( | const bsls::TimeInterval & | timeout = bsls::TimeInterval() |
) |
Call& bmqa::MockSession::expect_startAsync | ( | const bsls::TimeInterval & | timeout = bsls::TimeInterval() |
) |
Call& bmqa::MockSession::expect_stop | ( | ) |
Call& bmqa::MockSession::expect_stopAsync | ( | ) |
Call& bmqa::MockSession::expect_finalizeStop | ( | ) |
Call& bmqa::MockSession::expect_openQueue | ( | QueueId * | queueId, | |
const bmqt::Uri & | uri, | |||
bsls::Types::Uint64 | flags, | |||
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_openQueueSync | ( | QueueId * | queueId, | |
const bmqt::Uri & | uri, | |||
bsls::Types::Uint64 | flags, | |||
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_openQueueAsync | ( | QueueId * | queueId, | |
const bmqt::Uri & | uri, | |||
bsls::Types::Uint64 | flags, | |||
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_openQueueAsync | ( | QueueId * | queueId, | |
const bmqt::Uri & | uri, | |||
bsls::Types::Uint64 | flags, | |||
const OpenQueueCallback & | callback, | |||
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_closeQueue | ( | QueueId * | queueId, | |
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_closeQueueSync | ( | QueueId * | queueId, | |
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_closeQueueAsync | ( | QueueId * | queueId, | |
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_closeQueueAsync | ( | QueueId * | queueId, | |
const CloseQueueCallback & | callback, | |||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_configureQueue | ( | QueueId * | queueId, | |
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_configureQueueSync | ( | QueueId * | queueId, | |
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_configureQueueAsync | ( | QueueId * | queueId, | |
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_configureQueueAsync | ( | QueueId * | queueId, | |
const bmqt::QueueOptions & | options, | |||
const ConfigureQueueCallback & | callback, | |||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) |
Call& bmqa::MockSession::expect_nextEvent | ( | const bsls::TimeInterval & | timeout = bsls::TimeInterval() |
) |
Call& bmqa::MockSession::expect_post | ( | const MessageEvent & | messageEvent | ) |
Call& bmqa::MockSession::expect_confirmMessage | ( | const Message & | message | ) |
Call& bmqa::MockSession::expect_confirmMessage | ( | const MessageConfirmationCookie & | cookie | ) |
Call& bmqa::MockSession::expect_confirmMessages | ( | ConfirmEventBuilder * | builder | ) |
Expect a call to the function and return a reference offering modifiable access to the corresponding Call
object.
NOTE: Do not use these method directly, use the macro BMQA_EXPECT_CALL
instead.
int bmqa::MockSession::start | ( | const bsls::TimeInterval & | timeout = bsls::TimeInterval() |
) | [virtual] |
Connect to the BlazingMQ broker and start the message processing for this Session
. This method blocks until either the Session
is connected to the broker, fails to connect, or the operation times out. If the optionally specified timeout
is not populated, use the one defined in the session options. Return 0 on success, or a non-zero value corresponding to the bmqt::GenericResult::Enum
enum values otherwise. The behavior is undefined if this method is called on an already started Session
.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::startAsync | ( | const bsls::TimeInterval & | timeout = bsls::TimeInterval() |
) | [virtual] |
Start the MockSession
with an optionally specified timeout
. The return values are elucidated in bmqt::GenericResult
. In general a call to start
or startAsync
emits a SessionEvent
of type e_CONNECTED
or e_CONNECTION_TIMEOUT
.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::stop | ( | ) | [virtual] |
Gracefully disconnect from the BlazingMQ broker and stop the operation of this Session
. This method blocks waiting for all already invoked event handlers to exit and all session-related operations to be finished. No other method but start()
may be used after this method returns. This method must NOT be called if the session is in synchronous mode (i.e., not using the EventHandler), stopAsync()
should be called in this case.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::stopAsync | ( | ) | [virtual] |
Stop the MockSession
. In general a call to start
or startAsync
emits a SessionEvent
of type e_DISCONNECTED
or e_CONNECTION_TIMEOUT
.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::finalizeStop | ( | ) | [virtual] |
This method is only to be used if the session is in synchronous mode (i.e., not using the EventHandler): it must be called once all threads getting events with nextEvent()
have been joined.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::loadMessageEventBuilder | ( | MessageEventBuilder * | builder | ) | [virtual] |
Load the MessageEventBuilder
into the specified builder
output parameter.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::loadConfirmEventBuilder | ( | ConfirmEventBuilder * | builder | ) | [virtual] |
Load the ConfirmEventBuilder
into the specified builder
output parameter.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::loadMessageProperties | ( | MessageProperties * | buffer | ) | [virtual] |
Load the MessageProperties
into the specified buffer
output parameter.
Reimplemented from bmqa::AbstractSession.
Load QueueId
object associated with the specified uri
into the specified queueId
output parameter.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::getQueueId | ( | QueueId * | queueId, | |
const bmqt::CorrelationId & | correlationId | |||
) | const [virtual] |
Load QueueId
object associated with the specified correlationId
into the specified queueId
output parameter.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::openQueue | ( | QueueId * | queueId, | |
const bmqt::Uri & | uri, | |||
bsls::Types::Uint64 | flags, | |||
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
DEPRECATED: Use the openQueueSync(QueueId *queueId...)
instead. This method will be marked as BSLS_ANNOTATION_DEPRECATED
in future release of libbmq.
Reimplemented from bmqa::AbstractSession.
OpenQueueStatus bmqa::MockSession::openQueueSync | ( | QueueId * | queueId, | |
const bmqt::Uri & | uri, | |||
bsls::Types::Uint64 | flags, | |||
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
Open the queue having the specified uri
with the specified flags
(a combination of the values defined in bmqt::QueueFlags::Enum
), using the specified queueId
to correlate events related to that queue. The object queueId
referring to is modified, so the queueId
represents the actual queue uri, flags and options. Return a result providing the status and context of the operation. Use the optionally specified options
to configure some advanced settings. In general, a call to openQueueSync
emits nothing.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::openQueueAsync | ( | QueueId * | queueId, | |
const bmqt::Uri & | uri, | |||
bsls::Types::Uint64 | flags, | |||
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
DEPRECATED: Use the openQueueAsync(...)
with callback flavor instead. This method will be marked as BSLS_ANNOTATION_DEPRECATED
in future release of libbmq.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::openQueueAsync | ( | QueueId * | queueId, | |
const bmqt::Uri & | uri, | |||
bsls::Types::Uint64 | flags, | |||
const OpenQueueCallback & | callback, | |||
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
Asynchronously open the queue having the specified uri
with the specified flags
(a combination of the values defined in bmqt::QueueFlags::Enum
). The object queueId
referring to is modified, so the queueId
represents the actual queue uri, flags and options. The result of the operation is communicated to the specified callback
via a bmqa::OpenQueueStatus
, providing an automatically generated correlation queueId
and the status and context of the requested operation. Use the optionally specified options
to configure some advanced settings. In general, a call to openQueueAsync
does not emit a SessionEvent
, but rather invokes the callback
(if provided) instead when the corresponding emitEvent
is called.
NOTE: openQueueAsync
updates the queue state to e_OPENING
which is further updated upon invocation of the callback
(if provided) with a successful bmqa::OpenQueueStatus
.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::configureQueue | ( | QueueId * | queueId, | |
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
DEPRECATED: Use the 'configureQueueSync(QueueId *queueId...) instead. This method will be marked as BSLS_ANNOTATION_DEPRECATED
in future release of libbmq.
Reimplemented from bmqa::AbstractSession.
ConfigureQueueStatus bmqa::MockSession::configureQueueSync | ( | const QueueId * | queueId, | |
const bmqt::QueueOptions & | options, | |||
const bsls::TimeInterval & | timeout | |||
) | [virtual] |
Configure the queue identified by the specified queueId
using the specified options
to configure some advanced settings and return a result providing the status and context of the operation. In general, a call to configureQueueSync
emits nothing.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::configureQueueAsync | ( | QueueId * | queueId, | |
const bmqt::QueueOptions & | options = bmqt::QueueOptions() , |
|||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
DEPRECATED: Use the configureQueueAsync(...)
with callback flavor instead. This method will be marked as BSLS_ANNOTATION_DEPRECATED
in future release of libbmq.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::configureQueueAsync | ( | const QueueId * | queueId, | |
const bmqt::QueueOptions & | options, | |||
const ConfigureQueueCallback & | callback, | |||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
Asynchronously configure the queue identified by the specified queueId
using the specified options
to configure some advanced settings. The result of the operation is communicated to the specified callback
via a bmqa::ConfigureQueueStatus
, providing the status and context of the requested operation. In general, a call to configureQueueAsync
does not emit a SessionEvent
, but rather invokes the callback
(if provided) instead when the corresponding emitEvent
is called.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::closeQueue | ( | QueueId * | queueId, | |
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
DEPRECATED: Use the closeQueueSync(QueueId *queueId...)
instead. This method will be marked as BSLS_ANNOTATION_DEPRECATED
in future release of libbmq.
Reimplemented from bmqa::AbstractSession.
CloseQueueStatus bmqa::MockSession::closeQueueSync | ( | const QueueId * | queueId, | |
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
Close the queue identified by the specified queueId
using the specified timeout
. Populate the optionally specified result
with the status and context of the operation and return a value providing the status of the operation. In general, a call to closeQueueSync
emits nothing.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::closeQueueAsync | ( | QueueId * | queueId, | |
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
DEPRECATED: Use the closeQueueAsync(...)
with callback flavor instead. This method will be marked as BSLS_ANNOTATION_DEPRECATED
in future release of libbmq.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::closeQueueAsync | ( | const QueueId * | queueId, | |
const CloseQueueCallback & | callback, | |||
const bsls::TimeInterval & | timeout = bsls::TimeInterval() | |||
) | [virtual] |
Asynchronously close the queue identified by the specified queueId
using the specified timeout
. The result of the operation is communicated to the specified callback
via a bmqa::CloseQueueStatus
, providing the status and context of the requested operation. In general, a call to closeQueueAsync
does not emit a SessionEvent
, but rather invokes the callback
(if provided) instead when the corresponding emitEvent
is called.
Reimplemented from bmqa::AbstractSession.
Event bmqa::MockSession::nextEvent | ( | const bsls::TimeInterval & | timeout = bsls::TimeInterval() |
) | [virtual] |
Returns the nextEvent emitted.
NOTE: This method should only be used when the MockSession
has been created in synchronous mode. It is invalid if used in asynchronous mode and your test case is likely to be faulty if used with such a set up.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::post | ( | const MessageEvent & | messageEvent | ) | [virtual] |
Post the specified messageEvent
. Return values are defined as per bmqt::PostResult
. In general a call to post
emits a MessageEvent
of type e_ACK
or no response if acks are not requested.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::confirmMessage | ( | const Message & | message | ) | [virtual] |
Asynchronously confirm the receipt of the specified message
. This indicates that the application is done processing the message and that the broker can safely discard it from the queue according to the retention policy set up for that queue. Return 0 on success, and a non-zero value otherwise. Note that success implies that SDK has accepted the message
and will eventually send confirmation notification to the broker.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::confirmMessage | ( | const MessageConfirmationCookie & | cookie | ) | [virtual] |
Asynchronously confirm the receipt of the message with which the specified cookie
is associated. This indicates that the application is done processing the message and that the broker can safely discard it from the queue according to the retention policy set up for that queue. Return 0 on success, and a non-zero value otherwise. Note that success implies that SDK has accepted the message
and will eventually send confirmation notification to the broker.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::confirmMessages | ( | ConfirmEventBuilder * | builder | ) | [virtual] |
Confirm messages specified by the message
, cookie
or builder
. Return values are defined as per bmqt::GenericResult
. No event is emitted for calls to confirmMessage
.
Reimplemented from bmqa::AbstractSession.
int bmqa::MockSession::configureMessageDumping | ( | const bslstl::StringRef & | command | ) | [virtual] |
Configure this session instance to dump messages to the installed logger at ball::Severity::INFO
level according to the specified command
that should adhere to the following pattern:
IN|OUT ON|OFF|100|10s
where each token has a specific meaning:
PUSH
and ACK
) events PUT
and CONFIRM
) events Note that above, 100
and 10
numerical values are for just for illustration purposes, and application can choose an appropriate value for them. Also note that pattern is case-insensitive. Return zero if command
is valid and message dumping has been configured, non-zero value otherwise. The behavior is undefined unless the session has been started.
Reimplemented from bmqa::AbstractSession.
void bmqa::MockSession::setFailureCallback | ( | const FailureCb & | failureCb | ) |
Set the failure callback of to be the specified failureCb
. This callback is invoked whenever an expectation set by the test driver is not met.
bool bmqa::MockSession::popPostedEvent | ( | bmqa::MessageEvent * | event | ) |
Load into the specified event
the next posted event on this session, if any, and return true; leave event
unchanged and return false otherwise.
size_t bmqa::MockSession::unconfirmedMessages | ( | ) | const |
Get the number of unconfirmed messages. This corresponds to the number of push messages enqueued to the session object but not yet confirmed by the application.