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
424 stars 1 forks source link

How To Specify Datacenter? #273

Open hleb-albau opened 6 years ago

hleb-albau commented 6 years ago

Hi, we have multidc cassandra cluster. In my tests I want to create embedded cassandra with specified DC. Can't find any info on this topic. Is it possible?

hleb-albau commented 6 years ago

@jsevellec Can I provide pull request, that will change snitch to GossipingPropertyFileSnitch with rackdc.properties files configuration inside @EmbeddedCassandra? I Create local implementation, all works fine.

jsevellec commented 6 years ago

The goal of cassandra-unit is to be able to unit test your cassandra calls from your application against one embedded instance of Cassandra. Not sure about your request, can you explain it a bit more in details?

hleb-albau commented 6 years ago

@jsevellec My goal is to write tests for service, that connects to specific cassandra DC. So, for current service, I want to up cassandra with specific DC. Current cassandra-unit uses Datacentreless configuration (SimpleSnitch with SimpleStrategy replication policy) and by default start cassandra with dc=datacenter1. I can provide PR, that will enable GossipingPropertyFileSnitch, that will turn-on possibility to run cassandra with specificied DC and NetworkTopologyStrategy. By default logic will remain same, so there are no interoperability issues. If user wants to specify cassandra DC, she would use @EmbeddedCassandra(rackdcConfiguration="file.properties") annotation. See my commit: https://github.com/cybercongress/cyber-search/commit/2cd201ab858ce2209c98ca33896c8b1ba15a0819