-
Notifications
You must be signed in to change notification settings - Fork 50
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
WIP: Refactor of message dispatching #849
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I think this looks good. Some suggestions or improvements we might want to discuss.
|
||
interface v201::DataTransferInterface { | ||
+data_transfer_req(request: DataTransferRequest): std::optional<DataTransferResponse> | ||
+handle_data_transfer_req(call: Call<DataTransferRequest>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we replace this with a handle_message
function that takes an EnhancedMessage<v201::MessageType>
?
For this class there is only one message to handle but ideally that should not change the API for these functional blocks. If we later have to add a message to handle we can do it purely in the functional block
request.vendorId = "test_vendor"; | ||
ocpp::Call<DataTransferRequest> call(request, "unique_id_123"); | ||
|
||
EXPECT_CALL(mock_dispatcher, dispatch_call_result(_)).WillOnce(Invoke([](const json& call_result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is going to be worth investing some time in making these expectations nicer. Way outside of scope for now but would be smart to do before we make more of these tests.
I don't think we really care whether dispatch_call
or dispatch_call_async
is called for example, as long as one of those gets called for tests where that is a thing.
Also I would like to create custom matchers to set expectations on specified fields of structs so you don't have to do the invoke construction.
})); | ||
|
||
data_transfer.handle_data_transfer_req(call); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing tests for data_transfer_req
in here.
* Added new class MessageDispatcherInterface that can dispatch OCPP Call, CallResult, CallError * MessageDispatcherInterface became member of ChargePoint classes. The templated methods for sending/dispatching Call, CallResult, CallError have been moved from ChargePoint classes to MessageDispatcher * Added example implementation of one functional block DataTransfer including two tests Signed-off-by: Piet Gömpel <[email protected]>
Signed-off-by: Piet Gömpel <[email protected]>
1e47ab5
to
b532341
Compare
Describe your changes
Large refactor of message handling:
Issue ticket number and link
Checklist before requesting a review