-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add testing interface, including a set of capabilities to tests for #6687
Add testing interface, including a set of capabilities to tests for #6687
Conversation
Add capability tests for the fetchers to determine whether they support the tested capability. Signed-off-by: Dominik Voigt <[email protected]>
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.
Reviewed the code before this PR was submitted. Therefore, approving (while waiting what the automatec checks will say)
…ub.com/DominikVoigt/jabref into DominikVoigt-feat/add-capability-tests-for-fetchers
One of the architecture test fails: Probably because we hide some fetchers for the users |
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.
Thanks for your PR, this is a nice bachelor project.
I think it's good to get the interfaces right from the start, so I have a few comments concerning the overall structure. But overall the changes are fine, good job!
src/main/java/org/jabref/logic/importer/fetcher/AdvancedSearchConfig.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jabref/logic/importer/fetcher/SearchBasedFetcherCapabilityTest.java
Show resolved
Hide resolved
src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java
Outdated
Show resolved
Hide resolved
bf698ac Create common-market-law-review.csl (JabRef#4910) c962eca Create harvard-prifysgol-caerdydd.csl (JabRef#4922) 0c24e7f Update gewerblicher-rechtsschutz-und-urheberrecht.csl (JabRef#4923) d2ec1a7 Create Tijdschrift-voor-Geneeskunde.csl (JabRef#4907) 5df7250 Update harvard-institut-fur-praxisforschung-de.csl (JabRef#4918) 093fd91 Update universite-de-montreal-apa.csl (JabRef#4916) a3e41d4 Update thieme-german.csl (JabRef#4919) 648765a add DOI to aerosol-science-and-technology.csl (JabRef#4909) bc1ebee Reindent/reorder a8dc18a Fix documentation link for epidemiology & infection aab403a Fix AGLC Newspaper date 4c018d5 Add period between editor and translator (SBL styles) (JabRef#4906) 42f7491 Create geographische-zeitschrift.csl (JabRef#4898) a4002a6 Create german-kunstwissenschaft.csl (JabRef#4896) b01910b Disambiguation of names (JabRef#4895) git-subtree-dir: src/main/resources/csl-styles git-subtree-split: bf698ac
…ub.com/DominikVoigt/jabref into feat/add-capability-tests-for-fetchers
Signed-off-by: Dominik Voigt <[email protected]>
- Add missing assert - Modify test Signed-off-by: Dominik Voigt <[email protected]>
…hange request Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
…AdvancedSearchBasedParserFetcher interface. Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
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.
Now there are many unrelated changes in this PR. I guess a rebase/merge master should fix this.
Signed-off-by: Dominik Voigt <[email protected]>
- Add IEEE Xplore fetcher test - Move performComplexSearch into the SearchBasedFetcher Interface - Modify TestInterface to define how the objects under test behave - Use performComplexSearch in the TestInterface - Modify ComplexSearchQuery to allow for multiple author and multiple title phrase searches - Change SpringerFetcher from using JournalTitle field instead of Journal field, to be in line with IEEE and ArXiv Fetcher Signed-off-by: Dominik Voigt <[email protected]>
…ty-tests-for-fetchers
Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
Add related ADR. Signed-off-by: Dominik Voigt <[email protected]>
…ty-tests-for-fetchers
Signed-off-by: Dominik Voigt <[email protected]>
Remove URL from Doifetcher test, as it gets cleaned up by DOICleanUp as the URL contains a DOI. Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
…ty-tests-for-fetchers
Signed-off-by: Dominik Voigt <[email protected]>
bf698ac" This reverts commit c7795e9. This hopefully fixes the issue with the csl files. Signed-off-by: Dominik Voigt <[email protected]> # Conflicts: # src/main/resources/csl-styles/common-market-law-review.csl # src/main/resources/csl-styles/dependent/prifysgol-caerdydd-harvard.csl # src/main/resources/csl-styles/geographische-zeitschrift.csl # src/main/resources/csl-styles/kunstakademie-munster.csl # src/main/resources/csl-styles/tijdschrift-voor-geneeskunde.csl
Concerning the biblatex <-> bibtex conversion, please keep in mind that this is not only specific to fetchers, but actually concerns all ways entries can be added to the library (fetcher, import, paste from clipboard, etc). Anyway, should we move this to a new PR since I fear otherwise this one here gets to huge to be reviewable? |
Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
…ty-tests-for-fetchers
Signed-off-by: Dominik Voigt <[email protected]>
Remove any format conversion where the fetcher format conversion added it. Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
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.
Some small nitpicks, then it should be good to go
src/main/java/org/jabref/logic/importer/EntryBasedParserFetcher.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/importer/IdBasedParserFetcher.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcher.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/importer/fetcher/DoiFetcher.java
Outdated
Show resolved
Hide resolved
@@ -115,7 +106,11 @@ private static BibEntry parseJsonRespone(JSONObject jsonEntry, Character keyword | |||
entry.setField(StandardField.ISBN, jsonEntry.optString("isbn")); | |||
entry.setField(StandardField.ISSN, jsonEntry.optString("issn")); | |||
entry.setField(StandardField.ISSUE, jsonEntry.optString("issue")); | |||
entry.addFile(new LinkedFile("", Path.of(jsonEntry.optString("pdf_url")), "PDF")); | |||
try { | |||
entry.addFile(new LinkedFile(new URL(jsonEntry.optString("pdf_url")), "PDF")); |
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.
This needs to be discused -> maybe in a separate PR?
The LinkedFile points to a file locally stored. Not to a URL. -- Maybe, just use the URL
field of the BibEntry. Or use the URLDownloader to download and store the file. (Needs some investigation how JabRef downloads the file; since JabRef does some rename and folder-sort-magic)
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.
Linked files can also contain an online link.
However in this case I would set the URL field with the pdf url.
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 think this is correct: the url for the download of the fulltetx should be added as a linked file.
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.
Did not know this concept. Seemed to be introduced at 5e1adf8. Thus, OK for me.
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.
Thanks for your continued work on this! The code looks indeed really good. We can merge after a few nit-picks are fixed.
Afterwards, it would be good if the following things can be addressed as well:
- Change direction of flow so that
getUrlForQuery
callsgetComplexQueryURL
(so that fetchers only have to override the latter in normal circumstances). - In fact, it should be investigate if
performSearch(String)
can be completely removed and one only uses the complex query.
src/main/java/org/jabref/gui/bibtexextractor/BibtexExtractorViewModel.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/importer/SearchBasedFetcher.java
Outdated
Show resolved
Hide resolved
*/ | ||
public ComplexSearchQueryBuilder author(String author) { | ||
if (Objects.requireNonNull(author).isBlank()) { | ||
throw new IllegalArgumentException("Parameter must not be blank"); |
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.
Is it really a problem if the user searches for an empty string, e.g. author = ""
?
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.
Hey :)
IMHO allowing empty strings for any query parameter does not really make much sense semantically.
I do not see the semantics such an empty string should have:
- If the user does not want to specify an author, he should just leave the field null
- Otherwise, he tries to searches for documents without authors?
Did I overlook a use case where giving an empty string for a query parameter is useful?
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.
Sounds good! I just wanted to double check.
(We should keep this in the back of our heads when the user interface is implemented. There you would like to show a helping message instead of an error dialog).
src/main/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcher.java
Outdated
Show resolved
Hide resolved
@@ -115,7 +106,11 @@ private static BibEntry parseJsonRespone(JSONObject jsonEntry, Character keyword | |||
entry.setField(StandardField.ISBN, jsonEntry.optString("isbn")); | |||
entry.setField(StandardField.ISSN, jsonEntry.optString("issn")); | |||
entry.setField(StandardField.ISSUE, jsonEntry.optString("issue")); | |||
entry.addFile(new LinkedFile("", Path.of(jsonEntry.optString("pdf_url")), "PDF")); | |||
try { | |||
entry.addFile(new LinkedFile(new URL(jsonEntry.optString("pdf_url")), "PDF")); |
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 think this is correct: the url for the download of the fulltetx should be added as a linked file.
src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java
Outdated
Show resolved
Hide resolved
- Move doPostCleanup back - Move format in ImportCleanup into constructor. Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
…ty-tests-for-fetchers
Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
- Change title - Fix some typos and punctuation Signed-off-by: Dominik Voigt <[email protected]>
Signed-off-by: Dominik Voigt <[email protected]>
Fix indentation issue in CompositeSearchBasedFetcher Signed-off-by: Dominik Voigt <[email protected]>
Remove outdated JavaDoc Signed-off-by: Dominik Voigt <[email protected]>
* upstream/master: (47 commits) Fix copy pasting and delete via menu or key (#6740) Add instructions how to work with fetchers (#6731) Autoinstall extension in chrome (#6442) Delete link after download (#6723) New translations JabRef_en.properties (Portuguese, Brazilian) (#6728) Bump pascalgn/automerge-action from v0.8.5 to v0.9.0 (#6736) Bump byte-buddy-parent from 1.10.13 to 1.10.14 (#6733) Bump mockito-core from 3.4.4 to 3.4.6 (#6734) Bump unirest-java from 3.8.06 to 3.9.00 (#6735) Bump org.beryx.jlink from 2.21.1 to 2.21.2 (#6732) Add testing interface, including a set of capabilities to tests for (#6687) Fix pasting on mac and linux (#6419) Add validation of "AUTHORS" file (#6722) Squashed 'src/main/resources/csl-styles/' changes from cacc4ee..827b986 New Crowdin updates (#6721) Add missing AUTHORs Fix for issue 6639 (#6719) Fix more links Fix link New Crowdin updates (#6718) ...
Add capability tests for the fetchers to determine whether they support the tested capability.
This is a part of my bachelor thesis working on JabRef#369.
Here, I am systematically evaluating the capabilities of fetchers. This is a) for documentation in code b) to check whether the fetchers change their capability over time. I accept that tests may fail due to changing external services.
Follow-up PRs will come making use of the new functionality in the UI. This is a rather small PR to easy review (@stefan-kolb ^^). This is also a step towards implementing JabRef#341