From 94865186d5d575583b226f5801c02610f92b8cae Mon Sep 17 00:00:00 2001 From: subhramit Date: Fri, 14 Feb 2025 23:01:49 +0530 Subject: [PATCH 1/3] Fix some fetcher tests Signed-off-by: subhramit --- .../importer/fetcher/BiodiversityLibrary.java | 2 +- .../fetcher/BiodiversityLibraryTest.java | 5 +---- .../importer/fetcher/DOABFetcherTest.java | 7 +++---- .../importer/fetcher/DoiFetcherTest.java | 3 ++- .../fetcher/IacrEprintFetcherTest.java | 19 ++++++++----------- .../logic/importer/fetcher/MedraTest.java | 4 ++-- .../importer/fetcher/TitleFetcherTest.java | 1 - .../isbntobibtex/GVKIsbnFetcherTest.java | 15 ++++++++------- 8 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java b/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java index f5154d60b23..920aec8e072 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java @@ -40,7 +40,7 @@ public class BiodiversityLibrary implements SearchBasedParserFetcher, Customizab private static final String BASE_URL = "https://www.biodiversitylibrary.org/api3"; private static final String RESPONSE_FORMAT = "json"; - private static final String TEST_URL_WITHOUT_API_KEY = "https://www.biodiversitylibrary.org/api3?apikey="; + private static final String TEST_URL_WITHOUT_API_KEY = "https://www.biodiversitylibrary.org/api3?"; private final ImporterPreferences importerPreferences; diff --git a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java index a42d50a8772..209f05d1646 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java @@ -27,7 +27,7 @@ @FetcherTest class BiodiversityLibraryTest { - private final String RESPONSE_FORMAT = "&format=json"; + private final String RESPONSE_FORMAT = "format=json"; private String apiKey; private BiodiversityLibrary fetcher; @@ -56,7 +56,6 @@ void biodiversityHeritageApiKeyIsNotEmpty() { void baseURLConstruction() throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() - .concat(apiKey) .concat(RESPONSE_FORMAT); assertEquals(expected, fetcher.getBaseURL().toString()); @@ -67,7 +66,6 @@ void baseURLConstruction() throws MalformedURLException, URISyntaxException { void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() - .concat(apiKey) .concat(RESPONSE_FORMAT) .concat("&op=GetPartMetadata&pages=f&names=f") .concat("&id="); @@ -80,7 +78,6 @@ void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxExceptio void getItemMetadaUrl(String id) throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() - .concat(apiKey) .concat(RESPONSE_FORMAT) .concat("&op=GetItemMetadata&pages=f&ocr=f&ocr=f") .concat("&id="); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/DOABFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/DOABFetcherTest.java index 756a52a0d32..d4aba9c8254 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DOABFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DOABFetcherTest.java @@ -39,7 +39,7 @@ public static Stream performSearch() { .withField(StandardField.URL, "http://library.oapen.org/handle/20.500.12657/25535") .withField(StandardField.URI, "https://directory.doabooks.org/handle/20.500.12854/34739") .withField(StandardField.LANGUAGE, "English") - .withField(StandardField.KEYWORDS, "poetry, love, warfare") + .withField(StandardField.KEYWORDS, "poetry, love, warfare, thema EDItEUR::D Biography, Literature and Literary studies::DC Poetry::DCF Poetry by individual poets") .withField(StandardField.PUBLISHER, "punctum books"), "i open fire" ), @@ -55,8 +55,7 @@ public static Stream performSearch() { .withField(StandardField.URL, "http://library.oapen.org/handle/20.500.12657/25287") .withField(StandardField.URI, "https://directory.doabooks.org/handle/20.500.12854/26303") .withField(StandardField.LANGUAGE, "English") - .withField(StandardField.KEYWORDS, "Open Access, Monographs, OAPEN Library, " + - "Directory of Open Access Books") + .withField(StandardField.KEYWORDS, "Open Access, Monographs, OAPEN Library, Directory of Open Access Books, thema EDItEUR::G Reference, Information and Interdisciplinary subjects::GL Library and information sciences / Museology, thema EDItEUR::G Reference, Information and Interdisciplinary subjects::GP Research and information: general") .withField(StandardField.PUBLISHER, "Amsterdam University Press"), "the deliverance of open access books" ), @@ -70,7 +69,7 @@ public static Stream performSearch() { .withField(StandardField.URL, "https://library.oapen.org/handle/20.500.12657/48312") .withField(StandardField.URI, "https://directory.doabooks.org/handle/20.500.12854/68086") .withField(StandardField.LANGUAGE, "English") - .withField(StandardField.KEYWORDS, "Religion") + .withField(StandardField.KEYWORDS, "Religion, thema EDItEUR::Q Philosophy and Religion::QR Religion and beliefs::QRM Christianity::QRMF Christianity: sacred texts and revered writings::QRMF1 Bibles::QRMF13 New Testaments") .withField(StandardField.PUBLISHER, "Brill"), "Four Kingdom Motifs before and beyond the Book of Daniel" ), diff --git a/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java index 3cf0c3f14b0..08b31e4ed95 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java @@ -38,6 +38,7 @@ class DoiFetcherTest { .withField(StandardField.PUBLISHER, "IEEE") .withField(StandardField.TITLE, "BPEL4Chor: Extending BPEL for Modeling Choreographies") .withField(StandardField.YEAR, "2007") + .withField(StandardField.PAGES, "296--303") .withField(StandardField.DOI, "10.1109/icws.2007.59"); private final BibEntry bibEntryIannarelli2019 = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, @@ -54,7 +55,7 @@ class DoiFetcherTest { .withField(StandardField.YEAR, "2019") .withField(StandardField.DOI, "10.3303/CET1977146") .withField(StandardField.JOURNAL, "Chemical Engineering Transactions") - .withField(StandardField.PAGES, "871-876") + .withField(StandardField.PAGES, "871–876") .withField(StandardField.VOLUME, "77"); private final BibEntry bibEntryStenzel2020 = new BibEntry(StandardEntryType.Article) .withCitationKey("Stenzel_2020") diff --git a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java index a73954cb4a4..8e7f1453d1a 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java @@ -51,10 +51,9 @@ void setUp() { .withField(StandardField.ABSTRACT, "dummy") .withField(StandardField.AUTHOR, "Ittai Abraham and Dahlia Malkhi and Kartik Nayak and Ling Ren and Alexander Spiegelman") .withField(StandardField.DATE, "2017-11-24") - .withField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Paper 2017/1118") - .withField(StandardField.NOTE, "\\url{https://eprint.iacr.org/2017/1118}") + .withField(StandardField.HOWPUBLISHED, "Cryptology {ePrint} Archive, Paper 2017/1118") .withField(StandardField.TITLE, "Solida: A Blockchain Protocol Based on Reconfigurable Byzantine Consensus") - .withField(StandardField.URL, "https://eprint.iacr.org/2017/1118/20171124:064527") + .withField(StandardField.URL, "https://eprint.iacr.org/archive/versions/2017/1118/20171124:064527") .withField(StandardField.VERSION, "20171124:064527") .withField(StandardField.YEAR, "2017"); @@ -75,10 +74,9 @@ void setUp() { .withField(StandardField.AUTHOR, "Christof Beierle and Thorsten Kranz and Gregor Leander") .withField(StandardField.DATE, "2017-02-17") .withField(StandardField.DOI, "10.1007/978-3-662-53018-4_23") - .withField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Paper 2016/119") - .withField(StandardField.NOTE, "\\url{https://eprint.iacr.org/2016/119}") - .withField(StandardField.TITLE, "Lightweight Multiplication in GF(2^n) with Applications to MDS Matrices") - .withField(StandardField.URL, "https://eprint.iacr.org/2016/119/20170217:150415") + .withField(StandardField.HOWPUBLISHED, "Cryptology {ePrint} Archive, Paper 2016/119") + .withField(StandardField.TITLE, "Lightweight Multiplication in {GF}(2^n) with Applications to {MDS} Matrices") + .withField(StandardField.URL, "https://eprint.iacr.org/archive/versions/2016/119/20170217:150415") .withField(StandardField.VERSION, "20170217:150415") .withField(StandardField.YEAR, "2016"); @@ -87,10 +85,9 @@ void setUp() { .withField(StandardField.ABSTRACT, "dummy") .withField(StandardField.AUTHOR, "Sergi Delgado-Segura and Cristina Pérez-Solà and Guillermo Navarro-Arribas and Jordi Herrera-Joancomartí") .withField(StandardField.DATE, "2018-01-19") - .withField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Paper 2017/1095") - .withField(StandardField.NOTE, "\\url{https://eprint.iacr.org/2017/1095}") - .withField(StandardField.TITLE, "Analysis of the Bitcoin UTXO set") - .withField(StandardField.URL, "https://eprint.iacr.org/2017/1095/20180119:113352") + .withField(StandardField.HOWPUBLISHED, "Cryptology {ePrint} Archive, Paper 2017/1095") + .withField(StandardField.TITLE, "Analysis of the Bitcoin {UTXO} set") + .withField(StandardField.URL, "https://eprint.iacr.org/archive/versions/2017/1095/20180119:113352") .withField(StandardField.VERSION, "20180119:113352") .withField(StandardField.YEAR, "2017"); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MedraTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MedraTest.java index 308e8b77101..814544f0ef1 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MedraTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MedraTest.java @@ -35,7 +35,7 @@ private static Stream getDoiBibEntryPairs() { .withField(StandardField.DOI, "10.2143/TVF.80.3.3285690") .withField(StandardField.ISSN, "2031-8952, 2031-8952") .withField(StandardField.JOURNAL, "Tijdschrift voor Filosofie") - .withField(StandardField.PAGES, "625-629") + .withField(StandardField.PAGES, "625–629") )), Arguments.of("10.3303/CET1977146", @@ -55,7 +55,7 @@ private static Stream getDoiBibEntryPairs() { .withField(StandardField.YEAR, "2019") .withField(StandardField.DOI, "10.3303/CET1977146") .withField(StandardField.JOURNAL, "Chemical Engineering Transactions") - .withField(StandardField.PAGES, "871-876") + .withField(StandardField.PAGES, "871–876") .withField(StandardField.VOLUME, "77"))), Arguments.of("10.1400/115378", Optional.of( diff --git a/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java index 5446b6a9151..685edd22f3e 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java @@ -32,7 +32,6 @@ void setUp() { .withField(StandardField.BOOKTITLE, "2009 35th Euromicro Conference on Software Engineering and Advanced Applications") .withField(StandardField.PUBLISHER, "IEEE") .withField(StandardField.TITLE, "BPELscript: A Simplified Script Syntax for WS-BPEL 2.0") - .withField(StandardField.VOLUME, "5331") .withField(StandardField.YEAR, "2009") .withField(StandardField.MONTH, "#aug#") .withField(StandardField.PAGES, "39--46") diff --git a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/GVKIsbnFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/GVKIsbnFetcherTest.java index 9319ec74651..b1b5f08fb1a 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/GVKIsbnFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/GVKIsbnFetcherTest.java @@ -75,17 +75,18 @@ public void authorsAreCorrectlyFormatted() throws Exception { BibEntry bibEntry = new BibEntry(StandardEntryType.Book) .withField(StandardField.TITLE, "Repository") .withField(StandardField.SUBTITLE, "Eine Einführung") - .withField(StandardField.PUBLISHER, "De Gruyter Oldenbourg") + .withField(StandardField.PUBLISHER, "Walter de Gruyter GmbH") .withField(StandardField.AUTHOR, "Habermann, Hans-Joachim") .withField(StandardField.ISBN, "9783110702125") .withField(StandardField.YEAR, "2020") - .withField(StandardField.ADDRESS, "München") - .withField(StandardField.EDITION, "Reprint 2020") + .withField(StandardField.ADDRESS, "Berlin/München/Boston") + .withField(StandardField.EDITION, "1st ed.") .withField(StandardField.EDITOR, "Frank Leymann") - .withField(StandardField.NUMBER, "8.1") - .withField(StandardField.PAGETOTAL, "1294") - .withField(StandardField.SERIES, "Handbuch der Informatik") - .withField(new UnknownField("ppn_gvk"), "1738076555"); + .withField(StandardField.NUMBER, "v.8.1") + .withField(StandardField.PAGETOTAL, "1296") + .withField(StandardField.SERIES, "Handbuch der Informatik Series") + .withField(StandardField.NOTE, "Description based on publisher supplied metadata and other sources.") + .withField(new UnknownField("ppn_gvk"), "1910493767"); Optional fetchedEntry = fetcher.performSearchById("9783110702125"); assertEquals(Optional.of(bibEntry), fetchedEntry); From 1a2427cfdeba03401401137fad84d467b5f6adc2 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Sun, 16 Feb 2025 15:11:47 +0100 Subject: [PATCH 2/3] revert --- .../jabref/logic/importer/fetcher/BiodiversityLibrary.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java b/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java index 920aec8e072..b0de78575ae 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/BiodiversityLibrary.java @@ -40,7 +40,7 @@ public class BiodiversityLibrary implements SearchBasedParserFetcher, Customizab private static final String BASE_URL = "https://www.biodiversitylibrary.org/api3"; private static final String RESPONSE_FORMAT = "json"; - private static final String TEST_URL_WITHOUT_API_KEY = "https://www.biodiversitylibrary.org/api3?"; + private static final String TEST_URL_WIH_OPTIONAL_KEY = "https://www.biodiversitylibrary.org/api3?apikey="; private final ImporterPreferences importerPreferences; @@ -55,7 +55,7 @@ public String getName() { @Override public String getTestUrl() { - return TEST_URL_WITHOUT_API_KEY; + return TEST_URL_WIH_OPTIONAL_KEY; } public URL getBaseURL() throws URISyntaxException, MalformedURLException { From ebd17d12650a4326d0ca4d9c2d91d569ca01aaec Mon Sep 17 00:00:00 2001 From: subhramit Date: Mon, 17 Feb 2025 04:06:12 +0530 Subject: [PATCH 3/3] Revert changes in in`BiodiversityLibraryTest` Signed-off-by: subhramit --- .../logic/importer/fetcher/BiodiversityLibraryTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java index 209f05d1646..a42d50a8772 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java @@ -27,7 +27,7 @@ @FetcherTest class BiodiversityLibraryTest { - private final String RESPONSE_FORMAT = "format=json"; + private final String RESPONSE_FORMAT = "&format=json"; private String apiKey; private BiodiversityLibrary fetcher; @@ -56,6 +56,7 @@ void biodiversityHeritageApiKeyIsNotEmpty() { void baseURLConstruction() throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() + .concat(apiKey) .concat(RESPONSE_FORMAT); assertEquals(expected, fetcher.getBaseURL().toString()); @@ -66,6 +67,7 @@ void baseURLConstruction() throws MalformedURLException, URISyntaxException { void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() + .concat(apiKey) .concat(RESPONSE_FORMAT) .concat("&op=GetPartMetadata&pages=f&names=f") .concat("&id="); @@ -78,6 +80,7 @@ void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxExceptio void getItemMetadaUrl(String id) throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() + .concat(apiKey) .concat(RESPONSE_FORMAT) .concat("&op=GetItemMetadata&pages=f&ocr=f&ocr=f") .concat("&id=");