domingo, octubre 14, 2012

NoSQLUnit is a JUnit extension to make writing unit and high-level tests of systems that use NoSQL as backend easier. Visit official page for more information.

In current release instead of supporting one new engine, I focused on implementing an embedded in-memoryRedis engine based on Jedis. Read in documentation the limitations on current implementation. And of course now NoSQLUnit also supports embeddedRedis apart from Managed and Remote, you only have to register EmbeddedRedis rule to use it.

Also I have extended the support to embeddedNeo4j engine by allowing the use of instance defined into Spring context file using spring data namespace. See next example that NoSQLUnit will populate data into instance defined in application context.

And finally in this version of NoSQLUnit, I have implemented that we can use Shard connections provided by Jedis library to populate defined data into different shards. The only thing you should do is changing configuration instance of RedisRule to ShardedRedisConfiguration. See next simple example:

miércoles, octubre 10, 2012

In current post we are going to see how to install hubot and make it work over XMPP protocol (using open fire server), and how can help us during our daily work.

Hubot is a robot which belongs to your chat infrastructure as one more user, which you can talk with him. Hubot can help you automate a lot of tasks, like deploy a site, manage your Pomodoro, or managing issue system to cite a few of them. Hubot is written in CoffeScript on Node.js, keep in mind that Hubot can be extended with CoffeScript and you can easily extend it.

This post is written using Ubuntu, so if you are using any other OS, you only have to modify the way of how components are installed.

First of all (I assume you have a JVM installed), you must install npm and node.js. For this I have used apt-get.

sudo apt-get install nodejs npm

Next step is installing Hubot dependencies by running next apt-get command.

Hubot is installed, to see if it works simply run from installation directory:

alex@grumpy:/opt/hubot$ ./bin/hubot

and Hubot shell will be started. This shell is really useful for testing purposes but not for production environment.

Hubot> hubot ping
Hubot> PONG

which will produce a Pong message.

Now it is time to install Openfire server so we can communicate with Hubot using XMPP protocol instead of shell. Of course you could choose any other XMPP server, but for now Openfire is used.

To install it, download it from openfiresite, and extract it to /opt directory.

tar -xzvf openfire_<version>.tar.gz
mv openfire /opt

Then it is time to configure Openfire server, we are going to use embedded database but of course you can configure an external database such as MySQL or Oracle.

A web-based wizard driven setup and configuration tool is built in Openfire, so let's start Openfire server for the first time and configure typical parameters like administrator username, server name, ...

$OPENFIRE_HOME/bin/openfire start

and access to http://localhost:9090.

Then log in as admin into Openfire and create first two users, developer and hubot. So go to Users/Groups -> Create New User, and fill required information for both users.

Next step is creating a room where all users that want to interact with Hubot will join. So go to GroupChat -> Create New Room and create a new room. In our case we are going to call hubot.

and finally we must disable TLS security, there is an issue between Openfire TLS version and node.js XMPP module so if you are using Openfire, you should disable it.

Next step is checking that developer user has access to hubot chatroom and the account is correctly configured, so we can open our XMPP client (in our case Spark) but should be work with any other one and verify that we can connect.

If you are using Spark, log in with developer account and in Actions menu you will find Join Conference room option. Setthere and choose previously created room (hubot). And now you know you have configured correctly XMPP part.

And now it is time for Hubot. First of all we are going to create a bot called my-bot:

alex@grumpy:/opt/hubot$ ./bin/hubot -c ./my-bot

Then enter into my-bot directory and open package.json and add next dependencies which configure adapter so Hubot can use XMPP protocol for communication: