Posts

Showing posts from March, 2013

Measuring overall code coverage in multi-module Maven project

Image
As we know unfortunately Maven has no out of the box support for different test types. There are in fact few open tickets for adapting Maven to different test strategies, like adding integrationTestSourceDirectory to POM model (MNG-2009) or new lifecycle phases for operating on integration test sources (MNG-2010) to replace necessity of using build-helper-maven-plugin.

But apart from separating varying tests from each other how can we use available mechanisms to invoke both unit and integration tests and measure theirs code coverage? I want to achieve such situation (maybe except the number of tests because I usually want to have a little bit more :)) on the Sonar dashboard:

We'll work on a simple maven project with the popular layout:

33rd Degree to knowledge

I'm not sure I can be treated as a java master, but fortunately thanks to Warsaw Java User Group I had a chance to attend the 33 Degree Conference. Schedule looked very impressive as there were many rock-star speakers and outstanding talks. It was really hard to choose valid path, but after taking some hard decisions I've created the custom agenda. I've never liked keynotes, so let me start from regular talks :)

I've already noticed that Estonia is quite unique in the market of superior Java tools - companies like ZeroTurnaround and Plumbr are doing really nice job. I like them especially when they are talking about as interesting things as JVM internals :) Nikita Salnikov-Tarnovski made very nice presentation titled How much memory do your objects really need? Apart from the fact that he is showman the talk was really interesing! He introduced java-object-layout tool which can analyze object layout schema in different JVM's - another advantage is that this projec…

As a developer I want to use XML extremely easily

A few days ago I needed to parse some reports in Java application. Recently I used for such tasks built-in features, but I can say they are not very user-friendly or intuitive. And I think that there's no reason to use something strange for implementing such simple things. I'll be much better to find very cool replacement. After spending some time googling I've checked that unfortunately there were nothing satisfactory. I've even started thinking about using Scala but luckily in last-ditch attempt I've found JOOX. Really weird name, but I've found out it's abbreviation from Java Object Oriented XML... hmmm - sounds promising :) Authors described it as "simple wrapper for the org.w3c.dom package, to allow for fluent XML document creation and manipulation where DOM is required but too verbose". For me it's enough to start looking for maven artifact:
org.jooqjoox1.1.0 Core element is the org.joox.JOOX class with static $ method (yes, yes - jQuery …

Speed Up with Fast Java and File Serialization

Since the first version of Java, day-by-day many developers have been trying to achieve at least as good of performance as in C/C++. JVM vendors are doing their best by implementing some new JIT algorithms, but there is still a lot to do, especially in how we use Java.
For example, there is a lot to win in objects<->file serialization - notably in writing/reading objects that can readily fit in the memory. I’ll try to shed some light on that topic.
All the tests were executed on the simple object shown below: 
public class TestObject implements Serializable { private long longVariable; private long[] longArray; private String stringObject; private String secondStringObject; //just for testing nulls /* getters and setters */ }
To be more concise I’ll show only the write methods (though the other way is quite similar, too). Full source code is available on my GitHub (http://github.com/jkubrynski/serialization-tests).