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

public class Neo4jHandler extends Object
Acts upon Cypher queries executed by the SUT (captured as Neo4JRunCommands): for each captured query it computes how close the live graph is to satisfying it, as a distance to minimize. Only MATCH queries are scored; a query that does not parse as a MATCH (e.g. a write) is skipped.
  • Constructor Details

    • Neo4jHandler

      public Neo4jHandler()
      Creates a handler with heuristic calculation enabled.
  • Method Details

    • reset

      public void reset()
      Clears data collected for the current action.
    • isCalculateHeuristics

      public boolean isCalculateHeuristics()
      Returns:
      whether Neo4j heuristic calculation is enabled
    • setCalculateHeuristics

      public void setCalculateHeuristics(boolean calculateHeuristics)
      Enables or disables Neo4j heuristic calculation.
      Parameters:
      calculateHeuristics - new calculation state
    • setNeo4jConnection

      public void setNeo4jConnection(Object neo4jConnection)
      Sets the driver used to read the live graph.
      Parameters:
      neo4jConnection - the SUT's org.neo4j.driver.Driver, or null if it has none
    • handle

      public void handle(org.evomaster.client.java.instrumentation.Neo4JRunCommand info)
      Registers one intercepted Cypher query.
      Parameters:
      info - intercepted query
    • getEvaluatedNeo4jCommands

      public List<Neo4jCommandWithDistance> getEvaluatedNeo4jCommands()
      Evaluates all registered queries against a single snapshot of the graph, and consumes them. The snapshot is read once per action rather than per query, since the SUT is not running while the heuristics are computed.
      Returns:
      evaluated queries for the current action