Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into multiline
Browse files Browse the repository at this point in the history
* upstream/master:
  Update label names
  Squashed 'src/main/resources/csl-locales/' changes from d0ee4d13c9..79845b087b
  Squashed 'src/main/resources/csl-styles/' changes from c1793d2..143464e
  Cite work by @ayaankazerouni
  Improve performance for loading files (#6332)
  Add ADR von JUnit vs. AssertJ (#6335)
  'Name' textfield on focus instead of 'OK' button when user clicks on 'Add subgroup' option (#6330)
  Bump jurt from 6.3.2 to 6.4.3 (#6325)
  Bump unoil from 6.3.2 to 6.4.3 (#6320)
  Bump ridl from 6.3.2 to 6.4.3 (#6326)
  Bump classgraph from 4.8.69 to 4.8.71 (#6322)
  Bump flexmark from 0.61.6 to 0.61.16 (#6318)
  Bump richtextfx from 0.10.4 to 0.10.5 (#6319)
  Bump guava from 28.2-jre to 29.0-jre (#6323)
  Bump flexmark-ext-gfm-tasklist from 0.61.6 to 0.61.16 (#6327)
  Bump org.beryx.jlink from 2.17.5 to 2.17.7 (#6324)
  Improve performance massively by fixing a stupid binding mistake (#6316)
  Fixed missing paste command (#6313)
  Remove cache of auto completion results (#6310)
  • Loading branch information
Siedlerchr committed Apr 24, 2020
2 parents 0b39116 + bbea7df commit 4dab523
Show file tree
Hide file tree
Showing 119 changed files with 1,472 additions and 1,242 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue will be closed in 7 days due to inactivity :zzz: Please provide the requested information if the problem persists.'
stale-issue-label: 's: stale'
stale-issue-label: 'status: stale'
days-before-stale: 30
only-labels: 's: waiting-for-customer-feedback'
only-labels: 'status: waiting-for-customer-feedback'
1 change: 1 addition & 0 deletions .idea/runConfigurations/JabRef_Main.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where custom jstyles for Open/LibreOffice where not saved correctly. [#6170](https://github.com/JabRef/jabref/issues/6170)
- We fixed an issue where the INSPIRE fetcher was no longer working [#6229](https://github.com/JabRef/jabref/issues/6229)
- We fixed the display of icon both in the main table and linked file editor. [#6169](https://github.com/JabRef/jabref/issues/6169)
- We fixed the paste entry command in the menu and toolbar, that did not do anything. [#6293](https://github.com/JabRef/jabref/issues/6293)
- We fixed an issue where the windows installer did not create an entry in the start menu [bug report in the forum](https://discourse.jabref.org/t/error-while-fetching-from-doi/2018/3)

### Removed
Expand Down Expand Up @@ -245,6 +246,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We added a 'LaTeX citations' tab to the entry editor, to search for citations to the active entry in the LaTeX file directory. It can be disabled in the preferences dialog.
- We added an option in preferences to allow for integers in field "edition" when running database in bibtex mode. [#4680](https://github.com/JabRef/jabref/issues/4680)
- We added the ability to use negation in export filter layouts. [#5138](https://github.com/JabRef/jabref/pull/5138)
- Focus on Name Area instead of 'OK' button whenever user presses 'Add subgroup'. [#6307](https://github.com/JabRef/jabref/issues/6307)

### Fixed

Expand Down
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {
id 'com.github.ben-manes.versions' version '0.28.0'
id 'org.javamodularity.moduleplugin' version '1.5.0'
id 'org.openjfx.javafxplugin' version '0.0.8'
id 'org.beryx.jlink' version '2.17.5'
id 'org.beryx.jlink' version '2.17.7'

// nicer test outputs during running and completion
id 'com.adarshr.test-logger' version '2.0.0'
Expand Down Expand Up @@ -128,10 +128,10 @@ dependencies {
// See https://bugs.documentfoundation.org/show_bug.cgi?id=117331#c8 for background information
// Use the task bundleLibreOffice to update the bundled jar
// DO NOT CHANGE THE libreoffice PREFIX
libreoffice 'org.libreoffice:juh:6.3.2'
libreoffice 'org.libreoffice:jurt:6.3.2'
libreoffice 'org.libreoffice:ridl:6.3.2'
libreoffice 'org.libreoffice:unoil:6.3.2'
libreoffice 'org.libreoffice:juh:6.4.3'
libreoffice 'org.libreoffice:jurt:6.4.3'
libreoffice 'org.libreoffice:ridl:6.4.3'
libreoffice 'org.libreoffice:unoil:6.4.3'

implementation 'io.github.java-diff-utils:java-diff-utils:4.5'
implementation 'info.debatty:java-string-similarity:1.2.1'
Expand All @@ -151,7 +151,7 @@ dependencies {
exclude module: 'oraclepki'
}

implementation ('com.google.guava:guava:28.2-jre') {
implementation ('com.google.guava:guava:29.0-jre') {
// TODO: Remove this as soon as https://github.com/google/guava/issues/2960 is fixed
exclude module: "jsr305"
}
Expand All @@ -165,7 +165,7 @@ dependencies {
implementation 'de.saxsys:mvvmfx:1.8.0'
implementation 'org.fxmisc.easybind:easybind:1.0.3'
implementation 'org.fxmisc.flowless:flowless:0.6.1'
implementation 'org.fxmisc.richtext:richtextfx:0.10.4'
implementation 'org.fxmisc.richtext:richtextfx:0.10.5'
implementation group: 'org.glassfish.hk2.external', name: 'jakarta.inject', version: '2.6.1'
implementation 'com.jfoenix:jfoenix:9.0.9'
implementation 'org.controlsfx:controlsfx:11.0.1'
Expand Down Expand Up @@ -196,11 +196,11 @@ dependencies {
exclude module: "log4j-core"
}

implementation 'com.vladsch.flexmark:flexmark:0.61.6'
implementation 'com.vladsch.flexmark:flexmark:0.61.16'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.61.6'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.61.6'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.61.16'

testImplementation 'io.github.classgraph:classgraph:4.8.69'
testImplementation 'io.github.classgraph:classgraph:4.8.71'
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.6.2'
testImplementation 'org.junit.platform:junit-platform-launcher:1.6.2'
Expand Down
83 changes: 83 additions & 0 deletions docs/adr/0009-use-plain-junit5-for-testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Use Plain JUnit5 for advanced test assertions

## Context and Problem Statement

How to write readable test assertions?
How to write readable test assertions for advanced tests?

## Considered Options

* Plain JUnit5
* Hamcrest
* AssertJ

## Decision Outcome

Chosen option: "Plain JUnit5", because comes out best \(see below\).

### Positive Consequences

* Tests are more readable
* More easy to write tests
* More readable assertions

### Negative Consequences

* More complicated testing leads to more complicated assertions

## Pros and Cons of the Options

### Plain JUnit5

Homepage: <https://junit.org/junit5/docs/current/user-guide/>
JabRef testing guidelines: <https://devdocs.jabref.org/getting-into-the-code/code-howtos#test-cases>

Example:

```java
String actual = markdownFormatter.format(source);
assertTrue(actual.contains("Markup<br />"));
assertTrue(actual.contains("<li>list item one</li>"));
assertTrue(actual.contains("<li>list item 2</li>"));
assertTrue(actual.contains("> rest"));
assertFalse(actual.contains("\n"));
```

* Good, because Junit5 is "common Java knowledge"
* Bad, because complex assertions tend to get hard to read
* Bad, because no fluent API

### Hamcrest

Homepage: <http://hamcrest.org/JavaHamcrest/>

* Good, because offers advanced matchers (such as `contains`)
* Bad, because not full fluent API
* Bad, because entry barrier is increased

### AssertJ

Homepage: <https://joel-costigliola.github.io/assertj/>

Example:

```java
assertThat(markdownFormatter.format(source))
.contains("Markup<br />")
.contains("<li>list item one</li>")
.contains("<li>list item 2</li>")
.contains("> rest")
.doesNotContain("\n");
```

* Good, because offers fluent assertions
* Good, because allows partial string testing to focus on important parts
* Good, because assertions are more readable
* Bad, because not commonly used
* Bad, because newcomers have to learn an additional language to express test cases
* Bad, because entry barrier is increased
* Bad, because expressions of test cases vary from unit test to unit test

## Links

* German comparison between Hamcrest and AssertJ: <https://www.sigs-datacom.de/uploads/tx_dmjournals/philipp_JS_06_15_gRfN.pdf>
9 changes: 9 additions & 0 deletions docs/teaching.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ Course [Open Source Software](https://github.com/igorsteinmacher/DSL-UTFPR)
- Summary: Students are requested to contribute to an Open Source project to learn about the maintenance and evolution of software projects. This project is the predecessor of NAU's CS499.
- Course offered from 2013 to 2016 with different names

## Interesting Read for Students and Advisors

- [Developing Procrastination Feedback for Student Software Developers](https://medium.com/@ayaankazerouni/developing-procrastination-feedback-for-student-software-developers-1652de60db7f) by [@ayaankazerouni](https://github.com/ayaankazerouni?tab=overview&from=2015-12-01&to=2015-12-31)
> When students worked earlier and more often, they produced projects that:
>
> - were more correct,
> - were completed earlier,
> - took no more or less time to complete
## References

<a id="LientzSwanson" href="#a1">1</a>: Lientz B., Swanson E., 1980: Software Maintenance Management. Addison Wesley, Reading, MA.
Expand Down
47 changes: 3 additions & 44 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
import javafx.scene.layout.StackPane;

import org.jabref.Globals;
import org.jabref.JabRefExecutorService;
import org.jabref.gui.autocompleter.AutoCompletePreferences;
import org.jabref.gui.autocompleter.AutoCompleteUpdater;
import org.jabref.gui.autocompleter.PersonNameSuggestionProvider;
import org.jabref.gui.autocompleter.SuggestionProviders;
import org.jabref.gui.collab.DatabaseChangeMonitor;
Expand All @@ -40,9 +38,7 @@
import org.jabref.model.FieldChange;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.database.KeyCollisionException;
import org.jabref.model.database.event.BibDatabaseContextChangedEvent;
import org.jabref.model.database.event.CoarseChangeFilter;
import org.jabref.model.database.event.EntriesAddedEvent;
import org.jabref.model.database.event.EntriesRemovedEvent;
import org.jabref.model.database.shared.DatabaseLocation;
Expand Down Expand Up @@ -93,12 +89,10 @@ public class BasePanel extends StackPane {
// the query the user searches when this BasePanel is active
private Optional<SearchQuery> currentSearchQuery = Optional.empty();
private Optional<DatabaseChangeMonitor> changeMonitor = Optional.empty();
private JabRefExecutorService executorService;

public BasePanel(JabRefFrame frame, BasePanelPreferences preferences, BibDatabaseContext bibDatabaseContext, ExternalFileTypes externalFileTypes) {
this.preferences = Objects.requireNonNull(preferences);
this.frame = Objects.requireNonNull(frame);
this.executorService = JabRefExecutorService.INSTANCE;
this.bibDatabaseContext = Objects.requireNonNull(bibDatabaseContext);
this.externalFileTypes = Objects.requireNonNull(externalFileTypes);
this.undoManager = frame.getUndoManager();
Expand All @@ -114,6 +108,7 @@ public BasePanel(JabRefFrame frame, BasePanelPreferences preferences, BibDatabas
annotationCache = new FileAnnotationCache(bibDatabaseContext, Globals.prefs.getFilePreferences());

setupMainPanel();
setupAutoCompletion();

this.getDatabase().registerListener(new SearchListener());
this.getDatabase().registerListener(new EntriesRemovedListener());
Expand Down Expand Up @@ -257,7 +252,6 @@ public void insertEntry(final BibEntry bibEntry) {

public void insertEntries(final List<BibEntry> entries) {
if (!entries.isEmpty()) {
try {
bibDatabaseContext.getDatabase().insertEntries(entries);

// Set owner and timestamp
Expand All @@ -276,9 +270,6 @@ public void insertEntries(final List<BibEntry> entries) {
showAndEdit(entries.get(0));
}
clearAndSelect(entries.get(0));
} catch (KeyCollisionException ex) {
LOGGER.info("Collision for bibtex key" + ex.getId(), ex);
}
}
}

Expand Down Expand Up @@ -379,11 +370,6 @@ public void setupMainPanel() {

splitPane.getItems().add(mainTable);

// Set up name autocompleter for search:
setupAutoCompletion();
executorService.execute(this::instantiateSearchAutoCompleter);
this.getDatabase().registerListener(new SearchAutoCompleteListener());

// Saves the divider position as soon as it changes
// We need to keep a reference to the subscription, otherwise the binding gets garbage collected
dividerPositionSubscription = EasyBind.monadic(Bindings.valueAt(splitPane.getDividers(), 0))
Expand Down Expand Up @@ -413,28 +399,18 @@ public void setupMainPanel() {
private void setupAutoCompletion() {
AutoCompletePreferences autoCompletePreferences = preferences.getAutoCompletePreferences();
if (autoCompletePreferences.shouldAutoComplete()) {
suggestionProviders = new SuggestionProviders(autoCompletePreferences, Globals.journalAbbreviationLoader);
suggestionProviders.indexDatabase(getDatabase());
// Ensure that the suggestion providers are in sync with entries
CoarseChangeFilter changeFilter = new CoarseChangeFilter(bibDatabaseContext);
changeFilter.registerListener(new AutoCompleteUpdater(suggestionProviders));
suggestionProviders = new SuggestionProviders(getDatabase(), autoCompletePreferences, Globals.journalAbbreviationLoader);
} else {
// Create empty suggestion providers if auto completion is deactivated
suggestionProviders = new SuggestionProviders();
}
searchAutoCompleter = new PersonNameSuggestionProvider(FieldFactory.getPersonNameFields(), getDatabase());
}

public void updateSearchManager() {
frame.getGlobalSearchBar().setAutoCompleter(searchAutoCompleter);
}

private void instantiateSearchAutoCompleter() {
searchAutoCompleter = new PersonNameSuggestionProvider(FieldFactory.getPersonNameFields());
for (BibEntry entry : bibDatabaseContext.getDatabase().getEntries()) {
searchAutoCompleter.indexEntry(entry);
}
}

private void adjustSplitter() {
if (mode == BasePanelMode.SHOWING_EDITOR) {
splitPane.setDividerPositions(preferences.getEntryEditorDividerPosition());
Expand Down Expand Up @@ -730,23 +706,6 @@ public void listen(EntriesRemovedEvent entriesRemovedEvent) {
}
}

/**
* Ensures that the search auto completer is up to date when entries are changed AKA Let the auto completer, if any,
* harvest words from the entry Actual methods for autocomplete indexing must run in javafx thread
*/
private class SearchAutoCompleteListener {

@Subscribe
public void listen(EntriesAddedEvent addedEntriesEvent) {
DefaultTaskExecutor.runInJavaFXThread(() -> addedEntriesEvent.getBibEntries().forEach(entry -> searchAutoCompleter.indexEntry(entry)));
}

@Subscribe
public void listen(EntryChangedEvent entryChangedEvent) {
DefaultTaskExecutor.runInJavaFXThread(() -> searchAutoCompleter.indexEntry(entryChangedEvent.getBibEntry()));
}
}

/**
* Ensures that the results of the current search are updated when a new entry is inserted into the database Actual
* methods for performing search must run in javafx thread
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4dab523

Please sign in to comment.