I'm pleased to announce the release of cassandra-unit 1.2.0.1
Just as a reminder, cassandra-unit is a library to help you to start and load different type of dataset into an embedded Cassandra instance. Basically, the goal is to simplify the implementation of your unit tests in java.
There are 2 main new features in this release :
- the support of CQL3 script as a standard cassandra-unit dataset.
- the spring extension of cassandra-unit.
CQL3 support : embracing the new datamodel face of Cassandra
As you may know (or not ;-)) , the 1.2 version of Cassandra was released with major changes and a new remote protocol : binary CQL protocol. The main idea is with with new protocol is to get rid of some limitation with the Thrift protocol.
So with this new protocol come :
- a new version of the CQL language : CQL3
- a new java client driver : java-driver which appears to be the preferred way to query a cassandra instance. This driver is supported by the Datastax team (the company behind Cassandra)
- a new datamodel which is more "relational" oriented rather than a key/columns model (even if the storage is always based on this model). There is a lot of blog talking about that better than me :
So, as a first step this new release of cassandra-unit provide the ability to use CQL3 script as dataset to load data into your cassandra instance (embedded or not).
It implied internally some big modifications using the java-driver instead of Hector for the CQL3 part.
here is an example of use :
simple.cql :
CQLScriptLoadTest.cql :
thanks marcinszymaniuk for your contribution!
Spring extension
The other interesting feature provided in this release is the spring integration. I mean the ability to to use cassandra-unit with the Spring TestContest framework based on annotation.
As documented here, there was 3 ways to integrate cassandra-unit in your tests :
- the native approach
- using the AbstractCassandraUnitTestCase or AbstractCassandraUnitCQLTestCase
- using JUnit4 @Rule
The cassandra-unit-spring integration provide a new way to integrate cassandra-unit in your unit tests.
The documentation about the spring integration is here
Here is a small example :
simple.cql :
SpringCQLScriptLoadTest.java :
Thanks Olivier for your contribution!
2 comments:
Hi,
@Autowired not working, if I use The cassandra-unit-spring:
@TestExecutionListeners({ CassandraUnitTestExecutionListener.class })
Thanks,
Kamal
@anonyme : could you please repot the bug here : https://github.com/jsevellec/cassandra-unit
Post a Comment