Skip to content

Commit

Permalink
Merge branch 'US-JOET/couryrr/run-test-in-ci' into CI/reusable-workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik K <[email protected]>
  • Loading branch information
Dominik-K committed Dec 19, 2023
2 parents 771a005 + 844e351 commit d96e12c
Show file tree
Hide file tree
Showing 47 changed files with 1,529 additions and 236 deletions.
17 changes: 0 additions & 17 deletions .ci/build-kit/install_and_test.sh
Original file line number Diff line number Diff line change
@@ -1,17 +0,0 @@
#!/bin/sh

set -e

cmake \
-B build \
-S "$EXT_MOUNT/source" \
-DBUILD_TESTING_LIBOCPP=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_PATH/dist"

make -j$(nproc) -C build install

cd ./build/tests/

./database_tests
./utils_tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
workspace.yaml
CMakeLists.txt.user
!doc/build-with-fetchcontent
/dist
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ if(CMAKE_RUN_CLANG_TIDY)
-export-fixes=clang-tidy-fixes.yaml)
endif()

if(BUILD_TESTING_LIBOCPP)
if(BUILD_TESTING)
enable_testing()
include(CTest)
add_subdirectory(tests)
endif()

Expand Down
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,19 +498,7 @@ The main reference for the integration of libocpp for OCPP1.6 is the ocpp::v16::

## Unit testing

If you want to run the unit tests in the tests subdirectory: install the needed dependencies.
For Debian GNU/Linux 11 you can install it like this:

```bash
sudo apt install libgtest-dev lcov
python3 -m pip install gcovr
```

Run the unit tests

```bash
cmake .. -DBUILD_TESTING=ON
```
GTest is required for building the test cases target. To build the target and run the tests you can reference the script `.ci/build-kit/install_and_test.sh`. The script allows the GitHub Actions runner to execute. Local testing is still in progress.

## Building with FetchContent instead of EDM
In [doc/build-with-fetchcontent](doc/build-with-fetchcontent) you can find an example how to build libocpp with FetchContent instead of EDM.
17 changes: 17 additions & 0 deletions config/v16/profile_schemas/Internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@
"readOnly": true,
"default": true
},
"VerifyCsmsCommonName": {
"$comment": "Verify that the CSMS certificates commonName matches the CSMS FQDN",
"type": "boolean",
"readOnly": true,
"default": true
},
"OcspRequestInterval": {
"$comment": "Interval in seconds used to request OCSP revocation status information on the CSO Sub-CA certificates",
"type": "integer",
Expand Down Expand Up @@ -222,6 +228,17 @@
"readOnly": false,
"minimum": 0,
"default": 60
},
"QueueAllMessages": {
"$comment": "If set to true, also non-transactional messages are queued in memory in case they cannot be sent immediately.",
"type": "boolean",
"readOnly": true
},
"MessageQueueSizeThreshold": {
"$comment": "Threshold for the size of in-memory message queues used to buffer messages (and store e.g. while offline). If threshold is exceeded, messages will be dropped according to OCPP specification to avoid memory issues.",
"type": "integer",
"readOnly": true,
"minimum": 1
}
},
"additionalProperties": false
Expand Down
3 changes: 2 additions & 1 deletion config/v201/component_schemas/custom/Connector_1_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"variable_name": "AvailabilityState",
"characteristics": {
"supportsMonitoring": true,
"dataType": "OptionList"
"dataType": "OptionList",
"valuesList": "Available,Occupied,Reserved,Unavailable,Faulted"
},
"attributes": [
{
Expand Down
3 changes: 2 additions & 1 deletion config/v201/component_schemas/custom/Connector_2_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"variable_name": "AvailabilityState",
"characteristics": {
"supportsMonitoring": true,
"dataType": "OptionList"
"dataType": "OptionList",
"valuesList": "Available,Occupied,Reserved,Unavailable,Faulted"
},
"attributes": [
{
Expand Down
3 changes: 2 additions & 1 deletion config/v201/component_schemas/custom/EVSE_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"variable_name": "AvailabilityState",
"characteristics": {
"supportsMonitoring": true,
"dataType": "OptionList"
"dataType": "OptionList",
"valuesList": "Available,Occupied,Reserved,Unavailable,Faulted"
},
"attributes": [
{
Expand Down
3 changes: 2 additions & 1 deletion config/v201/component_schemas/custom/EVSE_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"variable_name": "AvailabilityState",
"characteristics": {
"supportsMonitoring": true,
"dataType": "OptionList"
"dataType": "OptionList",
"valuesList": "Available,Occupied,Reserved,Unavailable,Faulted"
},
"attributes": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"variable_name": "AvailabilityState",
"characteristics": {
"supportsMonitoring": true,
"dataType": "OptionList"
"dataType": "OptionList",
"valuesList": "Available,Occupied,Reserved,Unavailable,Faulted"
},
"attributes": [
{
Expand Down
37 changes: 36 additions & 1 deletion config/v201/component_schemas/standardized/InternalCtrlr.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"variable_name": "NetworkConnectionProfiles",
"characteristics": {
"supportsMonitoring": true,
"dataType": "MemberList"
"dataType": "string"
},
"attributes": [
{
Expand Down Expand Up @@ -470,6 +470,41 @@
"description": "Seconds between two checks for client certificate expiration and potential renewal",
"default": "43200",
"type": "integer"
},
"MessageQueueSizeThreshold": {
"variable_name": "MessageQueueSizeThreshold",
"characteristics": {
"minLimit": 1,
"supportsMonitoring": true,
"dataType": "integer"
},
"attributes": [
{
"type": "Actual",
"mutability": "ReadOnly"
}
],
"description": "Threshold for the size of in-memory message queues used to buffer messages (and store e.g. while offline). If threshold is exceeded, messages will be dropped according to OCPP specification to avoid memory issues.",
"minimum": 1,
"type": "integer"
},
"MaxMessageSize": {
"variable_name": "MaxMessageSize",
"characteristics": {
"minLimit": 1,
"supportsMonitoring": true,
"dataType": "integer"
},
"attributes": [
{
"type": "Actual",
"mutability": "ReadOnly"
}
],
"description": "Maximum size in bytes for messages sent to the CSMS via websocket. If a message exceeds this size and is eligible to be split into multiple messages, it will be split. Otherwise, this value is ignored.",
"minimum": 1,
"default": "65000",
"type": "integer"
}
},
"required": [
Expand Down
2 changes: 2 additions & 0 deletions config/v201/init_device_model_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
components and variables.
"""

from __future__ import annotations

import argparse
import json
import sqlite3
Expand Down
6 changes: 3 additions & 3 deletions include/ocpp/common/database_handler_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ class DatabaseHandlerBase {

/// \brief Get transaction messages from transaction messages queue table.
/// \return The transaction messages.
std::vector<DBTransactionMessage> get_transaction_messages();
virtual std::vector<DBTransactionMessage> get_transaction_messages();

/// \brief Insert a new transaction message that needs to be sent to the CSMS.
/// \param transaction_message The message to be stored.
/// \return True on success.
bool insert_transaction_message(const DBTransactionMessage& transaction_message);
virtual bool insert_transaction_message(const DBTransactionMessage& transaction_message);

/// \brief Remove a transaction message from the database.
/// \param unique_id The unique id of the transaction message.
/// \return True on success.
void remove_transaction_message(const std::string& unique_id);
virtual void remove_transaction_message(const std::string& unique_id);
};

} // namespace ocpp::common
Loading

0 comments on commit d96e12c

Please sign in to comment.