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

Fix fetcher tests #8877

Merged
merged 5 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@

import org.jabref.logic.importer.fetcher.ArXiv;
import org.jabref.logic.importer.fetcher.DoiFetcher;
import org.jabref.logic.importer.fetcher.IacrEprintFetcher;
import org.jabref.logic.importer.fetcher.IsbnFetcher;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.identifier.ArXivIdentifier;
import org.jabref.model.entry.identifier.DOI;
import org.jabref.model.entry.identifier.ISBN;
import org.jabref.model.entry.identifier.IacrEprint;

public class CompositeIdFetcher {

Expand All @@ -33,10 +31,11 @@ public Optional<BibEntry> performSearchById(String identifier) throws FetcherExc
if (isbn.isPresent()) {
return new IsbnFetcher(importFormatPreferences).performSearchById(isbn.get().getNormalized());
}
/* TODO: IACR is currently disabled, because it needs to be reworked: https://github.com/JabRef/jabref/issues/8876
Optional<IacrEprint> iacrEprint = IacrEprint.parse(identifier);
if (iacrEprint.isPresent()) {
return new IacrEprintFetcher(importFormatPreferences).performSearchById(iacrEprint.get().getNormalized());
}
}*/

return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Optional<URL> findFullText(BibEntry entry) throws IOException {
connection.followRedirects(true);
connection.ignoreHttpErrors(true);
// some publishers are quite slow (default is 3s)
connection.timeout(10000);
connection.timeout(30_000);

Connection.Response response = connection.execute();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static Stream<Arguments> performSearchByIdReturnsCorrectEntryForIdentifie
.withField(StandardField.KEYWORDS, "astro-ph.GA"),
"arXiv:2110.02957"
),
/* disabled, because Iacr does not work
Arguments.arguments(
"performSearchByIdReturnsCorrectEntryForIacrEprintId",
new BibEntry(StandardEntryType.Misc)
Expand All @@ -61,7 +62,7 @@ public static Stream<Arguments> performSearchByIdReturnsCorrectEntryForIdentifie
.withField(StandardField.YEAR, "2017")
.withCitationKey("cryptoeprint:2017:1118"),
"2017/1118"
),
), */
Arguments.arguments(
"performSearchByIdReturnsCorrectEntryForIsbnId",
new BibEntry(StandardEntryType.Book)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,44 +43,41 @@ public class IacrEprintFetcherTest {
public void setUp() {
fetcher = new IacrEprintFetcher(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS));

abram2017 = new BibEntry();
abram2017.setType(StandardEntryType.Misc);
abram2017.setCitationKey("cryptoeprint:2017:1118");
abram2017.setField(StandardField.ABSTRACT, "dummy");
abram2017.setField(StandardField.AUTHOR, "Ittai Abraham and Dahlia Malkhi and Kartik Nayak and Ling Ren and Alexander Spiegelman");
abram2017.setField(StandardField.DATE, "2017-11-18");
abram2017.setField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Report 2017/1118");
abram2017.setField(StandardField.NOTE, "\\url{https://ia.cr/2017/1118}");
abram2017.setField(StandardField.TITLE, "Solida: A Blockchain Protocol Based on Reconfigurable Byzantine Consensus");
abram2017.setField(StandardField.URL, "https://eprint.iacr.org/2017/1118/20171124:064527");
abram2017.setField(StandardField.VERSION, "20171124:064527");
abram2017.setField(StandardField.YEAR, "2017");

beierle2016 = new BibEntry();
beierle2016.setType(StandardEntryType.Misc);
beierle2016.setCitationKey("cryptoeprint:2016:119");
beierle2016.setField(StandardField.ABSTRACT, "dummy");
beierle2016.setField(StandardField.AUTHOR, "Christof Beierle and Thorsten Kranz and Gregor Leander");
beierle2016.setField(StandardField.DATE, "2017-02-17");
beierle2016.setField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Report 2016/119");
beierle2016.setField(StandardField.NOTE, "\\url{https://ia.cr/2016/119}");
beierle2016.setField(StandardField.TITLE, "Lightweight Multiplication in GF(2^n) with Applications to MDS Matrices");
beierle2016.setField(StandardField.URL, "https://eprint.iacr.org/2016/119/20170217:150415");
beierle2016.setField(StandardField.VERSION, "20170217:150415");
beierle2016.setField(StandardField.YEAR, "2016");

delgado2017 = new BibEntry();
delgado2017.setType(StandardEntryType.Misc);
delgado2017.setCitationKey("cryptoeprint:2017:1095");
delgado2017.setField(StandardField.ABSTRACT, "dummy");
delgado2017.setField(StandardField.AUTHOR, "Sergi Delgado-Segura and Cristina Pérez-Solà and Guillermo Navarro-Arribas and Jordi Herrera-Joancomartí");
delgado2017.setField(StandardField.DATE, "2018-01-19");
delgado2017.setField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Report 2017/1095");
delgado2017.setField(StandardField.NOTE, "\\url{https://ia.cr/2017/1095}");
delgado2017.setField(StandardField.TITLE, "Analysis of the Bitcoin UTXO set");
delgado2017.setField(StandardField.URL, "https://eprint.iacr.org/2017/1095/20180119:113352");
delgado2017.setField(StandardField.VERSION, "20180119:113352");
delgado2017.setField(StandardField.YEAR, "2017");
abram2017 = new BibEntry(StandardEntryType.Misc)
.withCitationKey("cryptoeprint:2017:1118")
.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-18")
.withField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Report 2017/1118")
.withField(StandardField.NOTE, "\\url{https://ia.cr/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.VERSION, "20171124:064527")
.withField(StandardField.YEAR, "2017");

beierle2016 = new BibEntry(StandardEntryType.Misc)
.withCitationKey("cryptoeprint:2016:119")
.withField(StandardField.ABSTRACT, "dummy")
.withField(StandardField.AUTHOR, "Christof Beierle and Thorsten Kranz and Gregor Leander")
.withField(StandardField.DATE, "2017-02-17")
.withField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Report 2016/119")
.withField(StandardField.NOTE, "\\url{https://ia.cr/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.VERSION, "20170217:150415")
.withField(StandardField.YEAR, "2016");

delgado2017 = new BibEntry(StandardEntryType.Misc)
.withCitationKey("cryptoeprint:2017:1095")
.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, Report 2017/1095")
.withField(StandardField.NOTE, "\\url{https://ia.cr/2017/1095}")
.withField(StandardField.TITLE, "Analysis of the Bitcoin UTXO set")
.withField(StandardField.URL, "https://eprint.iacr.org/2017/1095/20180119:113352")
.withField(StandardField.VERSION, "20180119:113352")
.withField(StandardField.YEAR, "2017");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void setUp() {
.withField(StandardField.PUBLISHER, "Addison Wesley")
.withField(StandardField.YEAR, "2018")
.withField(StandardField.AUTHOR, "Bloch, Joshua")
.withField(StandardField.DATE, "2018-01-31")
.withField(StandardField.DATE, "2018-01-15")
.withField(new UnknownField("ean"), "9780134685991")
.withField(StandardField.ISBN, "0134685997")
.withField(StandardField.URL, "https://www.ebook.de/de/product/28983211/joshua_bloch_effective_java.html");
Expand Down