Search in sources :

Example 51 with BibDatabase

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);
}
Also used : BibDatabase(org.jabref.model.database.BibDatabase) BibDatabaseContext(org.jabref.model.database.BibDatabaseContext) Before(org.junit.Before)

Example 52 with BibDatabase

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);
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) BibDatabase(org.jabref.model.database.BibDatabase) Before(org.junit.Before)

Example 53 with BibDatabase

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());
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) Defaults(org.jabref.model.Defaults) BibDatabase(org.jabref.model.database.BibDatabase) BibDatabaseContext(org.jabref.model.database.BibDatabaseContext)

Example 54 with BibDatabase

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);
}
Also used : Abbreviation(org.jabref.logic.journals.Abbreviation) BibEntry(org.jabref.model.entry.BibEntry) Defaults(org.jabref.model.Defaults) JournalAbbreviationRepository(org.jabref.logic.journals.JournalAbbreviationRepository) BibDatabase(org.jabref.model.database.BibDatabase) BibDatabaseContext(org.jabref.model.database.BibDatabaseContext) Test(org.junit.Test)

Example 55 with BibDatabase

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));
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BibDatabase(org.jabref.model.database.BibDatabase) Test(org.junit.Test)

Aggregations

BibDatabase (org.jabref.model.database.BibDatabase)88 BibEntry (org.jabref.model.entry.BibEntry)60 Test (org.junit.Test)44 ParserResult (org.jabref.logic.importer.ParserResult)20 ArrayList (java.util.ArrayList)19 HashMap (java.util.HashMap)15 BibDatabaseContext (org.jabref.model.database.BibDatabaseContext)15 BibtexParser (org.jabref.logic.importer.fileformat.BibtexParser)13 MetaData (org.jabref.model.metadata.MetaData)12 IOException (java.io.IOException)10 Defaults (org.jabref.model.Defaults)9 Before (org.junit.Before)9 File (java.io.File)8 InputStreamReader (java.io.InputStreamReader)8 InputStream (java.io.InputStream)7 PropertyVetoException (com.sun.star.beans.PropertyVetoException)6 UnknownPropertyException (com.sun.star.beans.UnknownPropertyException)6 WrappedTargetException (com.sun.star.lang.WrappedTargetException)6 LinkedHashMap (java.util.LinkedHashMap)5 BasePanel (org.jabref.gui.BasePanel)5