Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ jruby-9.4.14.0, jruby, ruby ]
ruby: [ jruby, ruby ]
neo4j: [ 4.4.46, 5.26.14, 2025.09.0 ]
include:
- ruby: jruby
Expand Down
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ end.spec 'neo4j-ruby-driver' do
dependency 'jar-dependencies', '>= 0.5.5'
dependency 'ruby-maven', '>= 0', :dev

spec_extras[:requirements] = ->(requirements) { requirements << 'jar org.neo4j.driver, neo4j-java-driver-all, 5.28.4' }
spec_extras[:requirements] = ->(requirements) {
requirements << 'jar org.neo4j.driver, neo4j-java-driver-all, 6.0.1'
requirements << 'jar org.neo4j.driver, neo4j-java-driver-observation-metrics, 6.0.1'
# requirements << 'jar org.neo4j.bolt, neo4j-bolt-connection-pooled, 10.1.0'
}
spec_extras[:platform] = 'java'
else
dependency 'async', ['>= 2.13', '< 2.24']
Expand Down
6 changes: 2 additions & 4 deletions jruby/neo4j/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Driver
Transaction = Java::OrgNeo4jDriverInternal::InternalTransaction

module Internal
java_import org.neo4j.driver.internal.shaded.bolt.connection.DatabaseNameUtil
java_import org.neo4j.driver.internal.shaded.bolt.connection.DatabaseName
end

module Net
Expand All @@ -37,11 +37,9 @@ module Types
end

Java::OrgNeo4jDriver::AuthTokens.singleton_class.prepend Neo4j::Driver::Ext::AuthTokens
Java::OrgNeo4jDriver::Bookmark.singleton_class.prepend Neo4j::Driver::Ext::Bookmark::ClassMethods
Java::OrgNeo4jDriver::GraphDatabase.singleton_class.prepend Neo4j::Driver::Ext::GraphDatabase
Java::OrgNeo4jDriver::Query.prepend Neo4j::Driver::Ext::Query
Java::OrgNeo4jDriverInternal::EagerResultValue.prepend Neo4j::Driver::Ext::Internal::EagerResultValue
Java::OrgNeo4jDriverInternal::InternalBookmark.prepend Neo4j::Driver::Ext::Internal::InternalBookmark
Java::OrgNeo4jDriverInternal::InternalDriver.prepend Neo4j::Driver::Ext::InternalDriver
Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::InternalEntity
Java::OrgNeo4jDriverInternal::InternalNode.prepend Neo4j::Driver::Ext::InternalNode
Expand All @@ -57,7 +55,7 @@ module Types
Java::OrgNeo4jDriverInternalAsync::InternalAsyncSession.prepend Neo4j::Driver::Ext::Internal::Async::InternalAsyncSession
Java::OrgNeo4jDriverInternalShadedBoltConnectionRoutedImplCluster::RoutingTableRegistryImpl.include Neo4j::Driver::Ext::Internal::Cluster::RoutingTableRegistryImpl
# Java::OrgNeo4jDriverInternalCursor::DisposableAsyncResultCursor.prepend Neo4j::Driver::Ext::Internal::Cursor::DisposableAsyncResultCursor
Java::OrgNeo4jDriverInternalMetrics::InternalConnectionPoolMetrics.include Neo4j::Driver::Ext::Internal::Metrics::InternalConnectionPoolMetrics
Java::OrgNeo4jDriverObservationMetricsInternal::InternalConnectionPoolMetrics.include Neo4j::Driver::Ext::Internal::Metrics::InternalConnectionPoolMetrics
Java::OrgNeo4jDriverInternalSummary::InternalNotification.prepend Neo4j::Driver::Ext::Internal::Summary::InternalNotification
Java::OrgNeo4jDriverInternalSummary::InternalPlan.prepend Neo4j::Driver::Ext::Internal::Summary::InternalPlan
Java::OrgNeo4jDriverInternalSummary::InternalResultSummary.prepend Neo4j::Driver::Ext::Internal::Summary::InternalResultSummary
Expand Down
15 changes: 0 additions & 15 deletions jruby/neo4j/driver/ext/bookmark.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Internal
module Cluster
module RoutingTableRegistryImpl
def routing_table_handler(database)
get_routing_table_handler(org.neo4j.driver.internal.bolt.api.DatabaseNameUtil.database(database)).then do |it|
get_routing_table_handler(org.neo4j.driver.internal.bolt.api.DatabaseName.database(database)).then do |it|
it.get if it.present?
end
end
Expand Down
13 changes: 0 additions & 13 deletions jruby/neo4j/driver/ext/internal/internal_bookmark.rb

This file was deleted.

14 changes: 7 additions & 7 deletions jruby/neo4j/driver/ext/internal_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ module InternalSession
# work around jruby issue https://github.com/jruby/jruby/issues/5603
Struct.new('Wrapper', :object)

