@@ -86,6 +86,12 @@ public static void setupGraph() throws KernelException {
8686 DB .execute (cypher );
8787 }
8888
89+ @ Before
90+ public void clearCommunities () {
91+ String cypher ="MATCH (n) REMOVE n.communities REMOVE n.community" ;
92+ DB .execute (cypher );
93+ }
94+
8995 @ Rule
9096 public ExpectedException exceptions = ExpectedException .none ();
9197
@@ -158,7 +164,7 @@ public void testStreamIncludingIntermediateCommunities() {
158164 public void testWrite () {
159165 final String cypher = "CALL algo.louvain('', '', {concurrency:1})" ;
160166 final IntIntScatterMap testMap = new IntIntScatterMap ();
161- DB .execute (cypher );
167+ DB .execute (cypher ). close () ;
162168
163169 String readQuery = "MATCH (n) RETURN n.community AS community" ;
164170
@@ -175,7 +181,7 @@ public void testWrite() {
175181 public void testWriteIncludingIntermediateCommunities () {
176182 final String cypher = "CALL algo.louvain('', '', {concurrency:1, includeIntermediateCommunities: true})" ;
177183 final IntIntScatterMap testMap = new IntIntScatterMap ();
178- DB .execute (cypher );
184+ DB .execute (cypher ). close () ;
179185
180186 String readQuery = "MATCH (n) RETURN n.communities AS communities" ;
181187
@@ -191,7 +197,7 @@ public void testWriteIncludingIntermediateCommunities() {
191197 @ Test
192198 public void testWriteNoIntermediateCommunitiesByDefault () {
193199 final String cypher = "CALL algo.louvain('', '', {concurrency:1})" ;
194- DB .execute (cypher );
200+ DB .execute (cypher ). close () ;
195201
196202 final AtomicLong testInteger = new AtomicLong (0 );
197203 String readQuery = "MATCH (n) WHERE not(exists(n.communities)) RETURN count(*) AS count" ;
@@ -304,12 +310,12 @@ public void printNodeSets() {
304310
305311 public int [] getClusterId (String nodeName ) {
306312
307- Object id [] = {0 };
313+ int id [] = {0 };
308314 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 " );
310316 return true ;
311317 });
312- return ( int []) id [ 0 ] ;
318+ return id ;
313319 }
314320
315321}
0 commit comments