Search code examples
cassandranosqlcassandraunitembedded-cassandra

Embedded Cassandra: how to apply a script?


I want to write tests against the data access layer powered by Cassandra. So I use Embedded Cassandra with Astyanax and cassandra-unit, but I can't find the way to load a script which contains something like this into the embedded instance:

create column family user_profiles
    with key_validation_class = UTF8Type
     and comparator = UTF8Type
     and column_metadata = [
       {column_name: first_name, validation_class: UTF8Type},
       {column_name: last_name, validation_class: UTF8Type},
       {column_name: email, validation_class: UTF8Type},
       {column_name: year_of_birth, validation_class: IntegerType}
     ]

Is there a way to do it? Will the solution work if I switch to CQL3 in my script?


Solution

  • the last release of cassandra-unit (1.2.0.1) provide what you need : a CQL3 script integration. https://github.com/jsevellec/cassandra-unit/wiki/changelog