# implementation of read_transaction, write_transaction, execute_read, execute_write
%i[read write].each do |mode|
["#{mode}_transaction", "execute_#{mode}"].each do |method_name|
define_method(method_name) do |**config, &block|
Driver::Internal::Deprecator.log_warning(method_name, "execute_#{mode}".to_sym, '6.0') if method_name.include? 'transaction'
check do
super(->(tx) { Struct::Wrapper.new(reverse_check { block.call(tx) }) }, to_java_config(Neo4j::Driver::TransactionConfig, **config)).object
end
define_method("execute_#{mode}") do |**config, &block|
check do
super(->(tx) { Struct::Wrapper.new(reverse_check { block.call(tx) }) }, to_java_config(Neo4j::Driver::TransactionConfig, **config)).object
end
end
end
Expand All @@ -38,6 +34,10 @@ def run(statement, parameters = {}, config = {})
def begin_transaction(**config)
check { super(to_java_config(Neo4j::Driver::TransactionConfig, **config)) }
end

def last_bookmarks
super.to_set
end
end
end
end
Expand Down
34 changes: 17 additions & 17 deletions spec/integration/bookmark_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ def create_node_in_tx(session)
end

def preamble(session)
expect(session.last_bookmark).not_to be_present
expect(session.last_bookmarks).not_to be_present
create_and_expect(session)
end

def create_and_expect(session)
create_node_in_tx(session)
bookmark = session.last_bookmark
expect(bookmark).to be_present
bookmark
session.last_bookmarks.tap do |bookmarks|
expect(bookmarks).to be_present
end
end

def expect_single_value(bookmark, value)
Expand All @@ -27,49 +27,49 @@ def expect_single_value(bookmark, value)

it 'raises for invalid bookmark' do
invalid_bookmark = Neo4j::Driver::Bookmark.from('hi, this is an invalid bookmark')
expect { driver.session(bookmarks: invalid_bookmark, &:begin_transaction) }
expect { driver.session(bookmarks: Set[invalid_bookmark], &:begin_transaction) }
.to raise_error Neo4j::Driver::Exceptions::ClientException
end

it 'remain after rollback tx' do
driver.session do |session|
bookmark = preamble(session)
bookmarks = preamble(session)
session.begin_transaction do |tx|
tx.run('CREATE (a:Person)')
tx.rollback
end
expect(session.last_bookmark).to eq bookmark
expect(session.last_bookmarks).to eq bookmarks
end
end

it 'remains after tx failure' do
driver.session do |session|
bookmark = preamble(session)
bookmarks = preamble(session)
tx = session.begin_transaction
expect { tx.run('RETURN') }.to raise_error Neo4j::Driver::Exceptions::ClientException
expect(session.last_bookmark).to eq bookmark
expect(session.last_bookmarks).to eq bookmarks
end
end

it 'remains after succesful session run' do
driver.session do |session|
bookmark = preamble(session)
bookmarks= preamble(session)
session.run('RETURN 1').consume
expect(session.last_bookmark).to eq bookmark
expect(session.last_bookmarks).to eq bookmarks
end
end

it 'remains after failed session run' do
driver.session do |session|
bookmark = preamble(session)
bookmarks = preamble(session)
expect { session.run('RETURN').consume }.to raise_error Neo4j::Driver::Exceptions::ClientException
expect(session.last_bookmark).to eq bookmark
expect(session.last_bookmarks).to eq bookmarks
end
end

it 'is updated every committed tx' do
driver.session do |session|
expect(session.last_bookmark).not_to be_present
expect(session.last_bookmarks).not_to be_present
expect(Array.new(3) { create_and_expect(session) }.to_set.size).to eq 3
end
end
Expand All @@ -87,7 +87,7 @@ def expect_single_value(bookmark, value)

it 'creates session with initial bookmark' do
bookmark = Neo4j::Driver::Bookmark.from('TheBookmark')
expect(driver.session(bookmarks: bookmark, &:last_bookmark)).to eq bookmark
expect(driver.session(bookmarks: bookmark, &:last_bookmarks)).to contain_exactly bookmark
end

it 'fails on invalid bookmark using tx func' do
Expand All @@ -102,7 +102,7 @@ def expect_single_value(bookmark, value)

it 'creates session with AccessMode and initial bookmark' do
bookmark = Neo4j::Driver::Bookmark.from('TheBookmark')
expect(driver.session(default_access_mode: Neo4j::Driver::AccessMode::WRITE, bookmarks: bookmark, &:last_bookmark))
.to eq bookmark
expect(driver.session(default_access_mode: Neo4j::Driver::AccessMode::WRITE, bookmarks: bookmark, &:last_bookmarks))
.to contain_exactly bookmark
end
end
Loading
Loading