Skip to content
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

feat: add implementation for Version Protocol Service Stub #1760

Merged

Conversation

bmg13
Copy link
Contributor

@bmg13 bmg13 commented Jan 21, 2025

WHAT

Adds implementation for a stub Version Protocol Service, similar to existent ones.

WHY

To allow mocking the protocol api.

FURTHER NOTES

Helpful context on this approach: #1264

Closes ##1733

@bmg13 bmg13 marked this pull request as ready for review January 27, 2025 14:57
Copy link
Contributor

@lgblaumeiser lgblaumeiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lgblaumeiser
Copy link
Contributor

Hi @bmg13, unfortunately, I had to break your nicely updated DEPENDENCIES file 😞

Copy link
Contributor

@ndr-brt ndr-brt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add at least one test that demonstrates the functionality (likely in UseMockConnectorSampleTest)

@bmg13 bmg13 requested review from lgblaumeiser and ndr-brt January 30, 2025 18:02
Comment on lines 146 to 147
assertThat(value.contains("version=2024/1, path=/2024/1"));
assertThat(value.contains("version=v0.8, path=/"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these aren't asserting anything, they should be written as:

assertThat(value).contains("version=2024/1, path=/2024/1");
assertThat(value).contains("version=v0.8, path=/");

however, this is not correct anyway, because the result should be a json (ref.), the assertions could also be made with restassured directly (example)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, thank you! Kept the assertions separated, but now as the result as json, as expected. Changed in here.


import java.util.concurrent.CompletableFuture;

public class VersionServiceStub extends AbstractServiceStub implements VersionService {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an api exposed on the protocol, it does not need to be part of this mock connector (only management)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, however the VersionService is the one we wan to mock in ProtocolVersionApiV4AlphaController. Which means, the ProtcolApiVersionExtension needs this mock to not have an wiring issue.
What I believe can (and should) be changed is removing the VersionProtocolServiceStub since is not needed because is never invoked, i.e., the controller for VersionProtocol does not need the mock of VersionProtocol.
Tested locally without the VersionProtocolServiceStub just to confirm.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sure, it was an oversight on my side. VersionProtocolService does not need to be mocked

@@ -38,7 +38,6 @@ dependencies {
runtimeOnly(libs.edc.boot)
runtimeOnly(libs.edc.api.management) {
exclude("org.eclipse.edc", "edr-cache-api")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes me think that we should add also the edr-cache-api endpoint, could you open an issue about?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, created in here.

@bmg13 bmg13 requested a review from ndr-brt February 3, 2025 09:32
Copy link
Contributor

@ndr-brt ndr-brt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken ITs will be fixed by #1782, in the meaning, this looks good to me

Copy link

sonarqubecloud bot commented Feb 4, 2025

@rafaelmag110 rafaelmag110 merged commit a92af54 into eclipse-tractusx:main Feb 4, 2025
33 checks passed
@rafaelmag110 rafaelmag110 added the enhancement New feature or request label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

4 participants