use of org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern in project jabref by JabRef.
the class BibtexParserTest method integrationTestCustomKeyPattern.
@Test
public void integrationTestCustomKeyPattern() throws IOException {
ParserResult result = BibtexParser.parse(new StringReader("@comment{jabref-meta: keypattern_article:articleTest;}" + OS.NEWLINE + "@comment{jabref-meta: keypatterndefault:test;}"), importFormatPreferences);
GlobalBibtexKeyPattern pattern = mock(GlobalBibtexKeyPattern.class);
AbstractBibtexKeyPattern bibtexKeyPattern = result.getMetaData().getCiteKeyPattern(pattern);
AbstractBibtexKeyPattern expectedPattern = new DatabaseBibtexKeyPattern(pattern);
expectedPattern.setDefaultValue("test");
expectedPattern.addBibtexKeyPattern("article", "articleTest");
assertEquals(expectedPattern, bibtexKeyPattern);
}
use of org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern in project jabref by JabRef.
the class SynchronizationTestSimulator method setUp.
@Before
public void setUp() throws SQLException, DatabaseNotSupportedException, InvalidDBMSConnectionPropertiesException {
this.dbmsConnection = TestConnector.getTestDBMSConnection(dbmsType);
GlobalBibtexKeyPattern pattern = GlobalBibtexKeyPattern.fromPattern("[auth][year]");
clientContextA = new BibDatabaseContext(new Defaults(BibDatabaseMode.BIBTEX), DatabaseLocation.SHARED, ',', pattern);
clientContextA.getDBMSSynchronizer().openSharedDatabase(dbmsConnection);
clientContextB = new BibDatabaseContext(new Defaults(BibDatabaseMode.BIBTEX), DatabaseLocation.SHARED, ',', pattern);
clientContextB.getDBMSSynchronizer().openSharedDatabase(dbmsConnection);
eventListenerB = new SynchronizationTestEventListener();
clientContextB.getDBMSSynchronizer().registerListener(eventListenerB);
}
use of org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern in project jabref by JabRef.
the class PreferencesMigrations method migrateTypedKeyPrefs.
private static void migrateTypedKeyPrefs(JabRefPreferences prefs, Preferences oldPatternPrefs) throws BackingStoreException {
LOGGER.info("Found old Bibtex Key patterns which will be migrated to new version.");
GlobalBibtexKeyPattern keyPattern = GlobalBibtexKeyPattern.fromPattern(prefs.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN));
for (String key : oldPatternPrefs.keys()) {
keyPattern.addBibtexKeyPattern(key, oldPatternPrefs.get(key, null));
}
prefs.putKeyPattern(keyPattern);
}
Aggregations