Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/main/java/com/redislabs/redisgraph/RedisGraphAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ public ResultSet query(String query) {
}
}

/**
* Delete the Graph (Current implementation flush the all DB)
*/
public void deleteGraph() {
_conn().flushDB();
}

private BinaryClient sendCommand(Jedis conn, ProtocolCommand provider, String ...args) {
BinaryClient client = conn.getClient();
client.sendCommand(provider, args);
Expand Down
17 changes: 12 additions & 5 deletions src/test/java/com/redislabs/redisgraph/RedisGraphAPITest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.redislabs.redisgraph;

import java.lang.reflect.Method;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import com.redislabs.redisgraph.Statistics.Label;

import redis.clients.jedis.Jedis;

public class RedisGraphAPITest {
RedisGraphAPI api;

Expand All @@ -14,15 +18,18 @@ public RedisGraphAPITest() {
}

@Before
public void flushDB() {
api.deleteGraph();
public void flushDB() throws Exception{
// api.deleteGraph(); - TODO add this back once we implement this API

Method method = RedisGraphAPI.class.getDeclaredMethod("_conn");
method.setAccessible(true);
((Jedis)method.invoke(api)).flushDB();
}


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

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

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