Class Neo4jHandler
java.lang.Object
org.evomaster.client.java.controller.internal.db.neo4j.Neo4jHandler
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluates all registered queries against a single snapshot of the graph, and consumes them.voidhandle(org.evomaster.client.java.instrumentation.Neo4JRunCommand info) Registers one intercepted Cypher query.booleanvoidreset()Clears data collected for the current action.voidsetCalculateHeuristics(boolean calculateHeuristics) Enables or disables Neo4j heuristic calculation.voidsetNeo4jConnection(Object neo4jConnection) Sets the driver used to read the live graph.
-
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
Sets the driver used to read the live graph.- Parameters:
neo4jConnection- the SUT'sorg.neo4j.driver.Driver, ornullif it has none
-
handle
public void handle(org.evomaster.client.java.instrumentation.Neo4JRunCommand info) Registers one intercepted Cypher query.- Parameters:
info- intercepted query
-
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
-