gitlab-ci: enable neo4j
authorJean Privat <jean@pryen.org>
Wed, 20 Feb 2019 03:39:10 +0000 (22:39 -0500)
committerJean Privat <jean@pryen.org>
Thu, 21 Feb 2019 16:22:20 +0000 (11:22 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

.gitlab-ci.yml
lib/neo4j/neo4j.nit
tests/gitlab_ci.skip
tests/test_neo.args
tests/test_neo4j.nit
tests/test_neo4j_batch.nit

index fdad845..0c4e0a7 100644 (file)
@@ -2,8 +2,12 @@ image: nitlang/nit-ci
 
 services:
   - mongo
+  - neo4j:2.3
   - postgres
 
+variables:
+  NEO4J_AUTH: none
+
 cache:
   paths:
     - .ccache
index 665ecdb..a5f128a 100644 (file)
 
 # Neo4j connector through its JSON REST API using curl.
 #
-# For ease of use and testing this module provide a wrapper to the `neo4j` command:
-#
-#     # Start the Neo4j server
-#     var srv = new Neo4jServer
-#     assert srv.start_quiet
-#
 # In order to connect to Neo4j you need a connector:
 #
 #     # Create new Neo4j client
-#     var client = new Neo4jClient("http://localhost:7474")
+#     var client = new Neo4jClient("http://neo4j:7474")
 #     assert client.is_ok
 #
 # The fundamental units that form a graph are nodes and relationships.
@@ -66,39 +60,9 @@ module neo4j
 import curl_json
 import error
 
-# Handles Neo4j server start and stop command
-#
-# `neo4j` binary must be in `PATH` in order to work
-class Neo4jServer
-
-       # Start the local Neo4j server instance
-       fun start: Bool do
-               sys.system("neo4j start console")
-               return true
-       end
-
-       # Like `start` but redirect the console output to `/dev/null`
-       fun start_quiet: Bool do
-               sys.system("neo4j start console > /dev/null")
-               return true
-       end
-
-       # Stop the local Neo4j server instance
-       fun stop: Bool do
-               sys.system("neo4j stop")
-               return true
-       end
-
-       # Like `stop` but redirect the console output to `/dev/null`
-       fun stop_quiet: Bool do
-               sys.system("neo4j stop > /dev/null")
-               return true
-       end
-end
-
 # `Neo4jClient` is needed to communicate through the REST API
 #
-#     var client = new Neo4jClient("http://localhost:7474")
+#     var client = new Neo4jClient("http://neo4j:7474")
 #     assert client.is_ok
 class Neo4jClient
 
@@ -142,7 +106,7 @@ class Neo4jClient
 
        # Save the node in base
        #
-       #     var client = new Neo4jClient("http://localhost:7474")
+       #     var client = new Neo4jClient("http://neo4j:7474")
        #
        #     # Create a node
        #     var andres = new NeoNode
@@ -198,7 +162,7 @@ class Neo4jClient
        # Save the edge in base
        # From and to nodes will be created.
        #
-       #     var client = new Neo4jClient("http://localhost:7474")
+       #     var client = new Neo4jClient("http://neo4j:7474")
        #
        #     var andres = new NeoNode
        #     var kate = new NeoNode
@@ -247,7 +211,7 @@ class Neo4jClient
 
        # Retrieve all nodes with specified `lbl`
        #
-       #     var client = new Neo4jClient("http://localhost:7474")
+       #     var client = new Neo4jClient("http://neo4j:7474")
        #
        #     var andres = new NeoNode
        #     andres.labels.add_all(["Human", "Male"])
@@ -273,7 +237,7 @@ class Neo4jClient
 
        # Retrieve nodes belonging to all the specified `labels`.
        #
-       #     var client = new Neo4jClient("http://localhost:7474")
+       #     var client = new Neo4jClient("http://neo4j:7474")
        #
        #     var andres = new NeoNode
        #     andres.labels.add_all(["Human", "Male"])
@@ -389,7 +353,7 @@ end
 #
 # Example:
 #
-#     var client = new Neo4jClient("http://localhost:7474")
+#     var client = new Neo4jClient("http://neo4j:7474")
 #     var query = new CypherQuery
 #     query.nmatch("(n)-[r:LOVES]->(m)")
 #     query.nwhere("n.name=\"Andres\"")
@@ -508,7 +472,7 @@ end
 # Then we can link the entity to the base:
 #
 #     # Init client
-#     var client = new Neo4jClient("http://localhost:7474")
+#     var client = new Neo4jClient("http://neo4j:7474")
 #     client.save_node(andres)
 #     # The node is now linked
 #     assert andres.is_linked
@@ -600,7 +564,7 @@ end
 #
 # Creating new nodes:
 #
-#     var client = new Neo4jClient("http://localhost:7474")
+#     var client = new Neo4jClient("http://neo4j:7474")
 #
 #     var andres = new NeoNode
 #     andres.labels.add "Person"
@@ -713,7 +677,7 @@ end
 #
 # Create a relationship:
 #
-#     var client = new Neo4jClient("http://localhost:7474")
+#     var client = new Neo4jClient("http://neo4j:7474")
 #     # Create nodes
 #     var andres = new NeoNode
 #     andres["name"] = "Andres"
@@ -806,7 +770,7 @@ end
 #
 # Example:
 #
-#     var client = new Neo4jClient("http://localhost:7474")
+#     var client = new Neo4jClient("http://neo4j:7474")
 #
 #     var node1 = new NeoNode
 #     var node2 = new NeoNode
@@ -1013,7 +977,7 @@ end
 # This is a representation of a neo job in JSON Format
 #
 # Each job description should contain a `to` attribute, with a value relative to the data API root
-# (so http://localhost:7474/db/data/node becomes just /node), and a `method` attribute containing
+# (so http://neo4j:7474/db/data/node becomes just /node), and a `method` attribute containing
 # HTTP verb to use.
 #
 # Optionally you may provide a `body` attribute, and an `id` attribute to help you keep track
index 376b9da..5d4f23a 100644 (file)
@@ -3,7 +3,6 @@ emscripten
 java
 glsl
 mpi
-neo
 objc
 action_nitro
 asteronits
index a1ee088..46fe939 100644 (file)
@@ -1 +1 @@
-localhost 7474 test_prog/test_prog.nit
+neo4j 7474 test_prog/test_prog.nit
index 974a80a..d240047 100644 (file)
@@ -17,12 +17,9 @@ import neo4j
 # key used to loosely assume unicity and prevent conflicting db accesses
 var key = "NIT_TESTING_ID".environ.to_i
 
-var srv = new Neo4jServer
-srv.start_quiet
-
 print "# Test local\n"
 
-var client = new Neo4jClient("http://localhost:7474")
+var client = new Neo4jClient("http://neo4j:7474")
 assert client.is_ok
 
 # Clear the previous objects, if any
@@ -91,7 +88,7 @@ print "{kate["name"].to_s} IS LOVED BY {kate.in_nodes("LOVES").first["name"].to_
 
 print "\n# Test lazy\n"
 
-client = new Neo4jClient("http://localhost:7474/")
+client = new Neo4jClient("http://neo4j:7474/")
 assert client.is_ok
 
 # Read Andres
index 464eb2f..499f7ef 100644 (file)
@@ -14,9 +14,6 @@
 
 import neo4j
 
-var srv = new Neo4jServer
-srv.start_quiet
-
 # key used to loosely assume unicity and prevent conflicting db accesses
 var key = "NIT_TESTING_ID".environ.to_i
 
@@ -37,7 +34,7 @@ kate["status"] = false
 var loves = new NeoEdge(andres, "LOVES", kate)
 loves["since"] = 1999
 
-var client = new Neo4jClient("http://localhost:7474")
+var client = new Neo4jClient("http://neo4j:7474")
 assert client.is_ok
 
 # Clear the previous objects, if any
@@ -64,7 +61,7 @@ var andres_url = andres.url.to_s
 var kate_url = kate.url.to_s
 var loves_url = loves.url.to_s
 
-client = new Neo4jClient("http://localhost:7474")
+client = new Neo4jClient("http://neo4j:7474")
 assert client.is_ok
 
 # Read Andres