use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class BibDatabaseContextTest method testTypeBasedOnDefaultBiblatex.
@Test
public void testTypeBasedOnDefaultBiblatex() {
BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(new BibDatabase(), new MetaData(), new Defaults(BibDatabaseMode.BIBLATEX));
assertEquals(BibDatabaseMode.BIBLATEX, bibDatabaseContext.getMode());
bibDatabaseContext.setMode(BibDatabaseMode.BIBTEX);
assertEquals(BibDatabaseMode.BIBTEX, bibDatabaseContext.getMode());
}
use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class DBMSSynchronizerTest method testMetaDataChangedEventListener.
@Test
public void testMetaDataChangedEventListener() {
MetaData testMetaData = new MetaData();
testMetaData.registerListener(dbmsSynchronizer);
dbmsSynchronizer.setMetaData(testMetaData);
testMetaData.setMode(BibDatabaseMode.BIBTEX);
Map<String, String> expectedMap = MetaDataSerializer.getSerializedStringMap(testMetaData, pattern);
Map<String, String> actualMap = dbmsProcessor.getSharedMetaData();
Assert.assertEquals(expectedMap, actualMap);
}
use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class BibDatabaseContextTest method testTypeBasedOnDefaultBibtex.
@Test
public void testTypeBasedOnDefaultBibtex() {
BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(new BibDatabase(), new MetaData(), new Defaults(BibDatabaseMode.BIBTEX));
assertEquals(BibDatabaseMode.BIBTEX, bibDatabaseContext.getMode());
bibDatabaseContext.setMode(BibDatabaseMode.BIBLATEX);
assertEquals(BibDatabaseMode.BIBLATEX, bibDatabaseContext.getMode());
}
use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class DBMSSynchronizerTest method testApplyMetaData.
@Test
public void testApplyMetaData() {
BibEntry bibEntry = getBibEntryExample(1);
bibDatabase.insertEntry(bibEntry);
MetaData testMetaData = new MetaData();
testMetaData.setSaveActions(new FieldFormatterCleanups(true, Collections.singletonList(new FieldFormatterCleanup("author", new LowerCaseFormatter()))));
dbmsSynchronizer.setMetaData(testMetaData);
dbmsSynchronizer.applyMetaData();
Assert.assertEquals("wirthlin, michael j1", bibEntry.getField("author").get());
}
use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class Benchmarks method init.
@Setup
public void init() throws Exception {
Globals.prefs = JabRefPreferences.getInstance();
Random randomizer = new Random();
for (int i = 0; i < 1000; i++) {
BibEntry entry = new BibEntry();
entry.setCiteKey("id" + i);
entry.setField("title", "This is my title " + i);
entry.setField("author", "Firstname Lastname and FirstnameA LastnameA and FirstnameB LastnameB" + i);
entry.setField("journal", "Journal Title " + i);
entry.setField("keyword", "testkeyword");
entry.setField("year", "1" + i);
entry.setField("rnd", "2" + randomizer.nextInt());
database.insertEntry(entry);
}
BibtexDatabaseWriter<StringSaveSession> databaseWriter = new BibtexDatabaseWriter<>(StringSaveSession::new);
StringSaveSession saveSession = databaseWriter.savePartOfDatabase(new BibDatabaseContext(database, new MetaData(), new Defaults()), database.getEntries(), new SavePreferences());
bibtexString = saveSession.getStringValue();
latexConversionString = "{A} \\textbf{bold} approach {\\it to} ${{\\Sigma}}{\\Delta}$ modulator \\textsuperscript{2} \\$";
htmlConversionString = "<b>Österreich</b> – & characters ⪢ <i>italic</i>";
}
Aggregations