Skip to content

Commit 2ddb7d6

Browse files
committed
Update tests using dbms.listTransactions()
`dbms.listTransactions()` has been replaced with `SHOW TRANSACTIONS`.
1 parent fa8b2a3 commit 2ddb7d6

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

driver/src/test/java/org/neo4j/driver/integration/SessionBoltV3IT.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.neo4j.driver.integration;
2020

2121
import static java.time.Duration.ofMillis;
22-
import static java.util.Arrays.asList;
2322
import static org.hamcrest.MatcherAssert.assertThat;
2423
import static org.hamcrest.Matchers.containsString;
2524
import static org.hamcrest.Matchers.greaterThan;
@@ -78,13 +77,13 @@ void shouldSetTransactionMetadata() {
7877
Map<String, Object> metadata = new HashMap<>();
7978
metadata.put("a", "hello world");
8079
metadata.put("b", LocalDate.now());
81-
metadata.put("c", asList(true, false, true));
80+
metadata.put("c", false);
8281

8382
TransactionConfig config =
8483
TransactionConfig.builder().withMetadata(metadata).build();
8584

8685
// call listTransactions procedure that should list itself with the specified metadata
87-
Result result = driver.session().run("CALL dbms.listTransactions()", config);
86+
Result result = driver.session().run("SHOW TRANSACTIONS YIELD metaData", config);
8887
Map<String, Object> receivedMetadata = result.single().get("metaData").asMap();
8988

9089
assertEquals(metadata, receivedMetadata);
@@ -101,7 +100,7 @@ void shouldSetTransactionMetadataAsync() {
101100

102101
// call listTransactions procedure that should list itself with the specified metadata
103102
CompletionStage<Map<String, Object>> metadataFuture = driver.asyncSession()
104-
.runAsync("CALL dbms.listTransactions()", config)
103+
.runAsync("SHOW TRANSACTIONS YIELD metaData", config)
105104
.thenCompose(ResultCursor::singleAsync)
106105
.thenApply(record -> record.get("metaData").asMap());
107106

@@ -312,10 +311,10 @@ private static void testTransactionMetadataWithAsyncTransactionFunctions(boolean
312311
// call listTransactions procedure that should list itself with the specified metadata
313312
CompletionStage<Record> singleFuture = read
314313
? asyncSession.readTransactionAsync(
315-
tx -> tx.runAsync("CALL dbms.listTransactions()").thenCompose(ResultCursor::singleAsync),
314+
tx -> tx.runAsync("SHOW TRANSACTIONS YIELD metaData").thenCompose(ResultCursor::singleAsync),
316315
config)
317316
: asyncSession.writeTransactionAsync(
318-
tx -> tx.runAsync("CALL dbms.listTransactions()").thenCompose(ResultCursor::singleAsync),
317+
tx -> tx.runAsync("SHOW TRANSACTIONS YIELD metaData").thenCompose(ResultCursor::singleAsync),
319318
config);
320319

321320
CompletionStage<Map<String, Object>> metadataFuture =
@@ -337,9 +336,9 @@ private static void testTransactionMetadataWithTransactionFunctions(boolean read
337336
// call listTransactions procedure that should list itself with the specified metadata
338337
Record single = read
339338
? session.readTransaction(
340-
tx -> tx.run("CALL dbms.listTransactions()").single(), config)
339+
tx -> tx.run("SHOW TRANSACTIONS YIELD metaData").single(), config)
341340
: session.writeTransaction(
342-
tx -> tx.run("CALL dbms.listTransactions()").single(), config);
341+
tx -> tx.run("SHOW TRANSACTIONS YIELD metaData").single(), config);
343342

344343
Map<String, Object> receivedMetadata = single.get("metaData").asMap();
345344

driver/src/test/java/org/neo4j/driver/integration/TransactionBoltV3IT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private static void verifyValidException(Exception error) {
166166

167167
private static void verifyTransactionMetadata(Map<String, Object> metadata) {
168168
try (Session session = driver.driver().session()) {
169-
Result result = session.run("CALL dbms.listTransactions()");
169+
Result result = session.run("SHOW TRANSACTIONS YIELD metaData");
170170

171171
Map<String, Object> receivedMetadata = result.list().stream()
172172
.map(record -> record.get("metaData"))

0 commit comments

Comments
 (0)