Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1) - OpenOCPP extracted (firmware OCPP 1.6J/2.0.1) - ShapeShifter library installed (pip install -e) - ShapeShifter specification extracted - EVerest extracted TODO updated with progress
This commit is contained in:
43
tools/EVerest-main/modules/EVSE/Auth/tests/CMakeLists.txt
Normal file
43
tools/EVerest-main/modules/EVSE/Auth/tests/CMakeLists.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
set(TEST_TARGET_NAME ${PROJECT_NAME}_auth_tests)
|
||||
|
||||
set(MODULE_DIR
|
||||
"${PROJECT_SOURCE_DIR}/modules/EVSE/Auth")
|
||||
|
||||
set(TEST_SOURCES ${MODULE_DIR}/lib/ReservationHandler.cpp
|
||||
${MODULE_DIR}/lib/AuthHandler.cpp
|
||||
${MODULE_DIR}/lib/Connector.cpp
|
||||
${MODULE_DIR}/lib/ConnectorStateMachine.cpp)
|
||||
|
||||
add_executable(${TEST_TARGET_NAME} auth_tests.cpp reservation_tests.cpp ${TEST_SOURCES})
|
||||
|
||||
message("Current source dir: ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
set(INCLUDE_DIR
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/stubs"
|
||||
"${MODULE_DIR}/include"
|
||||
"${MODULE_DIR}/tests"
|
||||
)
|
||||
|
||||
get_target_property(GENERATED_INCLUDE_DIR generate_cpp_files EVEREST_GENERATED_INCLUDE_DIR)
|
||||
|
||||
target_include_directories(${TEST_TARGET_NAME} PUBLIC
|
||||
${INCLUDE_DIR}
|
||||
${GENERATED_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(${TEST_TARGET_NAME} PRIVATE
|
||||
GTest::gmock
|
||||
GTest::gtest_main
|
||||
everest::timer
|
||||
${CMAKE_DL_LIBS}
|
||||
everest::log
|
||||
everest::framework
|
||||
everest::helpers
|
||||
pthread
|
||||
nlohmann_json::nlohmann_json
|
||||
date::date
|
||||
date::date-tz
|
||||
)
|
||||
|
||||
add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
|
||||
ev_register_test_target(${TEST_TARGET_NAME})
|
||||
@@ -0,0 +1,40 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright Pionix GmbH and Contributors to EVerest
|
||||
|
||||
#include <map>
|
||||
|
||||
/**
|
||||
* @brief This implementation is only used for testing purposes. It is used to check which EVSE have received
|
||||
* authorization.
|
||||
*
|
||||
*/
|
||||
class FakeAuthReceiver {
|
||||
|
||||
private:
|
||||
std::map<int32_t, bool> evse_index_to_authorization_map;
|
||||
|
||||
public:
|
||||
FakeAuthReceiver(){};
|
||||
explicit FakeAuthReceiver(const std::vector<int32_t>& evse_indices) {
|
||||
for (const auto evse_index : evse_indices) {
|
||||
evse_index_to_authorization_map[evse_index] = false;
|
||||
}
|
||||
};
|
||||
void add_evse_index(const int32_t evse_index) {
|
||||
evse_index_to_authorization_map[evse_index] = false;
|
||||
};
|
||||
void authorize(const int32_t evse_index) {
|
||||
evse_index_to_authorization_map[evse_index] = true;
|
||||
};
|
||||
void deauthorize(const int32_t evse_index) {
|
||||
evse_index_to_authorization_map[evse_index] = false;
|
||||
};
|
||||
bool get_authorization(const int32_t evse_index) {
|
||||
return evse_index_to_authorization_map[evse_index];
|
||||
};
|
||||
void reset() {
|
||||
for (auto& e : evse_index_to_authorization_map) {
|
||||
e.second = false;
|
||||
}
|
||||
};
|
||||
};
|
||||
2251
tools/EVerest-main/modules/EVSE/Auth/tests/auth_tests.cpp
Normal file
2251
tools/EVerest-main/modules/EVSE/Auth/tests/auth_tests.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1455
tools/EVerest-main/modules/EVSE/Auth/tests/reservation_tests.cpp
Normal file
1455
tools/EVerest-main/modules/EVSE/Auth/tests/reservation_tests.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
||||
#ifndef KVS_INTERFACE_HPP
|
||||
#define KVS_INTERFACE_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
// #include <utils/types.hpp>
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
using Array = nlohmann::json::array_t;
|
||||
using Object = nlohmann::json::object_t;
|
||||
|
||||
class kvsIntf {
|
||||
private:
|
||||
std::variant<std::nullptr_t, Array, Object, bool, double, int, std::string> value;
|
||||
|
||||
public:
|
||||
kvsIntf() {
|
||||
}
|
||||
void call_store(std::string key,
|
||||
std::variant<std::nullptr_t, Array, Object, bool, double, int, std::string> value) {
|
||||
std::cout << "Store called!" << std::endl;
|
||||
this->value = value;
|
||||
}
|
||||
std::variant<std::nullptr_t, Array, Object, bool, double, int, std::string> call_load(std::string key) {
|
||||
std::cout << "Load called!" << std::endl;
|
||||
|
||||
return this->value;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // KVS_INTERFACE_HPP
|
||||
Reference in New Issue
Block a user