java.lang.Object
org.evomaster.client.java.controller.internal.db.cassandra.CassandraHandler

public class CassandraHandler extends Object
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 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 in CassandraSchemaTracer) are deliberately left untouched: like SqlHandler.schema and MongoHandler.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

      public void setCqlSession(Object cqlSession)
    • 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 (see CassandraSchemaTracer), so it can later be attached to empty-table hints in getExecutionDto().
    • getEvaluatedCqlCommands

      public List<CqlCommandWithDistance> 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 last reset().
    • 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.