diff --git a/include/ocpp/v201/database_handler.hpp b/include/ocpp/v201/database_handler.hpp index 99f294913a..94ddd3c912 100644 --- a/include/ocpp/v201/database_handler.hpp +++ b/include/ocpp/v201/database_handler.hpp @@ -181,7 +181,7 @@ class DatabaseHandler : public common::DatabaseHandlerCommon { void clear_charging_profiles(); /// \brief Retrieves all ChargingProfiles - virtual std::map> get_all_charging_profiles_by_evse(); + virtual std::map> get_all_charging_profiles_group_by_evse(); }; } // namespace v201 diff --git a/lib/ocpp/v201/charge_point.cpp b/lib/ocpp/v201/charge_point.cpp index fde7e8e5ea..9cd21c3e1c 100644 --- a/lib/ocpp/v201/charge_point.cpp +++ b/lib/ocpp/v201/charge_point.cpp @@ -3862,7 +3862,7 @@ void ChargePoint::execute_change_availability_request(ChangeAvailabilityRequest // K01.27 - load profiles from database void ChargePoint::load_charging_profiles() { try { - auto evses = this->database_handler->get_all_charging_profiles_by_evse(); + auto evses = this->database_handler->get_all_charging_profiles_group_by_evse(); EVLOG_info << "Found " << evses.size() << " evse in the database"; for (const auto& [evse_id, profiles] : evses) { for (auto profile : profiles) { diff --git a/lib/ocpp/v201/database_handler.cpp b/lib/ocpp/v201/database_handler.cpp index 5b4907cd10..ff3c0b17eb 100644 --- a/lib/ocpp/v201/database_handler.cpp +++ b/lib/ocpp/v201/database_handler.cpp @@ -755,7 +755,7 @@ void DatabaseHandler::clear_charging_profiles() { this->database->clear_table("CHARGING_PROFILES"); } -std::map> DatabaseHandler::get_all_charging_profiles_by_evse() { +std::map> DatabaseHandler::get_all_charging_profiles_group_by_evse() { std::map> map; std::string sql = "SELECT EVSE_ID, PROFILE FROM CHARGING_PROFILES"; diff --git a/tests/lib/ocpp/v201/test_database_handler.cpp b/tests/lib/ocpp/v201/test_database_handler.cpp index 6d4c8848f2..8dd4f654fc 100644 --- a/tests/lib/ocpp/v201/test_database_handler.cpp +++ b/tests/lib/ocpp/v201/test_database_handler.cpp @@ -153,7 +153,7 @@ TEST_F(DatabaseHandlerTest, KO1_FR27_DatabaseWithNoData_InsertProfile) { 1, ChargingProfile{ .id = 1, .stackLevel = 1, .chargingProfilePurpose = ChargingProfilePurposeEnum::TxDefaultProfile}); - auto sut = this->database_handler.get_all_charging_profiles_by_evse(); + auto sut = this->database_handler.get_all_charging_profiles_group_by_evse(); EXPECT_EQ(sut.size(), 1); EXPECT_EQ(sut[1].size(), 1); // Access the profiles at EVSE_ID 1 @@ -274,7 +274,7 @@ TEST_F(DatabaseHandlerTest, KO1_FR27_DatabaseWithSingleProfileData_LoadsCharging .id = 1, .stackLevel = 1, .chargingProfilePurpose = ChargingProfilePurposeEnum::TxDefaultProfile}; this->database_handler.insert_or_update_charging_profile(1, profile); - auto sut = this->database_handler.get_all_charging_profiles_by_evse(); + auto sut = this->database_handler.get_all_charging_profiles_group_by_evse(); EXPECT_EQ(sut.size(), 1); @@ -301,7 +301,7 @@ TEST_F(DatabaseHandlerTest, KO1_FR27_DatabaseWithMultipleProfileSameEvse_LoadsCh .id = 3, .stackLevel = 3, .chargingProfilePurpose = ChargingProfilePurposeEnum::TxDefaultProfile}; this->database_handler.insert_or_update_charging_profile(1, p3); - auto sut = this->database_handler.get_all_charging_profiles_by_evse(); + auto sut = this->database_handler.get_all_charging_profiles_group_by_evse(); EXPECT_EQ(sut.size(), 1); @@ -340,7 +340,7 @@ TEST_F(DatabaseHandlerTest, KO1_FR27_DatabaseWithMultipleProfileDiffEvse_LoadsCh ChargingProfile{.id = 6, .stackLevel = 6, .chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile}; this->database_handler.insert_or_update_charging_profile(3, p6); - auto sut = this->database_handler.get_all_charging_profiles_by_evse(); + auto sut = this->database_handler.get_all_charging_profiles_group_by_evse(); EXPECT_EQ(sut.size(), 3);