Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 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
4 changes: 2 additions & 2 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions jruby/neo4j/driver/ext/config_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nsauk could you check. It appears to me that the only change needed was this line:

&.map { |value| value_of(org.neo4j.driver.NotificationClassification, value) }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, additionally move the .or_else(nil) from value_of method to the line 71 as the value_of of java enum, which NotificationClassification now is, does not return Optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote the rest of this method using the Java driver's public API so we rely less on internals.

InternalNotificationSeverity works with value_of, but NotificationSeverity fails because it's an interface. As far as I can understand, we can't use the same approach for both (unless it's const_get).

&.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
Expand Down
36 changes: 35 additions & 1 deletion spec/neo4j/driver/dev_manual_examples_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The context numbering has been incremented to 2.13, but verify that the documentation or examples being referenced align with this new numbering scheme to maintain consistency.

Copilot uses AI. Check for mistakes.
def add_item(driver)
session = driver.session
session.execute_write { |tx| tx.run('CREATE (a:Item)') }
Expand Down Expand Up @@ -293,4 +299,32 @@ def match_person_nodes(tx)
expect(add_employees('abc')).to eq(2)
end
end

context '5. Notification config', version: '>=5' 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
Loading