diff --git a/unittests/action/TestActionHelper.cpp b/unittests/action/TestActionHelper.cpp index 39b16d6f..513008ba 100644 --- a/unittests/action/TestActionHelper.cpp +++ b/unittests/action/TestActionHelper.cpp @@ -11,7 +11,7 @@ TEST_CASE("Action Helper", "[action]") { ActionHelperOwnerMockBase testDhMock; // TODO: Setting another number here breaks the test. Find out why - MessageQueueMock testMqMock(MessageQueueIF::NO_QUEUE); + MessageQueueMock testMqMock(MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE); ActionHelper actionHelper = ActionHelper(&testDhMock, dynamic_cast(&testMqMock)); CommandMessage actionMessage; ActionId_t testActionId = 777; diff --git a/unittests/cfdp/handler/testDestHandler.cpp b/unittests/cfdp/handler/testDestHandler.cpp index b6d7ec68..ccdf6fed 100644 --- a/unittests/cfdp/handler/testDestHandler.cpp +++ b/unittests/cfdp/handler/testDestHandler.cpp @@ -24,7 +24,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") { using namespace returnvalue; MessageQueueId_t destQueueId = 2; AcceptsTmMock tmReceiver(destQueueId); - MessageQueueMock mqMock(destQueueId); + MessageQueueMock mqMock(destQueueId, MessageQueueIF::NO_QUEUE); auto localId = EntityId(UnsignedByteField(2)); auto remoteId = EntityId(UnsignedByteField(3)); FaultHandlerMock fhMock; diff --git a/unittests/cfdp/handler/testDistributor.cpp b/unittests/cfdp/handler/testDistributor.cpp index dd8d996d..da9767b1 100644 --- a/unittests/cfdp/handler/testDistributor.cpp +++ b/unittests/cfdp/handler/testDistributor.cpp @@ -12,7 +12,7 @@ TEST_CASE("CFDP Distributor", "[cfdp][distributor]") { LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}}; StorageManagerMock pool(objects::NO_OBJECT, cfg); - auto queue = MessageQueueMock(1); + auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE); CfdpDistribCfg distribCfg(1, pool, &queue); auto distributor = CfdpDistributor(distribCfg); auto obswEntityId = cfdp::EntityId(UnsignedByteField(2)); diff --git a/unittests/cfdp/handler/testReservedMsgParser.cpp b/unittests/cfdp/handler/testReservedMsgParser.cpp index 3e70acba..a33dcf18 100644 --- a/unittests/cfdp/handler/testReservedMsgParser.cpp +++ b/unittests/cfdp/handler/testReservedMsgParser.cpp @@ -20,7 +20,7 @@ TEST_CASE("Reserved Message Parser", "[cfdp]") { std::string srcFileName = "hello.txt"; std::string destFileName = "hello2.txt"; MessageQueueId_t destQueueId = 2; - MessageQueueMock msgQueue(1); + MessageQueueMock msgQueue(1, destQueueId); LocalPool::LocalPoolConfig storeCfg = {{10, 32}, {10, 64}, {10, 128}, {10, 1024}}; StorageManagerMock ipcStore(0, storeCfg); std::array buffer{}; diff --git a/unittests/datapoollocal/testDataSet.cpp b/unittests/datapoollocal/testDataSet.cpp index 93e761b3..1a5940f3 100644 --- a/unittests/datapoollocal/testDataSet.cpp +++ b/unittests/datapoollocal/testDataSet.cpp @@ -15,7 +15,7 @@ using namespace returnvalue; using namespace lpool; TEST_CASE("DataSetTest", "[DataSetTest]") { - auto queue = MessageQueueMock(1); + auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE); TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); poolOwner.initialize(); StaticTestDataset localSet; diff --git a/unittests/datapoollocal/testLocalPoolManager.cpp b/unittests/datapoollocal/testLocalPoolManager.cpp index 89c69956..0c85e1f6 100644 --- a/unittests/datapoollocal/testLocalPoolManager.cpp +++ b/unittests/datapoollocal/testLocalPoolManager.cpp @@ -16,12 +16,11 @@ using namespace lpool; TEST_CASE("Pool Owner and Periodic HK", "[datapool]") { - constexpr MessageQueueId_t defaultDestId = 1; - constexpr MessageQueueId_t hkDest = defaultDestId; - const MessageQueueId_t subscriberId = 2; - auto hkReceiver = HkReceiverMock(hkDest); - auto queue = MessageQueueMock(3); - TestPoolOwner poolOwner(queue, hkDest, objects::TEST_LOCAL_POOL_OWNER_BASE); + constexpr MessageQueueId_t DEFAULT_DEST_ID = 1; + constexpr MessageQueueId_t HK_DEST = DEFAULT_DEST_ID; + auto hkReceiver = HkReceiverMock(HK_DEST); + auto queue = MessageQueueMock(3, HK_DEST); + TestPoolOwner poolOwner(queue, HK_DEST, objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner.initialize() == returnvalue::OK); @@ -42,7 +41,7 @@ TEST_CASE("Pool Owner and Periodic HK", "[datapool]") { CommandMessageCleaner::clearCommandMessage(&messageSent); } - SECTION("PeriodicHKAndMessaging") { + SECTION("Periodic HK And Messaging") { // Now we subcribe for a HK periodic generation. Even when it's difficult to simulate // the temporal behaviour correctly the HK manager should generate a HK packet // immediately and the periodic helper depends on HK op function calls anyway instead of diff --git a/unittests/datapoollocal/testLocalPoolVariable.cpp b/unittests/datapoollocal/testLocalPoolVariable.cpp index cc805ecf..4345e047 100644 --- a/unittests/datapoollocal/testLocalPoolVariable.cpp +++ b/unittests/datapoollocal/testLocalPoolVariable.cpp @@ -12,7 +12,7 @@ using namespace lpool; using namespace dp; TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") { - auto queue = MessageQueueMock(1); + auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE); lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner.initialize() == OK); diff --git a/unittests/datapoollocal/testLocalPoolVector.cpp b/unittests/datapoollocal/testLocalPoolVector.cpp index 47629b5a..994bb274 100644 --- a/unittests/datapoollocal/testLocalPoolVector.cpp +++ b/unittests/datapoollocal/testLocalPoolVector.cpp @@ -11,7 +11,7 @@ using namespace dp; using namespace lpool; TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") { - auto queue = MessageQueueMock(1); + auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE); lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner.initialize() == OK); diff --git a/unittests/devicehandler/TestDeviceHandlerBase.cpp b/unittests/devicehandler/TestDeviceHandlerBase.cpp index c3f4df84..d3f8a55f 100644 --- a/unittests/devicehandler/TestDeviceHandlerBase.cpp +++ b/unittests/devicehandler/TestDeviceHandlerBase.cpp @@ -14,7 +14,7 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { // Will be deleted with DHB destructor auto* cookieIFMock = new CookieIFMock; ComIFMock comIF(objects::COM_IF_MOCK); - MessageQueueMock mqMock(1); + MessageQueueMock mqMock(1, MessageQueueIF::NO_QUEUE); HkReceiverMock hkReceiver(1); DeviceFdirMock deviceFdirMock(objects::DEVICE_HANDLER_MOCK, objects::NO_OBJECT); DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK, diff --git a/unittests/mock/MessageQueueMock.cpp b/unittests/mock/MessageQueueMock.cpp index 96a6ee86..a0ba9279 100644 --- a/unittests/mock/MessageQueueMock.cpp +++ b/unittests/mock/MessageQueueMock.cpp @@ -3,8 +3,8 @@ #include #include -MessageQueueMock::MessageQueueMock(MessageQueueId_t queueId) - : MessageQueueBase(queueId, MessageQueueIF::NO_QUEUE, nullptr) {} +MessageQueueMock::MessageQueueMock(MessageQueueId_t queueId, MessageQueueId_t defaultDest) + : MessageQueueBase(queueId, defaultDest, nullptr) {} bool MessageQueueMock::wasMessageSent() const { return std::any_of( diff --git a/unittests/mock/MessageQueueMock.h b/unittests/mock/MessageQueueMock.h index cacb72e4..26ac9470 100644 --- a/unittests/mock/MessageQueueMock.h +++ b/unittests/mock/MessageQueueMock.h @@ -23,7 +23,7 @@ struct SendInfo { class MessageQueueMock : public MessageQueueBase { public: void addReceivedMessage(MessageQueueMessageIF& msg); - explicit MessageQueueMock(MessageQueueId_t queueId); + explicit MessageQueueMock(MessageQueueId_t queueId, MessageQueueId_t defaultDest); //! Get next message which was sent to the default destination ReturnValue_t getNextSentMessageToDefaultDest(MessageQueueMessageIF& message); diff --git a/unittests/tcdistributor/testCcsdsDistributor.cpp b/unittests/tcdistributor/testCcsdsDistributor.cpp index c61c6bc4..8e54f440 100644 --- a/unittests/tcdistributor/testCcsdsDistributor.cpp +++ b/unittests/tcdistributor/testCcsdsDistributor.cpp @@ -11,7 +11,7 @@ TEST_CASE("CCSDS Distributor", "[ccsds][tmtcdistrib]") { LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}}; LocalPool pool(objects::NO_OBJECT, cfg); - auto queue = MessageQueueMock(1); + auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE); auto checkerMock = CcsdsCheckerMock(); uint16_t unregisteredApid = 0; uint16_t defaultApid = 4; diff --git a/unittests/tmtcservices/testPsb.cpp b/unittests/tmtcservices/testPsb.cpp index b07cf7b4..3a60e421 100644 --- a/unittests/tmtcservices/testPsb.cpp +++ b/unittests/tmtcservices/testPsb.cpp @@ -14,7 +14,7 @@ TEST_CASE("Pus Service Base", "[pus-service-base]") { uint16_t apid = 2; auto verificationReporter = PusVerificationReporterMock(); - auto msgQueue = MessageQueueMock(1); + auto msgQueue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE); auto tmReceiver = AcceptsTmMock(2); auto psbParams = PsbParams(0, apid, 17); @@ -117,7 +117,7 @@ TEST_CASE("Pus Service Base", "[pus-service-base]") { } SECTION("Set Request Queue") { - auto msgQueueMock = MessageQueueMock(2); + auto msgQueueMock = MessageQueueMock(2, MessageQueueIF::NO_QUEUE); psb.setRequestQueue(msgQueueMock); auto& p = psb.getParams(); REQUIRE(p.reqQueue == &msgQueueMock); diff --git a/unittests/tmtcservices/testSendHelper.cpp b/unittests/tmtcservices/testSendHelper.cpp index 1af33603..56add958 100644 --- a/unittests/tmtcservices/testSendHelper.cpp +++ b/unittests/tmtcservices/testSendHelper.cpp @@ -10,8 +10,7 @@ TEST_CASE("TM Send Helper", "[tm-send-helper]") { MessageQueueId_t destId = 2; auto errReporter = InternalErrorReporterMock(); - auto msgQueue = MessageQueueMock(1); - msgQueue.setDefaultDestination(destId); + auto msgQueue = MessageQueueMock(1, destId); TmSendHelper sendHelper(msgQueue, errReporter, destId); auto timeStamper = CdsShortTimestamperMock(); LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}}; diff --git a/unittests/tmtcservices/testStoreAndSendHelper.cpp b/unittests/tmtcservices/testStoreAndSendHelper.cpp index 2c23c172..f68d687a 100644 --- a/unittests/tmtcservices/testStoreAndSendHelper.cpp +++ b/unittests/tmtcservices/testStoreAndSendHelper.cpp @@ -17,8 +17,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") { MessageQueueId_t destId = 1; auto errReporter = InternalErrorReporterMock(); - auto msgQueue = MessageQueueMock(2); - msgQueue.setDefaultDestination(destId); + auto msgQueue = MessageQueueMock(2, destId); TmSendHelper sendHelper(msgQueue, errReporter, destId); TmStoreAndSendWrapper tmHelper(17, storeHelper, sendHelper);