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 some fetcher test #8595

Merged
merged 3 commits into from
Mar 21, 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 @@ -485,6 +485,10 @@ public void download() {
downloadTask.messageProperty().set(
Localization.lang("Fulltext for") + ": " + entry.getCitationKey().orElse(Localization.lang("New entry")));
downloadTask.showToUser(true);
downloadTask.onFailure(ex -> {
LOGGER.error("Error downloading", ex);
dialogService.showErrorDialogAndWait(Localization.lang("Error downloading"), ex);
});
taskExecutor.execute(downloadTask);
} catch (MalformedURLException exception) {
dialogService.showErrorDialogAndWait(Localization.lang("Invalid URL"), exception);
Expand Down Expand Up @@ -524,8 +528,7 @@ public BackgroundTask<Path> prepareDownloadTask(Path targetDirectory, URLDownloa
return targetDirectory.resolve(fulltextDir).resolve(suggestedName);
})
.then(destination -> new FileDownloadTask(urlDownload.getSource(), destination))
.onFinished(() -> URLDownload.setSSLVerification(defaultSSLSocketFactory, defaultHostnameVerifier))
.onFailure(exception -> dialogService.showErrorDialogAndWait("Download failed", exception));
.onFinished(() -> URLDownload.setSSLVerification(defaultSSLSocketFactory, defaultHostnameVerifier));
return downloadTask;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ void downloadDoesNotOverwriteFileTypeExtension() throws MalformedURLException {
@FetcherTest
@Test
void downloadHtmlWhenLinkedFilePointsToHtml() throws MalformedURLException {
// the link mentioned in issue #7452
String url = "https://onlinelibrary.wiley.com/doi/abs/10.1002/0470862106.ia615";
// use google as test url, wiley is protected by clooudfare
String url = "https://google.com";
String fileType = StandardExternalFileType.URL.getName();
linkedFile = new LinkedFile(new URL(url), fileType);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public void setUp() throws Exception {
luceyPaulEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2000JGR...10520297L");
luceyPaulEntry.setField(StandardField.MONTH, "#jan#");
luceyPaulEntry.setField(StandardField.NUMBER, "E8");
luceyPaulEntry.setField(StandardField.ABSTRACT, "The Clementine mission to the Moon returned global imaging data collected by the ultraviolet visible (UVVIS) camera. This data set is now in a final state of calibration, and a five-band multispectral digital image model (DIM) of the lunar surface will soon be available to the science community. We have used observations of the lunar sample-return sites and stations extracted from the final DIM in conjunction with compositional information for returned lunar soils to revise our previously published algorithms for the spectral determination of the FeO and TiO$_{2}$ content of the lunar surface. The algorithms successfully normalize the effects of space weathering so that composition may be determined without regard to a surface's state of maturity. These algorithms permit anyone with access to the standard archived DIM to construct high spatial resolution maps of FeO and TiO$_{2}$ abundance. Such maps will be of great utility in a variety of lunar geologic studies.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static Stream<Arguments> provideTestData() {
"performSearchByIdReturnsCorrectEntryForDoiId",
new BibEntry(StandardEntryType.Book)
.withField(StandardField.TITLE, "Java{\\textregistered} For Dummies{\\textregistered}")
.withField(StandardField.PUBLISHER, "Wiley Publishing, Inc.")
.withField(StandardField.PUBLISHER, "Wiley")
.withField(StandardField.YEAR, "2011")
.withField(StandardField.AUTHOR, "Barry Burd")
.withField(StandardField.MONTH, "jul")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void setUp() {
bibEntryBurd2011.setType(StandardEntryType.Book);
bibEntryBurd2011.setCitationKey("Burd_2011");
bibEntryBurd2011.setField(StandardField.TITLE, "Java{\\textregistered} For Dummies{\\textregistered}");
bibEntryBurd2011.setField(StandardField.PUBLISHER, "Wiley Publishing, Inc.");
bibEntryBurd2011.setField(StandardField.PUBLISHER, "Wiley");
bibEntryBurd2011.setField(StandardField.YEAR, "2011");
bibEntryBurd2011.setField(StandardField.AUTHOR, "Barry Burd");
bibEntryBurd2011.setField(StandardField.MONTH, "jul");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.jabref.testutils.category.FetcherTest;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -39,6 +40,7 @@ void linkWithPdfInTitleTag() throws IOException {
);
}

@Disabled("Cannot fetch due to Cloudfare protection")
@Test
void linkWithPdfStringLeadsToFulltext() throws IOException {
entry.setField(StandardField.DOI, "10.1002/acr2.11101");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ public class GrobidCitationFetcherTest {

static String example1 = "Derwing, T. M., Rossiter, M. J., & Munro, M. J. (2002). Teaching native speakers to listen to foreign-accented speech. Journal of Multilingual and Multicultural Development, 23(4), 245-259.";
static BibEntry example1AsBibEntry = new BibEntry(StandardEntryType.Article).withCitationKey("-1")
.withField(StandardField.AUTHOR, "Derwing, Tracey and Rossiter, Marian and Munro, Murray")
.withField(StandardField.AUTHOR, "Derwing, T. and Rossiter, M. and Munro, M.")
.withField(StandardField.TITLE, "Teaching Native Speakers to Listen to Foreign-accented Speech")
.withField(StandardField.JOURNAL, "Journal of Multilingual and Multicultural Development")
.withField(StandardField.DOI, "10.1080/01434630208666468")
.withField(StandardField.DATE, "2002-09")
.withField(StandardField.DATE, "2002")
.withField(StandardField.YEAR, "2002")
.withField(StandardField.MONTH, "9")
.withField(StandardField.PAGES, "245-259")
.withField(StandardField.VOLUME, "23")
.withField(StandardField.PUBLISHER, "Informa UK Limited")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,24 @@ void searchByQueryFindsEntry() throws Exception {
.withField(StandardField.TITLE, "How to Find My Task? Chatbot to Assist Newcomers in Choosing Tasks in OSS Projects")
.withField(StandardField.ABSTRACT, "Open Source Software (OSS) is making a meteoric rise in the software industry since several big companies have entered this market. Unfortunately, newcomers enter these projects and usually lose interest in contributing because of several factors. This paper aims to reduce the problems users face when they walk their first steps into OSS projects: finding the appropriate task. This paper presents a chatbot that filters tasks to help newcomers choose a task that fits their skills. We performed a quantitative and a qualitative study comparing the chatbot with the current GitHub issue tracker interface, which uses labels to categorize and identify tasks. The results show that users perceived the chatbot as easier to use than the GitHub issue tracker. Additionally, users tend to interpret the use of chatbots as situational, helping mainly newcomers and inexperienced contributors.");

BibEntry fourthArticle = new BibEntry(StandardEntryType.Article)
.withField(StandardField.AUTHOR, "Calefato, Fabio and Gerosa, Marco Aurélio and Iaffaldano, Giuseppe and Lanubile, Filippo and Steinmacher, Igor")
.withField(StandardField.DATE, "2022-03-19")
.withField(StandardField.DOI, "10.1007/s10664-021-10012-6")
.withField(StandardField.FILE, ":http\\://link.springer.com/openurl/pdf?id=doi\\:10.1007/s10664-021-10012-6:PDF")
.withField(StandardField.ISSN, "1382-3256")
.withField(StandardField.JOURNAL, "Empirical Software Engineering")
.withField(StandardField.MONTH, "#mar#")
.withField(StandardField.NUMBER, "3")
.withField(StandardField.PAGES, "1--41")
.withField(StandardField.PUBLISHER, "Springer")
.withField(StandardField.TITLE, "Will you come back to contribute? Investigating the inactivity of OSS core developers in GitHub")
.withField(StandardField.VOLUME, "27")
.withField(StandardField.YEAR, "2022")
.withField(StandardField.ABSTRACT, "Several Open-Source Software (OSS) projects depend on the continuity of their development communities to remain sustainable. Understanding how developers become inactive or why they take breaks can help communities prevent abandonment and incentivize developers to come back. In this paper, we propose a novel method to identify developers’ inactive periods by analyzing the individual rhythm of contributions to the projects. Using this method, we quantitatively analyze the inactivity of core developers in 18 OSS organizations hosted on GitHub. We also survey core developers to receive their feedback about the identified breaks and transitions. Our results show that our method was effective for identifying developers’ breaks. About 94% of the surveyed core developers agreed with our state model of inactivity; 71% and 79% of them acknowledged their breaks and state transition, respectively. We also show that all core developers take breaks (at least once) and about a half of them (~45%) have completely disengaged from a project for at least one year. We also analyzed the probability of transitions to/from inactivity and found that developers who pause their activity have a ~35 to ~55% chance to return to an active state; yet, if the break lasts for a year or longer, then the probability of resuming activities drops to ~21–26%, with a ~54% chance of complete disengagement. These results may support the creation of policies and mechanisms to make OSS community managers aware of breaks and potential project abandonment.");

List<BibEntry> fetchedEntries = fetcher.performSearch("JabRef Social Barriers Steinmacher");
assertEquals(List.of(thirdArticle, firstArticle, secondArticle), fetchedEntries);
assertEquals(List.of(fourthArticle, thirdArticle, firstArticle, secondArticle), fetchedEntries);
}

@Test
Expand Down