diff --git a/pom.xml b/pom.xml
index cabbfb2..a9ac289 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,59 +1,60 @@
-
- 4.0.0
-
-
- org.sonatype.oss
- oss-parent
- 7
-
-
- com.falkordb
- jfalkordb
- 0.5.1-SNAPSHOT
- jar
-
- JFalkorDB
- Official client for FalkorDB
- https://www.falkordb.com
-
-
- FalkorDB
- https://www.falkordb.com
-
-
-
- CircleCI
- https://circleci.com/gh/FalkorDB/JFalkorDB
-
-
-
- GitHub
- https://github.com/FalkorDB/JFalkorDB/issues
-
-
-
- https://github.com/FalkorDB/JFalkorDB
- scm:git:git://github.com/FalkorDB/JFalkorDB.git
- scm:git:git@github.com:FalkorDB/JFalkorDB.git
-
-
-
-
- BSD 3-Clause
- https://opensource.org/licenses/BSD-3-Clause
- repo
-
-
-
-
-
- gkorland
- Guy Korland
- gkorland@gmail.com
-
-
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ 4.0.0
+
+
+ org.sonatype.oss
+ oss-parent
+ 7
+
+
+ com.falkordb
+ jfalkordb
+ 0.5.1-SNAPSHOT
+ jar
+
+ JFalkorDB
+ Official client for FalkorDB
+ https://www.falkordb.com
+
+
+ FalkorDB
+ https://www.falkordb.com
+
+
+
+ CircleCI
+ https://circleci.com/gh/FalkorDB/JFalkorDB
+
+
+
+ GitHub
+ https://github.com/FalkorDB/JFalkorDB/issues
+
+
+
+ https://github.com/FalkorDB/JFalkorDB
+ scm:git:git://github.com/FalkorDB/JFalkorDB.git
+ scm:git:git@github.com:FalkorDB/JFalkorDB.git
+
+
+
+
+ BSD 3-Clause
+ https://opensource.org/licenses/BSD-3-Clause
+ repo
+
+
+
+
+
+ gkorland
+ Guy Korland
+ gkorland@gmail.com
+
+
central
@@ -62,125 +63,172 @@
central
https://central.sonatype.com/repository/maven-snapshots/
-
+
-
- 8
- 8
-
-
-
-
- redis.clients
- jedis
- 6.1.0
-
-
- org.apache.commons
- commons-text
- 1.14.0
-
-
- org.slf4j
- slf4j-simple
- 2.0.17
- test
-
-
- org.junit.jupiter
- junit-jupiter
- 5.13.4
- test
-
-
- nl.jqno.equalsverifier
- equalsverifier
- 3.19.4
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 3.5.3
-
-
-
- org.jacoco
- jacoco-maven-plugin
- 0.8.13
-
-
-
- prepare-agent
-
-
-
- report
- test
-
- report
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.3.1
-
-
- attach-sources
-
- jar-no-fork
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 3.11.2
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 3.2.7
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
- org.sonatype.central
- central-publishing-maven-plugin
- 0.8.0
- true
-
- central
- true
- published
-
-
-
-
+
+ 8
+ 8
+
+
+
+
+ redis.clients
+ jedis
+ 6.1.0
+
+
+ org.apache.commons
+ commons-text
+ 1.14.0
+
+
+ org.slf4j
+ slf4j-simple
+ 2.0.17
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter
+ 5.13.4
+ test
+
+
+ nl.jqno.equalsverifier
+ equalsverifier
+ 3.19.4
+ test
+
+
+ org.testcontainers
+ testcontainers
+ 1.21.3
+ test
+
+
+ org.testcontainers
+ junit-jupiter
+ 1.21.3
+ test
+
+
+ com.redis
+ testcontainers-redis
+ 2.2.4
+ test
+
+
+
+
+
+
+
+ maven-surefire-plugin
+
+
+ **/*IT.java
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 3.5.3
+
+
+ integration-tests
+
+ integration-test
+ verify
+
+
+
+ **/*IT.java
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.5.3
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.13
+
+
+
+ prepare-agent
+
+
+
+ report
+ test
+
+ report
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.3.1
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.11.2
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 3.2.7
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+ 0.8.0
+ true
+
+ central
+ true
+ published
+
+
+
+
diff --git a/src/test/java/com/falkordb/GraphAPITest.java b/src/test/java/com/falkordb/GraphAPITest.java
index a49c31a..46f2ffb 100644
--- a/src/test/java/com/falkordb/GraphAPITest.java
+++ b/src/test/java/com/falkordb/GraphAPITest.java
@@ -1,33 +1,28 @@
package com.falkordb;
-import static org.junit.jupiter.api.Assertions.fail;
-
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-
-import org.junit.jupiter.api.Assertions;
+import com.falkordb.Statistics.Label;
+import com.falkordb.exceptions.GraphException;
+import com.falkordb.graph_entities.*;
+import com.falkordb.test.BaseTestContainerTestIT;
+import com.falkordb.test.utils.PathBuilder;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import com.falkordb.Statistics.Label;
-import com.falkordb.exceptions.GraphException;
-import com.falkordb.graph_entities.Edge;
-import com.falkordb.graph_entities.Node;
-import com.falkordb.graph_entities.Path;
-import com.falkordb.graph_entities.Point;
-import com.falkordb.graph_entities.Property;
-import com.falkordb.test.utils.PathBuilder;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static org.junit.jupiter.api.Assertions.fail;
-public class GraphAPITest {
+public class GraphAPITest extends BaseTestContainerTestIT {
private GraphContextGenerator client;
@BeforeEach
public void createApi() {
- client = FalkorDB.driver().graph("social");
+ client = FalkorDB.driver(getFalkordbHost(), getFalkordbPort()).graph("social");
}
@AfterEach
@@ -293,8 +288,8 @@ public void testRecord() {
"r.place", "r.since", "r.doubleValue", "r.boolValue"), record.keys());
Assertions.assertEquals(Arrays.asList(expectedNode, expectedEdge,
- name, (long) age, doubleValue, true,
- place, (long) since, doubleValue, false),
+ name, (long) age, doubleValue, true,
+ place, (long) since, doubleValue, false),
record.values());
Node a = record.getValue("a");
@@ -580,8 +575,8 @@ public void testContextedAPI() {
"r.place", "r.since", "r.doubleValue", "r.boolValue"), record.keys());
Assertions.assertEquals(Arrays.asList(expectedNode, expectedEdge,
- name, (long) age, doubleValue, true,
- place, (long) since, doubleValue, false),
+ name, (long) age, doubleValue, true,
+ place, (long) since, doubleValue, false),
record.values());
Node a = record.getValue("a");
@@ -599,13 +594,13 @@ public void testContextedAPI() {
// Test profile functionality in contexted API
ResultSet profileResult = c.profile("MATCH (a:person) WHERE (a.name = 'roi') RETURN a.age");
Assertions.assertNotNull(profileResult);
-
+
// Verify profile result structure in contexted API
Assertions.assertTrue(profileResult.size() > 0, "Profile result should contain execution plan operations");
Header profileHeader = profileResult.getHeader();
Assertions.assertNotNull(profileHeader, "Profile result should have a header");
Assertions.assertTrue(profileHeader.getSchemaNames().size() > 0, "Profile result header should have columns");
-
+
// Verify profile result contains meaningful data
Iterator profileIterator = profileResult.iterator();
Assertions.assertTrue(profileIterator.hasNext(), "Profile result should have execution plan operations");
@@ -826,7 +821,7 @@ public void testVecf32() {
Object res = vector.get(0);
// The result can be either Double or Float depending on the server version
- if ( res instanceof Double) {
+ if (res instanceof Double) {
List v = r.getValue(0);
Assertions.assertEquals(2.1, v.get(0), 0.01);
Assertions.assertEquals(-0.82, v.get(1), 0.01);
@@ -986,44 +981,44 @@ public void testProfile() {
// Create sample data for profiling
client.query("CREATE (:person{name:'alice',age:30})");
client.query("CREATE (:person{name:'bob',age:25})");
-
+
// Test basic profile
ResultSet profileResult = client.profile("MATCH (a:person) WHERE (a.name = 'alice') RETURN a.age");
Assertions.assertNotNull(profileResult);
-
+
// Verify profile result has expected structure
Assertions.assertTrue(profileResult.size() > 0, "Profile result should contain execution plan operations");
-
+
// Verify profile result has a header
Header header = profileResult.getHeader();
Assertions.assertNotNull(header, "Profile result should have a header");
Assertions.assertTrue(header.getSchemaNames().size() > 0, "Profile result header should have columns");
-
+
// Verify the profile result contains timing information (execution plan data)
// Profile results typically contain execution plan operations with timing data
Iterator iterator = profileResult.iterator();
Assertions.assertTrue(iterator.hasNext(), "Profile result should have at least one operation");
-
+
Record firstRecord = iterator.next();
Assertions.assertNotNull(firstRecord, "Profile result record should not be null");
Assertions.assertTrue(firstRecord.size() > 0, "Profile result record should have values");
-
+
// Test profile with parameters
Map params = new HashMap<>();
params.put("name", "alice");
ResultSet profileResultWithParams = client.profile("MATCH (a:person) WHERE (a.name = $name) RETURN a.age", params);
Assertions.assertNotNull(profileResultWithParams);
-
+
// Verify parameterized profile result has expected structure
Assertions.assertTrue(profileResultWithParams.size() > 0, "Parameterized profile result should contain execution plan operations");
Header paramHeader = profileResultWithParams.getHeader();
Assertions.assertNotNull(paramHeader, "Parameterized profile result should have a header");
-
+
// Test profile with more complex query
ResultSet complexProfileResult = client.profile("MATCH (p:person) WHERE p.age > 20 RETURN p.name, p.age ORDER BY p.age");
Assertions.assertNotNull(complexProfileResult);
Assertions.assertTrue(complexProfileResult.size() > 0, "Complex profile result should contain execution plan operations");
-
+
// Verify all profile results have statistics (execution plans should have execution time)
Assertions.assertNotNull(profileResult.getStatistics(), "Profile result should have statistics");
Assertions.assertNotNull(profileResultWithParams.getStatistics(), "Parameterized profile result should have statistics");
@@ -1040,7 +1035,7 @@ public void testGraphCopy() {
// Copy the graph
client.copyGraph("social-copied");
- GraphContextGenerator client2 = FalkorDB.driver().graph("social-copied");
+ GraphContextGenerator client2 = FalkorDB.driver(getFalkordbHost(), getFalkordbPort()).graph("social-copied");
try {
// Compare graph contents
ResultSet copiedResultSet = client2.query("MATCH (p:person)-[rel:knows]->(p2:person) RETURN p,rel,p2");
@@ -1069,7 +1064,7 @@ public void testGraphCopyContextedAPI() {
c.copyGraph("social-copied");
}
- GraphContextGenerator client2 = FalkorDB.driver().graph("social-copied");
+ GraphContextGenerator client2 = FalkorDB.driver(getFalkordbHost(), getFalkordbPort()).graph("social-copied");
try {
// Compare graph contents
ResultSet copiedResultSet = client2.query("MATCH (p:person)-[rel:knows]->(p2:person) RETURN p,rel,p2");
@@ -1098,9 +1093,9 @@ public void testExplain() {
Assertions.assertFalse(explainResult.isEmpty());
// Should contain typical execution plan keywords in one of the lines
boolean containsExpectedKeywords = explainResult.stream()
- .anyMatch(line -> line.toLowerCase().contains("scan") ||
- line.toLowerCase().contains("project") ||
- line.toLowerCase().contains("results"));
+ .anyMatch(line -> line.toLowerCase().contains("scan") ||
+ line.toLowerCase().contains("project") ||
+ line.toLowerCase().contains("results"));
Assertions.assertTrue(containsExpectedKeywords);
// Test explain with parameters
diff --git a/src/test/java/com/falkordb/InstantiationTest.java b/src/test/java/com/falkordb/InstantiationTest.java
index c474c20..7ca7e1b 100644
--- a/src/test/java/com/falkordb/InstantiationTest.java
+++ b/src/test/java/com/falkordb/InstantiationTest.java
@@ -1,38 +1,41 @@
package com.falkordb;
-import java.net.URI;
-
+import com.falkordb.test.BaseTestContainerTestIT;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class InstantiationTest {
+import java.net.URI;
+
+public class InstantiationTest extends BaseTestContainerTestIT {
private GraphContextGenerator client;
@Test
public void createDefaultClient() {
- client = FalkorDB.driver().graph("g");
+
+ client = FalkorDB.driver(getFalkordbHost(), getFalkordbPort()).graph("g");
ResultSet resultSet = client.query("CREATE ({name:'bsb'})");
Assertions.assertEquals(1, resultSet.getStatistics().nodesCreated());
}
@Test
public void createClientWithHostAndPort() {
- client = FalkorDB.driver("localhost", 6379).graph("g");
+ client = FalkorDB.driver(getFalkordbHost(), getFalkordbPort()).graph("g");
ResultSet resultSet = client.query("CREATE ({name:'bsb'})");
Assertions.assertEquals(1, resultSet.getStatistics().nodesCreated());
}
@Test
public void createClientWithHostAndPortNoUser() {
- client = FalkorDB.driver("localhost", 6379, null, null).graph("g");
+ client = FalkorDB.driver(getFalkordbHost(), getFalkordbPort(), null, null).graph("g");
ResultSet resultSet = client.query("CREATE ({name:'bsb'})");
Assertions.assertEquals(1, resultSet.getStatistics().nodesCreated());
}
@Test
public void createClientWithURL() {
- client = FalkorDB.driver(URI.create("redis://localhost:6379")).graph("g");
+ client = FalkorDB.driver(URI.create(String.format("redis://%s:%d",
+ getFalkordbHost(), getFalkordbPort()))).graph("g");
ResultSet resultSet = client.query("CREATE ({name:'bsb'})");
Assertions.assertEquals(1, resultSet.getStatistics().nodesCreated());
}
diff --git a/src/test/java/com/falkordb/IterableTest.java b/src/test/java/com/falkordb/IterableTest.java
index 7ff89b1..2af210c 100644
--- a/src/test/java/com/falkordb/IterableTest.java
+++ b/src/test/java/com/falkordb/IterableTest.java
@@ -1,19 +1,20 @@
package com.falkordb;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
+import com.falkordb.test.BaseTestContainerTestIT;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class IterableTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+public class IterableTest extends BaseTestContainerTestIT {
private GraphContextGenerator api;
@BeforeEach
public void createApi() {
- api = FalkorDB.driver().graph("social");
+ api = FalkorDB.driver(getFalkordbHost(), getFalkordbPort()).graph("social");
}
@AfterEach
diff --git a/src/test/java/com/falkordb/ListGraphsTest.java b/src/test/java/com/falkordb/ListGraphsTest.java
index eaa8d18..c9c8531 100644
--- a/src/test/java/com/falkordb/ListGraphsTest.java
+++ b/src/test/java/com/falkordb/ListGraphsTest.java
@@ -1,18 +1,19 @@
package com.falkordb;
-import java.util.List;
-
+import com.falkordb.test.BaseTestContainerTestIT;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class ListGraphsTest {
+import java.util.List;
+
+public class ListGraphsTest extends BaseTestContainerTestIT {
private Driver driver;
@BeforeEach
public void setUp() {
- driver = FalkorDB.driver();
+ driver = FalkorDB.driver(getFalkordbHost(), getFalkordbPort());
}
@Test
@@ -29,13 +30,13 @@ public void testListGraphsWithCreatedGraph() {
// Create a test graph
GraphContextGenerator testGraph = driver.graph("test-list-graph");
testGraph.query("CREATE (:TestNode {name:'test'})");
-
+
try {
// List graphs and verify our graph is included
List graphs = driver.listGraphs();
Assertions.assertNotNull(graphs);
- Assertions.assertTrue(graphs.contains("test-list-graph"),
- "Graph list should contain the created graph: " + graphs);
+ Assertions.assertTrue(graphs.contains("test-list-graph"),
+ "Graph list should contain the created graph: " + graphs);
} finally {
// Clean up the test graph
testGraph.deleteGraph();
@@ -48,38 +49,38 @@ public void testListGraphsAfterDeletion() {
// Create a test graph
GraphContextGenerator testGraph = driver.graph("test-delete-graph");
testGraph.query("CREATE (:TestNode {name:'test'})");
-
+
// Verify graph exists
List graphsBefore = driver.listGraphs();
Assertions.assertTrue(graphsBefore.contains("test-delete-graph"));
-
+
// Delete the graph
testGraph.deleteGraph();
testGraph.close();
-
+
// Verify graph is no longer in the list
List graphsAfter = driver.listGraphs();
- Assertions.assertFalse(graphsAfter.contains("test-delete-graph"),
- "Graph list should not contain the deleted graph: " + graphsAfter);
+ Assertions.assertFalse(graphsAfter.contains("test-delete-graph"),
+ "Graph list should not contain the deleted graph: " + graphsAfter);
}
@Test
public void testListGraphsMultiple() {
GraphContextGenerator graph1 = driver.graph("test-multi-1");
GraphContextGenerator graph2 = driver.graph("test-multi-2");
-
+
try {
// Create nodes in both graphs
graph1.query("CREATE (:TestNode {name:'test1'})");
graph2.query("CREATE (:TestNode {name:'test2'})");
-
+
// List graphs and verify both are included
List graphs = driver.listGraphs();
Assertions.assertNotNull(graphs);
- Assertions.assertTrue(graphs.contains("test-multi-1"),
- "Graph list should contain test-multi-1: " + graphs);
- Assertions.assertTrue(graphs.contains("test-multi-2"),
- "Graph list should contain test-multi-2: " + graphs);
+ Assertions.assertTrue(graphs.contains("test-multi-1"),
+ "Graph list should contain test-multi-1: " + graphs);
+ Assertions.assertTrue(graphs.contains("test-multi-2"),
+ "Graph list should contain test-multi-2: " + graphs);
} finally {
// Clean up both test graphs
graph1.deleteGraph();
diff --git a/src/test/java/com/falkordb/PipelineTest.java b/src/test/java/com/falkordb/PipelineTest.java
index e9ad384..9adb436 100644
--- a/src/test/java/com/falkordb/PipelineTest.java
+++ b/src/test/java/com/falkordb/PipelineTest.java
@@ -1,23 +1,23 @@
package com.falkordb;
-import java.util.*;
-
+import com.falkordb.graph_entities.Node;
+import com.falkordb.graph_entities.Property;
+import com.falkordb.impl.resultset.ResultSetImpl;
+import com.falkordb.test.BaseTestContainerTestIT;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import com.falkordb.graph_entities.Node;
-import com.falkordb.graph_entities.Property;
-import com.falkordb.impl.resultset.ResultSetImpl;
+import java.util.*;
-public class PipelineTest {
+public class PipelineTest extends BaseTestContainerTestIT {
private GraphContextGenerator api;
@BeforeEach
public void createApi() {
- api = FalkorDB.driver().graph("social");
+ api = FalkorDB.driver(getFalkordbHost(), getFalkordbPort()).graph("social");
}
@@ -220,26 +220,26 @@ public void testProfile() {
pipeline.query("CREATE (:person{name:'bob',age:25})");
pipeline.profile("MATCH (a:person) WHERE (a.name = 'alice') RETURN a.age");
List