Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Commit

Permalink
close tx
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Needham committed Oct 11, 2018
1 parent e26d75b commit 3c3bcb8
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public static void setupGraph() throws KernelException {
DB.execute(cypher);
}

@Before
public void clearCommunities() {
String cypher ="MATCH (n) REMOVE n.communities REMOVE n.community";
DB.execute(cypher);
}

@Rule
public ExpectedException exceptions = ExpectedException.none();

Expand Down Expand Up @@ -158,7 +164,7 @@ public void testStreamIncludingIntermediateCommunities() {
public void testWrite() {
final String cypher = "CALL algo.louvain('', '', {concurrency:1})";
final IntIntScatterMap testMap = new IntIntScatterMap();
DB.execute(cypher);
DB.execute(cypher).close();

String readQuery = "MATCH (n) RETURN n.community AS community";

Expand All @@ -175,7 +181,7 @@ public void testWrite() {
public void testWriteIncludingIntermediateCommunities() {
final String cypher = "CALL algo.louvain('', '', {concurrency:1, includeIntermediateCommunities: true})";
final IntIntScatterMap testMap = new IntIntScatterMap();
DB.execute(cypher);
DB.execute(cypher).close();

String readQuery = "MATCH (n) RETURN n.communities AS communities";

Expand All @@ -191,7 +197,7 @@ public void testWriteIncludingIntermediateCommunities() {
@Test
public void testWriteNoIntermediateCommunitiesByDefault() {
final String cypher = "CALL algo.louvain('', '', {concurrency:1})";
DB.execute(cypher);
DB.execute(cypher).close();

final AtomicLong testInteger = new AtomicLong(0);
String readQuery = "MATCH (n) WHERE not(exists(n.communities)) RETURN count(*) AS count";
Expand Down Expand Up @@ -304,12 +310,12 @@ public void printNodeSets() {

public int[] getClusterId(String nodeName) {

Object id[] = {0};
int id[] = {0};
DB.execute("MATCH (n) WHERE n.name = '" + nodeName + "' RETURN n").accept(row -> {
id[0] = row.getNode("n").getProperty("communities");
id[0] = (int) row.getNode("n").getProperty("community");
return true;
});
return (int[]) id[0];
return id;
}

}

0 comments on commit 3c3bcb8

Please sign in to comment.