Skip to content

Commit

Permalink
add some comments for further debugging hints
Browse files Browse the repository at this point in the history
call clear in setup to ensure empty tables and no leftovers from failures
  • Loading branch information
Siedlerchr committed Oct 25, 2019
1 parent 96d65e9 commit b1ff631
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ private static Stream<Object[]> getTestingDatabaseSystems() throws InvalidDBMSCo
}

public void setUp(DBMSConnection dbmsConnection) throws Exception {

clear(dbmsConnection);

bibDatabase = new BibDatabase();
BibDatabaseContext context = new BibDatabaseContext(bibDatabase);
dbmsSynchronizer = new DBMSSynchronizer(context, ',', pattern, new DummyFileUpdateMonitor());
Expand Down Expand Up @@ -94,15 +95,17 @@ public void testFieldChangedEventListener(DBMSType dbmsType, DBMSConnection dbms
BibEntry expectedEntry = getBibEntryExample(1);
expectedEntry.registerListener(dbmsSynchronizer);

bibDatabase.insertEntry(expectedEntry);
bibDatabase.insertEntry(expectedEntry);
expectedEntry.setField(StandardField.AUTHOR, "Brad L and Gilson");

//problem is that we somehow now have an empty entry with no fields maybe due to the all entries event?
expectedEntry.setField(StandardField.TITLE, "The micro multiplexer", EntryEventSource.SHARED);

List<BibEntry> actualEntries = dbmsProcessor.getSharedEntries();
assertEquals(1, actualEntries.size());
assertEquals(expectedEntry.getField(StandardField.AUTHOR), actualEntries.get(0).getField(StandardField.AUTHOR));
assertEquals("The nano processor1", actualEntries.get(0).getField(StandardField.TITLE).get());

//somehow the field stable is not filled
clear(dbmsConnection);
}

Expand Down Expand Up @@ -137,12 +140,8 @@ public void testEntryRemovedEventListener(DBMSType dbmsType, DBMSConnection dbms
@ParameterizedTest
@MethodSource("getTestingDatabaseSystems")
public void testMetaDataChangedEventListener(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception {

bibDatabase = new BibDatabase();
BibDatabaseContext context = new BibDatabaseContext(bibDatabase);
dbmsSynchronizer = new DBMSSynchronizer(context, ',', pattern, new DummyFileUpdateMonitor());
dbmsSynchronizer.openSharedDatabase(dbmsConnection);


setUp(dbmsConnection);
MetaData testMetaData = new MetaData();
testMetaData.registerListener(dbmsSynchronizer);
dbmsSynchronizer.setMetaData(testMetaData);
Expand Down Expand Up @@ -199,7 +198,6 @@ public void testSynchronizeLocalDatabaseWithEntryRemoval(DBMSType dbmsType, DBMS
@ParameterizedTest
@MethodSource("getTestingDatabaseSystems")
public void testSynchronizeLocalDatabaseWithEntryUpdate(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception {

setUp(dbmsConnection);

BibEntry bibEntry = getBibEntryExample(1);
Expand Down

0 comments on commit b1ff631

Please sign in to comment.