Skip to content

Add testing interface, including a set of capabilities to tests for#6687

Merged
koppor merged 46 commits into
JabRef:masterfrom
DominikVoigt:feat/add-capability-tests-for-fetchers
Aug 2, 2020
Merged

Add testing interface, including a set of capabilities to tests for#6687
koppor merged 46 commits into
JabRef:masterfrom
DominikVoigt:feat/add-capability-tests-for-fetchers

Conversation

@DominikVoigt

Copy link
Copy Markdown
Contributor

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 https://github.com/koppor/jabref/issues/341.6

  • Change in CHANGELOG.md described (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.

Add capability tests for the fetchers to determine whether they support the tested capability.

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>

@koppor koppor left a comment

Copy link
Copy Markdown
Member

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)

@Siedlerchr

Copy link
Copy Markdown
Member

One of the architecture test fails:
getSearchBasedFetchersReturnsAllFetcherDerivingFromSearchBasedFetcher

Probably because we hide some fetchers for the users

@tobiasdiez tobiasdiez left a comment

Copy link
Copy Markdown
Member

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!

Comment thread src/main/java/org/jabref/logic/importer/AdvancedFetcher.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/AdvancedFetcher.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/AdvancedFetcher.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/fetcher/AdvancedSearchConfig.java Outdated
Comment thread src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java Outdated
Comment thread src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java Outdated
Comment thread src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java Outdated
github actions and others added 9 commits July 15, 2020 02:11
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
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
- Add missing assert
- Modify test

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
…hange request

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
…AdvancedSearchBasedParserFetcher interface.

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>

@tobiasdiez tobiasdiez left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/main/java/org/jabref/logic/importer/fetcher/IEEE.java Outdated
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
- 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 <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Add related ADR.

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Remove URL from Doifetcher test, as it gets cleaned up by DOICleanUp as the URL contains a DOI.

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
@tobiasdiez

Copy link
Copy Markdown
Member

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).
Moreover, there are other post-process steps (apart from the bibtex conversion) that would ideally be handled, for example, bibtex key generation, adding of "timestamp" and "user" fields etc.
We discussed this already a few times, and the tendency was towards adding a conversion handler that post-processes the output of the fetcher/importer/... and then adds the entries in the database:
#2117 (comment)
#1018 (comment)
Also relevant: #895

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 <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Remove any format conversion where the fetcher format conversion added it.

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>

@koppor koppor left a comment

Copy link
Copy Markdown
Member

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

Comment thread src/main/java/org/jabref/cli/ArgumentProcessor.java Outdated
Comment thread docs/adr/0013-how-to-provide-fetchers-with-import-format.md Outdated
Comment thread src/main/java/org/jabref/cli/ArgumentProcessor.java Outdated
Comment thread src/main/java/org/jabref/cli/ArgumentProcessor.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/EntryBasedParserFetcher.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/IdBasedParserFetcher.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/fetcher/CiteSeer.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcher.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/fetcher/DoiFetcher.java Outdated
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"));

Copy link
Copy Markdown
Member

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)

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

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.

@tobiasdiez tobiasdiez left a comment

Copy link
Copy Markdown
Member

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 calls getComplexQueryURL (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.

Comment thread docs/adr/0012-handle-different-bibEntry-formats-of-fetchers.md Outdated
Comment thread src/main/java/org/jabref/gui/ClipBoardManager.java Outdated
Comment thread src/main/java/org/jabref/gui/bibtexextractor/BibtexExtractorViewModel.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/ImportCleanup.java Outdated
Comment thread src/main/java/org/jabref/logic/importer/SearchBasedFetcher.java Outdated
*/
public ComplexSearchQueryBuilder author(String author) {
if (Objects.requireNonNull(author).isBlank()) {
throw new IllegalArgumentException("Parameter must not be blank");

Copy link
Copy Markdown
Member

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 = ""?

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Member

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).

Comment thread src/main/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcher.java Outdated
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"));

Copy link
Copy Markdown
Member

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.

- Move doPostCleanup back
- Move format in ImportCleanup into constructor.

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
 - Change title
 - Fix some typos and punctuation

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Fix indentation issue in CompositeSearchBasedFetcher

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
Remove outdated JavaDoc

Signed-off-by: Dominik Voigt <dominik.ingo.voigt@gmail.com>
@koppor koppor merged commit b506baa into JabRef:master Aug 2, 2020
Siedlerchr added a commit that referenced this pull request Aug 9, 2020
* 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)
  ...
@DominikVoigt DominikVoigt deleted the feat/add-capability-tests-for-fetchers branch January 1, 2021 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants