remove more obsolete code

This commit is contained in:
Robin Müller 2023-08-15 18:06:50 +02:00
parent 1e78d6ce66
commit 12f8cc5fc2
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
9 changed files with 13 additions and 71 deletions

View File

@ -349,7 +349,6 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(subdp::ParamsBase
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, params.sid);
if (dataSet != nullptr) {
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, params.enableReporting);
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, params.isDiagnostics());
LocalPoolDataSetAttorney::initializePeriodicHelper(*dataSet, params.collectionInterval,
owner->getPeriodicOperationFrequency());
}
@ -381,7 +380,6 @@ ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(subdp::ParamsBase&
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, params.sid);
if (dataSet != nullptr) {
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, true);
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, params.isDiagnostics());
}
hkReceivers.push_back(hkReceiver);
@ -585,11 +583,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
/* Now we set a HK message and send it the HK packet destination. */
CommandMessage hkMessage;
if (LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) {
HousekeepingMessage::setHkDiagnosticsReply(&hkMessage, sid, storeId);
} else {
HousekeepingMessage::setHkReportReply(&hkMessage, sid, storeId);
}
HousekeepingMessage::setHkReportReply(&hkMessage, sid, storeId);
if (hkQueue == nullptr) {
/* Error, no queue available to send packet with. */

View File

@ -239,10 +239,6 @@ ReturnValue_t LocalPoolDataSetBase::serialize(uint8_t **buffer, size_t *size, si
}
}
void LocalPoolDataSetBase::setDiagnostic(bool isDiagnostics) { this->diagnostic = isDiagnostics; }
bool LocalPoolDataSetBase::isDiagnostics() const { return diagnostic; }
void LocalPoolDataSetBase::setReportingEnabled(bool reportingEnabled) {
this->reportingEnabled = reportingEnabled;
}

View File

