Wednesday, May 1, 2013

New CrNiCKL version addresses issue with JUnit and Java 7

Version 1.2.1 of crnickl was released yesterday April 30, 2013. It comes with a small improvement to the API and addresses a problem with unit tests under Java 7

API improvement

The Database interface declares a new method named makeSurrogate to turn a string into a Surrogate. The string is typically produced by a surrogate's toString method. It was previously not possible to create a surrogate from such a string without making some assumptions and using low-level methods.

Issue with JUnit and Java 7

JUnit tests written with JUnit are usually short pieces of code which can be run independently of each other. However, when writing test cases for a database system, it is often handy to assume that test methods are executed in a predictable order, for example in source code order. Under this assumption, a first series of test methods populates the database, followed by a series of methods which modifies the data, and finally a series of methods which deletes the data.

Making this assumption was fine until upgrading to Java 7. The new implementation of the reflection API differs from its predecessors in such a way that JUnit now executes test methods in seemingly random order. This wreaks havoc when the order of tests is important.

To address this issue the @FixMethodOrder annotation has been introduced in JUnit 4.11. It can be used to force execution of test methods in alphabetical order.

Version 1.1.0 of crnickl-test uses this new annotation and renames some methods so that source order and alphabetical order agree. crnickl-test is a library providing common tests for all database drivers and is used by crnickl-jdbc and crnickl-mongodb.

The software can be found on GitHub and in Maven Central.

CrNiCKL project website

Tuesday, January 22, 2013

CrNiCKL driver for MongoDB released

A CrNiCKL driver for MongoDB was released yesterday. With this first NoSQL driver, developers have now the choice to run CrNiCKL services either on SQL or on NoSQL databases. A NoSQL database can be a good solution for accommodating huge datasets or to address replication or sharding requirements. On the other hand, when data integrity is paramount, it is better to stick with a good old SQL database and use the CrNiCKL driver for JDBC.

The drivers can be found on GitHub and in Maven Central.

CrNiCKL project website