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

Lookup dataverse by alias or ID when downloading guestbook responses via API #10020

Merged
merged 6 commits into from Oct 18, 2023

Conversation

bencomp
Copy link
Contributor

@bencomp bencomp commented Oct 17, 2023

What this PR does / why we need it:
Replaces a dataverse by-alias lookup with findDataverseOrDie to allow looking up a dataverse by both its alias and its ID, as the documentation for 5.12.1 mentions. The same section for the latest version says the same.

Which issue(s) this PR closes:

Special notes for your reviewer: I would like this PR to count towards my Hacktoberfest goal, so if this is useful, please add the hacktoberfest-accepted label or an approving review.
My editor VSCodium with Java extensions made me handle the WrappedResponse that findDataverseOrDie may throw. Throwing a WebApplicationException is appropriate for the context, according to its Javadoc description.

Suggestions on how to test this: check that the commands in the issue work after applying the change.

Does this PR introduce a user interface change? If mockups are available, please link/include them here: no

Is there a release notes update needed for this change?:
I suppose this may fix a bug in the API, but I don't consider this a big change otherwise.

Additional documentation:

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

@bencomp thanks for the PR! 🎉 I left a comment about WrappedResponse.

src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java Outdated Show resolved Hide resolved
Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

Asking about tests.

src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java Outdated Show resolved Hide resolved
Co-authored-by: Philip Durbin <philip_durbin@harvard.edu>
Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

Do you feel like writing some tests? If so, I'd suggest adding a method for downloading guestbook responses to UtilIT.java (I couldn't find one) and then calling it from DataversesIT.java.

@pdurbin pdurbin changed the title 9619 Lookup dataverse by alias or ID Lookup dataverse by alias or ID when downloading guestbook responses via API Oct 17, 2023
@bencomp
Copy link
Contributor Author

bencomp commented Oct 17, 2023

Working on it.

@bencomp
Copy link
Contributor Author

bencomp commented Oct 17, 2023

I couldn't test locally – maybe because I have en_GB as locale – and the Maven integration test job doesn't run the new test either. Does that require something else to happen, @pdurbin?

@pdurbin
Copy link
Member

pdurbin commented Oct 18, 2023

@bencomp thanks for adding tests! To run tests locally, I recommend running Dataverse in Docker using https://guides.dataverse.org/en/6.0/developers/dev-environment.html#quickstart and then running just the tests in that class with mvn test -Dtest=DataversesIT. You could get even more granular with mvn test -Dtest=DataversesIT#testGetGuestbookResponses.

Jenkins is failing but not due to your code. I just kicked off a manual run at https://github.com/gdcc/api-test-runner/actions/runs/6554508063 to get a second opinion.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

This should help resolve the 403.

src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java Outdated Show resolved Hide resolved
@pdurbin
Copy link
Member

pdurbin commented Oct 18, 2023

I just looked over https://guides.dataverse.org/en/6.0/api/native-api.html#retrieve-guestbook-responses-for-a-dataverse-collection and it seems fine. It already claims to support a collection alias, which is what @bencomp is enabling in this PR.

bencomp and others added 2 commits October 18, 2023 13:15
@bencomp
Copy link
Contributor Author

bencomp commented Oct 18, 2023

Well, now it works on my machine 🎉
I would say this is done 😌

@pdurbin
Copy link
Member

pdurbin commented Oct 18, 2023

Jenkins is still broken right now but I'm getting a second opinion about if API tests are passing here: https://github.com/gdcc/api-test-runner/actions/runs/6561459544

Should take about 20 minutes.

@pdurbin
Copy link
Member

pdurbin commented Oct 18, 2023

Ok, it passed. @scolapasta can we put this on https://github.com/orgs/IQSS/projects/2 ?

@scolapasta scolapasta added this to Ready for Review ⏩ in IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) via automation Oct 18, 2023
Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

Tests are passing on GitHub Actions and the docs at https://guides.dataverse.org/en/6.0/api/native-api.html#retrieve-guestbook-responses-for-a-dataverse-collection look good. They already mention alias even though it's newly supported in this PR.

Thanks, @bencomp! 🎉

IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from Ready for Review ⏩ to Ready for QA ⏩ Oct 18, 2023
@pdurbin pdurbin added Feature: Guestbook hacktoberfest-accepted Accepted for HF, see https://groups.google.com/g/dataverse-community/c/n_Nn_T2yA-w/m/BcoXO4tEAQAJ labels Oct 18, 2023
@kcondon kcondon self-assigned this Oct 18, 2023
@kcondon kcondon merged commit 75d19d5 into IQSS:develop Oct 18, 2023
9 of 10 checks passed
IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from Ready for QA ⏩ to Done 🚀 Oct 18, 2023
@bencomp bencomp deleted the 9619-guestbook-responses branch October 18, 2023 21:19
@pdurbin pdurbin added this to the 6.1 milestone Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Guestbook hacktoberfest-accepted Accepted for HF, see https://groups.google.com/g/dataverse-community/c/n_Nn_T2yA-w/m/BcoXO4tEAQAJ
Projects
No open projects
3 participants