*More* Unit Testing Cassandra with Maven
Nearly two years ago (wow) I wrote about unit testing with Maven/Cassandra in Unit testing Cassandra with Maven. Well, the project I was working on got a little sidetracked, but I came back to it with a vengeance this month to try and bring it to completion. I moved development hosts, and ran into a few small issues with how I set up the build environment (great for getting ready for a continuous integration setup). At the same time, I thought I'd bring myself up to date from Cassandra 0.7 to 1.1.2. That's where all the trouble began!
First things first - version control. I'm an avid git user - github is my second home for all my code. Suffice it to say that I neglected to branch my trunk for this. Not only was I hoping the upgrade would be painless, I was looking to implement some features this past weekend as well, not just upgrade my Cassandra versions. Well, that went south really quick, and I wasn't allowed to work on other things until I fixed this upgrade issue. All because I failed to issue:
"git checkout -b cassie-1.1-upgrade"
I could make all my destructive changes in that branch, and continue working on other features/bugs in my project in other branches. But because I broke my branch - not only wouldn't my unit tests pass, but mostly it wouldn't compile at all - I couldn't work productively on anything else. So note folks - for major destructive work like this, ALWAYS branch.
The next phase of this project was updating the dependencies.
org.apache.cassandra:cassandra-all:1.1.2
org.apache.cassandra:cassandra-thrift:1.1.2
org.apache.thrift:libthrift:0.8.0
me.prettyprint:hector-core:1.0-5
That took care of the Cassandra dependencies for my project. But an interesting thing happened - EmbeddedServerHelper no longer obeyed the KeySpace definitions in cassandra.yaml - in order to load my schema I had to come up with another option. Thanks to the maven-failsafe-plugin, and the cassandra-maven-plugin, I can fork each of my unit tests and get a newly scrubbed/loaded/initialized schema to run my testcases against. This clearing is important, by running this way, so far I've yet to lose any data in my two-tier test-cases (Integration tests, not so much at the moment). So having an easy to use, easily document schema that could be loaded upon first server startup - that was huge - and now it was missing.
[ more to come ]