Class CassandraHandler
java.lang.Object
org.evomaster.client.java.controller.internal.db.cassandra.CassandraHandler
Acts upon CQL commands executed by the SUT against a Cassandra database. It buffers the
SELECT/UPDATE/DELETE commands intercepted via instrumentation and, on demand, computes a
heuristic distance for each: the target table's full contents are re-fetched (via reflection
against the live
CqlSession, so no compile-time dependency on the Cassandra driver is
needed) and evaluated with CassandraHeuristicsCalculator, to guide the search towards
making the WHERE clause satisfiable.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionComputes the heuristic distance for every buffered CQL command, draining the buffer in the process, and returns the accumulated results across all rounds since the lastreset().org.evomaster.client.java.controller.api.dto.database.execution.CassandraExecutionsDtovoidhandle(org.evomaster.client.java.instrumentation.cassandra.CassandraTableMetadata info) Records a table's column schema, read directly off the Cassandra driver's own metadata the first time a query references that table (seeCassandraSchemaTracer), so it can later be attached to empty-table hints ingetExecutionDto().voidhandle(org.evomaster.client.java.instrumentation.ExecutedCqlCommand info) Buffers an intercepted CQL execution.booleanbooleanvoidreset()Clears the CQL commands and empty-table queries buffered for the current test, along with their computed distances.voidsetCalculateHeuristics(boolean calculateHeuristics) voidsetCqlSession(Object cqlSession) voidsetExtractCqlExecution(boolean extractCqlExecution)
-
Constructor Details
-
CassandraHandler
public CassandraHandler()
-
-
Method Details
-
reset
public void reset()Clears the CQL commands and empty-table queries buffered for the current test, along with their computed distances. Table schemas (tableSchemas, and the cache inCassandraSchemaTracer) are deliberately left untouched: likeSqlHandler.schemaandMongoHandler.collectionSchemas, a table's shape doesn't change over the course of a search, so it's captured once (the first time a table is referenced) and kept for the life of the run rather than re-derived every test. -
setCqlSession
-
isCalculateHeuristics
public boolean isCalculateHeuristics() -
isExtractCqlExecution
public boolean isExtractCqlExecution() -
setCalculateHeuristics
public void setCalculateHeuristics(boolean calculateHeuristics) -
setExtractCqlExecution
public void setExtractCqlExecution(boolean extractCqlExecution) -
handle
public void handle(org.evomaster.client.java.instrumentation.ExecutedCqlCommand info) Buffers an intercepted CQL execution. Only SELECT, UPDATE and DELETE are kept: those are the only statements with a WHERE clause whose satisfiability is worth guiding the search towards (an INSERT/DDL command has no WHERE to compute a distance against). -
handle
public void handle(org.evomaster.client.java.instrumentation.cassandra.CassandraTableMetadata info) Records a table's column schema, read directly off the Cassandra driver's own metadata the first time a query references that table (seeCassandraSchemaTracer), so it can later be attached to empty-table hints ingetExecutionDto(). -
getEvaluatedCqlCommands
Computes the heuristic distance for every buffered CQL command, draining the buffer in the process, and returns the accumulated results across all rounds since the lastreset(). -
getExecutionDto
public org.evomaster.client.java.controller.api.dto.database.execution.CassandraExecutionsDto getExecutionDto()- Returns:
- the CQL commands whose WHERE clause was not satisfied by any row, as a data-generation hint.
-