Skip to content

Commit fba0b8b

Browse files
build(deps): Upgrade Cypher-DSL to 2024.7.2 in preparation for 2025.0.0 release.
1 parent 17e3723 commit fba0b8b

File tree

3 files changed

+6
-87
lines changed

3 files changed

+6
-87
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<blockhound.version>1.0.8.RELEASE</blockhound.version>
7878
<checkstyle.skip>${skipTests}</checkstyle.skip>
7979
<checkstyle.version>10.20.1</checkstyle.version>
80-
<cypher-dsl.version>2024.5.1</cypher-dsl.version>
80+
<cypher-dsl.version>2024.7.2</cypher-dsl.version>
8181
<dist.id>spring-data-neo4j</dist.id>
8282
<dist.key>SDNEO4J</dist.key>
8383
<flatten-maven-plugin.version>1.7.0</flatten-maven-plugin.version>

src/test/java/org/springframework/data/neo4j/documentation/repositories/custom_queries/DomainResultsImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import static org.neo4j.cypherdsl.core.Cypher.name;
3131
import static org.neo4j.cypherdsl.core.Cypher.node;
3232
import static org.neo4j.cypherdsl.core.Cypher.parameter;
33-
import static org.neo4j.cypherdsl.core.Cypher.shortestPath;
3433

