diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ab6ce7ec3a..b35e36b8296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We call backup files `.bak` and temporary writing files now `.sav`. - JabRef keeps 10 older versions of a `.bib` file in the [user data dir](https://github.com/harawata/appdirs#supported-directories) (instead of a single `.sav` (now: `.bak`) file in the directory of the `.bib` file) - We changed the button label from "Return to JabRef" to "Return to library" to better indicate the purpose of the action. +- We removed "last-search-date" from the SLR feature, because the last-search-date can be deducted from the git logs. - We reworked the External Changes Resolver dialog. [#9021](https://github.com/JabRef/jabref/pull/9021) @@ -33,6 +34,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - The [HtmlToLaTeXFormatter](https://docs.jabref.org/finding-sorting-and-cleaning-entries/saveactions#html-to-latex) keeps single `<` characters. - We fixed a performance regression when opening large libraries [#9041](https://github.com/JabRef/jabref/issues/9041) - We fixed a bug where spaces are trimmed when highlighting differences in the Entries merge dialog. [koppor#371](https://github.com/koppor/jabref/issues/371) +- We fixed some visual glitches with the linked files editor field in the entry editor and increased its height. [#8823](https://github.com/JabRef/jabref/issues/8823) - We fixed several bugs regarding the manual and the autosave of library files that sometimes lead to exceptions or data loss. [#9067](https://github.com/JabRef/jabref/pull/9067), [#8448](https://github.com/JabRef/jabref/issues/8484), [#8746](https://github.com/JabRef/jabref/issues/8746), [#6684](https://github.com/JabRef/jabref/issues/6684), [#6644](https://github.com/JabRef/jabref/issues/6644), [#6102](https://github.com/JabRef/jabref/issues/6102), [#6002](https://github.com/JabRef/jabref/issues/6000) - We fixed an issue where applied save actions on saving the library file would lead to the dialog "The libary has been modified by another program" popping up [#4877](https://github.com/JabRef/jabref/issues/4877) - We fixed an issue where title case didn't capitalize words after en-dash characters [#9068] @@ -46,7 +48,6 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - ## [5.7] - 2022-08-05 ### Added diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java index 20dd904978b..14fcf013668 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java @@ -16,11 +16,14 @@ import javax.net.ssl.SSLSocketFactory; import javafx.beans.Observable; +import javafx.beans.binding.Bindings; +import javafx.beans.binding.ObjectBinding; import javafx.beans.property.BooleanProperty; import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.property.StringProperty; +import javafx.scene.Node; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.ButtonBar.ButtonData; import javafx.scene.control.ButtonType; @@ -83,6 +86,8 @@ public class LinkedFileViewModel extends AbstractViewModel { private final PreferencesService preferences; private final LinkedFileHandler linkedFileHandler; + private ObjectBinding linkedFileIconBinding; + private final Validator fileExistsValidator; public LinkedFileViewModel(LinkedFile linkedFile, @@ -178,6 +183,14 @@ public JabRefIcon getTypeIcon() { .orElse(IconTheme.JabRefIcons.FILE); } + public ObjectBinding typeIconProperty() { + if (linkedFileIconBinding == null) { + linkedFileIconBinding = Bindings.createObjectBinding(() -> this.getTypeIcon().getGraphicNode(), linkedFile.fileTypeProperty()); + } + + return linkedFileIconBinding; + } + public void markAsAutomaticallyFound() { isAutomaticallyFound.setValue(true); } diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml index 7d34c27164e..5f61cfd109c 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml @@ -6,40 +6,40 @@ + - - - + + + + + diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java index 8a1a0c81fc9..e93c3952858 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java @@ -12,7 +12,9 @@ import javafx.scene.Parent; import javafx.scene.control.Button; import javafx.scene.control.ContextMenu; +import javafx.scene.control.Label; import javafx.scene.control.ListView; +import javafx.scene.control.OverrunStyle; import javafx.scene.control.ProgressBar; import javafx.scene.control.SelectionMode; import javafx.scene.control.SeparatorMenuItem; @@ -84,7 +86,7 @@ public LinkedFilesEditor(Field field, .load(); ViewModelListCellFactory cellFactory = new ViewModelListCellFactory() - .withStringTooltip(LinkedFileViewModel::getDescription) + .withStringTooltip(LinkedFileViewModel::getDescriptionAndLink) .withGraphic(this::createFileDisplay) .withContextMenu(this::createContextMenuForFile) .withOnMouseClickedEvent(this::handleItemMouseClick) @@ -165,10 +167,17 @@ private Node createFileDisplay(LinkedFileViewModel linkedFile) { progressIndicator.progressProperty().bind(linkedFile.downloadProgressProperty()); progressIndicator.visibleProperty().bind(linkedFile.downloadOngoingProperty()); + Label label = new Label(); + label.graphicProperty().bind(linkedFile.typeIconProperty()); + label.textProperty().bind(linkedFile.linkProperty()); + label.getStyleClass().setAll("file-row-text"); + label.textOverrunProperty().setValue(OverrunStyle.LEADING_ELLIPSIS); + EasyBind.subscribe(linkedFile.isAutomaticallyFoundProperty(), found -> label.pseudoClassStateChanged(opacity, found)); + HBox info = new HBox(8); HBox.setHgrow(info, Priority.ALWAYS); info.setStyle("-fx-padding: 0.5em 0 0.5em 0;"); // To align with buttons below which also have 0.5em padding - info.getChildren().setAll(icon, link, desc, progressIndicator); + info.getChildren().setAll(label, progressIndicator); Button acceptAutoLinkedFile = IconTheme.JabRefIcons.AUTO_LINKED_FILE.asButton(); acceptAutoLinkedFile.setTooltip(new Tooltip(Localization.lang("This file was found automatically. Do you want to link it to this entry?"))); @@ -177,7 +186,7 @@ private Node createFileDisplay(LinkedFileViewModel linkedFile) { acceptAutoLinkedFile.setOnAction(event -> linkedFile.acceptAsLinked()); acceptAutoLinkedFile.getStyleClass().setAll("icon-button"); - Button writeMetadataToPdf = IconTheme.JabRefIcons.IMPORT.asButton(); + Button writeMetadataToPdf = IconTheme.JabRefIcons.PDF_METADATA_WRITE.asButton(); writeMetadataToPdf.setTooltip(new Tooltip(Localization.lang("Write BibTeXEntry metadata to PDF."))); writeMetadataToPdf.visibleProperty().bind(linkedFile.isOfflinePdfProperty()); writeMetadataToPdf.getStyleClass().setAll("icon-button"); @@ -186,7 +195,7 @@ private Node createFileDisplay(LinkedFileViewModel linkedFile) { writeMetadataToPdf.disableProperty().bind(writeMetadataToPdfCommand.executableProperty().not()); writeMetadataToPdf.setOnAction(event -> writeMetadataToPdfCommand.execute()); - Button parsePdfMetadata = IconTheme.JabRefIcons.FILE_SEARCH.asButton(); + Button parsePdfMetadata = IconTheme.JabRefIcons.PDF_METADATA_READ.asButton(); parsePdfMetadata.setTooltip(new Tooltip(Localization.lang("Parse Metadata from PDF."))); parsePdfMetadata.visibleProperty().bind(linkedFile.isOfflinePdfProperty()); parsePdfMetadata.setOnAction(event -> { @@ -195,9 +204,9 @@ private Node createFileDisplay(LinkedFileViewModel linkedFile) { }); parsePdfMetadata.getStyleClass().setAll("icon-button"); - HBox container = new HBox(10); + HBox container = new HBox(2); container.setPrefHeight(Double.NEGATIVE_INFINITY); - + container.maxWidthProperty().bind(listView.widthProperty().subtract(20d)); container.getChildren().addAll(acceptAutoLinkedFile, info, writeMetadataToPdf, parsePdfMetadata); return container; @@ -261,7 +270,7 @@ private void handleItemMouseClick(LinkedFileViewModel linkedFile, MouseEvent eve @Override public double getWeight() { - return 2; + return 3; } private ContextMenu createContextMenuForFile(LinkedFileViewModel linkedFile) { diff --git a/src/main/java/org/jabref/gui/icon/IconTheme.java b/src/main/java/org/jabref/gui/icon/IconTheme.java index 80eb1824a9b..a573bf6c74c 100644 --- a/src/main/java/org/jabref/gui/icon/IconTheme.java +++ b/src/main/java/org/jabref/gui/icon/IconTheme.java @@ -192,6 +192,8 @@ public enum JabRefIcons implements JabRefIcon { DELETE_ENTRY(MaterialDesignD.DELETE), SEARCH(MaterialDesignM.MAGNIFY), FILE_SEARCH(MaterialDesignF.FILE_FIND), + PDF_METADATA_READ(MaterialDesignF.FORMAT_ALIGN_TOP), + PDF_METADATA_WRITE(MaterialDesignF.FORMAT_ALIGN_BOTTOM), ADVANCED_SEARCH(Color.CYAN, MaterialDesignM.MAGNIFY), PREFERENCES(MaterialDesignC.COG), SELECTORS(MaterialDesignS.STAR_SETTINGS), @@ -309,6 +311,7 @@ public enum JabRefIcons implements JabRefIcon { NEW_GROUP(MaterialDesignP.PLUS), OPEN_LINK(MaterialDesignO.OPEN_IN_NEW), LOOKUP_IDENTIFIER(MaterialDesignS.SEARCH_WEB), + LINKED_FILE_ADD(MaterialDesignP.PLUS), FETCH_FULLTEXT(MaterialDesignS.SEARCH_WEB), FETCH_BY_IDENTIFIER(MaterialDesignC.CLIPBOARD_ARROW_DOWN), TOGGLE_ABBREVIATION(MaterialDesignF.FORMAT_ALIGN_CENTER), diff --git a/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialog.fxml b/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialog.fxml index 592a99d1567..364f3da9214 100644 --- a/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialog.fxml +++ b/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialog.fxml @@ -1,42 +1,52 @@ - + - + + - + - - + + - - - + + + - diff --git a/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialogView.java b/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialogView.java index 6ed39ce1ae9..3d6149a203b 100644 --- a/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialogView.java +++ b/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialogView.java @@ -12,6 +12,8 @@ import org.jabref.gui.StateManager; import org.jabref.gui.externalfiletype.ExternalFileType; import org.jabref.gui.util.BaseDialog; +import org.jabref.gui.util.ViewModelListCellFactory; +import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.LinkedFile; import org.jabref.preferences.PreferencesService; @@ -40,6 +42,8 @@ public LinkedFileEditDialogView(LinkedFile linkedFile) { .setAsContent(this.getDialogPane()); this.getDialogPane().getButtonTypes().addAll(ButtonType.APPLY, ButtonType.CANCEL); + this.setResizable(false); + this.setTitle(Localization.lang("Edit file link")); this.setResultConverter(button -> { if (button == ButtonType.APPLY) { @@ -54,6 +58,11 @@ public LinkedFileEditDialogView(LinkedFile linkedFile) { private void initialize() { viewModel = new LinkedFilesEditDialogViewModel(linkedFile, stateManager.getActiveDatabase().get(), dialogService, preferences.getFilePreferences()); fileType.itemsProperty().bindBidirectional(viewModel.externalFileTypeProperty()); + new ViewModelListCellFactory() + .withIcon(ExternalFileType::getIcon) + .withText(ExternalFileType::getName) + .install(fileType); + description.textProperty().bindBidirectional(viewModel.descriptionProperty()); link.textProperty().bindBidirectional(viewModel.linkProperty()); fileType.valueProperty().bindBidirectional(viewModel.selectedExternalFileTypeProperty()); diff --git a/src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java b/src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java index b08c039cdbe..43561b9b5c5 100644 --- a/src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java +++ b/src/main/java/org/jabref/gui/mergeentries/newmergedialog/FieldRowView.java @@ -21,6 +21,7 @@ import org.jabref.gui.mergeentries.newmergedialog.toolbar.ThreeWayMergeToolbar; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.Field; +import org.jabref.model.strings.StringUtil; import com.tobiasdiez.easybind.EasyBind; import org.fxmisc.richtext.StyleClassedTextArea; @@ -150,7 +151,7 @@ public MergedFieldCell getMergedValueCell() { } public void showDiff(ShowDiffConfig diffConfig) { - if (!rightValueCell.isVisible()) { + if (!rightValueCell.isVisible() || StringUtil.isNullOrEmpty(viewModel.getLeftFieldValue()) || StringUtil.isNullOrEmpty(viewModel.getRightFieldValue())) { return; } LOGGER.debug("Showing diffs..."); diff --git a/src/main/java/org/jabref/logic/crawler/StudyRepository.java b/src/main/java/org/jabref/logic/crawler/StudyRepository.java index 0453642b9c8..19fdd7e4abe 100644 --- a/src/main/java/org/jabref/logic/crawler/StudyRepository.java +++ b/src/main/java/org/jabref/logic/crawler/StudyRepository.java @@ -6,7 +6,6 @@ import java.nio.charset.UnsupportedCharsetException; import java.nio.file.Files; import java.nio.file.Path; -import java.time.LocalDate; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.List; @@ -119,7 +118,7 @@ public StudyRepository(Path pathToRepository, gitHandler.createCommitOnCurrentBranch("Setup/Update Repository Structure", false); gitHandler.checkoutBranch(SEARCH_BRANCH); // If study definition does not exist on this branch or was changed on work branch, copy it from work - boolean studyDefinitionDoesNotExistOrChanged = !(Files.exists(studyDefinitionFile) && new StudyYamlParser().parseStudyYamlFile(studyDefinitionFile).equalsBesideLastSearchDate(study)); + boolean studyDefinitionDoesNotExistOrChanged = !(Files.exists(studyDefinitionFile) && new StudyYamlParser().parseStudyYamlFile(studyDefinitionFile).equals(study)); if (studyDefinitionDoesNotExistOrChanged) { new StudyYamlParser().writeStudyYamlFile(study, studyDefinitionFile); } @@ -218,15 +217,13 @@ public Study getStudy() { */ public void persist(List crawlResults) throws IOException, GitAPIException, SaveException { updateWorkAndSearchBranch(); - study.setLastSearchDate(LocalDate.now()); persistStudy(); gitHandler.createCommitOnCurrentBranch("Update search date", true); gitHandler.checkoutBranch(SEARCH_BRANCH); persistResults(crawlResults); - study.setLastSearchDate(LocalDate.now()); persistStudy(); try { - // First commit changes to search branch branch and update remote + // First commit changes to search branch and update remote String commitMessage = "Conducted search: " + LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS); boolean newSearchResults = gitHandler.createCommitOnCurrentBranch(commitMessage, false); gitHandler.checkoutBranch(WORK_BRANCH); diff --git a/src/main/java/org/jabref/model/study/Study.java b/src/main/java/org/jabref/model/study/Study.java index cc117f0160e..1c85a1d77c2 100644 --- a/src/main/java/org/jabref/model/study/Study.java +++ b/src/main/java/org/jabref/model/study/Study.java @@ -1,6 +1,5 @@ package org.jabref.model.study; -import java.time.LocalDate; import java.util.List; import java.util.Objects; @@ -12,16 +11,17 @@ * * This class defines all aspects of a scientific study relevant to the application. It is a proxy for the file based study definition. */ - -@JsonPropertyOrder({"authors", "title", "last-search-date", "research-questions", "queries", "databases"}) +@JsonPropertyOrder({"authors", "title", "research-questions", "queries", "databases"}) public class Study { private List authors; + private String title; - @JsonProperty("last-search-date") - private LocalDate lastSearchDate; + @JsonProperty("research-questions") private List researchQuestions; + private List queries; + private List databases; public Study(List authors, String title, List researchQuestions, List queryEntries, List databases) { @@ -54,14 +54,6 @@ public void setQueries(List queries) { this.queries = queries; } - public LocalDate getLastSearchDate() { - return lastSearchDate; - } - - public void setLastSearchDate(LocalDate date) { - lastSearchDate = date; - } - public List getDatabases() { return databases; } @@ -91,7 +83,6 @@ public String toString() { return "Study{" + "authors=" + authors + ", studyName='" + title + '\'' + - ", lastSearchDate=" + lastSearchDate + ", researchQuestions=" + researchQuestions + ", queries=" + queries + ", libraries=" + databases + @@ -99,57 +90,21 @@ public String toString() { } @Override - public boolean equals(Object o) { - if (this == o) { + public boolean equals(Object other) { + if (this == other) { return true; } - if (o == null || getClass() != o.getClass()) { + if (other == null || getClass() != other.getClass()) { return false; } - Study study = (Study) o; + Study otherStudy = (Study) other; - if (getAuthors() != null ? !getAuthors().equals(study.getAuthors()) : study.getAuthors() != null) { - return false; - } - if (getTitle() != null ? !getTitle().equals(study.getTitle()) : study.getTitle() != null) { - return false; - } - if (getLastSearchDate() != null ? !getLastSearchDate().equals(study.getLastSearchDate()) : study.getLastSearchDate() != null) { - return false; - } - if (getResearchQuestions() != null ? !getResearchQuestions().equals(study.getResearchQuestions()) : study.getResearchQuestions() != null) { - return false; - } - if (getQueries() != null ? !getQueries().equals(study.getQueries()) : study.getQueries() != null) { - return false; - } - return getDatabases() != null ? getDatabases().equals(study.getDatabases()) : study.getDatabases() == null; - } - - public boolean equalsBesideLastSearchDate(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Study study = (Study) o; - - if (getAuthors() != null ? !getAuthors().equals(study.getAuthors()) : study.getAuthors() != null) { - return false; - } - if (getTitle() != null ? !getTitle().equals(study.getTitle()) : study.getTitle() != null) { - return false; - } - if (getResearchQuestions() != null ? !getResearchQuestions().equals(study.getResearchQuestions()) : study.getResearchQuestions() != null) { - return false; - } - if (getQueries() != null ? !getQueries().equals(study.getQueries()) : study.getQueries() != null) { - return false; - } - return getDatabases() != null ? getDatabases().equals(study.getDatabases()) : study.getDatabases() == null; + return Objects.equals(authors, otherStudy.authors) && + Objects.equals(title, otherStudy.title) && + Objects.equals(researchQuestions, otherStudy.researchQuestions) && + Objects.equals(queries, otherStudy.queries) && + Objects.equals(databases, otherStudy.databases); } @Override diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 6b1a6822bde..141212c61fc 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2514,6 +2514,8 @@ Plain\ Text=Plain Text Show\ Diff=Show Diff Merged\ Entry=Merged Entry +Edit\ file\ link=Edit file link + (Note\:\ If\ original\ entries\ lack\ keywords\ to\ qualify\ for\ the\ new\ group\ configuration,\ confirming\ here\ will\ add\ them)=(Note: If original entries lack keywords to qualify for the new group configuration, confirming here will add them) Assign=Assign Do\ not\ assign=Do not assign diff --git a/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java b/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java index ec0911431d0..697b04958f6 100644 --- a/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java +++ b/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java @@ -4,7 +4,6 @@ import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; -import java.time.LocalDate; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -41,6 +40,7 @@ import static org.jabref.logic.citationkeypattern.CitationKeyGenerator.DEFAULT_UNWANTED_CHARACTERS; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; @@ -124,9 +124,9 @@ void repositoryStructureCorrectlyCreated() { assertTrue(Files.exists(Path.of(tempRepositoryDirectory.toString(), hashCodeQuantum + " - Quantum", "Springer.bib"))); assertTrue(Files.exists(Path.of(tempRepositoryDirectory.toString(), hashCodeCloudComputing + " - Cloud Computing", "Springer.bib"))); assertTrue(Files.exists(Path.of(tempRepositoryDirectory.toString(), hashCodeSoftwareEngineering + " - Software Engineering", "Springer.bib"))); - assertTrue(Files.notExists(Path.of(tempRepositoryDirectory.toString(), hashCodeQuantum + " - Quantum", "IEEEXplore.bib"))); - assertTrue(Files.notExists(Path.of(tempRepositoryDirectory.toString(), hashCodeCloudComputing + " - Cloud Computing", "IEEEXplore.bib"))); - assertTrue(Files.notExists(Path.of(tempRepositoryDirectory.toString(), hashCodeSoftwareEngineering + " - Software Engineering", "IEEEXplore.bib"))); + assertFalse(Files.exists(Path.of(tempRepositoryDirectory.toString(), hashCodeQuantum + " - Quantum", "IEEEXplore.bib"))); + assertFalse(Files.exists(Path.of(tempRepositoryDirectory.toString(), hashCodeCloudComputing + " - Cloud Computing", "IEEEXplore.bib"))); + assertFalse(Files.exists(Path.of(tempRepositoryDirectory.toString(), hashCodeSoftwareEngineering + " - Software Engineering", "IEEEXplore.bib"))); } /** @@ -165,21 +165,10 @@ void mergedResultsPersistedCorrectly() throws Exception { assertEquals(getSpringerCloudComputingMockResults(), getTestStudyRepository().getQueryResultEntries("Cloud Computing").getEntries()); } - @Test - void setsLastSearchDatePersistedCorrectly() throws Exception { - List mockResults = getMockResults(); - - studyRepository.persist(mockResults); - - assertEquals(LocalDate.now(), getTestStudyRepository().getStudy().getLastSearchDate()); - } - @Test void studyResultsPersistedCorrectly() throws Exception { List mockResults = getMockResults(); - studyRepository.persist(mockResults); - assertEquals(new HashSet<>(getNonDuplicateBibEntryResult().getEntries()), new HashSet<>(getTestStudyRepository().getStudyResultEntries().getEntries())); } diff --git a/src/test/java/org/jabref/logic/crawler/StudyYamlParserTest.java b/src/test/java/org/jabref/logic/crawler/StudyYamlParserTest.java index f5ab98e9c81..1b169f7f00a 100644 --- a/src/test/java/org/jabref/logic/crawler/StudyYamlParserTest.java +++ b/src/test/java/org/jabref/logic/crawler/StudyYamlParserTest.java @@ -2,7 +2,6 @@ import java.net.URL; import java.nio.file.Path; -import java.time.LocalDate; import java.util.List; import org.jabref.logic.util.io.FileUtil; @@ -35,22 +34,18 @@ void setupStudy() throws Exception { new StudyDatabase("Medline/PubMed", true), new StudyDatabase("IEEEXplore", false)); expectedStudy = new Study(authors, studyName, researchQuestions, queryEntries, libraryEntries); - expectedStudy.setLastSearchDate(LocalDate.parse("2020-11-26")); } @Test public void parseStudyFileSuccessfully() throws Exception { Study study = new StudyYamlParser().parseStudyYamlFile(testDirectory.resolve("study.yml")); - assertEquals(expectedStudy, study); } @Test public void writeStudyFileSuccessfully() throws Exception { new StudyYamlParser().writeStudyYamlFile(expectedStudy, testDirectory.resolve("study.yml")); - Study study = new StudyYamlParser().parseStudyYamlFile(testDirectory.resolve("study.yml")); - assertEquals(expectedStudy, study); } } diff --git a/src/test/resources/org/jabref/logic/crawler/study.yml b/src/test/resources/org/jabref/logic/crawler/study.yml index 3b5b45bbb66..af2ed218297 100644 --- a/src/test/resources/org/jabref/logic/crawler/study.yml +++ b/src/test/resources/org/jabref/logic/crawler/study.yml @@ -1,7 +1,6 @@ authors: - Jab Ref title: TestStudyName -last-search-date: 2020-11-26 research-questions: - Question1 - Question2