Skip to content

Commit c891edf

Browse files
committed
Remove todo and remove test that is not working anymore because of the changes. Add documentation
Signed-off-by: Maaike Zijderveld, iolar <git.mail@iolar.nl>
1 parent 34897f6 commit c891edf

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

include/ocpp/v201/ocpp_types.hpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -2236,12 +2236,24 @@ void to_json(json& j, const Firmware& k);
22362236
/// \brief Conversion from a given json object \p j to a given Firmware \p k
22372237
void from_json(const json& j, Firmware& k);
22382238

2239-
// \brief Writes the string representation of the given Firmware \p k to the given output stream \p os
2239+
/// \brief Writes the string representation of the given Firmware \p k to the given output stream \p os
22402240
/// \returns an output stream with the Firmware written to
22412241
std::ostream& operator<<(std::ostream& os, const Firmware& k);
22422242

2243+
///
2244+
/// \brief Required ComponentVariable.
2245+
///
22432246
struct RequiredComponentVariable : ComponentVariable {
2247+
/// \brief Constructor
22442248
RequiredComponentVariable() : required_for({OcppProtocolVersion::v201, OcppProtocolVersion::v21}) {};
2249+
2250+
///
2251+
/// \brief RequiredComponentVariable
2252+
/// \param component Component
2253+
/// \param variable Variable
2254+
/// \param custom_data Custom data (default nullopt)
2255+
/// \param required_for Required for which version. Multiple versions can be given.
2256+
///
22452257
RequiredComponentVariable(const Component component, const std::optional<Variable> variable,
22462258
const std::optional<CustomData> custom_data = std::nullopt,
22472259
const std::set<OcppProtocolVersion> required_for = {OcppProtocolVersion::v201,
@@ -2251,6 +2263,8 @@ struct RequiredComponentVariable : ComponentVariable {
22512263
this->variable = variable;
22522264
this->customData = custom_data;
22532265
};
2266+
2267+
/// \brief For which ocpp protocol version(s) this component variable is required.
22542268
std::set<OcppProtocolVersion> required_for;
22552269
};
22562270
} // namespace v201

lib/ocpp/v201/device_model.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,6 @@ void DeviceModel::check_integrity(const std::map<int32_t, int32_t>& evse_connect
492492
this->check_required_variables();
493493
this->device_model->check_integrity();
494494

495-
// TODO: add required variable check here.
496-
497495
int32_t nr_evse_components = 0;
498496
std::map<int32_t, int32_t> evse_id_nr_connector_components;
499497

tests/lib/ocpp/v201/test_init_device_model_db.cpp

-19
Original file line numberDiff line numberDiff line change
@@ -427,25 +427,6 @@ TEST_F(InitDeviceModelDbTest, default_device_model_config) {
427427
EXPECT_NO_THROW(db.initialize_database(CONFIG_PATH_DEFAULT, true));
428428
}
429429

430-
TEST_F(InitDeviceModelDbTest, missing_required_values) {
431-
// Test if initializing fails when there is a missing required value.
432-
InitDeviceModelDb db(DATABASE_PATH, MIGRATION_FILES_PATH);
433-
try {
434-
db.initialize_database(CONFIGS_PATH_REQUIRED_NO_VALUE, true);
435-
FAIL() << "Expected InitDeviceModelDbError, but no exception was thrown";
436-
} catch (const InitDeviceModelDbError& exception) {
437-
EXPECT_EQ(std::string(exception.what()), "Check integrity failed:\n"
438-
"- Component UnitTestCtrlr, evse 2, connector 3\n"
439-
" - Variable UnitTestPropertyAName, errors:\n"
440-
" - No value set for Actual attribute for required variable.\n"
441-
" - Variable UnitTestPropertyCName, errors:\n"
442-
" - Could not find required Actual attribute.\n");
443-
} catch (const std::exception& exception) {
444-
FAIL() << "Expected InitDeviceModelDbError, but exception of type " << typeid(exception).name()
445-
<< " was thrown";
446-
}
447-
}
448-
449430
TEST_F(InitDeviceModelDbTest, wrong_type) {
450431
// Test if initializing fails when there is a missing required value.
451432
InitDeviceModelDb db(DATABASE_PATH, MIGRATION_FILES_PATH);

0 commit comments

Comments
 (0)