@@ -86,6 +86,12 @@ public static void setupGraph() throws KernelException {
86
86
DB .execute (cypher );
87
87
}
88
88
89
+ @ Before
90
+ public void clearCommunities () {
91
+ String cypher ="MATCH (n) REMOVE n.communities REMOVE n.community" ;
92
+ DB .execute (cypher );
93
+ }
94
+
89
95
@ Rule
90
96
public ExpectedException exceptions = ExpectedException .none ();
91
97
@@ -158,7 +164,7 @@ public void testStreamIncludingIntermediateCommunities() {
158
164
public void testWrite () {
159
165
final String cypher = "CALL algo.louvain('', '', {concurrency:1})" ;
160
166
final IntIntScatterMap testMap = new IntIntScatterMap ();
161
- DB .execute (cypher );
167
+ DB .execute (cypher ). close () ;
162
168
163
169
String readQuery = "MATCH (n) RETURN n.community AS community" ;
164
170
@@ -175,7 +181,7 @@ public void testWrite() {
175
181
public void testWriteIncludingIntermediateCommunities () {
176
182
final String cypher = "CALL algo.louvain('', '', {concurrency:1, includeIntermediateCommunities: true})" ;
177
183
final IntIntScatterMap testMap = new IntIntScatterMap ();
178
- DB .execute (cypher );
184
+ DB .execute (cypher ). close () ;
179
185
180
186
String readQuery = "MATCH (n) RETURN n.communities AS communities" ;
181
187
@@ -191,7 +197,7 @@ public void testWriteIncludingIntermediateCommunities() {
191
197
@ Test
192
198
public void testWriteNoIntermediateCommunitiesByDefault () {
193
199
final String cypher = "CALL algo.louvain('', '', {concurrency:1})" ;
194
- DB .execute (cypher );
200
+ DB .execute (cypher ). close () ;
195
201
196
202
final AtomicLong testInteger = new AtomicLong (0 );
197
203
String readQuery = "MATCH (n) WHERE not(exists(n.communities)) RETURN count(*) AS count" ;
@@ -304,12 +310,12 @@ public void printNodeSets() {
304
310
305
311
public int [] getClusterId (String nodeName ) {
306
312
307
- Object id [] = {0 };
313
+ int id [] = {0 };
308
314
DB .execute ("MATCH (n) WHERE n.name = '" + nodeName + "' RETURN n" ).accept (row -> {
309
- id [0 ] = row .getNode ("n" ).getProperty ("communities " );
315
+ id [0 ] = ( int ) row .getNode ("n" ).getProperty ("community " );
310
316
return true ;
311
317
});
312
- return ( int []) id [ 0 ] ;
318
+ return id ;
313
319
}
314
320
315
321
}
0 commit comments