@@ -92,6 +92,96 @@ void shouldCreateUndirectedRelationships(int concurrency) {
9292 }
9393 }
9494
95+ @ GdlGraph (graphNamePrefix = "singleDirected" , orientation = Orientation .NATURAL )
96+ private static final String SINGLE_PROPERTY_DIRECTED =
97+ " (a), (b), (c), (d)" +
98+ ", (a)-[:T1 {prop1: 42.0D}]->(b)" +
99+ ", (b)-[:T1 {prop1: 1.0D}]->(a)" +
100+ ", (b)-[:T1 {prop1: 4.0D}]->(c)" +
101+ ", (a)-[:T1 {prop1: 4.0D}]->(a)" ;
102+
103+ @ GdlGraph (graphNamePrefix = "singleUndirected" , orientation = Orientation .UNDIRECTED )
104+ private static final String SINGLE_PROPERTY_UNDIRECTED =
105+ " (a), (b), (c), (d)" +
106+ ", (a)-[:T2 {prop1: 42.0D}]->(b)" +
107+ ", (b)-[:T2 {prop1: 1.0D}]->(a)" +
108+ ", (b)-[:T2 {prop1: 4.0D}]->(c)" +
109+ ", (a)-[:T2 {prop1: 4.0D}]->(a)" ;
110+ @ Inject
111+ GraphStore singleDirectedGraphStore ;
112+ @ Inject
113+ GraphStore singleUndirectedGraphStore ;
114+
115+ @ ParameterizedTest
116+ @ ValueSource (ints = {1 , 4 })
117+ void shouldCreateUndirectedRelationshipsWithSingleRelationshipProperty (int concurrency ) {
118+ var config = ImmutableToUndirectedConfig
119+ .builder ()
120+ .concurrency (concurrency )
121+ .relationshipType ("T1" )
122+ .mutateRelationshipType ("T2" )
123+ .build ();
124+
125+ SingleTypeRelationshipImportResult undirectedRelationships = new ToUndirected (
126+ singleDirectedGraphStore ,
127+ config ,
128+ ProgressTracker .NULL_TRACKER ,
129+ Pools .DEFAULT
130+ ).compute ();
131+
132+ singleDirectedGraphStore .addRelationshipType (RelationshipType .of (config .mutateRelationshipType ()), undirectedRelationships );
133+
134+ assertGraphEquals (
135+ singleUndirectedGraphStore .getGraph (RelationshipType .of ("T2" ), Optional .of ("prop1" )),
136+ singleDirectedGraphStore .getGraph (RelationshipType .of ("T2" ), Optional .of ("prop1" ))
137+ );
138+ }
139+
140+ @ GdlGraph (graphNamePrefix = "noPropertyDirected" , orientation = Orientation .NATURAL )
141+ private static final String NO_PROPERTY_DIRECTED =
142+ " (a), (b), (c), (d)" +
143+ ", (a)-[:T1]->(b)" +
144+ ", (b)-[:T1]->(a)" +
145+ ", (b)-[:T1]->(c)" +
146+ ", (a)-[:T1]->(a)" ;
147+
148+ @ GdlGraph (graphNamePrefix = "noPropertyUndirected" , orientation = Orientation .UNDIRECTED )
149+ private static final String NO_PROPERTY_UNDIRECTED =
150+ " (a), (b), (c), (d)" +
151+ ", (a)-[:T2]->(b)" +
152+ ", (b)-[:T2]->(a)" +
153+ ", (b)-[:T2]->(c)" +
154+ ", (a)-[:T2]->(a)" ;
155+ @ Inject
156+ GraphStore noPropertyDirectedGraphStore ;
157+ @ Inject
158+ GraphStore noPropertyUndirectedGraphStore ;
159+
160+ @ ParameterizedTest
161+ @ ValueSource (ints = {1 , 4 })
162+ void shouldCreateUndirectedRelationshipsWithNoRelationshipProperty (int concurrency ) {
163+ var config = ImmutableToUndirectedConfig
164+ .builder ()
165+ .concurrency (concurrency )
166+ .relationshipType ("T1" )
167+ .mutateRelationshipType ("T2" )
168+ .build ();
169+
170+ SingleTypeRelationshipImportResult undirectedRelationships = new ToUndirected (
171+ noPropertyDirectedGraphStore ,
172+ config ,
173+ ProgressTracker .NULL_TRACKER ,
174+ Pools .DEFAULT
175+ ).compute ();
176+
177+ noPropertyDirectedGraphStore .addRelationshipType (RelationshipType .of (config .mutateRelationshipType ()), undirectedRelationships );
178+
179+ assertGraphEquals (
180+ noPropertyUndirectedGraphStore .getGraph (RelationshipType .of ("T2" )),
181+ noPropertyDirectedGraphStore .getGraph (RelationshipType .of ("T2" ))
182+ );
183+ }
184+
95185 @ Test
96186 void shouldLogProgress () {
97187 var log = Neo4jProxy .testLog ();
0 commit comments