diff --git a/.github/workflows/specs.yml b/.github/workflows/specs.yml index 7c7f57b8..25ed1824 100644 --- a/.github/workflows/specs.yml +++ b/.github/workflows/specs.yml @@ -17,8 +17,8 @@ jobs: strategy: fail-fast: false matrix: - ruby: [ jruby-9.4.12.0, jruby, ruby ] - neo4j: [ 4.4.42, 5.26.5, 2025.03.0 ] + ruby: [ jruby-9.4.14.0, jruby, ruby ] + neo4j: [ 4.4.46, 5.26.14, 2025.09.0 ] include: - ruby: jruby java-version: 21 diff --git a/jruby/neo4j/driver/ext/config_converter.rb b/jruby/neo4j/driver/ext/config_converter.rb index 53cc5bdc..64ed28d7 100644 --- a/jruby/neo4j/driver/ext/config_converter.rb +++ b/jruby/neo4j/driver/ext/config_converter.rb @@ -68,14 +68,14 @@ def trust_strategy(**config) def notification_config(minimum_severity: nil, disabled_categories: nil) org.neo4j.driver.internal.InternalNotificationConfig.new( - value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity), + value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity).or_else(nil), disabled_categories - &.map { |value| value_of(org.neo4j.driver.internal.InternalNotificationCategory, value) } + &.map { |value| value_of(org.neo4j.driver.NotificationClassification, value) } &.then(&java.util.HashSet.method(:new))) end def value_of(klass, value) - klass.value_of(value&.to_s&.upcase).or_else(nil) + klass.value_of(value&.to_s&.upcase) end end end diff --git a/spec/neo4j/driver/dev_manual_examples_spec.rb b/spec/neo4j/driver/dev_manual_examples_spec.rb index d900ecb0..b162016b 100644 --- a/spec/neo4j/driver/dev_manual_examples_spec.rb +++ b/spec/neo4j/driver/dev_manual_examples_spec.rb @@ -87,9 +87,15 @@ it { is_expected.to be true } end + + context 'Example 2.12. Notification config' do + let(:config) { { notification_config: { minimum_severity: :warning, disabled_categories: [:hint, :generic] } } } + + it { is_expected.to be true } + end end - context 'Example 2.12. Service unavailable' do + context 'Example 2.13. Service unavailable' do def add_item(driver) session = driver.session session.execute_write { |tx| tx.run('CREATE (a:Item)') } @@ -293,4 +299,32 @@ def match_person_nodes(tx) expect(add_employees('abc')).to eq(2) end end + + context '5. Notification config', version: '>=5', jruby: true do + subject do + driver.session do |session| + result = session.run( + 'MATCH p=shortestPath((:Person {name: $start})-[*]->(:Person {name: $end})) RETURN p', + start: 'Alice', + end: 'Bob' + ) + result.consume.notifications.map(&:code) + end + end + + let(:host) { 'localhost' } # work around for https://github.com/neo4j/neo4j-java-driver/issues/1652 + let(:driver) { Neo4j::Driver::GraphDatabase.driver(uri, basic_auth_token, **config) } + + context 'Example 5.1. Default severity and categories' do + let(:config) { {} } + + it { is_expected.not_to be_empty } + end + + context 'Example 5.2. Custom severity and categories' do + let(:config) { { notification_config: { minimum_severity: :warning, disabled_categories: [:hint, :generic] } } } + + it { is_expected.to be_empty } + end + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 77c792c7..3e7630c3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -39,6 +39,7 @@ config.filter_run_excluding auth: :none config.filter_run_excluding version: method(:not_version?) config.filter_run_excluding concurrency: true unless RUBY_PLATFORM == 'java' + config.filter_run_excluding jruby: true unless RUBY_PLATFORM == 'java' config.exclude_pattern = 'spec/ruby/**/*_spec.rb' if RUBY_PLATFORM == 'java' Neo4j::Driver::Internal::Deprecator.deprecator.behavior = :silence end