Sunday, December 11, 2005

Eclipse Logfile Viewer plug-in

While working with Eclipse 3.0 I used for a while a very nice Eclipse log file viewer plug-in which I lost while upgrading from one Eclipse 3.1 milestone to another. I think I also did not need to use one for a while.

Recently again I thought it would be nice to have a log file viewer in Eclipse directly. During my research for a log file viewer I came across a logfile viewer available via http://www.mimo.ch. I installed it on my Eclipse 3.1 and it does a very nice job. What I like especially about the plug-in is the coloring of log statements that match a given string.

Microsoft's answer to Google Maps

I just came accross Microsofts answer to Google maps:

http://local.live.com

I like the google map type better than the one here or in Yahoo. What I like about Yahoo maps is the address book and with local.live.com the printing selection.

If Google would allow to save addresses and to fine tune the printing, it would be my first choice. For now I have to switch between Google and Yahoo maps.

Sunday, November 13, 2005

The Principle of Subsumption

Explain the principle of Subsumption, also known as the Liskov Substituiton Principle.

From Joshua Bloch and Neal Gafter's Java Puzzlers book:

This principle says that everything you can do with a base class, you can also do with a derived class. Subsumption is an integral part of the natural mental model of object-oriented programming. Whenever it is violated, a programm becomes more difficult to understand.

Measure time with two ropes and some matches

Imagine you have two ropes of different sizes. Both ropes are not of consistent thickness, i.e. each rope can be at one point thick and at another one very thin. All you know is, that each rope takes exactly one hour to burn completely.

How can you measure exactly 45 minutes by burning the ropes and without any other tool to be used than a match?

Java String Class

Assume there is no String class in Java. Implement one and optimize it. How would you do it?

Sunday, October 16, 2005

Eclipse Update 3.1.1

Usually I am pretty current with all the Eclipse development. If a new milestone build come out, I am there to download it and install it. Since 3.1 I got a bit behind. 3.1 works so nice for me right now and seems to cover all my wishes, that I totally ignored milestone builds for Eclipse 3.2. If I say ignore, that is not true. I just was not aware that there are already two milestone builds for the next version. Today I discovered it. I also noticed that there is an update from Eclipse 3.1 to 3.1.1. This update can be done using the Update Manager.

More information can be found at: http://www.eclipse.org/eclipse/platform-releng/updatesfor3.1.1.html.

Test Coverage with Coverlipse

I am usually creating software project reports with some of the tools coming with Maven and which are very nicely integrated into the project web sites that Maven can produce.

Yesterday I came across a similar tools that comes as Eclipse plugin: Coverclipse.

I installed Coverclipse on my eclipse 3.1 version at home, which I usually do first before I decide to use it at work. The plug-in can be installed with the Eclipse Software Update manager.

A first run on a rather small project seemed to end in an endless loop. I might be wrong but I had the feeling that something was wrong and tried to terminate it, but could not succeed. After restarting Eclipse I was more cautious and explicitly named the package I wanted to include and switched anything else to be excluded from the coverage test. It might be that Coverlispe just wanted to cover everything that is somehow referenced it the project. After setting the filters Coverlipse executed all my JUnit tests in a timely manner. After Coverlipse executs your JUnit tests, it marks in the Eclipse editor on the left bar all lines which are covered with a green check mark and all lines which are uncovered with a red exclamation point. This is very helpfull but one can look at this at a bit dominante. Luckily the Coverlipse Class View has a button that allows to clear all results which also makes the markers on the editor bar vanishing.

I usually do not write unit tests for getters and setters. Coverlispe marks those methods red, which means they are not covered by unit tests. While this is true and undeniable, I wish there would be some filter mechanism similar to the package in- and exclusion that allows to exclude getters and setters from the coverage reports.

All in all I think it is a very nice tool and I will add it to my Eclipse installation at work.

Monday, October 10, 2005

Spring, ApplicationContext, and Testing

I currently struggle with the following problem:

I need to test a SpringFramework Controller class I am using in a web application and need to set the ApplicationContext as used in the web application. My ApplicationContext is set in four or five different application context xml files.

Monday, October 03, 2005

Manage You Bookmarks

While reading an interview with Cedric Beust, the developer of TestNG I came accross a sentence where he was mentioning del.icio.us and tagged bookmarks. Curious as I am I took a look at it, and man this is cool. You can manage all your bookmarks on their server, tag them as often as you wish and then access your bookmarks from any box. This is great! I have bookmarks on my Windows box and bookmarks on my Linux laptop. And then I have a bookmark list on my box at work.

Now I am busy migrating them all to del.icio.us.

Saturday, October 01, 2005

Unit Testing in Java with TestNG

It is now about three years that I started to use JUnit and its family members like DbUnit, XmlUnit etc. For my work I have written a DbUnit wrapper that eases the DbUnit usage. I have used XmlUnit for a while to test XML files. I have also used MockObjects as for example EasyMock, JMock, and others.

Recently I came accross TestNG and started to read about it. Tonight I finally decided to have a close look at TestNG and actually use it. What attracts me first is the grouping of tests and the easy way to include or exclude tests. Eclipse has this nice feature where you can right click on a single test and execute it. I make very often usage of this feature to avoid executing other time intensive tests.

What TestNG provides is so much more advanced. Just group tests with annotations and in your TestNG suite xml file define which ones to include, and which ones to exclude.

Another thing that helps me to get started with TestNG is the fact that there is a TestNG Eclipse plugin which allows to run TestNG test cases in the same way as I am used doing it with JUnit tests.

Maven
TestNG provides also a Maven plugin. It took me a while to figure out how to get it. On the TestNG site I could only locate a page that explains the Maven TestNG plugin, but not how to get it. I finally found the information in the TestNg Group available on Google groups.

What you need to do is the following (copied from the News Group posting):
issue the plugin:download command and answer the questions as follows:
  • artifactId is maven-testng-plugin,
  • groupId is testng,
  • and version is 1.1
You'll need to add http://www.vanwardtechnologies.com/repository to your maven.repo.remote list.

Sunday, September 25, 2005

Java Blogs

I am always looking around for interesting Java blogs. Some starting points I found today are the following:

Java Puzzlers

I just got Java Puzzlers from Joshua Bloch and Neal Gafter (http://www.javapuzzlers.com). The book is a great collection of 95 Java puzzles. Each puzzle is a Java problem, some are just a few lines of code, some have the size of one book page.

This book seems to be a great source of learning Java pitfalls in a fun and challenging way.

Wednesday, September 14, 2005

First Entry

I welcome myself to the world of blogging. So far I am not sure what I want to present on this blog, but I am thinking about it...