Add get and set and notification support to the fields in the configuration#405
Conversation
65d3943 to
7c3e519
Compare
- Introduce dedicated LolaFieldInstanceDeployment class replacing the former LolaEventInstanceDeployment type alias, adding field-specific members use_get_if_available_ and use_set_if_available_. - Fix mw_com_config_schema.json: move useGetIfAvailable and useSetIfAvailable into the field "properties" object so they are correctly validated when additionalProperties is false. Issue: SWP-250429
- Update config_parser.cpp to read optional field values useGetIfAvailable/useSetIfAvailable - Fix existing unit test of loloa field instance deployment. Issue: SWP-250429
Update existing tests which refer LolaFieldInstanceDeployment to support additional optional useGetIfAvailable and useSetIfAvailable Issue: SWP-250429
- Add tests to verfiy behaviour of option field values useGetIfAvailable/useSetIfAvailable Issue: SWP-250429
- Update ReadMe and UML diagram to refelct updated changes optional field values useGetIfAvailable/useSetIfAvailable Issue: SWP-250429
- Remove the redundant unit tests and update the exsiting test for default field setter/getter value - Update the default values of useGetIfAvailable/useSetIfAvailable from default false to true - Update the plant UML diagram to retain only necessary information Issue: SWP-250429
7c3e519 to
4ccfdb8
Compare
2adacc7 to
4ccfdb8
Compare
… LolaEventInstanceDeployment members - Delegate GetNumberOfSampleSlots(), GetNumberOfTracingSlots(), and SetNumberOfSampleSlots() to the inner lola_event_instance_deployment_ member - Delegate CreateFromJson() event parsing and Serialize() event part to LolaEventInstanceDeployment - Add a non-template GetSkeletonEventProperties() overload in skeleton_service_element_binding_factory_impl.h that delegates to the event deployment overload - Update all call sites: config_parser.cpp, configuration_test_resources.cpp, and all affected test files
4ccfdb8 to
eef7275
Compare
| class LolaFieldInstanceDeployment | ||
| { | ||
| public: | ||
| using SampleSlotCountType = std::uint16_t; |
There was a problem hiding this comment.
These aliases are part of LolaEventInstanceDeployment so should be removed. If you need them here, then you should access them via LolaEventInstanceDeployment.
There was a problem hiding this comment.
- I have removed -
using SampleSlotCountType = std::uint16_t; using SubscriberCountType = std::uint8_t; using TracingSlotSizeType = std::uint8_t;
and updated with the "LolaEventInstanceDeployment". example like below -
void SetNumberOfSampleSlots(LolaEventInstanceDeployment::SampleSlotCountType number_of_sample_slots) noexcept;
| "type": "string", | ||
| "title": "Service Instance Specifier", | ||
| "description": "Represents the InstanceSpecifier value. This is itself an AUTOSAR short-name-path (representing a port prototype of a software component instance). For comfort reasons, we allow also the usage of abbreviated short-name-paths (short-name-paths with a number of components starting from root being removed) in case they are still unique within an executable (this json/configuration is a per executable config!). From AUTOSAR concept perspective an executable contains a 'root sw-component', which itself can be a nested composition of AdaptiveApplicationSwComponentTypes). Because of this 'compositing feature' it could be the case, that the direct short-name of a port prototype isn’t unique within the composition making up the executable. In reality however the port names are 95% unique and forcing the usage of lengthy short-name-paths can be annoying! So this translates to the following rules:\n1. A config file with two “instanceSpecifiers”, where one is only a trailing substring of the other is INVALID!\n2. If user code makes a resolve/lookup providing an 'instanceSpecifier' in the form of an abbreviated short-name-path, which turns out NOT being unique with respect to the config, this is a hard programming/configuration fault, which shall lead to an abort." | ||
| "description": "Represents the InstanceSpecifier value. This is itself an AUTOSAR short-name-path (representing a port prototype of a software component instance). For comfort reasons, we allow also the usage of abbreviated short-name-paths (short-name-paths with a number of components starting from root being removed) in case they are still unique within an executable (this json/configuration is a per executable config!). From AUTOSAR concept perspective an executable contains a 'root sw-component', which itself can be a nested composition of AdaptiveApplicationSwComponentTypes). Because of this 'compositing feature' it could be the case, that the direct short-name of a port prototype isn\u2019t unique within the composition making up the executable. In reality however the port names are 95% unique and forcing the usage of lengthy short-name-paths can be annoying! So this translates to the following rules:\n1. A config file with two \u201cinstanceSpecifiers\u201d, where one is only a trailing substring of the other is INVALID!\n2. If user code makes a resolve/lookup providing an 'instanceSpecifier' in the form of an abbreviated short-name-path, which turns out NOT being unique with respect to the config, this is a hard programming/configuration fault, which shall lead to an abort." |
| ExpectLolaFieldInstanceDeploymentObjectsEqual(reconstructed_unit, unit); | ||
| } | ||
|
|
||
| TEST_F(LolaFieldInstanceDeploymentFixture, UseGetIfAvailableIsTrueAfterRoundTripSerialisation) |
There was a problem hiding this comment.
You can use a paramaterised test for this. You can search for TEST_P in the code base for examples.
|
|
||
| const auto& service_instance_map = [service_element_type, &lola_service_instance_deployment]() { | ||
| if (service_element_type == ServiceElementType::EVENT) | ||
| const auto service_element_name = service_element.service_element_name.data(); |
There was a problem hiding this comment.
To minimize the duplicated code, maybe we can change the lambda to be get_number_of_tracing_slots which accepts auto service_elements_map (which can be events_ or fields_) and do the map lookup within the lambda?
| EXPECT_EQ(secondDeploymentInfo.fields_.at("CurrentTemperatureFrontLeft") | ||
| .lola_event_instance_deployment_.max_concurrent_allocations_.value(), | ||
| 1); | ||
| EXPECT_FALSE(secondDeploymentInfo.fields_.at("CurrentTemperatureFrontLeft").use_get_if_available_); |
There was a problem hiding this comment.
The values should be changed so that they're true. Makes it more likely to catch if we're not correctly parsing the value (since defualt is false).
There was a problem hiding this comment.
Done. And updated the mw_com_config.json file also accordingly
| {static} + CreateFromJson(json_object : const score::json::Object&) : LolaFieldInstanceDeployment | ||
| + Serialize() const : score::json::Object | ||
| -- | ||
| <u>Type Aliases:</u> |
There was a problem hiding this comment.
Aliases should be removed since they're part of the event deployment.
| + is_set_configured: bool | ||
| + is_get_configured: bool | ||
| {static} + constexpr serializationVersion : std::uint32_t | ||
| + max_subscribers_ : std::optional<SubscriberCountType> |
There was a problem hiding this comment.
We now compose a LolaEventInstanceDeployment.
| // coverity[autosar_cpp14_m11_0_1_violation] | ||
| LolaEventInstanceDeployment lola_event_instance_deployment_; | ||
| // coverity[autosar_cpp14_m11_0_1_violation] | ||
| bool use_get_if_available_; |
There was a problem hiding this comment.
Should be an optional because it's mandatory on proxy side and not used on skeleton side. Doesn't make sense to have a value on skeleton side.
Add useGetIfAvailable/useSetIfAvailable to LoLa field deployment
Issue: SWP-250429