Skip to content

Commit b55c384

Browse files
committed
Remove deleteGraph and added flashDB directly in the test
1 parent 4b93e98 commit b55c384

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/main/java/com/redislabs/redisgraph/RedisGraphAPI.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ public ResultSet query(String query) {
4848
}
4949
}
5050

51-
/**
52-
* Delete the Graph (Current implementation flush the all DB)
53-
*/
54-
public void deleteGraph() {
55-
_conn().flushDB();
56-
}
57-
5851
private BinaryClient sendCommand(Jedis conn, ProtocolCommand provider, String ...args) {
5952
BinaryClient client = conn.getClient();
6053
client.sendCommand(provider, args);

src/test/java/com/redislabs/redisgraph/RedisGraphAPITest.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package com.redislabs.redisgraph;
22

3+
import java.lang.reflect.Method;
4+
35
import org.junit.Assert;
46
import org.junit.Before;
57
import org.junit.Test;
68

79
import com.redislabs.redisgraph.Statistics.Label;
810

11+
import redis.clients.jedis.Jedis;
12+
913
public class RedisGraphAPITest {
1014
RedisGraphAPI api;
1115

@@ -14,15 +18,18 @@ public RedisGraphAPITest() {
1418
}
1519

1620
@Before
17-
public void flushDB() {
18-
api.deleteGraph();
21+
public void flushDB() throws Exception{
22+
// api.deleteGraph(); - TODO add this back once we implement this API
23+
24+
Method method = RedisGraphAPI.class.getDeclaredMethod("_conn");
25+
method.setAccessible(true);
26+
((Jedis)method.invoke(api)).flushDB();
1927
}
20-
2128

2229
@Test
2330
public void testCreateNode() throws Exception {
2431
// Create a node
25-
ResultSet result = api.query("CREATE ({name:\"roi\",age:32})");
32+
ResultSet result = api.query("CREATE ({name:'roi',age:32})");
2633
Assert.assertFalse(result.hasNext());
2734

2835
Assert.assertEquals(1, result.getStatistics().nodesCreated());
@@ -36,7 +43,7 @@ public void testCreateNode() throws Exception {
3643
@Test
3744
public void testCreateLabeledNode() throws Exception {
3845
// Create a node with a label
39-
ResultSet result = api.query("CREATE (:human{name:\"danny\",age:12})");
46+
ResultSet result = api.query("CREATE (:human{name:'danny',age:12})");
4047
Assert.assertFalse(result.hasNext());
4148

4249
Assert.assertEquals("1", result.getStatistics().getStringValue(Label.NODES_CREATED));

0 commit comments

Comments
 (0)