use of org.neo4j.bolt.dbapi.CustomBookmarkFormatParser in project neo4j by neo4j.
the class BookmarksParserV4Test method shouldThrowBoltExceptionWhenCustomBookmarksParsingFails.
@Test
void shouldThrowBoltExceptionWhenCustomBookmarksParsingFails() {
var parser = new BookmarksParserV4(databaseIdRepository, new CustomBookmarkFormatParser() {
@Override
public boolean isCustomBookmark(String string) {
return true;
}
@Override
public List<Bookmark> parse(List<String> customBookmarks) {
throw new IllegalArgumentException("This bookmark is just wrong");
}
});
var metadata = metadata(List.of(""));
var error = assertThrows(BookmarkParsingException.class, () -> parser.parseBookmarks(metadata));
assertThat(error.status()).isEqualTo(InvalidBookmark);
assertTrue(error.causesFailureMessage());
assertThat(error.getMessage()).contains("Parsing of supplied bookmarks failed with message: This bookmark is just wrong");
}
use of org.neo4j.bolt.dbapi.CustomBookmarkFormatParser in project neo4j by neo4j.
the class FabricServicesBootstrap method createBoltDatabaseManagementServiceProvider.
public BoltGraphDatabaseManagementServiceSPI createBoltDatabaseManagementServiceProvider(BoltGraphDatabaseManagementServiceSPI kernelDatabaseManagementService, DatabaseManagementService managementService, Monitors monitors, SystemNanoClock clock) {
FabricExecutor fabricExecutor = dependencies.resolveDependency(FabricExecutor.class);
TransactionManager transactionManager = dependencies.resolveDependency(TransactionManager.class);
FabricDatabaseManager fabricDatabaseManager = dependencies.resolveDependency(FabricDatabaseManager.class);
var serverConfig = dependencies.resolveDependency(Config.class);
var transactionIdTracker = new TransactionIdTracker(managementService, monitors, clock);
var databaseManager = (DatabaseManager<DatabaseContext>) dependencies.resolveDependency(DatabaseManager.class);
var databaseIdRepository = databaseManager.databaseIdRepository();
var transactionBookmarkManagerFactory = dependencies.resolveDependency(TransactionBookmarkManagerFactory.class);
var localGraphTransactionIdTracker = new LocalGraphTransactionIdTracker(transactionIdTracker, databaseIdRepository, serverConfig);
var fabricDatabaseManagementService = dependencies.satisfyDependency(new BoltFabricDatabaseManagementService(fabricExecutor, fabricConfig, transactionManager, fabricDatabaseManager, localGraphTransactionIdTracker, transactionBookmarkManagerFactory));
return new BoltGraphDatabaseManagementServiceSPI() {
@Override
public BoltGraphDatabaseServiceSPI database(String databaseName, MemoryTracker memoryTracker) throws UnavailableException, DatabaseNotFoundException {
if (fabricDatabaseManager.hasMultiGraphCapabilities(databaseName)) {
return fabricDatabaseManagementService.database(databaseName, memoryTracker);
}
return kernelDatabaseManagementService.database(databaseName, memoryTracker);
}
@Override
public Optional<CustomBookmarkFormatParser> getCustomBookmarkFormatParser() {
return fabricDatabaseManagementService.getCustomBookmarkFormatParser();
}
};
}
Aggregations