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

add 1.6 k01 clear all profiles with filter tests #447

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .ci/build-kit/install_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ cmake \
-G Ninja \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_PATH/dist"
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_PATH/dist" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON

ninja -j$(nproc) -C build install

trap "cp build/Testing/Temporary/LastTest.log /ext/ctest-report" EXIT

ninja -j$(nproc) -C build test

# cmake -B build -G Ninja -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="./dist" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
4 changes: 2 additions & 2 deletions include/ocpp/v16/database_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,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 @@ -32,6 +32,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