1919// MQB
2020#include < mqbcfg_brokerconfig.h>
2121#include < mqbcfg_messages.h>
22+ #include < mqbevt_ackevent.h>
23+ #include < mqbevt_pushevent.h>
24+ #include < mqbevt_putevent.h>
2225#include < mqbi_queue.h>
2326#include < mqbmock_cluster.h>
2427#include < mqbmock_dispatcher.h>
@@ -641,10 +644,6 @@ T assertFail()
641644
642645// / The `TestBench` holds system components together.
643646class TestBench {
644- private:
645- // PRIVATE TYPES
646- typedef mqbmock::Dispatcher::EventGuard EventGuard;
647-
648647 public:
649648 // DATA
650649 bdlbb::PooledBlobBufferFactory d_bufferFactory;
@@ -824,13 +823,11 @@ class TestBench {
824823 guid,
825824 queueId);
826825
827- mqbi::Dispatcher::DispatcherEventSp event =
828- bsl::allocate_shared<mqbi::DispatcherEvent>(d_allocator_p);
829- (*event)
830- .setType (mqbi::DispatcherEventType::e_ACK)
831- .setAckMessage (ackMessage);
826+ bsl::shared_ptr<mqbevt::AckEvent> event_sp =
827+ bsl::allocate_shared<mqbevt::AckEvent>(d_allocator_p);
828+ (*event_sp).setAckMessage (ackMessage);
832829
833- dispatch (event );
830+ dispatch (event_sp );
834831 }
835832
836833 // / Sends a `Put` event for the specified `queueId`, `msgGUID` and
@@ -870,16 +867,6 @@ class TestBench {
870867 &d_bufferFactory,
871868 cat);
872869
873- mqbi::Dispatcher::DispatcherEventSp event =
874- bsl::allocate_shared<mqbi::DispatcherEvent>(d_allocator_p);
875- (*event)
876- .setType (mqbi::DispatcherEventType::e_PUT)
877- .setIsRelay (true ) // Relay message
878- .setSource (&d_cs) // DispatcherClient *value
879- .setPutHeader (putHeader)
880- .setBlob (eventBlob) // const bsl::shared_ptr<bdlbb::Blob>& value
881- .setCompressionAlgorithmType (cat);
882-
883870 // Internal-ticket D167598037.
884871 // Verify that PutMessageIterator does not change the input.
885872 bmqp::Event rawEvent (eventBlob.get (),
@@ -898,7 +885,12 @@ class TestBench {
898885 BSLS_ASSERT (pIt2.next ());
899886 BSLS_ASSERT (pIt3.next ());
900887
901- dispatch (event);
888+ bsl::shared_ptr<mqbevt::PutEvent> event_sp =
889+ bsl::allocate_shared<mqbevt::PutEvent>(d_allocator_p);
890+ (*event_sp).setPutHeader (putHeader).setBlob (eventBlob).setSource (
891+ &d_cs);
892+
893+ dispatch (event_sp);
902894 }
903895
904896 // / Sends a `Push` event for the specified `queueId`, `msgGUID` and
@@ -912,20 +904,20 @@ class TestBench {
912904 {
913905 PVV (" Sending PUSH with queueId=" << queueId << " , guid=" << msgGUID);
914906
915- mqbi::Dispatcher::DispatcherEventSp event =
916- bsl::allocate_shared<mqbi::DispatcherEvent >(d_allocator_p);
907+ bsl::shared_ptr<mqbevt::PushEvent> event_sp =
908+ bsl::allocate_shared<mqbevt::PushEvent >(d_allocator_p);
917909
918- (*event)
919- .setType (mqbi::DispatcherEventType::e_PUSH)
920- .setSource (&d_cs) // DispatcherClient *value
910+ (*event_sp)
911+ .setSource (&d_cs)
921912 .setQueueId (queueId)
922913 .setBlob (blob)
923914 .setGuid (msgGUID)
924915 .setMessagePropertiesInfo (logic)
925916 .setCompressionAlgorithmType (cat);
926917
927- dispatch (event );
918+ dispatch (event_sp );
928919 }
920+
929921 bool validateData (const bdlbb::Blob& blob,
930922 int offset,
931923 int length = k_PAYLOAD_LENGTH)
@@ -1013,7 +1005,8 @@ class TestBench {
10131005 // / using the specified `event`.
10141006 void dispatch (mqbi::Dispatcher::DispatcherEventSp event)
10151007 {
1016- EventGuard guard (d_mockDispatcher._withEvent (&d_cs, event));
1008+ mqbmock::Dispatcher::EventGuard guard (
1009+ d_mockDispatcher._withEvent (&d_cs, event));
10171010
10181011 d_cs.onDispatcherEvent (*event);
10191012 }
@@ -1943,9 +1936,6 @@ static void test9_newStylePush()
19431936
19441937 BMQTST_ASSERT_EQ (bmqt::EventBuilderResult::e_SUCCESS, rc);
19451938
1946- mqbi::Dispatcher::DispatcherEventSp putEvent =
1947- bsl::allocate_shared<mqbi::DispatcherEvent>(
1948- bmqtst::TestHelperUtil::allocator ());
19491939 bmqp::Event rawEvent (peb.blob ().get (),
19501940 bmqtst::TestHelperUtil::allocator ());
19511941
@@ -1957,14 +1947,15 @@ static void test9_newStylePush()
19571947 rawEvent.loadPutMessageIterator (&putIt, false );
19581948 BSLS_ASSERT (putIt.next ());
19591949
1960- (*putEvent)
1961- .setType (mqbi::DispatcherEventType::e_PUT)
1962- .setIsRelay (true ) // Relay message
1963- .setSource (&tb.d_cs ) // DispatcherClient *value
1950+ bsl::shared_ptr<mqbevt::PutEvent> event_sp =
1951+ bsl::allocate_shared<mqbevt::PutEvent>(
1952+ bmqtst::TestHelperUtil::allocator ());
1953+ (*event_sp)
1954+ .setSource (&tb.d_cs )
19641955 .setPutHeader (putIt.header ())
1965- .setBlob (peb.blob ()); // const bsl::shared_ptr<bdlbb::Blob>& value
1956+ .setBlob (peb.blob ());
19661957
1967- tb.dispatch (putEvent );
1958+ tb.dispatch (event_sp );
19681959
19691960 // Check if a message was sent
19701961 const bsl::vector<MyMockQueueHandle::Post>& postMessages =
@@ -2060,9 +2051,6 @@ static void test10_newStyleCompressedPush()
20602051
20612052 BMQTST_ASSERT_EQ (bmqt::EventBuilderResult::e_SUCCESS, rc);
20622053
2063- mqbi::Dispatcher::DispatcherEventSp putEvent =
2064- bsl::allocate_shared<mqbi::DispatcherEvent>(
2065- bmqtst::TestHelperUtil::allocator ());
20662054 bmqp::Event rawEvent (peb.blob ().get (),
20672055 bmqtst::TestHelperUtil::allocator ());
20682056
@@ -2074,15 +2062,15 @@ static void test10_newStyleCompressedPush()
20742062 rawEvent.loadPutMessageIterator (&putIt, false );
20752063 BSLS_ASSERT (putIt.next ());
20762064
2077- (*putEvent)
2078- .setType (mqbi::DispatcherEventType::e_PUT)
2079- .setIsRelay (true ) // Relay message
2080- .setSource (&tb.d_cs ) // DispatcherClient *value
2065+ bsl::shared_ptr<mqbevt::PutEvent> event_sp =
2066+ bsl::allocate_shared<mqbevt::PutEvent>(
2067+ bmqtst::TestHelperUtil::allocator ());
2068+ (*event_sp)
2069+ .setSource (&tb.d_cs )
20812070 .setPutHeader (putIt.header ())
2082- .setBlob (peb.blob ()) // const bsl::shared_ptr<bdlbb::Blob>& value
2083- .setCompressionAlgorithmType (bmqt::CompressionAlgorithmType::e_ZLIB);
2071+ .setBlob (peb.blob ());
20842072
2085- tb.dispatch (putEvent );
2073+ tb.dispatch (event_sp );
20862074
20872075 // Check if a message was sent
20882076 const bsl::vector<MyMockQueueHandle::Post>& postMessages =
0 commit comments