Class ReflectionBasedNeo4jClient

java.lang.Object
org.evomaster.client.java.controller.internal.db.neo4j.ReflectionBasedNeo4jClient

public class ReflectionBasedNeo4jClient extends Object
Talks to the SUT's Neo4j driver through reflection, so that EvoMaster never has a compile-time dependency on neo4j-java-driver and cannot clash with whichever version the SUT ships. Mirrors the approach of ReflectionBasedRedisClient: every Class.forName / getMethod / invoke lives here, behind an ordinary typed API, so its callers hold no reflection of their own.

Only primitive projections cross this boundary (ids, label and type names, property maps), never the driver's own Node / Relationship types, which keeps the reflected surface down to Session.run, Result.list, Record.get and Value.as*.

  • Constructor Details

    • ReflectionBasedNeo4jClient

      public ReflectionBasedNeo4jClient(Object driver)
      Parameters:
      driver - the SUT's org.neo4j.driver.Driver
  • Method Details

    • session

      public Object session()
      Opens a session. The caller is responsible for passing it to close(Object).
    • close

      public void close(Object session)
    • runAndList

      public List<?> runAndList(Object session, String cypher)
      Runs a read-only Cypher query and returns its records.
    • runAndList

      public List<?> runAndList(Object session, String cypher, Map<String,Object> parameters)
      Runs a parameterised Cypher query and returns its records. Values travel as a parameter map rather than being interpolated into the query text, which avoids quoting and typing problems.
      Parameters:
      parameters - keys are parameter names without the leading $, values are the values to bind to them
    • detachDeleteAll

      public void detachDeleteAll()
      Empties the database: every node and every relationship attached to it.
    • get

      public Object get(Object record, String key)
      Reads the field key out of a Record.
    • asString

      public String asString(Object value)
    • asList

      public List<?> asList(Object value)
    • asMap

      public Map<String,Object> asMap(Object value)