use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.
the class IntegrityCheckTest method testBibtexkeyChecks.
@Test
public void testBibtexkeyChecks() {
final BibDatabaseContext correctContext = createContext("bibtexkey", "Knuth2014");
correctContext.getDatabase().getEntries().get(0).setField("author", "Knuth");
correctContext.getDatabase().getEntries().get(0).setField("year", "2014");
assertCorrect(correctContext);
final BibDatabaseContext wrongContext = createContext("bibtexkey", "Knuth2014a");
wrongContext.getDatabase().getEntries().get(0).setField("author", "Knuth");
wrongContext.getDatabase().getEntries().get(0).setField("year", "2014");
assertWrong(wrongContext);
}
use of org.jabref.model.database.BibDatabaseContext 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.database.BibDatabaseContext 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.database.BibDatabaseContext in project jabref by JabRef.
the class GroupNodeViewModelTest method setUp.
@Before
public void setUp() throws Exception {
stateManager = mock(StateManager.class);
when(stateManager.getSelectedEntries()).thenReturn(FXCollections.emptyObservableList());
databaseContext = new BibDatabaseContext();
taskExecutor = new CurrentThreadTaskExecutor();
viewModel = getViewModelForGroup(new WordKeywordGroup("Test group", GroupHierarchyType.INDEPENDENT, "test", "search", true, ',', false));
}
use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.
the class GroupTreeViewModelTest method setUp.
@Before
public void setUp() throws Exception {
databaseContext = new BibDatabaseContext();
stateManager = new StateManager();
stateManager.activeDatabaseProperty().setValue(Optional.of(databaseContext));
taskExecutor = new CurrentThreadTaskExecutor();
groupTree = new GroupTreeViewModel(stateManager, mock(DialogService.class), taskExecutor);
}
Aggregations