Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into changemergesdialog
Browse files Browse the repository at this point in the history
* upstream/master:
  Add throttle to AutosaveUIManager (#5680)
  Do not couple search position to sidebar width (#5716)
  fix springer fetcher tests
  Bump controlsfx from 11.0.0 to 11.0.1 (#5714)
  Add CHANGELOG.md entry for Oracle
  Enable oracle tests (#5683)
  • Loading branch information
Siedlerchr committed Dec 7, 2019
2 parents abd0d5d + d0f6c2b commit ab2beef
Show file tree
Hide file tree
Showing 17 changed files with 241 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/refresh-csl-subtrees.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Refresh Citation Style Language Files

on:
schedule:
# run on 1th and 15th of each month
# run on 1st and 15th of each month
- cron: '1 2 1,15 * *'

jobs:
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/tests-oracle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Oracle Tests

on:
push:
paths:
- 'src/test/java/org/jabref/model/database/**'
- 'src/test/java/org/jabref/logic/shared/**'
- '.github/workflows/tests-oracle.yml'
- 'build.gradle'
schedule:
# run on each Wednesday
- cron: '2 3 * * 3'

jobs:
oracletests:
name: Oracle tests
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v1
with:
depth: 1
submodules: false
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 13
- uses: actions/cache@v1
name: Restore gradle chache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.OS }}-gradle-${{ env.cache-name }}-
${{ runner.OS }}-gradle-
${{ runner.OS }}-
- uses: actions/cache@v1
name: Restore gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Start Oracle XE
run: |
mkdir ~/oracle-xe || true
cd ~/oracle-xe
wget -qN https://github.com/deusaquilus/docker-oracle-xe/archive/master.zip
unzip master.zip
cd docker-oracle-xe-master
wget -qN http://ccrypt.sourceforge.net/download/1.11/ccrypt-1.11.linux-x86_64.tar.gz
wget -qN -O files/oracle-database-xe-18c-1.0-1.x86_64.rpm.cpt https://files.jabref.org/thing.cpt
pwd
tar xzf ccrypt-1.11.linux-x86_64.tar.gz
ccrypt-1.11.linux-x86_64/ccrypt -d -E CCRYPT files/oracle-database-xe-18c-1.0-1.x86_64.rpm.cpt
docker build -t oracle-xe:18c .
docker run -d -p 32118:1521 -p 35518:5500 --name=oracle-xe oracle-xe:18c
# give oracle some time to start
sleep 300
docker logs oracle-xe
# path `/opt/oracle/product/18c/dbhomeXE` is taken from the `Dockerfile` used to build "oracle-xe"
docker exec -i oracle-xe bash -c "source /home/oracle/.bashrc; /bin/bash -c '/opt/oracle/product/18c/dbhomeXE/bin/sqlplus sys/Oracle18@localhost/XE as sysdba'" < $GITHUB_WORKSPACE/buildres/setup-test-oracle.sql
env:
CCRYPT: ${{ secrets.CCRYPT }}
- name: Run database test
run: ./gradlew databaseTest --rerun-tasks
env:
DBMS: "oracle"
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
java-version: 13
- uses: actions/cache@v1
name: Restore gradle chache
name: Restore gradle cache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
if: failure()
run: |
sudo apt-get install -qq -y xml-twig-tools xsltproc
scripts/after-failure.sh
scripts/after-failure.sh
databasetests:
name: Database tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:
name: Restore gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Update test coverage metrics
run: xvfb-run --auto-servernum ./gradlew jacocoTestReport && bash <(curl -s https://codecov.io/bash);
env:
Expand Down
4 changes: 2 additions & 2 deletions .idea/runConfigurations/JabRef_Main.xml

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

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We added support to switch between biblatex and bibtex library types. [#5550](https://github.com/JabRef/jabref/issues/5550)
- We changed the save action buttons to be easier to understand. [#5565](https://github.com/JabRef/jabref/issues/5565)
- We made the columns for groups, files and uri in the main table reorderable and merged the clickable icon columns for uri, url, doi and eprint. [#5544](https://github.com/JabRef/jabref/pull/5544)
- We reduced the number of write actions performed when autosave is enabled [#5679](https://github.com/JabRef/jabref/issues/5679)

### Fixed

Expand Down Expand Up @@ -67,6 +68,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the author field was not correctly parsed during bibtex key-generation. [#5551](https://github.com/JabRef/jabref/issues/5551)
- We fixed an issue where notifications where shown during autosave. [#5555](https://github.com/JabRef/jabref/issues/5555)
- We fixed an issue where the side pane was not remembering its position. [#5615](https://github.com/JabRef/jabref/issues/5615)
- We fixed an issue where JabRef could not interact with [Oracle XE](https://www.oracle.com/de/database/technologies/appdev/xe.html) in the [shared SQL database setup](https://docs.jabref.org/collaborative-work/sqldatabase).
- We fixed an issue where the toolbar icons were hidden on smaller screens.

### Removed

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ dependencies {
compile 'org.fxmisc.richtext:richtextfx:0.10.3'
compile group: 'org.glassfish.hk2.external', name: 'jakarta.inject', version: '2.6.1'
compile 'com.jfoenix:jfoenix:9.0.9'
compile 'org.controlsfx:controlsfx:11.0.0'
compile 'org.controlsfx:controlsfx:11.0.1'

compile 'org.jsoup:jsoup:1.12.1'
compile 'com.konghq:unirest-java:3.2.00'
Expand Down
6 changes: 6 additions & 0 deletions buildres/setup-test-oracle.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
create pluggable database jabref admin user jabref identified by jabref
file_name_convert=('/opt/oracle/oradata/XE/pdbseed','/opt/oracle/oradata/XE/JABREF');
alter pluggable database jabref open read write;
alter pluggable database all save state;
ALTER SESSION SET CONTAINER = jabref;
grant all privileges to jabref container=current;
6 changes: 1 addition & 5 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,6 @@ public void changed(ObservableValue<? extends Boolean> observable, Boolean oldVa

EasyBind.subscribe(sidePane.visibleProperty(), visible -> {
if (visible) {
// Run SplitPane.setResizableWithParent later to avoid miscalculation during initial layouting
Platform.runLater(() -> SplitPane.setResizableWithParent(sidePane, Boolean.FALSE));
if (!splitPane.getItems().contains(sidePane)) {
splitPane.getItems().add(0, sidePane);
setDividerPosition();
Expand Down Expand Up @@ -452,6 +450,7 @@ private void setDividerPosition() {

private Node createToolbar() {
Pane leftSpacer = new Pane();
leftSpacer.setMinWidth(50);
HBox.setHgrow(leftSpacer, Priority.SOMETIMES);
Pane rightSpacer = new Pane();
HBox.setHgrow(rightSpacer, Priority.SOMETIMES);
Expand All @@ -471,9 +470,6 @@ private Node createToolbar() {
factory.createIconButton(StandardActions.SAVE_LIBRARY, new OldDatabaseCommandWrapper(Actions.SAVE, this, stateManager)),
leftSpacer
);
leftSide.setMinWidth(100);
leftSide.prefWidthProperty().bind(sidePane.widthProperty());
leftSide.maxWidthProperty().bind(sidePane.widthProperty());

final PushToApplicationAction pushToApplicationAction = getPushToApplicationsManager().getPushToApplicationAction();
final Button pushToApplicationButton = factory.createIconButton(pushToApplicationAction.getActionInformation(), pushToApplicationAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.jabref.model.database.BibDatabaseContext;
Expand All @@ -21,38 +19,40 @@

/**
* Saves the given {@link BibDatabaseContext} on every {@link BibDatabaseContextChangedEvent} by posting a new {@link AutosaveEvent}.
* An intelligent {@link ExecutorService} with a {@link BlockingQueue} prevents a high load while saving and rejects all redundant save tasks.
* An intelligent {@link ScheduledThreadPoolExecutor} prevents a high load while saving and rejects all redundant save tasks.
* The scheduled action is stored and canceled if a newer save action is proposed.
*/
public class AutosaveManager {

private static final Logger LOGGER = LoggerFactory.getLogger(AutosaveManager.class);
private static final int AUTO_SAVE_DELAY = 200;

private static Set<AutosaveManager> runningInstances = new HashSet<>();

private final BibDatabaseContext bibDatabaseContext;
private final BlockingQueue<Runnable> workerQueue;
private final ExecutorService executor;
private final ScheduledExecutorService executor;
private final EventBus eventBus;
private final CoarseChangeFilter changeFilter;
private Future<?> scheduledSaveAction;

private AutosaveManager(BibDatabaseContext bibDatabaseContext) {
this.bibDatabaseContext = bibDatabaseContext;
this.workerQueue = new ArrayBlockingQueue<>(1);
this.executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, workerQueue);
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
executor.setRemoveOnCancelPolicy(true); // This prevents memory leaks
this.executor = executor;
this.eventBus = new EventBus();
this.changeFilter = new CoarseChangeFilter(bibDatabaseContext);
changeFilter.registerListener(this);
}

@Subscribe
public synchronized void listen(@SuppressWarnings("unused") BibDatabaseContextChangedEvent event) {
try {
executor.submit(() -> {
eventBus.post(new AutosaveEvent());
});
} catch (RejectedExecutionException e) {
LOGGER.debug("Rejecting autosave while another save process is already running.");
if (scheduledSaveAction != null) {
scheduledSaveAction.cancel(false);
}
scheduledSaveAction = executor.schedule(() -> {
eventBus.post(new AutosaveEvent());
}, AUTO_SAVE_DELAY, TimeUnit.MILLISECONDS);
}

private void shutdown() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class SpringerFetcher implements SearchBasedParserFetcher {
private static final Logger LOGGER = LoggerFactory.getLogger(SpringerFetcher.class);

private static final String API_URL = "http://api.springernature.com/meta/v1/json?q=";
private static final String API_KEY = "b0c7151179b3d9c1119cf325bca8460d";
private static final String API_KEY = "a98b4a55181ffcd27259bea45edad12e";

/**
* Convert a JSONObject obtained from http://api.springer.com/metadata/json to a BibEntry
Expand Down
Loading

0 comments on commit ab2beef

Please sign in to comment.