Generate random test data using DataFactory

Unit testing, integration testing or any other testing requires input data. And to generate this input data which is close to the real world format example x.getAddress() returns “Crescent Services located at 1085 Cloveridge Boulevard” could be a quite a task if one has to write some code to generate it randomly. To make the testing easier one has to make use of some library which would give all the data required. There might be other libraries available but my personal choice is DataFactory. Straightforward and simple to use, many helpful methods like fetching a random date between a range, getDateOfBirth(), getEmailAdress() and so on,

Andrew Gibson himself has written a good article on java.dzone

Recension av Clean Code: A Handbook of Agile Software Craftsmanship

Clean Code är skriven av Robert C. Martin, även känd som Uncle Bob. Han har arbetat som mjukvaruutvecklare sen 70-talet, är engagerad i agil utveckling och en förespråkare av testdriven utveckling. På denna länk finns kod utvecklad av Uncle Bob: Där finns bland annat FitNesse som tas upp som exempel i boken. Continue reading

Data validation made simple using Bean Validator

There are many validation frameworks out there. But the one that we are going talk about is Bean Validation API (JSR 303).  With Annotations and a simple API it is quite straight forward to express constraints on data; objects. The implementation’s that I have come across are from Apache and Hibernate. An example say’s more than 1000 words as mentioned on Hiberate Validator site.

public class Car {

   private String manufacturer;
 Continue reading 

JFocus 2013 PM

Continued from JFocus 2013 AM

When we had attended the web sockets / web service hands-on lab, I went on to the next session, Simon Ritter had a 3½ hours session about the raspberry pi.

To sum up, the raspberry pi is a credit card sized computer with 512 MB memory, 1 GHz ARM Cortex. It has powerful (compared to its size) graphics capabilities, that makes it possible, to run HDMI. It is built to run Linux and there is a lot of different distributions, but there is an Android build in the making.

The interesting part here is the graphics processor built in the processor. Since this was a lab and everyone could not bring a screen and keyboard and mouse to the lab we used our laptops, accessing the Linux build through VNC, and in this case the VNC client was running the graphics on the CPU.

Now this is normally not a problem but since the hands-on lab was about implementing Java FX on the raspberry pi platform and learning about how to use a small powered CPU and Graphics processor with Java FX that can be quite demanding, this proved to be a minor flaw in the course.

Given that the demonstration was about how powerful the GPU was and the VNC client did not access the GPU, the demonstration failed.

The course about Java FX was rich and I learned a lot about another way of using the Java FX, but in general bad execution made several of the attendants to leave the class room.

JFocus 2013 AM

I was so fortunate to attend to jFocus this year. Though it was this sprint I wanted to wrap up the year by going through the events I attended.

The first course I attended was a Hands-on Lab where we looked through Websockets and Webservices, two subjects that I am personally interested in. The main examples lets us make and run a basic website called movieplex. The main page is a template website that is connected with basic html to a web service.

When we went through the lab, some of the technology was so new that we needed to download the newest versions of glassfish the application server we used, and the newest version of java 7.

The Lab was separated in to two parts, first part was building the web service, going through the basic of JAX-RS and the second part was connecting to the web service to the web socket.

The connection of the web socket to the web service, was painless and with minimal effort, just adding a few lines of code to the project.
I have included the project files, if you are interested in trying out the lab yourself.

javaee7-hol page_white_acrobat lab-guide page_white_acrobat