Skip to content

Commit 13ba6ca

Browse files
GH-2553 - Consolidate issue related integration tests.
Closes #2553.
1 parent 357719b commit 13ba6ca

File tree

84 files changed

+2904
-3642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2904
-3642
lines changed

src/main/asciidoc/appendix/custom-queries.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ and a domain model as shown in the <<custom-query.paths.dm,mapping>> (Constructo
140140
[source,java,indent=0,tabsize=4]
141141
.Domain model for a <<custom-query.paths.g>>.
142142
----
143-
include::../../../../src/test/java/org/springframework/data/neo4j/integration/issues/gh2210/GH2210IT.java[tag=custom-query.paths.dm]
143+
include::../../../../src/test/java/org/springframework/data/neo4j/integration/issues/gh2210/SomeEntity.java[tag=custom-query.paths.dm]
144+
145+
include::../../../../src/test/java/org/springframework/data/neo4j/integration/issues/gh2210/SomeRelation.java[tag=custom-query.paths.dm]
144146
----
145147

146148
As you see, the relationships are only outgoing. Generated finder methods (including `findById`) will always try to match
@@ -194,7 +196,7 @@ Mapped entities (everything with a `@Node`) passed as parameter to a function th
194196
a custom query will be turned into a nested map.
195197
The following example represents the structure as Neo4j parameters.
196198

197-
Given are a `Movie`, `Person` and `Actor` classes annotated as shown in <<movie-model, the movie model>>:
199+
Given are a `Movie`, `Vertex` and `Actor` classes annotated as shown in <<movie-model, the movie model>>:
198200

199201
[[movie-model]]
200202
[source,java]

src/main/asciidoc/faq/faq.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,8 @@ Which looks like this:
744744

745745
image::bacon-distance.png[]
746746

747-
We find 3 nodes labeled `Person` and 2 nodes labeled `Movie`. Both can be mapped with a custom query.
748-
Assume there's a node entity for both `Person` and `Movie` as well as `Actor` taking care of the relationship:
747+
We find 3 nodes labeled `Vertex` and 2 nodes labeled `Movie`. Both can be mapped with a custom query.
748+
Assume there's a node entity for both `Vertex` and `Movie` as well as `Actor` taking care of the relationship:
749749

750750

751751
[source,java]
@@ -791,7 +791,7 @@ public final class Movie {
791791
}
792792
----
793793

794-
When using a query as shown in <<bacon-distance>> for a domain class of type `Person` like this
794+
When using a query as shown in <<bacon-distance>> for a domain class of type `Vertex` like this
795795

796796
[source,java]
797797
----

src/main/asciidoc/object-mapping/sdc-object-mapping.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ This is, to enable mutations of otherwise immutable properties.
132132
<.> By default, Spring Data uses field-access to read and write property values.
133133
As per visibility rules of `private` fields, `MethodHandles` are used to interact with fields.
134134
<.> The class exposes a `withId(…)` method that's used to set the identifier, e.g. when an instance is inserted into the datastore and an identifier has been generated.
135-
Calling `withId(…)` creates a new `Person` object.
135+
Calling `withId(…)` creates a new `Vertex` object.
136136
All subsequent mutations will take place in the new instance leaving the previous untouched.
137137
<.> Using property-access allows direct method invocations without using `MethodHandles`.
138138
====
@@ -192,7 +192,7 @@ class Person {
192192
====
193193
<.> The identifier property is final but set to `null` in the constructor.
194194
The class exposes a `withId(…)` method that's used to set the identifier, e.g. when an instance is inserted into the datastore and an identifier has been generated.
195-
The original `Person` instance stays unchanged as a new one is created.
195+
The original `Vertex` instance stays unchanged as a new one is created.
196196
The same pattern is usually applied for other properties that are store managed but might have to be changed for persistence operations.
197197
<.> The `firstname` and `lastname` properties are ordinary immutable properties potentially exposed through getters.
198198
<.> The `age` property is an immutable but derived one from the `birthday` property.
@@ -241,7 +241,7 @@ Spring Data adapts specifics of Kotlin to allow object creation and mutation.
241241
=== Kotlin object creation
242242

243243
Kotlin classes are supported to be instantiated , all classes are immutable by default and require explicit property declarations to define mutable properties.
244-
Consider the following `data` class `Person`:
244+
Consider the following `data` class `Vertex`:
245245

246246
====
247247
[source,java]
@@ -281,7 +281,7 @@ Every time the `name` parameter is either not part of the result or its value is
281281
=== Property population of Kotlin data classes
282282

283283
In Kotlin, all classes are immutable by default and require explicit property declarations to define mutable properties.
284-
Consider the following `data` class `Person`:
284+
Consider the following `data` class `Vertex`:
285285

286286
====
287287
[source,java]

src/test/java/org/springframework/data/neo4j/integration/imperative/Neo4jTemplateIT.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,14 @@
5353
import org.springframework.data.neo4j.test.Neo4jImperativeTestConfiguration;
5454
import org.springframework.data.neo4j.core.DatabaseSelectionProvider;
5555
import org.springframework.data.neo4j.core.Neo4jTemplate;
56-
import org.springframework.data.neo4j.core.mapping.Constants;
57-
import org.springframework.data.neo4j.core.mapping.Neo4jMappingContext;
58-
import org.springframework.data.neo4j.core.mapping.Neo4jPersistentEntity;
5956
import org.springframework.data.neo4j.core.mapping.Neo4jPersistentProperty;
6057
import org.springframework.data.neo4j.core.transaction.Neo4jBookmarkManager;
6158
import org.springframework.data.neo4j.core.transaction.Neo4jTransactionManager;
62-
import org.springframework.data.neo4j.integration.issues.gh2415.BaseNodeEntity;
63-
import org.springframework.data.neo4j.integration.issues.gh2415.NodeEntity;
64-
import org.springframework.data.neo4j.integration.issues.gh2415.NodeWithDefinedCredentials;
6559
import org.springframework.data.neo4j.integration.shared.common.EntityWithPrimitiveConstructorArguments;
6660
import org.springframework.data.neo4j.integration.shared.common.Person;
6761
import org.springframework.data.neo4j.integration.shared.common.PersonWithAllConstructor;
6862
import org.springframework.data.neo4j.integration.shared.common.PersonWithAssignedId;
6963
import org.springframework.data.neo4j.integration.shared.common.ThingWithGeneratedId;
70-
import org.springframework.data.neo4j.repository.query.QueryFragmentsAndParameters;
7164
import org.springframework.data.neo4j.test.BookmarkCapture;
7265
import org.springframework.data.neo4j.test.Neo4jExtension.Neo4jConnectionSupport;
7366
import org.springframework.data.neo4j.test.Neo4jIntegrationTest;
@@ -125,14 +118,6 @@ void setupData() {
125118
transaction.run("CREATE (p:Person{firstName: 'Bela', lastName: 'B.'})");
126119
transaction.run("CREATE (p:PersonWithAssignedId{id: 'x', firstName: 'John', lastName: 'Doe'})");
127120

128-
transaction.run(
129-
"CREATE (root:NodeEntity:BaseNodeEntity{nodeId: 'root'}) " +
130-
"CREATE (company:NodeEntity:BaseNodeEntity{nodeId: 'comp'}) " +
131-
"CREATE (cred:Credential{id: 'uuid-1', name: 'Creds'}) " +
132-
"CREATE (company)-[:CHILD_OF]->(root) " +
133-
"CREATE (root)-[:HAS_CREDENTIAL]->(cred) " +
134-
"CREATE (company)-[:WITH_CREDENTIAL]->(cred)");
135-
136121
transaction.commit();
137122
bookmarkCapture.seedWith(session.lastBookmark());
138123
}
@@ -923,21 +908,6 @@ void statementWithParamsShouldWork() {
923908
assertThat(people).extracting(Person::getLastName).containsExactly("Schnitzel");
924909
}
925910

926-
@Test // GH-2415
927-
void saveWithProjectionImplementedByEntity(@Autowired Neo4jMappingContext mappingContext) {
928-
929-
Neo4jPersistentEntity<?> metaData = mappingContext.getPersistentEntity(BaseNodeEntity.class);
930-
NodeEntity nodeEntity = neo4jTemplate
931-
.find(BaseNodeEntity.class)
932-
.as(NodeEntity.class)
933-
.matching(QueryFragmentsAndParameters.forCondition(metaData, Constants.NAME_OF_TYPED_ROOT_NODE.apply(metaData).property("nodeId").isEqualTo(Cypher.literalOf("root"))))
934-
.one().get();
935-
neo4jTemplate.saveAs(nodeEntity, NodeWithDefinedCredentials.class);
936-
937-
nodeEntity = neo4jTemplate.findById(nodeEntity.getNodeId(), NodeEntity.class).get();
938-
assertThat(nodeEntity.getChildren()).hasSize(1);
939-
}
940-
941911
@Configuration
942912
@EnableTransactionManagement
943913
static class Config extends Neo4jImperativeTestConfiguration {

0 commit comments

Comments
 (0)