-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Create groups where paper from - SLR #15429
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
Open
LoayTarek5
wants to merge
15
commits into
JabRef:main
Choose a base branch
from
LoayTarek5:create-groups-where-paper-from-SLR-12542
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
18deaad
Add automatic source groups for SLR results
LoayTarek5 dd3d0ea
Accept a keyword separator for merging entries
LoayTarek5 7f5127d
Add keyword separator support
LoayTarek5 241025b
Update entry merging by adding keyword separator support for group fi…
LoayTarek5 836dcec
Implement automatic merging of source groups in three-way merge for e…
LoayTarek5 258efc8
Add unit tests for MergeEntriesHelper to validate group merging
LoayTarek5 900f9e5
Support grouping of fetched entries by fetcher name
LoayTarek5 ea9a62e
Add unit tests to verify group creation in fetched results
LoayTarek5 e05949f
Remove the auto-merge block from constructor
LoayTarek5 4db6489
Use exact assertion for group union-merge test
LoayTarek5 f88bff2
Use withField instead of setField in test helpers
LoayTarek5 5a391fb
Union-merge groups field when dropping duplicate entries during datab…
LoayTarek5 0f28dc8
Tag SLR entries with source fetcher group and add group metadata
LoayTarek5 3376852
Add tests for groups field union-merge on duplicate entries
LoayTarek5 b2ad00a
Add tests for fetcher group creation and fix keyword separator mock
LoayTarek5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
jabgui/src/test/java/org/jabref/gui/mergeentries/MergeEntriesHelperTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| package org.jabref.gui.mergeentries; | ||
|
|
||
| import org.jabref.gui.undo.NamedCompoundEdit; | ||
| import org.jabref.model.entry.BibEntry; | ||
| import org.jabref.model.entry.field.StandardField; | ||
| import org.jabref.model.entry.types.StandardEntryType; | ||
|
|
||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
|
||
| class MergeEntriesHelperTest { | ||
|
|
||
| private static final char KEYWORD_SEPARATOR = ','; | ||
|
|
||
| private NamedCompoundEdit compoundEdit; | ||
|
|
||
| @BeforeEach | ||
| void setup() { | ||
| compoundEdit = new NamedCompoundEdit("test"); | ||
| } | ||
|
|
||
| @Test | ||
| void groupsFieldIsNotRemovedWhenFetcherHasNoGroups() { | ||
| BibEntry entryFromFetcher = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title"); | ||
| BibEntry entryFromLibrary = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title") | ||
| .withField(StandardField.GROUPS, "IEEE"); | ||
|
|
||
| MergeEntriesHelper.mergeEntries(entryFromFetcher, entryFromLibrary, compoundEdit, KEYWORD_SEPARATOR); | ||
|
|
||
| assertEquals("IEEE", entryFromLibrary.getField(StandardField.GROUPS).orElse("")); | ||
| } | ||
|
|
||
| @Test | ||
| void groupsAreUnionMergedWhenBothEntriesHaveGroups() { | ||
| BibEntry entryFromFetcher = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title") | ||
| .withField(StandardField.GROUPS, "Springer"); | ||
| BibEntry entryFromLibrary = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title") | ||
| .withField(StandardField.GROUPS, "IEEE"); | ||
|
|
||
| MergeEntriesHelper.mergeEntries(entryFromFetcher, entryFromLibrary, compoundEdit, KEYWORD_SEPARATOR); | ||
|
|
||
| String groups = entryFromLibrary.getField(StandardField.GROUPS).orElse(""); | ||
| assertEquals("IEEE, Springer", entryFromLibrary.getField(StandardField.GROUPS).orElse("")); | ||
| } | ||
|
|
||
| @Test | ||
| void groupsAreNotDuplicatedOnRepeatedMerge() { | ||
| BibEntry entryFromFetcher = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title") | ||
| .withField(StandardField.GROUPS, "IEEE"); | ||
| BibEntry entryFromLibrary = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title") | ||
| .withField(StandardField.GROUPS, "IEEE"); | ||
|
|
||
| MergeEntriesHelper.mergeEntries(entryFromFetcher, entryFromLibrary, compoundEdit, KEYWORD_SEPARATOR); | ||
|
|
||
| assertEquals("IEEE", entryFromLibrary.getField(StandardField.GROUPS).orElse("")); | ||
| } | ||
|
|
||
| @Test | ||
| void groupsFromFetcherAreAddedWhenLibraryHasNoGroups() { | ||
| BibEntry entryFromFetcher = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title") | ||
| .withField(StandardField.GROUPS, "Springer"); | ||
| BibEntry entryFromLibrary = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title"); | ||
|
|
||
| MergeEntriesHelper.mergeEntries(entryFromFetcher, entryFromLibrary, compoundEdit, KEYWORD_SEPARATOR); | ||
|
|
||
| assertEquals("Springer", entryFromLibrary.getField(StandardField.GROUPS).orElse("")); | ||
| } | ||
|
|
||
| @Test | ||
| void regularObsoleteFieldIsRemovedWhenNotInFetcher() { | ||
| BibEntry entryFromFetcher = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title"); | ||
| BibEntry entryFromLibrary = new BibEntry(StandardEntryType.Article) | ||
| .withField(StandardField.TITLE, "Some Title") | ||
| .withField(StandardField.NOTE, "Obsolete note"); | ||
|
|
||
| MergeEntriesHelper.mergeEntries(entryFromFetcher, entryFromLibrary, compoundEdit, KEYWORD_SEPARATOR); | ||
|
|
||
| assertFalse(entryFromLibrary.hasField(StandardField.NOTE)); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.