Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folkengine/add 1.6 validate and add profile tests #1

Closed
4 changes: 2 additions & 2 deletions include/ocpp/v16/database_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ class DatabaseHandler : public ocpp::common::DatabaseHandlerBase {
bool clear_local_authorization_list();

/// \brief Inserts or updates the given \p profile to CHARGING_PROFILES table
void insert_or_update_charging_profile(const int connector_id, const v16::ChargingProfile& profile);
virtual void insert_or_update_charging_profile(const int connector_id, const v16::ChargingProfile& profile);

/// \brief Deletes the profile with the given \p profile_id
void delete_charging_profile(const int profile_id);
virtual void delete_charging_profile(const int profile_id);

/// \brief Deletes all profiles from table CHARGING_PROFILES
void delete_charging_profiles();
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ target_link_libraries(libocpp_unit_tests PRIVATE
target_sources(libocpp_unit_tests PRIVATE
comparators.cpp)

add_subdirectory(lib/ocpp/v16)
add_subdirectory(lib/ocpp/v201)
add_subdirectory(lib/ocpp/common)

Expand Down
24 changes: 24 additions & 0 deletions tests/database_handler_mock.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: Apache-2.0

#ifndef OCPP_DATABASE_HANDLE_MOCK_H
#define OCPP_DATABASE_HANDLE_MOCK_H

#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <ocpp/v16/database_handler.hpp>

namespace ocpp {

class DatabaseHandlerMock : public v16::DatabaseHandler {
public:
DatabaseHandlerMock(const std::string& chargepoint_id, const fs::path& database_path,
const fs::path& init_script_path) :
DatabaseHandler(chargepoint_id, database_path, init_script_path){};
MOCK_METHOD(void, insert_or_update_charging_profile, (const int, const v16::ChargingProfile&), (override));
MOCK_METHOD(void, delete_charging_profile, (const int profile_id), (override));
};

} // namespace ocpp

#endif // DATABASE_HANDLE_MOCK_H
2 changes: 2 additions & 0 deletions tests/lib/ocpp/v16/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target_sources(libocpp_unit_tests PRIVATE
test_smart_charging_handler.cpp)
Loading
Loading