jsevellec / cassandra-unit

Utility tool to load Data into Cassandra to help you writing good isolated JUnit Test into your application
GNU Lesser General Public License v3.0
425 stars 0 forks source link

Check the session's status #333

Closed ex0ns closed 3 months ago

ex0ns commented 2 years ago

I wanted to integrate the EmbeddedCassandraServer with a migration tool, however this migration management tool would close the sessions that is was provided with. As far as I could see, there are now way to re-establish a connection that was closed inside this project.

This simple fix allow us to call re-create a valid session after the migration by calling getSession (which would trigger a new initSession). This is however not the perfect fix because a lot of private methods access the session field directly and would still try to used a closed session if the second call to initSession is made.

It also seems that some abstract classes such as AbstractCassandraUnit4CQLTestCase are storing the first session they receive and would not benefit from an updated call to getSession in the underlying CassandraCQLUnit object.

What do you think ?