use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class DBMSSynchronizerTest method setUp.
@Before
public void setUp() throws SQLException, DatabaseNotSupportedException, InvalidDBMSConnectionPropertiesException {
dbmsConnection = TestConnector.getTestDBMSConnection(dbmsType);
bibDatabase = new BibDatabase();
BibDatabaseContext context = new BibDatabaseContext(bibDatabase);
pattern = GlobalBibtexKeyPattern.fromPattern("[auth][year]");
dbmsSynchronizer = new DBMSSynchronizer(context, ',', pattern);
dbmsProcessor = DBMSProcessor.getProcessorInstance(dbmsConnection);
bibDatabase.registerListener(dbmsSynchronizer);
dbmsSynchronizer.openSharedDatabase(dbmsConnection);
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class EntryLinkCheckerTest method setUp.
@Before
public void setUp() {
database = new BibDatabase();
checker = new EntryLinkChecker(database);
entry = new BibEntry();
database.insertEntry(entry);
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class IntegrityCheckTest method createContext.
private BibDatabaseContext createContext(String field, String value, String type) {
BibEntry entry = new BibEntry();
entry.setField(field, value);
entry.setType(type);
BibDatabase bibDatabase = new BibDatabase();
bibDatabase.insertEntry(entry);
return new BibDatabaseContext(bibDatabase, new Defaults());
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class IntegrityCheckTest method testEntryIsUnchangedAfterChecks.
@Test
public void testEntryIsUnchangedAfterChecks() {
BibEntry entry = new BibEntry();
// populate with all known fields
for (String fieldName : InternalBibtexFields.getAllPublicAndInternalFieldNames()) {
entry.setField(fieldName, UUID.randomUUID().toString());
}
// add a random field
entry.setField(UUID.randomUUID().toString(), UUID.randomUUID().toString());
// duplicate entry
BibEntry clonedEntry = (BibEntry) entry.clone();
BibDatabase bibDatabase = new BibDatabase();
bibDatabase.insertEntry(entry);
BibDatabaseContext context = new BibDatabaseContext(bibDatabase, new Defaults());
new IntegrityCheck(context, mock(FileDirectoryPreferences.class), createBibtexKeyPatternPreferences(), new JournalAbbreviationRepository(new Abbreviation("IEEE Software", "IEEE SW"))).checkBibtexDatabase();
assertEquals(clonedEntry, entry);
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class OOBibStyleTest method testEmptyStringPropertyAndOxfordComma.
@Test
public void testEmptyStringPropertyAndOxfordComma() throws URISyntaxException, IOException {
OOBibStyle style = new OOBibStyle("test.jstyle", layoutFormatterPreferences);
Map<BibEntry, BibDatabase> entryDBMap = new HashMap<>();
List<BibEntry> entries = new ArrayList<>();
BibDatabase database = new BibDatabase();
BibEntry entry = new BibEntry();
entry.setType("article");
entry.setField("author", "Alpha von Beta and Gamma Epsilon and Ypsilon Tau");
entry.setField("title", "JabRef Manual");
entry.setField("year", "2016");
database.insertEntry(entry);
entries.add(entry);
entryDBMap.put(entry, database);
assertEquals("von Beta, Epsilon, & Tau, 2016", style.getCitationMarker(entries, entryDBMap, true, null, null));
}
Aggregations