|
|
@ -21,8 +21,10 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->initializeHkManagerAfterTaskCreation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->initializeHkManagerAfterTaskCreation() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
MessageQueueMockBase* mqMock = poolOwner->getMockQueueHandle();
|
|
|
|
MessageQueueMockBase* poolOwnerMock = poolOwner->getMockQueueHandle();
|
|
|
|
REQUIRE(mqMock != nullptr);
|
|
|
|
REQUIRE(poolOwnerMock != nullptr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MessageQueueIF* hkCommander = QueueFactory::instance()->createMessageQueue();
|
|
|
|
CommandMessage messageSent;
|
|
|
|
CommandMessage messageSent;
|
|
|
|
uint8_t messagesSent = 0;
|
|
|
|
uint8_t messagesSent = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -41,9 +43,9 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
/* Now the update message should be generated. */
|
|
|
|
/* Now the update message should be generated. */
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent() == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent() == true);
|
|
|
|
|
|
|
|
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
|
|
|
|
|
|
|
|
|
|
@ -53,9 +55,9 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
|
|
|
|
|
|
|
|
|
|
@ -63,15 +65,15 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
REQUIRE(poolOwner->subscribeWrapperSetUpdateHk() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->subscribeWrapperSetUpdateHk() == retval::CATCH_OK);
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 2);
|
|
|
|
CHECK(messagesSent == 2);
|
|
|
|
/* first message sent should be the update notification, considering
|
|
|
|
/* first message sent should be the update notification, considering
|
|
|
|
the internal list is a vector checked in insertion order. */
|
|
|
|
the internal list is a vector checked in insertion order. */
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
|
|
|
|
|
|
|
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
CHECK(messageSent.getCommand() == static_cast<int>(HousekeepingMessage::HK_REPORT));
|
|
|
|
CHECK(messageSent.getCommand() == static_cast<int>(HousekeepingMessage::HK_REPORT));
|
|
|
|
/* Clear message to avoid memory leak, our mock won't do it for us (yet) */
|
|
|
|
/* Clear message to avoid memory leak, our mock won't do it for us (yet) */
|
|
|
|
CommandMessageCleaner::clearCommandMessage(&messageSent);
|
|
|
|
CommandMessageCleaner::clearCommandMessage(&messageSent);
|
|
|
@ -99,9 +101,9 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
|
|
|
|
|
|
|
|
/* Trigger generation of snapshot */
|
|
|
|
/* Trigger generation of snapshot */
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
/* Check that snapshot was generated */
|
|
|
|
/* Check that snapshot was generated */
|
|
|
|
CHECK(messageSent.getCommand() == static_cast<int>(HousekeepingMessage::UPDATE_SNAPSHOT_SET));
|
|
|
|
CHECK(messageSent.getCommand() == static_cast<int>(HousekeepingMessage::UPDATE_SNAPSHOT_SET));
|
|
|
|
/* Now we deserialize the snapshot into a new dataset instance */
|
|
|
|
/* Now we deserialize the snapshot into a new dataset instance */
|
|
|
@ -162,12 +164,12 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
/* Check update snapshot was sent. */
|
|
|
|
/* Check update snapshot was sent. */
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
|
|
|
|
|
|
|
|
/* Should have been reset. */
|
|
|
|
/* Should have been reset. */
|
|
|
|
CHECK(poolVar->hasChanged() == false);
|
|
|
|
CHECK(poolVar->hasChanged() == false);
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_SNAPSHOT_VARIABLE));
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_SNAPSHOT_VARIABLE));
|
|
|
|
/* Now we deserialize the snapshot into a new dataset instance */
|
|
|
|
/* Now we deserialize the snapshot into a new dataset instance */
|
|
|
@ -209,11 +211,11 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
/* Check update notification was sent. */
|
|
|
|
/* Check update notification was sent. */
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
/* Should have been reset. */
|
|
|
|
/* Should have been reset. */
|
|
|
|
CHECK(poolVar->hasChanged() == false);
|
|
|
|
CHECK(poolVar->hasChanged() == false);
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE));
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE));
|
|
|
|
/* Now subscribe for the dataset update (HK and update) again with subscription interface */
|
|
|
|
/* Now subscribe for the dataset update (HK and update) again with subscription interface */
|
|
|
@ -225,26 +227,26 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
/* Now two messages should be sent. */
|
|
|
|
/* Now two messages should be sent. */
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 2);
|
|
|
|
CHECK(messagesSent == 2);
|
|
|
|
mqMock->clearMessages(true);
|
|
|
|
poolOwnerMock->clearMessages(true);
|
|
|
|
|
|
|
|
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
poolOwner->dataset.setChanged(true);
|
|
|
|
poolVar->setChanged(true);
|
|
|
|
poolVar->setChanged(true);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
/* Now three messages should be sent. */
|
|
|
|
/* Now three messages should be sent. */
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 3);
|
|
|
|
CHECK(messagesSent == 3);
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE));
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE));
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
CHECK(messageSent.getCommand() ==
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
|
|
|
static_cast<int>(HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
|
|
|
CHECK(messageSent.getCommand() == static_cast<int>(HousekeepingMessage::HK_REPORT));
|
|
|
|
CHECK(messageSent.getCommand() == static_cast<int>(HousekeepingMessage::HK_REPORT));
|
|
|
|
CommandMessageCleaner::clearCommandMessage(&messageSent);
|
|
|
|
CommandMessageCleaner::clearCommandMessage(&messageSent);
|
|
|
|
REQUIRE(mqMock->receiveMessage(&messageSent) == static_cast<int>(MessageQueueIF::EMPTY));
|
|
|
|
REQUIRE(poolOwnerMock->receiveMessage(&messageSent) == static_cast<int>(MessageQueueIF::EMPTY));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SECTION("PeriodicHKAndMessaging") {
|
|
|
|
SECTION("PeriodicHKAndMessaging") {
|
|
|
@ -255,38 +257,38 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
REQUIRE(poolOwner->subscribePeriodicHk(true) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->subscribePeriodicHk(true) == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
/* Now HK packet should be sent as message immediately. */
|
|
|
|
/* Now HK packet should be sent as message immediately. */
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
LocalPoolDataSetBase* setHandle = poolOwner->getDataSetHandle(lpool::testSid);
|
|
|
|
LocalPoolDataSetBase* setHandle = poolOwner->getDataSetHandle(lpool::testSid);
|
|
|
|
REQUIRE(setHandle != nullptr);
|
|
|
|
REQUIRE(setHandle != nullptr);
|
|
|
|
CHECK(poolOwner->poolManager.generateHousekeepingPacket(lpool::testSid, setHandle, false) ==
|
|
|
|
CHECK(poolOwner->poolManager.generateHousekeepingPacket(lpool::testSid, setHandle, false) ==
|
|
|
|
retval::CATCH_OK);
|
|
|
|
retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
CHECK(setHandle->getReportingEnabled() == true);
|
|
|
|
CHECK(setHandle->getReportingEnabled() == true);
|
|
|
|
CommandMessage hkCmd;
|
|
|
|
CommandMessage hkCmd;
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false, false);
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false, false);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(setHandle->getReportingEnabled() == false);
|
|
|
|
CHECK(setHandle->getReportingEnabled() == false);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, true, false);
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, true, false);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(setHandle->getReportingEnabled() == true);
|
|
|
|
CHECK(setHandle->getReportingEnabled() == true);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false, false);
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false, false);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(setHandle->getReportingEnabled() == false);
|
|
|
|
CHECK(setHandle->getReportingEnabled() == false);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4,
|
|
|
|
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4,
|
|
|
|
false);
|
|
|
|
false);
|
|
|
@ -294,23 +296,23 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
/* For non-diagnostics and a specified minimum frequency of 0.2 seconds, the
|
|
|
|
/* For non-diagnostics and a specified minimum frequency of 0.2 seconds, the
|
|
|
|
resulting collection interval should be 1.0 second */
|
|
|
|
resulting collection interval should be 1.0 second */
|
|
|
|
CHECK(poolOwner->dataset.getCollectionInterval() == 1.0);
|
|
|
|
CHECK(poolOwner->dataset.getCollectionInterval() == 1.0);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, false);
|
|
|
|
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, false);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
/* Now HK packet should be sent as message. */
|
|
|
|
/* Now HK packet should be sent as message. */
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid, false);
|
|
|
|
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid, false);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setUpdateNotificationSetCommand(&hkCmd, lpool::testSid);
|
|
|
|
HousekeepingMessage::setUpdateNotificationSetCommand(&hkCmd, lpool::testSid);
|
|
|
|
sid_t sidToCheck;
|
|
|
|
sid_t sidToCheck;
|
|
|
@ -326,62 +328,62 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) ==
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) ==
|
|
|
|
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
|
|
|
|
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
|
|
|
|
/* We still expect a failure message being sent */
|
|
|
|
/* We still expect a failure message being sent */
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4,
|
|
|
|
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4,
|
|
|
|
false);
|
|
|
|
false);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) ==
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) ==
|
|
|
|
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
|
|
|
|
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, false);
|
|
|
|
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, false);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) ==
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) ==
|
|
|
|
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
|
|
|
|
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, true);
|
|
|
|
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, true);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4,
|
|
|
|
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4,
|
|
|
|
true);
|
|
|
|
true);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, true, true);
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, true, true);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false, true);
|
|
|
|
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false, true);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid, false);
|
|
|
|
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid, false);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) ==
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) ==
|
|
|
|
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
|
|
|
|
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid, true);
|
|
|
|
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid, true);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
|
|
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
REQUIRE(poolOwnerMock->wasMessageSent(&messagesSent) == true);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(messagesSent == 1);
|
|
|
|
CHECK(mqMock->popMessage() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwnerMock->popMessage() == retval::CATCH_OK);
|
|
|
|
|
|
|
|
|
|
|
|
HousekeepingMessage::setUpdateNotificationVariableCommand(&hkCmd, lpool::uint8VarGpid);
|
|
|
|
HousekeepingMessage::setUpdateNotificationVariableCommand(&hkCmd, lpool::uint8VarGpid);
|
|
|
|
gp_id_t gpidToCheck;
|
|
|
|
gp_id_t gpidToCheck;
|
|
|
@ -407,5 +409,5 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|
|
|
/* we need to reset the subscription list because the pool owner
|
|
|
|
/* we need to reset the subscription list because the pool owner
|
|
|
|
is a global object. */
|
|
|
|
is a global object. */
|
|
|
|
CHECK(poolOwner->reset() == retval::CATCH_OK);
|
|
|
|
CHECK(poolOwner->reset() == retval::CATCH_OK);
|
|
|
|
mqMock->clearMessages(true);
|
|
|
|
poolOwnerMock->clearMessages(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|