@ -182,10 +182,6 @@ class LocalPoolDataSetBase : public PoolDataSetBase, public MarkChangedIF {
//! This mutex is used if the data is created by one object only.
MutexIF* mutexIfSingleDataCreator = nullptr;
bool diagnostic = false;
void setDiagnostic(bool diagnostics);
bool isDiagnostics() const;
/**
* Used for periodic generation.
*/

View File

@ -5,12 +5,6 @@
class LocalPoolDataSetAttorney {
private:
static void setDiagnostic(LocalPoolDataSetBase& set, bool diagnostics) {
set.setDiagnostic(diagnostics);
}
static bool isDiagnostics(LocalPoolDataSetBase& set) { return set.isDiagnostics(); }
static void initializePeriodicHelper(LocalPoolDataSetBase& set, float collectionInterval,
uint32_t minimumPeriodicIntervalMs) {
set.initializePeriodicHelper(collectionInterval, minimumPeriodicIntervalMs);

View File

@ -14,14 +14,6 @@ void HousekeepingMessage::setHkReportReply(CommandMessage *message, sid_t sid,
message->setParameter3(storeId.raw);
}
void HousekeepingMessage::setHkDiagnosticsReply(CommandMessage *message, sid_t sid,
store_address_t storeId) {
message->setCommand(DIAGNOSTICS_REPORT);
message->setMessageSize(HK_MESSAGE_SIZE);
setSid(message, sid);
message->setParameter3(storeId.raw);
}
sid_t HousekeepingMessage::getHkDataReply(const CommandMessage *message,
store_address_t *storeIdToSet) {
if (storeIdToSet != nullptr) {

View File

@ -64,7 +64,6 @@ class HousekeepingMessage {
float collectionInterval);
static void setHkReportReply(CommandMessage* reply, sid_t sid, store_address_t storeId);
static void setHkDiagnosticsReply(CommandMessage* reply, sid_t sid, store_address_t storeId);
static void setHkRequestSuccessReply(CommandMessage* reply, sid_t sid);
static void setHkRequestFailureReply(CommandMessage* reply, sid_t sid, ReturnValue_t error);

View File

@ -288,34 +288,33 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
CHECK(setHandle->getReportingEnabled() == true);
CommandMessage hkCmd;
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false, false);
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
CHECK(setHandle->getReportingEnabled() == false);
REQUIRE(poolOwnerMock.wasMessageSent());
CHECK(poolOwnerMock.numberOfSentMessages() == 1);
CHECK(poolOwnerMock.clearLastSentMessage() == returnvalue::OK);
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, true, false);
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, true);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
CHECK(setHandle->getReportingEnabled() == true);
REQUIRE(poolOwnerMock.wasMessageSent());
CHECK(poolOwnerMock.clearLastSentMessage() == returnvalue::OK);
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false, false);
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
CHECK(setHandle->getReportingEnabled() == false);
REQUIRE(poolOwnerMock.wasMessageSent());
CHECK(poolOwnerMock.clearLastSentMessage() == returnvalue::OK);
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4,
false);
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
CHECK_THAT(poolOwner.dataset.getCollectionInterval(), Catch::Matchers::WithinAbs(0.4, 0.01));
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
CHECK(poolOwnerMock.clearLastSentMessage() == returnvalue::OK);
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, false);
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid);
REQUIRE(poolOwner.poolManager.performHkOperation() == returnvalue::OK);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
/* Now HK packet should be sent as message. */
@ -323,7 +322,7 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
poolOwnerMock.clearMessages();
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid, false);
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
@ -336,57 +335,31 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
CHECK(poolOwner.changedDataSetCallbackWasCalled(sidToCheck, storeId) == true);
CHECK(sidToCheck == lpool::testSid);
/* Now we test the handling is the dataset is set to diagnostic */
poolOwner.dataset.setDiagnostic(true);
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, false);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) ==
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
/* We still expect a failure message being sent */
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
CHECK(poolOwnerMock.clearLastSentMessage() == returnvalue::OK);
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, false);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) ==
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
CHECK(poolOwnerMock.clearLastSentMessage() == returnvalue::OK);
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid, true);
HousekeepingMessage::setStructureReportingCommand(&hkCmd, lpool::testSid);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
poolOwnerMock.clearMessages();
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4,
true);
HousekeepingMessage::setCollectionIntervalModificationCommand(&hkCmd, lpool::testSid, 0.4);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
poolOwnerMock.clearMessages();
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, true, true);
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, true);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
poolOwnerMock.clearMessages();
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false, true);
HousekeepingMessage::setToggleReportingCommand(&hkCmd, lpool::testSid, false);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
poolOwnerMock.clearMessages();
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid, false);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) ==
static_cast<int>(LocalDataPoolManager::WRONG_HK_PACKET_TYPE));
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);
poolOwnerMock.clearMessages();
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid, true);
HousekeepingMessage::setOneShotReportCommand(&hkCmd, lpool::testSid);
CHECK(poolOwner.poolManager.handleHousekeepingMessage(&hkCmd) == returnvalue::OK);
REQUIRE(poolOwnerMock.wasMessageSent());
REQUIRE(poolOwnerMock.numberOfSentMessages() == 1);

View File

@ -109,7 +109,7 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
REQUIRE(id != MessageQueueIF::NO_QUEUE);
CommandMessage message2;
sid_t sid(objects::INTERNAL_ERROR_REPORTER, InternalErrorDataset::ERROR_SET_ID);
HousekeepingMessage::setToggleReportingCommand(&message2, sid, true, false);
HousekeepingMessage::setToggleReportingCommand(&message2, sid, true);
result = hkQueue->sendMessage(id, &message2);
REQUIRE(result == returnvalue::OK);
internalErrorReporter->performOperation(0);

View File

@ -58,8 +58,6 @@ class LocalPoolTestDataSet : public LocalDataSet {
lp_var_t<float> localPoolVarFloat = lp_var_t<float>(lpool::floatVarGpid, this);
lp_vec_t<uint16_t, 3> localPoolUint16Vec = lp_vec_t<uint16_t, 3>(lpool::uint16Vec3Gpid, this);
void setDiagnostic(bool isDiagnostic) { LocalPoolDataSetBase::setDiagnostic(isDiagnostic); }
private:
};