Tuesday, February 17, 2015

Java Testing with Spock...introducing #spock #manning #java #book

Well tested code  is a concept that many developers talk about every day, lots of great authors write books and articles around it, several tools are being developed that aim to help developers to do it faster and efficiently.

Despite all the above, testing is something like a lost art, many development teams ignore it, do not do it at all, or it is considered as a waste of time!!! Look no further, poorly tested code (and systems) is one of the major reason that many of our software projects and code fail now-days. 

There are a few people that I have worked with all these years, that stick to their principles regarding quality in the code, testing and continuous refactoring. One of them is Kostis Kapelonis, who I had the pleasure to work with a couple of years ago under the same corporate roof, and is actively involved in our small Java community here in Athens.

 If the name sounds familiar, then most probably you might have attended one of his many presentations during our local Java User Group here in Athens or red some of his articles in InfoQ. A couple of weeks ago, Kostis sent  an email asking for help on reviewing his first draft chapters on an upcoming book, around Spock, another cool and interesting tool, that aims to take it's place (hopefully) in our every day testing tool set as Java developers.

Despite the fact that I still have not used Spock in my day job (projects), reading these  drafts chapters helped me discover a new tool with similar concepts comparing to tools I am already familiar with  eg Mockito, Jmock + a yet another reason to study Groovy. I always enjoyed Kostis's presentations and I find his writing simple and clear.

So if you love well tested code, if you love Groovy or you feel that your current testing tool set does not cut it towards your needs, have a look on Java Testing with Spock which currently has just entered the MEAP 'phase' in Manning. Maybe Spock is something you should review and assess, so why not let an expert guide you through the process!

: ) 


I am very very happy and proud that the list with Greek book authors (especially Java freaks, is getting bigger), my other fav one is Patroklos. I hope one day to join them as well!

Sunday, February 01, 2015

How to install 3 popular NoSQL databases for development in MacOSX for newbies Part 3 (CouchBase ) #nosql #couchbase

In this post we are going to install CouchBase, a NoSQL database that has gained a lot of momentum latetly. CouchBase is very very developer friendly in terms of setting up and getting started time. Actually is the simplest. It offers a single download for many platforms (including MacOSX). You can find them here.

It is dead simple, as already described in the instructions. Just download, unzip and move the CouchBaseServer.app to your Applications folder or anywhere else you like. Done!

In order to start the server just double click on the .app, and a small icon will be loaded on your top right corner of the menu.

 The server will start and by pressing the Open Admin Console link, you will be redirected to a web page with the Server's Admin console (

That's it, the admin console, offers you similar functionality to a GUI client, so you can review and manipulate your buckets, views etc!

Easy! So easy that you must try it!!! : )

How to install 3 popular NoSQL databases for development in MacOSX for newbies Part 2 (Cassandra ) #nosql #cassandra #datastax

In this post we will install on our local MacOSX (Yosemite) environment, another famous NoSQL database, the Apache Cassandra. As a developer, I found Datastax, community packaging of Cassandra, very handy, seems they offer ready made MacOSX specific packages. 

You can of course download and install the the tarballs from Apache or use their virtual box images,  offered in the site.

We will be downloading Datastax Community Cassandra edition from here. The current version is 2.1.2, after downloading the tar.gz file, I will be extracting it, to a folder similar to the previous post of MongoDB. So my cassandra installation will be  under


Eventually that is all about (I assume you already have Java/JDK installed on your MacOSX). If not please check this post.

Your Cassandra folder should like the image below:

In order to start your test Cassandra cluster and nodes, just type the following

> cd \home\work\dsc-cassandra-2.2.1\bin\(or whatever is your path)

> ./cassandra -f 

The -f switch will start the process in the foreground, so it would be easier for starters to shutdown the process by pressing Ctrl +C .

 If you omit the -f, the process will start by default in the background and in order to stop you need to use the kill command and search for the process. More info here.

Well this is it, easy enough. When your cluster starts you should see something like the image below in your command line window.

What about a gui client for starters?

Well, Datastax offers a very handy client called DevCenter. 
Download the MacOSX, tar.gz, and extract it to a folder similar to the one, we extracted cassandra.


Double click on the DevCenter.app . It is actually a tool based on Eclipse. Create a new connection as shown in the image below.

You can play around and create a DEMO keyspace as shown below.

You can find  a very simple intro post here.


How to install 3 popular NoSQL databases for development in MacOSX for newbies Part 1 (mongodb) #nosql #mongodb #cassandra #couchbase #part1

This post aims to help all developers (not only Java) that want to develop using NoSQL datastores, specifically MongoDB, Cassandra and Couchbase, in MaOSX. Before starting writing code you need to have the db engines installed and ready for tests. So our goal for these mini posts will be to  install all of them in our local environment and then start coding. (My goal is to write some coding posts using all of them, in the upcoming days).

I am currently using MacOSX 10.10.2 (Yosemite), I have already installed Maven 3.2.x and Java JDK 1.8 in my machine. If you need help as a junior java developer in MacOSX, then I suggest you go through this post


You need to download the binaries for MacOSX, which can be found here. Then, extract the .tgz file to a folder of your choice, for my case is a directory called


After doing that you should have within the mongodb directory the following contents, as illustrated in the image below

We are almost there, all we need to do is create with the same director (could be anywhere else actually) a directory called data .  As illustrated in the image below.

 This is the directory where our mongodb instance will save it's data files. In order to start up our MongoDB instance, from the command line we need to issue the following command

> cd \home\work\mongodb\bin

> mongod --dbpath ../data

We should see something like the following, below :

Since I want to make my life easier, using the .profile file I have created an alias command that will start my test mongo, without having to make the 2 steps above. So if you edit your .profile under your home directory, you can add an alias the like the following:(beware these are my local, paths dont forget to change them).

alias startmongo='/Users/papo/work/mongodb/bin/mongod --dbpath /Users/papo/work/mongodb/data/'

So you can issue from command line the command >startmongo and your mongodb instance will start!

What about a client to check our database, maybe create some documents?

 RoboMongo is a nice MongoDB client for MacOSX! Easy to setup and use.

After downloading it, we setup a new connection, with the minimum information.

 And we are ready to go.