Developing software is fun. Developing software that is well tested, where those tests run quickly is even more fun.
Stubbed Cassandra is an open source tool that enables you to test applications that use Cassandra in a quick, deterministic way.
It is especially aimed edge case testing such as read and write timeouts.
It acts as a real Cassandra instance and can be primed to respond with results or with exceptions like read timeouts. It does this by implementing the server side of the CQL binary protocol.
It is separated into two components:
- Java Client: Java client for Scassandra. A thin Java wrapper around Scassandra that allows Java projects to depend on Scassandra via maven dependency and have a programmatic interface for starting/stopping and priming.
- Scassandra Server: Stubbed Scassandra server. Only go here if you’re insterested in running Stubbed Cassandra without a build tool such as maven or gradle. Implemented in Scala, can be run as a standalone server or depended on via the Java client. Doesn’t have an embedded Cassandra, is a standalone implementation of the server side of the Cassandra native protocol. You can prime the server to return rows, read timeout and write timeout via a REST API.
Scassandra, currently v1.1.0, is aimed at Java developers so most of the information is on the Java Client section of the website. It also may be used as a standalone jar.
- #181 - Record ‘USE ' queries in activity log
- #171 - Protocol 3 and 4 support. Migrate cql-antlr into tree as submodule.
- #167 - Provide CORS support to Scassandra endpoints
- #157 - Share ActorSystem between Scassandra instances
- #155 - Add getters for thens in multi-prime requests
- #151 - Allow priming of config using config object
- #154 - Provide custom configuration for batch result
- #149 - Introduce alias for Then to avoid reserved word issues
- #150 - Handle invalid types with an informative error message
- #148 - Use shapeless 2
- #147 - Akka configuration fix
- #141 - Add ability to retrieve prepared multi primes
- #140 - Support for clearing prepared multi primes
- #139 - Delay support for batch statements
- Multi prime API.
- Log better error message for timeout binding to ports
- #112 - Prime Result that closes connection
- #115 - Archive standalone jar
- Batch support
- Ability to see currently connected clients and kill connections
- Java 6 suppport for those still sadly using it
- Verification for when a prepared statement is prepared
- Fat jar support
- Capturing of query parameters for non-prepared statements
- Noving to a single build for server, client and tests.
- Support for priming specific errors e.g the number of replicas responded rather than just that it wsa a read/write timeout
- Removed support for version 1.* of the Java DataStax driver due to classpath issues (you can still use 2.* with Cassandra 1.2 and it will work)
- Support for maps of any type
- New method for priming types: CqlType (the ColumnTypes enum has been deprecated)
- Prepared statement matcher now handles maps
- Support for lists and sets of any type
- Prepared statement matcher that handles matching the varialbe list correctly
- [Feature #50] Support adding a fixed delay to both queries and prepared statements
- [Feature #52] Cassandra 2.1 support
- [Feature #53] JUnit matchers for queries and prepared statements
- Text map maps support: varchar, ascii and text
- Can use a queryPattern rather than a query for priming, making knowing the exact query the application will execute no longer necessary
- [Bug #49] QueryPattern for prepared statements for error scenarios do not work
- Lists and sets of the character types: varchar, ascii and text
- JUnit rule for Java Client
- Priming of queries with columns of all the primitive types (no suport for collections/custom tyes).
- Priming of prepared statements. The variable (?s) types and response types can be any of the primitive types.
- Retrieval of a list of all recorded queries.
- Retrieval of a list of all the recorded executed prepared statements. If the prepared statement has been primed then the variable values are also visible.
- User defined types
- Retrieval of a list of all prepared statements even if they haven’t been executed.
- Priming of tables rather than queries. Currently Scassandra does not parse the query and compares an executed query with all the primes query field. This would be very useful for priming the system keyspace as certain drivers expect the same thing to be in system.local but do slightly different queries to retireve it.
For feature requests and bug reports raise an issue at the Github issues page
Any questions ping me on twitter: @chbatey
- Christopher Batey (@chbatey)
- Andrew Tolbert
- Dogan Narinc