Skip to content

Commit cbc54bc

Browse files
authored
Include NotificationConfig on BEGIN message for bolt scheme (#1404)
`NotificationConfig` might be ignored on new sessions with `bolt` scheme. This update fixes it.
1 parent bf4cf00 commit cbc54bc

File tree

8 files changed

+32
-7
lines changed

8 files changed

+32
-7
lines changed

bundle/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.neo4j.driver</groupId>
88
<artifactId>neo4j-java-driver-parent</artifactId>
9-
<version>5.8-SNAPSHOT</version>
9+
<version>5.7-SNAPSHOT</version>
1010
<relativePath>..</relativePath>
1111
</parent>
1212

driver/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.neo4j.driver</groupId>
88
<artifactId>neo4j-java-driver-parent</artifactId>
9-
<version>5.8-SNAPSHOT</version>
9+
<version>5.7-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>neo4j-java-driver</artifactId>

driver/src/main/java/org/neo4j/driver/internal/messaging/request/TransactionMetadataBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,16 @@ public static Map<String, Value> buildMetadata(
6868
boolean databaseNamePresent = databaseName.databaseName().isPresent();
6969
boolean impersonatedUserPresent = impersonatedUser != null;
7070
boolean txTypePresent = txType != null;
71+
boolean notificationConfigPresent = notificationConfig != null;
7172

7273
if (!bookmarksPresent
7374
&& !txTimeoutPresent
7475
&& !txMetadataPresent
7576
&& !accessModePresent
7677
&& !databaseNamePresent
7778
&& !impersonatedUserPresent
78-
&& !txTypePresent) {
79+
&& !txTypePresent
80+
&& !notificationConfigPresent) {
7981
return emptyMap();
8082
}
8183

driver/src/test/java/org/neo4j/driver/internal/messaging/request/TransactionMetadataBuilderTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
import org.junit.jupiter.params.provider.ValueSource;
4343
import org.neo4j.driver.AccessMode;
4444
import org.neo4j.driver.Bookmark;
45+
import org.neo4j.driver.NotificationCategory;
46+
import org.neo4j.driver.NotificationConfig;
47+
import org.neo4j.driver.NotificationSeverity;
4548
import org.neo4j.driver.Value;
4649
import org.neo4j.driver.internal.InternalBookmark;
4750

@@ -106,4 +109,24 @@ void shouldNotHaveMetadataForDatabaseNameWhenIsNull() {
106109
buildMetadata(null, null, defaultDatabase(), WRITE, Collections.emptySet(), null, null, null);
107110
assertTrue(metadata.isEmpty());
108111
}
112+
113+
@Test
114+
void shouldIncludeNotificationConfig() {
115+
var metadata = buildMetadata(
116+
null,
117+
null,
118+
defaultDatabase(),
119+
WRITE,
120+
Collections.emptySet(),
121+
null,
122+
null,
123+
NotificationConfig.defaultConfig()
124+
.enableMinimumSeverity(NotificationSeverity.WARNING)
125+
.disableCategories(Set.of(NotificationCategory.UNSUPPORTED)));
126+
127+
var expectedMetadata = new HashMap<String, Value>();
128+
expectedMetadata.put("notifications_minimum_severity", value("WARNING"));
129+
expectedMetadata.put("notifications_disabled_categories", value(Set.of("UNSUPPORTED")));
130+
assertEquals(expectedMetadata, metadata);
131+
}
109132
}

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.neo4j.driver</groupId>
88
<artifactId>neo4j-java-driver-parent</artifactId>
9-
<version>5.8-SNAPSHOT</version>
9+
<version>5.7-SNAPSHOT</version>
1010
</parent>
1111

1212
<groupId>org.neo4j.doc.driver</groupId>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>org.neo4j.driver</groupId>
77
<artifactId>neo4j-java-driver-parent</artifactId>
8-
<version>5.8-SNAPSHOT</version>
8+
<version>5.7-SNAPSHOT</version>
99

1010
<packaging>pom</packaging>
1111
<name>Neo4j Java Driver Project</name>

testkit-backend/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>neo4j-java-driver-parent</artifactId>
99
<groupId>org.neo4j.driver</groupId>
10-
<version>5.8-SNAPSHOT</version>
10+
<version>5.7-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>testkit-backend</artifactId>

testkit-tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.neo4j.driver</groupId>
88
<artifactId>neo4j-java-driver-parent</artifactId>
9-
<version>5.8-SNAPSHOT</version>
9+
<version>5.7-SNAPSHOT</version>
1010
<relativePath>..</relativePath>
1111
</parent>
1212

0 commit comments

Comments
 (0)