From 1e1678b8f2ba190bcccf7f18bc9776c486171b73 Mon Sep 17 00:00:00 2001 From: Peter Giavotto <146003699+Giavotto@users.noreply.github.com> Date: Thu, 22 Aug 2024 12:09:46 -0400 Subject: [PATCH] Changed the test fixture names to more accurately reflect what is being tested, additionally adjusted Schemas_Path in test_composite_schedule Signed-off-by: Peter Giavotto <146003699+Giavotto@users.noreply.github.com> --- tests/lib/ocpp/v201/test_charge_point.cpp | 101 +++++----- .../lib/ocpp/v201/test_composite_schedule.cpp | 32 ++-- .../ocpp/v201/test_smart_charging_handler.cpp | 176 +++++++++--------- 3 files changed, 157 insertions(+), 152 deletions(-) diff --git a/tests/lib/ocpp/v201/test_charge_point.cpp b/tests/lib/ocpp/v201/test_charge_point.cpp index 33ad0761e..208405961 100644 --- a/tests/lib/ocpp/v201/test_charge_point.cpp +++ b/tests/lib/ocpp/v201/test_charge_point.cpp @@ -50,11 +50,11 @@ class TestChargePoint : public ChargePoint { } }; -class ChargePointFixture : public DatabaseTestingUtils { +class ChargepointTestFixtureV201 : public DatabaseTestingUtils { public: - ChargePointFixture() { + ChargepointTestFixtureV201() { } - ~ChargePointFixture() { + ~ChargepointTestFixtureV201() { } void SetUp() override { @@ -275,7 +275,7 @@ class ChargePointFixture : public DatabaseTestingUtils { ocpp::v201::Callbacks callbacks; }; -TEST_F(ChargePointFixture, CreateChargePoint) { +TEST_F(ChargepointTestFixtureV201, CreateChargePoint) { auto evse_connector_structure = create_evse_connector_structure(); auto database_handler = create_database_handler(); auto evse_security = std::make_shared(); @@ -286,7 +286,7 @@ TEST_F(ChargePointFixture, CreateChargePoint) { "/tmp", evse_security, callbacks)); } -TEST_F(ChargePointFixture, CreateChargePoint_InitializeInCorrectOrder) { +TEST_F(ChargepointTestFixtureV201, CreateChargePoint_InitializeInCorrectOrder) { auto evse_connector_structure = create_evse_connector_structure(); auto database_handler = create_database_handler(); database_handler->open_connection(); @@ -312,7 +312,7 @@ TEST_F(ChargePointFixture, CreateChargePoint_InitializeInCorrectOrder) { charge_point.stop(); } -TEST_F(ChargePointFixture, CreateChargePoint_EVSEConnectorStructureDefinedBadly_ThrowsDeviceModelStorageError) { +TEST_F(ChargepointTestFixtureV201, CreateChargePoint_EVSEConnectorStructureDefinedBadly_ThrowsDeviceModelStorageError) { auto database_handler = create_database_handler(); auto evse_security = std::make_shared(); configure_callbacks_with_mocks(); @@ -325,7 +325,7 @@ TEST_F(ChargePointFixture, CreateChargePoint_EVSEConnectorStructureDefinedBadly_ DeviceModelStorageError); } -TEST_F(ChargePointFixture, CreateChargePoint_MissingDeviceModel_ThrowsInvalidArgument) { +TEST_F(ChargepointTestFixtureV201, CreateChargePoint_MissingDeviceModel_ThrowsInvalidArgument) { auto evse_connector_structure = create_evse_connector_structure(); auto database_handler = create_database_handler(); auto evse_security = std::make_shared(); @@ -338,7 +338,7 @@ TEST_F(ChargePointFixture, CreateChargePoint_MissingDeviceModel_ThrowsInvalidArg std::invalid_argument); } -TEST_F(ChargePointFixture, CreateChargePoint_MissingDatabaseHandler_ThrowsInvalidArgument) { +TEST_F(ChargepointTestFixtureV201, CreateChargePoint_MissingDatabaseHandler_ThrowsInvalidArgument) { auto evse_connector_structure = create_evse_connector_structure(); auto evse_security = std::make_shared(); configure_callbacks_with_mocks(); @@ -352,7 +352,7 @@ TEST_F(ChargePointFixture, CreateChargePoint_MissingDatabaseHandler_ThrowsInvali std::invalid_argument); } -TEST_F(ChargePointFixture, CreateChargePoint_CallbacksNotValid_ThrowsInvalidArgument) { +TEST_F(ChargepointTestFixtureV201, CreateChargePoint_CallbacksNotValid_ThrowsInvalidArgument) { auto evse_connector_structure = create_evse_connector_structure(); auto database_handler = create_database_handler(); auto evse_security = std::make_shared(); @@ -380,7 +380,7 @@ TEST_F(ChargePointFixture, CreateChargePoint_CallbacksNotValid_ThrowsInvalidArgu * is provided. */ -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfSetChargingProfilesCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfSetChargingProfilesCallbackExists) { configure_callbacks_with_mocks(); callbacks.set_charging_profiles_callback = nullptr; @@ -392,93 +392,94 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfSetChargingProfilesC * all_callbacks_valid. */ -TEST_F(ChargePointFixture, K01FR02_CallbacksAreInvalidWhenNotProvided) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksAreInvalidWhenNotProvided) { EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksAreValidWhenAllRequiredCallbacksProvided) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksAreValidWhenAllRequiredCallbacksProvided) { configure_callbacks_with_mocks(); EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfResetIsAllowedCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfResetIsAllowedCallbackExists) { configure_callbacks_with_mocks(); callbacks.is_reset_allowed_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfResetCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfResetCallbackExists) { configure_callbacks_with_mocks(); callbacks.reset_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfStopTransactionCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfStopTransactionCallbackExists) { configure_callbacks_with_mocks(); callbacks.stop_transaction_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfPauseChargingCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfPauseChargingCallbackExists) { configure_callbacks_with_mocks(); callbacks.pause_charging_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfConnectorEffectiveOperativeStatusChangedCallbackExists) { +TEST_F(ChargepointTestFixtureV201, + K01FR02_CallbacksValidityChecksIfConnectorEffectiveOperativeStatusChangedCallbackExists) { configure_callbacks_with_mocks(); callbacks.connector_effective_operative_status_changed_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfGetLogRequestCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfGetLogRequestCallbackExists) { configure_callbacks_with_mocks(); callbacks.get_log_request_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfUnlockConnectorCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfUnlockConnectorCallbackExists) { configure_callbacks_with_mocks(); callbacks.unlock_connector_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfRemoteStartTransactionCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfRemoteStartTransactionCallbackExists) { configure_callbacks_with_mocks(); callbacks.remote_start_transaction_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfIsReservationForTokenCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfIsReservationForTokenCallbackExists) { configure_callbacks_with_mocks(); callbacks.is_reservation_for_token_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfUpdateFirmwareRequestCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfUpdateFirmwareRequestCallbackExists) { configure_callbacks_with_mocks(); callbacks.update_firmware_request_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfSecurityEventCallbackExists) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfSecurityEventCallbackExists) { configure_callbacks_with_mocks(); callbacks.security_event_callback = nullptr; EXPECT_FALSE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalVariableChangedCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfOptionalVariableChangedCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.variable_changed_callback = nullptr; @@ -489,7 +490,8 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalVariableChan EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalVariableNetworkProfileCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, + K01FR02_CallbacksValidityChecksIfOptionalVariableNetworkProfileCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.validate_network_profile_callback = nullptr; @@ -502,7 +504,7 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalVariableNetw EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfOptionalConfigureNetworkConnectionProfileCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); @@ -516,7 +518,7 @@ TEST_F(ChargePointFixture, EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalTimeSyncCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfOptionalTimeSyncCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.time_sync_callback = nullptr; @@ -527,7 +529,7 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalTimeSyncCall EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalBootNotificationCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfOptionalBootNotificationCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.boot_notification_callback = nullptr; @@ -538,7 +540,7 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalBootNotifica EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalOCPPMessagesCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfOptionalOCPPMessagesCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.ocpp_messages_callback = nullptr; @@ -549,7 +551,7 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalOCPPMessages EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfOptionalCSEffectiveOperativeStatusChangedCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); @@ -563,7 +565,7 @@ TEST_F(ChargePointFixture, EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfOptionalEvseEffectiveOperativeStatusChangedCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); @@ -577,7 +579,8 @@ TEST_F(ChargePointFixture, EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalGetCustomerInformationCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, + K01FR02_CallbacksValidityChecksIfOptionalGetCustomerInformationCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.get_customer_information_callback = nullptr; @@ -591,7 +594,8 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalGetCustomerI EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalClearCustomerInformationCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, + K01FR02_CallbacksValidityChecksIfOptionalClearCustomerInformationCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.clear_customer_information_callback = nullptr; @@ -605,7 +609,8 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalClearCustome EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalAllConnectorsUnavailableCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, + K01FR02_CallbacksValidityChecksIfOptionalAllConnectorsUnavailableCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.all_connectors_unavailable_callback = nullptr; @@ -616,7 +621,7 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalAllConnector EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalDataTransferCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfOptionalDataTransferCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.data_transfer_callback = nullptr; @@ -627,7 +632,7 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalDataTransfer EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalTransactionEventCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, K01FR02_CallbacksValidityChecksIfOptionalTransactionEventCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.transaction_event_callback = nullptr; @@ -638,7 +643,8 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalTransactionE EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalTransactionEventResponseCallbackIsNotSetOrNotNull) { +TEST_F(ChargepointTestFixtureV201, + K01FR02_CallbacksValidityChecksIfOptionalTransactionEventResponseCallbackIsNotSetOrNotNull) { configure_callbacks_with_mocks(); callbacks.transaction_event_response_callback = nullptr; @@ -651,7 +657,7 @@ TEST_F(ChargePointFixture, K01FR02_CallbacksValidityChecksIfOptionalTransactionE EXPECT_TRUE(callbacks.all_callbacks_valid()); } -TEST_F(ChargePointFixture, K01_SetChargingProfileRequest_ValidatesAndAddsProfile) { +TEST_F(ChargepointTestFixtureV201, K01_SetChargingProfileRequest_ValidatesAndAddsProfile) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( @@ -670,7 +676,7 @@ TEST_F(ChargePointFixture, K01_SetChargingProfileRequest_ValidatesAndAddsProfile charge_point->handle_message(set_charging_profile_req); } -TEST_F(ChargePointFixture, K01FR07_SetChargingProfileRequest_TriggersCallbackWhenValid) { +TEST_F(ChargepointTestFixtureV201, K01FR07_SetChargingProfileRequest_TriggersCallbackWhenValid) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( @@ -693,7 +699,7 @@ TEST_F(ChargePointFixture, K01FR07_SetChargingProfileRequest_TriggersCallbackWhe charge_point->handle_message(set_charging_profile_req); } -TEST_F(ChargePointFixture, K01FR07_SetChargingProfileRequest_DoesNotTriggerCallbackWhenInvalid) { +TEST_F(ChargepointTestFixtureV201, K01FR07_SetChargingProfileRequest_DoesNotTriggerCallbackWhenInvalid) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( @@ -721,7 +727,7 @@ TEST_F(ChargePointFixture, K01FR07_SetChargingProfileRequest_DoesNotTriggerCallb charge_point->handle_message(set_charging_profile_req); } -TEST_F(ChargePointFixture, K01FR22_SetChargingProfileRequest_RejectsChargingStationExternalConstraints) { +TEST_F(ChargepointTestFixtureV201, K01FR22_SetChargingProfileRequest_RejectsChargingStationExternalConstraints) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( @@ -741,7 +747,7 @@ TEST_F(ChargePointFixture, K01FR22_SetChargingProfileRequest_RejectsChargingStat charge_point->handle_message(set_charging_profile_req); } -TEST_F(ChargePointFixture, K01FR29_SmartChargingCtrlrAvailableIsFalse_RespondsCallError) { +TEST_F(ChargepointTestFixtureV201, K01FR29_SmartChargingCtrlrAvailableIsFalse_RespondsCallError) { auto evse_connector_structure = create_evse_connector_structure(); auto database_handler = create_database_handler(); auto evse_security = std::make_shared(); @@ -767,7 +773,7 @@ TEST_F(ChargePointFixture, K01FR29_SmartChargingCtrlrAvailableIsFalse_RespondsCa charge_point->handle_message(set_charging_profile_req); } -TEST_F(ChargePointFixture, K01FR29_SmartChargingCtrlrAvailableIsTrue_CallsValidateAndAddProfile) { +TEST_F(ChargepointTestFixtureV201, K01FR29_SmartChargingCtrlrAvailableIsTrue_CallsValidateAndAddProfile) { auto evse_connector_structure = create_evse_connector_structure(); auto database_handler = create_database_handler(); auto evse_security = std::make_shared(); @@ -793,7 +799,7 @@ TEST_F(ChargePointFixture, K01FR29_SmartChargingCtrlrAvailableIsTrue_CallsValida charge_point->handle_message(set_charging_profile_req); } -TEST_F(ChargePointFixture, K08_GetCompositeSchedule_CallsCalculateGetCompositeSchedule) { +TEST_F(ChargepointTestFixtureV201, K08_GetCompositeSchedule_CallsCalculateGetCompositeSchedule) { GetCompositeScheduleRequest req; req.evseId = DEFAULT_EVSE_ID; req.chargingRateUnit = ChargingRateUnitEnum::W; @@ -807,7 +813,7 @@ TEST_F(ChargePointFixture, K08_GetCompositeSchedule_CallsCalculateGetCompositeSc charge_point->handle_message(get_composite_schedule_req); } -TEST_F(ChargePointFixture, K08_GetCompositeSchedule_CallsCalculateGetCompositeScheduleWithValidProfiles) { +TEST_F(ChargepointTestFixtureV201, K08_GetCompositeSchedule_CallsCalculateGetCompositeScheduleWithValidProfiles) { GetCompositeScheduleRequest req; req.evseId = DEFAULT_EVSE_ID; req.chargingRateUnit = ChargingRateUnitEnum::W; @@ -830,7 +836,7 @@ TEST_F(ChargePointFixture, K08_GetCompositeSchedule_CallsCalculateGetCompositeSc charge_point->handle_message(get_composite_schedule_req); } -TEST_F(ChargePointFixture, K08FR05_GetCompositeSchedule_DoesNotCalculateCompositeScheduleForNonexistentEVSE) { +TEST_F(ChargepointTestFixtureV201, K08FR05_GetCompositeSchedule_DoesNotCalculateCompositeScheduleForNonexistentEVSE) { GetCompositeScheduleRequest req; req.evseId = DEFAULT_EVSE_ID + 3; req.chargingRateUnit = ChargingRateUnitEnum::W; @@ -846,7 +852,8 @@ TEST_F(ChargePointFixture, K08FR05_GetCompositeSchedule_DoesNotCalculateComposit charge_point->handle_message(get_composite_schedule_req); } -TEST_F(ChargePointFixture, K08FR07_GetCompositeSchedule_DoesNotCalculateCompositeScheduleForIncorrectChargingRateUnit) { +TEST_F(ChargepointTestFixtureV201, + K08FR07_GetCompositeSchedule_DoesNotCalculateCompositeScheduleForIncorrectChargingRateUnit) { GetCompositeScheduleRequest req; req.evseId = DEFAULT_EVSE_ID; req.chargingRateUnit = ChargingRateUnitEnum::W; diff --git a/tests/lib/ocpp/v201/test_composite_schedule.cpp b/tests/lib/ocpp/v201/test_composite_schedule.cpp index d6a0cf8c8..b23a8beed 100644 --- a/tests/lib/ocpp/v201/test_composite_schedule.cpp +++ b/tests/lib/ocpp/v201/test_composite_schedule.cpp @@ -47,7 +47,7 @@ static const int DEFAULT_PROFILE_ID = 1; static const int DEFAULT_STACK_LEVEL = 1; static const std::string DEFAULT_TX_ID = "10c75ff7-74f5-44f5-9d01-f649f3ac7b78"; const static std::string MIGRATION_FILES_PATH = "./resources/v201/device_model_migration_files"; -const static std::string SCHEMAS_PATH = "./resources/example_config/v201/component_schemas"; +const static std::string SCHEMAS_PATH = "./resources/example_config/v201/component_config"; const static std::string CONFIG_PATH = "./resources/example_config/v201/config.json"; const static std::string DEVICE_MODEL_DB_IN_MEMORY_PATH = "file::memory:?cache=shared"; @@ -62,7 +62,7 @@ class TestSmartChargingHandler : public SmartChargingHandler { using SmartChargingHandler::SmartChargingHandler; }; -class ChargepointTestFixtureV201 : public DatabaseTestingUtils { +class CompositeScheduleTestFixtureV201 : public DatabaseTestingUtils { protected: void SetUp() override { } @@ -208,7 +208,7 @@ class ChargepointTestFixtureV201 : public DatabaseTestingUtils { boost::uuids::random_generator uuid_generator = boost::uuids::random_generator(); }; -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_FoundationTest_Grid) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_FoundationTest_Grid) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/grid/"); const DateTime start_time = ocpp::DateTime("2024-01-17T00:00:00"); @@ -346,7 +346,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_FoundationTest ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_LayeredTest_SameStartTime) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_LayeredTest_SameStartTime) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/layered/"); @@ -435,7 +435,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_LayeredTest_Sa } } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_LayeredRecurringTest_FutureStartTime) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_LayeredRecurringTest_FutureStartTime) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/layered_recurring/"); @@ -460,7 +460,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_LayeredRecurri ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_LayeredTest_PreviousStartTime) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_LayeredTest_PreviousStartTime) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_file("singles/TXProfile_Absolute_Start18-04.json"); const DateTime start_time = ocpp::DateTime("2024-01-17T18:00:00"); @@ -489,7 +489,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_LayeredTest_Pr ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_LayeredRecurringTest_PreviousStartTime) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_LayeredRecurringTest_PreviousStartTime) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/layered_recurring/"); const DateTime start_time = ocpp::DateTime("2024-02-19T18:00:00"); @@ -531,7 +531,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_LayeredRecurri /** * Calculate Composite Schedule */ -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_ValidateBaselineProfileVector) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_ValidateBaselineProfileVector) { const DateTime start_time = ocpp::DateTime("2024-01-17T18:01:00"); const DateTime end_time = ocpp::DateTime("2024-01-18T06:00:00"); std::vector profiles = SmartChargingTestUtils::get_baseline_profile_vector(); @@ -563,7 +563,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_ValidateBaseli ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_RelativeProfile_minutia) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_RelativeProfile_minutia) { const DateTime start_time = ocpp::DateTime("2024-05-17T05:00:00"); const DateTime end_time = ocpp::DateTime("2024-05-17T06:00:00"); @@ -592,7 +592,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_RelativeProfil ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_RelativeProfile_e2e) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_RelativeProfile_e2e) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/relative/"); this->evse_manager->open_transaction(DEFAULT_EVSE_ID, profiles.at(0).transactionId.value()); @@ -626,7 +626,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_RelativeProfil ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_DemoCaseOne_17th) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_DemoCaseOne_17th) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/case_one/"); ChargingProfile relative_profile = profiles.front(); @@ -663,7 +663,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_DemoCaseOne_17 ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_DemoCaseOne_19th) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_DemoCaseOne_19th) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/case_one/"); ChargingProfile first_profile = profiles.front(); @@ -697,7 +697,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_DemoCaseOne_19 ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_MaxOverridesHigherLimits) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_MaxOverridesHigherLimits) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/max/"); @@ -726,7 +726,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_MaxOverridesHi ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_MaxOverridenByLowerLimits) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_MaxOverridenByLowerLimits) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/max/"); @@ -755,7 +755,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_MaxOverridenBy ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_ExternalOverridesHigherLimits) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_ExternalOverridesHigherLimits) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/external/"); @@ -784,7 +784,7 @@ TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_ExternalOverri ASSERT_EQ(actual, expected); } -TEST_F(ChargepointTestFixtureV201, K08_CalculateCompositeSchedule_ExternalOverridenByLowerLimits) { +TEST_F(CompositeScheduleTestFixtureV201, K08_CalculateCompositeSchedule_ExternalOverridenByLowerLimits) { std::vector profiles = SmartChargingTestUtils::get_charging_profiles_from_directory(BASE_JSON_PATH + "/external/"); diff --git a/tests/lib/ocpp/v201/test_smart_charging_handler.cpp b/tests/lib/ocpp/v201/test_smart_charging_handler.cpp index 46e41541a..72e1dbf30 100644 --- a/tests/lib/ocpp/v201/test_smart_charging_handler.cpp +++ b/tests/lib/ocpp/v201/test_smart_charging_handler.cpp @@ -57,7 +57,7 @@ class TestSmartChargingHandler : public SmartChargingHandler { using SmartChargingHandler::SmartChargingHandler; }; -class ChargepointTestFixtureV201 : public DatabaseTestingUtils { +class SmartChargingHandlerTestFixtureV201 : public DatabaseTestingUtils { protected: void SetUp() override { } @@ -269,7 +269,7 @@ class ChargepointTestFixtureV201 : public DatabaseTestingUtils { boost::uuids::random_generator uuid_generator = boost::uuids::random_generator(); }; -TEST_F(ChargepointTestFixtureV201, K01FR03_IfTxProfileIsMissingTransactionId_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR03_IfTxProfileIsMissingTransactionId_ThenProfileIsInvalid) { auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, create_charge_schedule(ChargingRateUnitEnum::A), {}); auto sut = handler.validate_tx_profile(profile, DEFAULT_EVSE_ID); @@ -277,7 +277,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR03_IfTxProfileIsMissingTransactionId_The EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::TxProfileMissingTransactionId)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR05_IfExistingChargingProfileWithSameIdIsChargingStationExternalConstraints_ThenProfileIsInvalid) { auto external_constraints = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::ChargingStationExternalConstraints, @@ -291,7 +291,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ExistingChargingStationExternalConstraints)); } -TEST_F(ChargepointTestFixtureV201, K01FR16_IfTxProfileHasEvseIdNotGreaterThanZero_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR16_IfTxProfileHasEvseIdNotGreaterThanZero_ThenProfileIsInvalid) { auto wrong_evse_id = STATION_WIDE_ID; auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, create_charge_schedule(ChargingRateUnitEnum::A), DEFAULT_TX_ID); @@ -300,7 +300,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR16_IfTxProfileHasEvseIdNotGreaterThanZer EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::TxProfileEvseIdNotGreaterThanZero)); } -TEST_F(ChargepointTestFixtureV201, K01FR33_IfTxProfileTransactionIsNotOnEvse_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR33_IfTxProfileTransactionIsNotOnEvse_ThenProfileIsInvalid) { this->evse_manager->open_transaction(DEFAULT_EVSE_ID, "wrong transaction id"); auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, create_charge_schedule(ChargingRateUnitEnum::A), DEFAULT_TX_ID); @@ -309,7 +309,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR33_IfTxProfileTransactionIsNotOnEvse_The EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::TxProfileTransactionNotOnEvse)); } -TEST_F(ChargepointTestFixtureV201, K01FR09_IfTxProfileEvseHasNoActiveTransaction_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR09_IfTxProfileEvseHasNoActiveTransaction_ThenProfileIsInvalid) { auto connector_id = 1; auto meter_start = MeterValue(); auto id_token = IdToken(); @@ -321,7 +321,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR09_IfTxProfileEvseHasNoActiveTransaction EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::TxProfileEvseHasNoActiveTransaction)); } -TEST_F(ChargepointTestFixtureV201, K01FR48FR19_NumberPhasesOtherThan1AndPhaseToUseSet_ThenProfileInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR19_NumberPhasesOtherThan1AndPhaseToUseSet_ThenProfileInvalid) { auto periods = create_charging_schedule_periods_with_phases(0, 0, 1); auto profile = create_charging_profile( DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, @@ -333,8 +333,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR48FR19_NumberPhasesOtherThan1AndPhaseToU EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodInvalidPhaseToUse)); } -TEST_F(ChargepointTestFixtureV201, - K01FR48FR20_IfPhaseToUseSetAndACPhaseSwitchingSupportedUndefined_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR20_IfPhaseToUseSetAndACPhaseSwitchingSupportedUndefined_ThenProfileIsInvalid) { // As a device model with ac switching supported default set to 'true', we want to create a new database with the // ac switching support not set. But this is an in memory database, which is kept open until all handles to it are // closed. So we close all connections to the database. @@ -358,7 +357,7 @@ TEST_F(ChargepointTestFixtureV201, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodPhaseToUseACPhaseSwitchingUnsupported)); } -TEST_F(ChargepointTestFixtureV201, K01FR48FR20_IfPhaseToUseSetAndACPhaseSwitchingSupportedFalse_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR20_IfPhaseToUseSetAndACPhaseSwitchingSupportedFalse_ThenProfileIsInvalid) { // As a device model with ac switching supported default set to 'true', we want to create a new database with the // ac switching support not set. But this is an in memory database, which is kept open until all handles to it are // closed. So we close all connections to the database. @@ -382,8 +381,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR48FR20_IfPhaseToUseSetAndACPhaseSwitchin testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodPhaseToUseACPhaseSwitchingUnsupported)); } -TEST_F(ChargepointTestFixtureV201, - K01FR48FR20_IfPhaseToUseSetAndACPhaseSwitchingSupportedTrue_ThenProfileIsNotInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR20_IfPhaseToUseSetAndACPhaseSwitchingSupportedTrue_ThenProfileIsNotInvalid) { auto periods = create_charging_schedule_periods_with_phases(0, 1, 1); auto profile = create_charging_profile( DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, @@ -395,7 +393,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Not(ProfileValidationResultEnum::ChargingSchedulePeriodExtraneousPhaseValues)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR26_IfChargingRateUnitIsNotInChargingScheduleChargingRateUnits_ThenProfileIsInvalid) { const auto& charging_rate_unit_cv = ControllerComponentVariables::ChargingScheduleChargingRateUnit; device_model->set_value(charging_rate_unit_cv.component, charging_rate_unit_cv.variable.value(), @@ -412,7 +410,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingScheduleChargingRateUnitUnsupported)); } -TEST_F(ChargepointTestFixtureV201, K01_IfChargingSchedulePeriodsAreMissing_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_IfChargingSchedulePeriodsAreMissing_ThenProfileIsInvalid) { auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, create_charge_schedule(ChargingRateUnitEnum::A), DEFAULT_TX_ID); @@ -421,7 +419,7 @@ TEST_F(ChargepointTestFixtureV201, K01_IfChargingSchedulePeriodsAreMissing_ThenP EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingProfileNoChargingSchedulePeriods)); } -TEST_F(ChargepointTestFixtureV201, K01FR31_IfStartPeriodOfFirstChargingSchedulePeriodIsNotZero_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR31_IfStartPeriodOfFirstChargingSchedulePeriodIsNotZero_ThenProfileIsInvalid) { auto periods = create_charging_schedule_periods(1); auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, create_charge_schedule(ChargingRateUnitEnum::A, periods), DEFAULT_TX_ID); @@ -431,7 +429,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR31_IfStartPeriodOfFirstChargingScheduleP EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingProfileFirstStartScheduleIsNotZero)); } -TEST_F(ChargepointTestFixtureV201, K01FR35_IfChargingSchedulePeriodsAreNotInChonologicalOrder_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR35_IfChargingSchedulePeriodsAreNotInChonologicalOrder_ThenProfileIsInvalid) { auto periods = create_charging_schedule_periods({0, 2, 1}); auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, create_charge_schedule(ChargingRateUnitEnum::A, periods), DEFAULT_TX_ID); @@ -441,7 +439,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR35_IfChargingSchedulePeriodsAreNotInChon EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodsOutOfOrder)); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateChargingStationMaxProfile_NotChargingStationMaxProfile_Invalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateChargingStationMaxProfile_NotChargingStationMaxProfile_Invalid) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxDefaultProfile, create_charge_schedule(ChargingRateUnitEnum::A)); @@ -451,7 +449,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateChargingStationMaxProfile_NotChar EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::InvalidProfileType)); } -TEST_F(ChargepointTestFixtureV201, K04FR03_ValidateChargingStationMaxProfile_EvseIDgt0_Invalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K04FR03_ValidateChargingStationMaxProfile_EvseIDgt0_Invalid) { const int EVSE_ID_1 = DEFAULT_EVSE_ID; auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::ChargingStationMaxProfile, @@ -462,7 +460,7 @@ TEST_F(ChargepointTestFixtureV201, K04FR03_ValidateChargingStationMaxProfile_Evs EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingStationMaxProfileEvseIdGreaterThanZero)); } -TEST_F(ChargepointTestFixtureV201, K01FR38_ChargingProfilePurposeIsChargingStationMaxProfile_KindIsAbsolute_Valid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR38_ChargingProfilePurposeIsChargingStationMaxProfile_KindIsAbsolute_Valid) { auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::ChargingStationMaxProfile, create_charge_schedule(ChargingRateUnitEnum::A)); @@ -471,7 +469,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR38_ChargingProfilePurposeIsChargingStati EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } -TEST_F(ChargepointTestFixtureV201, K01FR38_ChargingProfilePurposeIsChargingStationMaxProfile_KindIsRecurring_Valid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR38_ChargingProfilePurposeIsChargingStationMaxProfile_KindIsRecurring_Valid) { auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::ChargingStationMaxProfile, create_charge_schedule(ChargingRateUnitEnum::A), {}, ChargingProfileKindEnum::Recurring); @@ -481,7 +479,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR38_ChargingProfilePurposeIsChargingStati EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } -TEST_F(ChargepointTestFixtureV201, K01FR38_ChargingProfilePurposeIsChargingStationMaxProfile_KindIsRelative_Invalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR38_ChargingProfilePurposeIsChargingStationMaxProfile_KindIsRelative_Invalid) { auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::ChargingStationMaxProfile, create_charge_schedule(ChargingRateUnitEnum::A), {}, ChargingProfileKindEnum::Relative); @@ -491,7 +489,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR38_ChargingProfilePurposeIsChargingStati EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingStationMaxProfileCannotBeRelative)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR39_IfTxProfileHasSameTransactionAndStackLevelAsAnotherTxProfile_ThenProfileIsInvalid) { this->evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); @@ -508,7 +506,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::TxProfileConflictingStackLevel)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR39_IfTxProfileHasDifferentTransactionButSameStackLevelAsAnotherTxProfile_ThenProfileIsValid) { std::string different_transaction_id = uuid(); this->evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); @@ -526,7 +524,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR39_IfTxProfileHasSameTransactionButDifferentStackLevelAsAnotherTxProfile_ThenProfileIsValid) { this->evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); @@ -546,7 +544,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR40_IfChargingProfileKindIsAbsoluteAndStartScheduleDoesNotExist_ThenProfileIsInvalid) { auto periods = create_charging_schedule_periods(0); auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, @@ -558,7 +556,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingProfileMissingRequiredStartSchedule)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR40_IfChargingProfileKindIsRecurringAndStartScheduleDoesNotExist_ThenProfileIsInvalid) { auto periods = create_charging_schedule_periods(0); auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, @@ -570,7 +568,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingProfileMissingRequiredStartSchedule)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR41_IfChargingProfileKindIsRelativeAndStartScheduleDoesExist_ThenProfileIsInvalid) { auto periods = create_charging_schedule_periods(0); auto profile = create_charging_profile( @@ -583,12 +581,12 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingProfileExtraneousStartSchedule)); } -TEST_F(ChargepointTestFixtureV201, K01FR28_WhenEvseDoesNotExistThenReject) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR28_WhenEvseDoesNotExistThenReject) { auto sut = handler.validate_evse_exists(NR_OF_EVSES + 1); EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::EvseDoesNotExist)); } -TEST_F(ChargepointTestFixtureV201, K01FR28_WhenEvseDoesExistThenAccept) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR28_WhenEvseDoesExistThenAccept) { auto sut = handler.validate_evse_exists(DEFAULT_EVSE_ID); EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } @@ -600,11 +598,11 @@ TEST_F(ChargepointTestFixtureV201, K01FR28_WhenEvseDoesExistThenAccept) { * and a new profile with the same stack level and different profile ID will be associated with an EVSE. * 2-7 - We return Valid for any other case, such as using the same EVSE or using the same profile ID. */ -class ChargepointTestFixtureV201_FR52 - : public ChargepointTestFixtureV201, +class SmartChargingHandlerTestFixtureV201_FR52 + : public SmartChargingHandlerTestFixtureV201, public ::testing::WithParamInterface> {}; -INSTANTIATE_TEST_SUITE_P(TxDefaultProfileValidationV201_Param_Test_Instantiate_FR52, ChargepointTestFixtureV201_FR52, +INSTANTIATE_TEST_SUITE_P(TxDefaultProfileValidationV201_Param_Test_Instantiate_FR52, SmartChargingHandlerTestFixtureV201_FR52, testing::Values(std::make_tuple(DEFAULT_PROFILE_ID + 1, DEFAULT_STACK_LEVEL, ProfileValidationResultEnum::DuplicateTxDefaultProfileFound), std::make_tuple(DEFAULT_PROFILE_ID, DEFAULT_STACK_LEVEL, @@ -612,7 +610,7 @@ INSTANTIATE_TEST_SUITE_P(TxDefaultProfileValidationV201_Param_Test_Instantiate_F std::make_tuple(DEFAULT_PROFILE_ID + 1, DEFAULT_STACK_LEVEL + 1, ProfileValidationResultEnum::Valid))); -TEST_P(ChargepointTestFixtureV201_FR52, K01FR52_TxDefaultProfileValidationV201Tests) { +TEST_P(SmartChargingHandlerTestFixtureV201_FR52, K01FR52_TxDefaultProfileValidationV201Tests) { auto [added_profile_id, added_stack_level, expected] = GetParam(); install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID); @@ -624,11 +622,11 @@ TEST_P(ChargepointTestFixtureV201_FR52, K01FR52_TxDefaultProfileValidationV201Te EXPECT_THAT(sut, testing::Eq(expected)); } -class ChargepointTestFixtureV201_FR53 - : public ChargepointTestFixtureV201, +class SmartChargingHandlerTestFixtureV201_FR53 + : public SmartChargingHandlerTestFixtureV201, public ::testing::WithParamInterface> {}; -INSTANTIATE_TEST_SUITE_P(TxDefaultProfileValidationV201_Param_Test_Instantiate_FR53, ChargepointTestFixtureV201_FR53, +INSTANTIATE_TEST_SUITE_P(TxDefaultProfileValidationV201_Param_Test_Instantiate_FR53, SmartChargingHandlerTestFixtureV201_FR53, testing::Values(std::make_tuple(DEFAULT_PROFILE_ID + 1, DEFAULT_STACK_LEVEL, ProfileValidationResultEnum::DuplicateTxDefaultProfileFound), std::make_tuple(DEFAULT_PROFILE_ID, DEFAULT_STACK_LEVEL, @@ -636,7 +634,7 @@ INSTANTIATE_TEST_SUITE_P(TxDefaultProfileValidationV201_Param_Test_Instantiate_F std::make_tuple(DEFAULT_PROFILE_ID + 1, DEFAULT_STACK_LEVEL + 1, ProfileValidationResultEnum::Valid))); -TEST_P(ChargepointTestFixtureV201_FR53, K01FR53_TxDefaultProfileValidationV201Tests) { +TEST_P(SmartChargingHandlerTestFixtureV201_FR53, K01FR53_TxDefaultProfileValidationV201Tests) { auto [added_profile_id, added_stack_level, expected] = GetParam(); install_profile_on_evse(STATION_WIDE_ID, DEFAULT_PROFILE_ID); @@ -648,7 +646,7 @@ TEST_P(ChargepointTestFixtureV201_FR53, K01FR53_TxDefaultProfileValidationV201Te EXPECT_THAT(sut, testing::Eq(expected)); } -TEST_F(ChargepointTestFixtureV201, K01FR52_TxDefaultProfileValidIfAppliedToWholeSystemAgain) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR52_TxDefaultProfileValidIfAppliedToWholeSystemAgain) { install_profile_on_evse(STATION_WIDE_ID, DEFAULT_PROFILE_ID); auto profile = create_charging_profile(DEFAULT_PROFILE_ID + 1, ChargingProfilePurposeEnum::TxDefaultProfile, @@ -659,7 +657,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR52_TxDefaultProfileValidIfAppliedToWhole EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } -TEST_F(ChargepointTestFixtureV201, K01FR53_TxDefaultProfileValidIfAppliedToExistingEvseAgain) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR53_TxDefaultProfileValidIfAppliedToExistingEvseAgain) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID); auto profile = create_charging_profile(DEFAULT_PROFILE_ID + 1, ChargingProfilePurposeEnum::TxDefaultProfile, @@ -670,7 +668,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR53_TxDefaultProfileValidIfAppliedToExist EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } -TEST_F(ChargepointTestFixtureV201, K01FR53_TxDefaultProfileValidIfAppliedToDifferentEvse) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR53_TxDefaultProfileValidIfAppliedToDifferentEvse) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID); auto profile = create_charging_profile(DEFAULT_PROFILE_ID + 1, ChargingProfilePurposeEnum::TxDefaultProfile, @@ -681,7 +679,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR53_TxDefaultProfileValidIfAppliedToDiffe EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } -TEST_F(ChargepointTestFixtureV201, K01FR44_IfNumberPhasesProvidedForDCEVSE_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR44_IfNumberPhasesProvidedForDCEVSE_ThenProfileIsInvalid) { auto mock_evse = testing::NiceMock(); ON_CALL(mock_evse, get_current_phase_type).WillByDefault(testing::Return(CurrentPhaseType::DC)); @@ -695,7 +693,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR44_IfNumberPhasesProvidedForDCEVSE_ThenP EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodExtraneousPhaseValues)); } -TEST_F(ChargepointTestFixtureV201, K01FR44_IfPhaseToUseProvidedForDCEVSE_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR44_IfPhaseToUseProvidedForDCEVSE_ThenProfileIsInvalid) { auto mock_evse = testing::NiceMock(); ON_CALL(mock_evse, get_current_phase_type).WillByDefault(testing::Return(CurrentPhaseType::DC)); @@ -709,7 +707,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR44_IfPhaseToUseProvidedForDCEVSE_ThenPro EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodExtraneousPhaseValues)); } -TEST_F(ChargepointTestFixtureV201, K01FR44_IfNumberPhasesProvidedForDCChargingStation_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR44_IfNumberPhasesProvidedForDCChargingStation_ThenProfileIsInvalid) { device_model->set_value(ControllerComponentVariables::ChargingStationSupplyPhases.component, ControllerComponentVariables::ChargingStationSupplyPhases.variable.value(), AttributeEnum::Actual, std::to_string(0), "test", true); @@ -724,7 +722,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR44_IfNumberPhasesProvidedForDCChargingSt EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodExtraneousPhaseValues)); } -TEST_F(ChargepointTestFixtureV201, K01FR44_IfPhaseToUseProvidedForDCChargingStation_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR44_IfPhaseToUseProvidedForDCChargingStation_ThenProfileIsInvalid) { device_model->set_value(ControllerComponentVariables::ChargingStationSupplyPhases.component, ControllerComponentVariables::ChargingStationSupplyPhases.variable.value(), AttributeEnum::Actual, std::to_string(0), "test", true); @@ -739,7 +737,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR44_IfPhaseToUseProvidedForDCChargingStat EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodExtraneousPhaseValues)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR45_IfNumberPhasesGreaterThanChargingStationSupplyPhasesForACEVSE_ThenProfileIsInvalid) { device_model->set_value(ControllerComponentVariables::ChargingStationSupplyPhases.component, ControllerComponentVariables::ChargingStationSupplyPhases.variable.value(), @@ -757,7 +755,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodUnsupportedNumberPhases)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR45_IfNumberPhasesGreaterThanChargingStationSupplyPhasesForACChargingStation_ThenProfileIsInvalid) { device_model->set_value(ControllerComponentVariables::ChargingStationSupplyPhases.component, ControllerComponentVariables::ChargingStationSupplyPhases.variable.value(), @@ -773,7 +771,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodUnsupportedNumberPhases)); } -TEST_F(ChargepointTestFixtureV201, K01FR49_IfNumberPhasesMissingForACEVSE_ThenSetNumberPhasesToThree) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR49_IfNumberPhasesMissingForACEVSE_ThenSetNumberPhasesToThree) { auto mock_evse = testing::NiceMock(); ON_CALL(mock_evse, get_current_phase_type).WillByDefault(testing::Return(CurrentPhaseType::AC)); @@ -790,7 +788,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR49_IfNumberPhasesMissingForACEVSE_ThenSe EXPECT_THAT(numberPhases, testing::Eq(3)); } -TEST_F(ChargepointTestFixtureV201, K01FR49_IfNumberPhasesMissingForACChargingStation_ThenSetNumberPhasesToThree) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR49_IfNumberPhasesMissingForACChargingStation_ThenSetNumberPhasesToThree) { device_model->set_value(ControllerComponentVariables::ChargingStationSupplyPhases.component, ControllerComponentVariables::ChargingStationSupplyPhases.variable.value(), AttributeEnum::Actual, std::to_string(3), "test", true); @@ -808,7 +806,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR49_IfNumberPhasesMissingForACChargingSta EXPECT_THAT(numberPhases, testing::Eq(3)); } -TEST_F(ChargepointTestFixtureV201, K01FR06_ExistingProfileLastsForever_RejectIncoming) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR06_ExistingProfileLastsForever_RejectIncoming) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID, ocpp::DateTime(date::utc_clock::time_point::min()), ocpp::DateTime(date::utc_clock::time_point::max())); @@ -824,7 +822,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR06_ExistingProfileLastsForever_RejectInc EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::DuplicateProfileValidityPeriod)); } -TEST_F(ChargepointTestFixtureV201, K01FR06_ExisitingProfileHasValidFromIncomingValidToOverlaps_RejectIncoming) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR06_ExisitingProfileHasValidFromIncomingValidToOverlaps_RejectIncoming) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID, ocpp::DateTime("2024-01-01T13:00:00"), ocpp::DateTime(date::utc_clock::time_point::max())); @@ -839,7 +837,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR06_ExisitingProfileHasValidFromIncomingV EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::DuplicateProfileValidityPeriod)); } -TEST_F(ChargepointTestFixtureV201, K01FR06_ExisitingProfileHasValidToIncomingValidFromOverlaps_RejectIncoming) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR06_ExisitingProfileHasValidToIncomingValidFromOverlaps_RejectIncoming) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID, ocpp::DateTime("2024-02-01T13:00:00"), ocpp::DateTime(date::utc_clock::time_point::max())); @@ -854,7 +852,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR06_ExisitingProfileHasValidToIncomingVal EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::DuplicateProfileValidityPeriod)); } -TEST_F(ChargepointTestFixtureV201, K01FR06_ExisitingProfileHasValidPeriodIncomingIsNowToMax_RejectIncoming) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR06_ExisitingProfileHasValidPeriodIncomingIsNowToMax_RejectIncoming) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID, ocpp::DateTime(date::utc_clock::now() - std::chrono::hours(5 * 24)), ocpp::DateTime(date::utc_clock::now() + std::chrono::hours(5 * 24))); @@ -870,7 +868,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR06_ExisitingProfileHasValidPeriodIncomin EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::DuplicateProfileValidityPeriod)); } -TEST_F(ChargepointTestFixtureV201, K01FR06_ExisitingProfileHasValidPeriodIncomingOverlaps_RejectIncoming) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR06_ExisitingProfileHasValidPeriodIncomingOverlaps_RejectIncoming) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID, ocpp::DateTime("2024-01-01T13:00:00"), ocpp::DateTime("2024-02-01T13:00:00")); @@ -886,7 +884,7 @@ TEST_F(ChargepointTestFixtureV201, K01FR06_ExisitingProfileHasValidPeriodIncomin EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::DuplicateProfileValidityPeriod)); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfEvseDoesNotExist_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfEvseDoesNotExist_ThenProfileIsInvalid) { auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, create_charge_schedule(ChargingRateUnitEnum::A), DEFAULT_TX_ID); @@ -895,7 +893,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfEvseDoesNotExist_ThenPr EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::EvseDoesNotExist)); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfScheduleIsInvalid_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfScheduleIsInvalid_ThenProfileIsInvalid) { auto extraneous_start_schedule = ocpp::DateTime("2024-01-17T17:00:00"); auto periods = create_charging_schedule_periods(0); auto profile = @@ -908,7 +906,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfScheduleIsInvalid_ThenP EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingProfileExtraneousStartSchedule)); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfChargeStationMaxProfileIsInvalid_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfChargeStationMaxProfileIsInvalid_ThenProfileIsInvalid) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::ChargingStationMaxProfile, @@ -919,7 +917,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfChargeStationMaxProfile EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingStationMaxProfileEvseIdGreaterThanZero)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfDuplicateTxDefaultProfileFoundOnEVSE_IsInvalid_ThenProfileIsInvalid) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID); @@ -934,7 +932,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::DuplicateTxDefaultProfileFound)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfDuplicateTxDefaultProfileFoundOnChargingStation_IsInvalid_ThenProfileIsInvalid) { install_profile_on_evse(STATION_WIDE_ID, DEFAULT_PROFILE_ID); @@ -949,7 +947,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::DuplicateTxDefaultProfileFound)); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfTxProfileIsInvalid_ThenProfileIsInvalid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfTxProfileIsInvalid_ThenProfileIsInvalid) { auto periods = create_charging_schedule_periods(0); auto profile = create_charging_profile( DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, @@ -959,7 +957,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfTxProfileIsInvalid_Then EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::TxProfileMissingTransactionId)); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfTxProfileIsValid_ThenProfileIsValid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfTxProfileIsValid_ThenProfileIsValid) { auto periods = create_charging_schedule_periods({0, 1, 2}); this->evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); @@ -972,7 +970,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfTxProfileIsValid_ThenPr EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfTxDefaultProfileIsValid_ThenProfileIsValid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfTxDefaultProfileIsValid_ThenProfileIsValid) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( @@ -983,7 +981,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfTxDefaultProfileIsValid EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid)); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfChargeStationMaxProfileIsValid_ThenProfileIsValid) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfChargeStationMaxProfileIsValid_ThenProfileIsValid) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::ChargingStationMaxProfile, @@ -995,7 +993,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateProfile_IfChargeStationMaxProfile } TEST_F( - ChargepointTestFixtureV201, + SmartChargingHandlerTestFixtureV201, K01_ValidateProfile_IfExistingChargingProfileWithSameIdIsChargingStationExternalConstraints_ThenProfileIsInvalid) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto external_constraints = @@ -1011,7 +1009,7 @@ TEST_F( EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ExistingChargingStationExternalConstraints)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR14_IfTxDefaultProfileWithSameStackLevelDoesNotExist_ThenApplyStationWideTxDefaultProfileToAllEvses) { auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxDefaultProfile, @@ -1024,7 +1022,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(handler.get_profiles(), testing::Contains(profile)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR15_IfTxDefaultProfileWithSameStackLevelDoesNotExist_ThenApplyTxDefaultProfileToEvse) { auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxDefaultProfile, @@ -1037,7 +1035,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(handler.get_profiles(), testing::Contains(profile)); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR05_IfProfileWithSameIdExistsOnEVSEAndIsNotChargingStationExternalContraints_ThenProfileIsReplaced) { auto profile1 = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxDefaultProfile, @@ -1058,7 +1056,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(profiles, testing::Not(testing::Contains(profile1))); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR05_IfProfileWithSameIdExistsOnChargingStationAndNewProfileIsOnEVSE_ThenProfileIsReplaced) { auto profile1 = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxDefaultProfile, create_charge_schedule(ChargingRateUnitEnum::A), uuid(), @@ -1078,7 +1076,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(profiles, testing::Not(testing::Contains(profile1))); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR05_IfProfileWithSameIdExistsOnAnyEVSEAndNewProfileIsOnEVSE_ThenProfileIsReplaced) { auto profile1 = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxDefaultProfile, create_charge_schedule(ChargingRateUnitEnum::A), uuid(), @@ -1098,7 +1096,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(profiles, testing::Not(testing::Contains(profile1))); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR05_IfProfileWithSameIdExistsOnAnyEVSEAndNewProfileIsOnChargingStation_ThenProfileIsReplaced) { auto profile1 = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, create_charge_schedule(ChargingRateUnitEnum::A), uuid(), @@ -1118,7 +1116,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(profiles, testing::Not(testing::Contains(profile1))); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR05_IfProfileWithSameIdExistsOnChargingStationAndNewProfileIsOnChargingStation_ThenProfileIsReplaced) { auto profile1 = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxDefaultProfile, create_charge_schedule(ChargingRateUnitEnum::A), uuid(), @@ -1138,7 +1136,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(profiles, testing::Not(testing::Contains(profile1))); } -TEST_F(ChargepointTestFixtureV201, +TEST_F(SmartChargingHandlerTestFixtureV201, K01FR05_ChargingStationWithMultipleProfilesAddProfileWithExistingProfileId_ThenProfileIsReplaced) { auto profile1 = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxDefaultProfile, create_charge_schedule(ChargingRateUnitEnum::A), uuid(), @@ -1184,7 +1182,7 @@ TEST_F(ChargepointTestFixtureV201, EXPECT_THAT(profiles, testing::Contains(profile5)); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateAndAdd_RejectsInvalidProfiles) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateAndAdd_RejectsInvalidProfiles) { auto periods = create_charging_schedule_periods(0); auto profile = create_charging_profile( DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, @@ -1204,7 +1202,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateAndAdd_RejectsInvalidProfiles) { EXPECT_THAT(profiles, testing::Not(testing::Contains(profile))); } -TEST_F(ChargepointTestFixtureV201, K01_ValidateAndAdd_AddsValidProfiles) { +TEST_F(SmartChargingHandlerTestFixtureV201, K01_ValidateAndAdd_AddsValidProfiles) { auto periods = create_charging_schedule_periods({0, 1, 2}); this->evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); @@ -1221,7 +1219,7 @@ TEST_F(ChargepointTestFixtureV201, K01_ValidateAndAdd_AddsValidProfiles) { EXPECT_THAT(profiles, testing::Contains(profile)); } -TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_EvseId) { +TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_EvseId) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile1 = create_charging_profile( @@ -1252,7 +1250,7 @@ TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_EvseId) { EXPECT_THAT(profile2, testing::Eq(reported_profile.profile)); } -TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_NoEvseId) { +TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_NoEvseId) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile1 = create_charging_profile( @@ -1276,7 +1274,7 @@ TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_NoEvseId) { EXPECT_THAT(profiles, testing::Contains(reported_profiles.at(1).profile)); } -TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_ProfileId) { +TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_ProfileId) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile1 = create_charging_profile( @@ -1300,7 +1298,7 @@ TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_ProfileId) { EXPECT_THAT(profile1, testing::Eq(reported_profiles.at(0).profile)); } -TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_EvseIdAndStackLevel) { +TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_EvseIdAndStackLevel) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile1 = create_charging_profile( @@ -1326,7 +1324,7 @@ TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_EvseIdAndStackLevel) EXPECT_THAT(profile2, testing::Eq(reported_profiles.at(0).profile)); } -TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_EvseIdAndSource) { +TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_EvseIdAndSource) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( @@ -1352,7 +1350,7 @@ TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_EvseIdAndSource) { EXPECT_THAT(reported_profiles, testing::SizeIs(0)); } -TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_EvseIdAndPurposeAndStackLevel) { +TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_EvseIdAndPurposeAndStackLevel) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile1 = create_charging_profile( @@ -1384,7 +1382,7 @@ TEST_F(ChargepointTestFixtureV201, K09_GetChargingProfiles_EvseIdAndPurposeAndSt EXPECT_THAT(profile2, testing::Eq(reported_profiles.at(0).profile)); } -TEST_F(ChargepointTestFixtureV201, K10_ClearChargingProfile_ClearsId) { +TEST_F(SmartChargingHandlerTestFixtureV201, K10_ClearChargingProfile_ClearsId) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( @@ -1402,7 +1400,7 @@ TEST_F(ChargepointTestFixtureV201, K10_ClearChargingProfile_ClearsId) { EXPECT_THAT(profiles, testing::Not(testing::Contains(profile))); } -TEST_F(ChargepointTestFixtureV201, K10_ClearChargingProfile_ClearsStackLevelPurposeCombination) { +TEST_F(SmartChargingHandlerTestFixtureV201, K10_ClearChargingProfile_ClearsStackLevelPurposeCombination) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID); auto profiles = handler.get_profiles(); @@ -1417,7 +1415,7 @@ TEST_F(ChargepointTestFixtureV201, K10_ClearChargingProfile_ClearsStackLevelPurp EXPECT_THAT(profiles, testing::IsEmpty()); } -TEST_F(ChargepointTestFixtureV201, K10_ClearChargingProfile_UnknownStackLevelPurposeCombination) { +TEST_F(SmartChargingHandlerTestFixtureV201, K10_ClearChargingProfile_UnknownStackLevelPurposeCombination) { install_profile_on_evse(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID); auto profiles = handler.get_profiles(); @@ -1432,7 +1430,7 @@ TEST_F(ChargepointTestFixtureV201, K10_ClearChargingProfile_UnknownStackLevelPur EXPECT_THAT(profiles, testing::Not(testing::IsEmpty())); } -TEST_F(ChargepointTestFixtureV201, K10_ClearChargingProfile_UnknownId) { +TEST_F(SmartChargingHandlerTestFixtureV201, K10_ClearChargingProfile_UnknownId) { auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( @@ -1450,12 +1448,12 @@ TEST_F(ChargepointTestFixtureV201, K10_ClearChargingProfile_UnknownId) { EXPECT_THAT(profiles, testing::Contains(profile)); } -TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfNoProfiles_ThenNoValidProfilesReturned) { +TEST_F(SmartChargingHandlerTestFixtureV201, K08_GetValidProfiles_IfNoProfiles_ThenNoValidProfilesReturned) { auto profiles = handler.get_valid_profiles(DEFAULT_EVSE_ID); EXPECT_THAT(profiles, testing::IsEmpty()); } -TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfEvseHasProfiles_ThenThoseProfilesReturned) { +TEST_F(SmartChargingHandlerTestFixtureV201, K08_GetValidProfiles_IfEvseHasProfiles_ThenThoseProfilesReturned) { auto profile = add_valid_profile_to(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID); ASSERT_TRUE(profile.has_value()); @@ -1463,7 +1461,7 @@ TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfEvseHasProfiles_ThenTh EXPECT_THAT(profiles, testing::Contains(profile)); } -TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfOtherEvseHasProfiles_ThenThoseProfilesAreNotReturned) { +TEST_F(SmartChargingHandlerTestFixtureV201, K08_GetValidProfiles_IfOtherEvseHasProfiles_ThenThoseProfilesAreNotReturned) { auto profile1 = add_valid_profile_to(DEFAULT_EVSE_ID, DEFAULT_PROFILE_ID); ASSERT_TRUE(profile1.has_value()); auto profile2 = add_valid_profile_to(DEFAULT_EVSE_ID + 1, DEFAULT_PROFILE_ID + 1); @@ -1474,7 +1472,7 @@ TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfOtherEvseHasProfiles_T EXPECT_THAT(profiles, testing::Not(testing::Contains(profile2))); } -TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfStationWideProfilesExist_ThenThoseProfilesAreReturned) { +TEST_F(SmartChargingHandlerTestFixtureV201, K08_GetValidProfiles_IfStationWideProfilesExist_ThenThoseProfilesAreReturned) { auto profile = add_valid_profile_to(STATION_WIDE_ID, DEFAULT_PROFILE_ID); ASSERT_TRUE(profile.has_value()); @@ -1482,7 +1480,7 @@ TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfStationWideProfilesExi EXPECT_THAT(profiles, testing::Contains(profile)); } -TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfStationWideProfilesExist_ThenThoseProfilesAreReturnedOnce) { +TEST_F(SmartChargingHandlerTestFixtureV201, K08_GetValidProfiles_IfStationWideProfilesExist_ThenThoseProfilesAreReturnedOnce) { auto profile = add_valid_profile_to(STATION_WIDE_ID, DEFAULT_PROFILE_ID); ASSERT_TRUE(profile.has_value()); @@ -1491,7 +1489,7 @@ TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfStationWideProfilesExi EXPECT_THAT(profiles.size(), testing::Eq(1)); } -TEST_F(ChargepointTestFixtureV201, K08_GetValidProfiles_IfInvalidProfileExists_ThenThatProfileIsNotReturned) { +TEST_F(SmartChargingHandlerTestFixtureV201, K08_GetValidProfiles_IfInvalidProfileExists_ThenThatProfileIsNotReturned) { auto extraneous_start_schedule = ocpp::DateTime("2024-01-17T17:00:00"); auto periods = create_charging_schedule_periods(0); auto invalid_profile =