3534
class DomainResultsImpl implements DomainResults {
3635

@@ -45,7 +44,7 @@ public List<MovieEntity> findMoviesAlongShortestPath(PersonEntity from, PersonEn
4544

4645
var p1 = node("Person").withProperties("name", parameter("person1"));
4746
var p2 = node("Person").withProperties("name", parameter("person2"));
48-
var shortestPath = shortestPath("p").definedBy(p1.relationshipBetween(p2).unbounded());
47+
var shortestPath = Cypher.shortestK(1).named("p").definedBy(p1.relationshipBetween(p2).unbounded());
4948
var p = shortestPath.getRequiredSymbolicName();
5049
var statement = Cypher.match(shortestPath)
5150
.with(p, listWith(name("n")).in(Cypher.nodes(shortestPath))

src/test/java/org/springframework/data/neo4j/integration/reactive/ReactiveNeo4jClientIT.java

Lines changed: 4 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,20 @@
1717

1818
import java.util.Collection;
1919
import java.util.Collections;
20-
import java.util.List;
2120
import java.util.Map;
22-
import java.util.concurrent.CompletableFuture;
2321
import java.util.concurrent.atomic.AtomicLong;
24-
import java.util.function.Consumer;
25-
import java.util.function.Function;
26-
import java.util.stream.Stream;
2722

2823
import org.junit.jupiter.api.BeforeAll;
2924
import org.junit.jupiter.api.BeforeEach;
3025
import org.junit.jupiter.api.Disabled;
3126
import org.junit.jupiter.api.Test;
3227
import org.neo4j.cypherdsl.core.Cypher;
3328
import org.neo4j.cypherdsl.core.Node;
34-
import org.neo4j.cypherdsl.core.Statement;
35-
import org.neo4j.cypherdsl.core.executables.ExecutableResultStatement;
3629
import org.neo4j.driver.Driver;
37-
import org.neo4j.driver.Query;
38-
import org.neo4j.driver.Record;
3930
import org.neo4j.driver.Session;
40-
import org.neo4j.driver.SimpleQueryRunner;
4131
import org.neo4j.driver.Transaction;
42-
import org.neo4j.driver.async.AsyncQueryRunner;
43-
import org.neo4j.driver.reactivestreams.ReactiveQueryRunner;
4432
import org.neo4j.driver.reactivestreams.ReactiveResult;
4533
import org.neo4j.driver.reactivestreams.ReactiveSession;
46-
import org.neo4j.driver.summary.ResultSummary;
47-
import org.reactivestreams.Publisher;
4834
import reactor.blockhound.BlockHound;
4935
import reactor.core.publisher.Flux;
5036
import reactor.core.publisher.Mono;
@@ -154,15 +140,15 @@ void clientShouldIntegrateWithCypherDSL(@Autowired TransactionalOperator transac
154140
Cypher.mapOf("value",
155141
Cypher.literalOf(23).multiply(Cypher.literalOf(2)).subtract(Cypher.literalOf(4))))
156142
.named("n");
157-
NewReactiveExecutableResultStatement statement = new NewReactiveExecutableResultStatement(namedAnswer);
143+
var cypher = Cypher.create(namedAnswer).returning(namedAnswer).build().getCypher();
158144

159145
AtomicLong vanishedId = new AtomicLong();
160146
transactionalOperator.execute(transaction -> {
161-
Flux<Long> inner = client.getQueryRunner()
162-
.flatMapMany(statement::fetchWith)
147+
var inner = client.getQueryRunner()
148+
.flatMap(qr -> Mono.from(qr.run(cypher)))
149+
.flatMapMany(r -> Flux.from(r.records()))
163150
.doOnNext(r -> vanishedId.set(TestIdentitySupport.getInternalId(r.get("n").asNode())))
164151
.map(record -> record.get("n").get("value").asLong());
165-
166152
transaction.setRollbackOnly();
167153
return inner;
168154
}).as(StepVerifier::create).expectNext(42L).verifyComplete();
@@ -221,70 +207,4 @@ public boolean isCypher5Compatible() {
221207

222208
}
223209

224-
private static class NewReactiveExecutableResultStatement implements ExecutableResultStatement {
225-
226-
private final Statement delegate;
227-
228-
NewReactiveExecutableResultStatement(Node namedAnswer) {
229-
this.delegate = Cypher.create(namedAnswer).returning(namedAnswer).build();
230-
}
231-
232-
/**
233-
* This method should move into a future Cypher-DSL version.
234-
* @param reactiveQueryRunner The runner to run the statement with
235-
* @return a publisher of records
236-
*/
237-
Publisher<Record> fetchWith(ReactiveQueryRunner reactiveQueryRunner) {
238-
return Mono.fromCallable(this::createQuery)
239-
.flatMapMany(reactiveQueryRunner::run)
240-
.flatMap(ReactiveResult::records);
241-
}
242-
243-
@Override
244-
public <T> List<T> fetchWith(SimpleQueryRunner queryRunner, Function<Record, T> function) {
245-
throw new UnsupportedOperationException();
246-
}
247-
248-
@Override
249-
public <T> CompletableFuture<List<T>> fetchWith(AsyncQueryRunner asyncQueryRunner,
250-
Function<Record, T> function) {
251-
throw new UnsupportedOperationException();
252-
}
253-
254-
@Override
255-
public ResultSummary streamWith(SimpleQueryRunner queryRunner, Consumer<Stream<Record>> consumer) {
256-
throw new UnsupportedOperationException();
257-
}
258-
259-
@Override
260-
public ResultSummary executeWith(SimpleQueryRunner queryRunner) {
261-
throw new UnsupportedOperationException();
262-
}
263-
264-
@Override
265-
public CompletableFuture<ResultSummary> executeWith(AsyncQueryRunner queryRunner) {
266-
throw new UnsupportedOperationException();
267-
}
268-
269-
Query createQuery() {
270-
return new Query(this.delegate.getCypher(), this.delegate.getCatalog().getParameters());
271-
}
272-
273-
@Override
274-
public Map<String, Object> getParameters() {
275-
return this.delegate.getCatalog().getParameters();
276-
}
277-
278-
@Override
279-
public Collection<String> getParameterNames() {
280-
return this.delegate.getCatalog().getParameterNames();
281-
}
282-
283-
@Override
284-
public String getCypher() {
285-
return this.delegate.getCypher();
286-
}
287-
288-
}
289-
290210
}

0 commit comments

Comments
 (0)