All,

I have a question about how to use the EmbeddedCassandraService in unit
tests.  I wrote a short collection of unit tests here:

https://github.com/wibiclint/cassandra-java-driver-keyspaces

I'm trying to start up a new EmbeddedCassandraService for each unit test.
I looked at the Cassandra source code to try to see how that happens there
and replicated it as well as I could here.  My first unit test works great,
but in subsequent unit tests I get this error:

java.lang.RuntimeException: java.io.FileNotFoundException:
target/cassandra/data/system/schema_keyspaces/system-schema_keyspaces-jb-2-Data.db
(No such file or directory)

I assume that this is because I am not shutting down the
EmbeddedCassandraService in the first unit test correctly (I do not have
any @After method).

Does anyone have any advice on how to clean up the EmbeddedCassandraService
between unit tests?  I can instead create the EmbeddedCassandraService in a
static @BeforeClass method and then have every unit test use a different
keyspace, but that strikes me as somewhat sloppy and I'd rather understand
what I'm doing well enough to be able to have one service per test if
necessary.

Thanks!

Best regards,
Clint

Reply via email to