Debugging Zookeeper with eclipse

This will be a very small post but i thought i should post it because the time i wasted trying to do this simple thing. what i wanted to do was to run the Zookeeper JUnit test one by one so i could debug them to understand how the system works by looking at how the test cases run. I use Eclipse as my IDE so i wanted to do this using Eclipse.

In Eclipse if there are JUnit test classes in the source code you can run a single test class by opening the class ( the .java ) right click on it and go to Debug As --> JUnit Test and simple run the tests in that test class.

I'm also a novice in this area so i am sure i might have made a mistake or two but i couldn't get Debug As ---> JUnit Test to appear when i checkout the project using subeclipse. So this is the way that worked for me.

Checkout Zookeeper

Just checkout Zookeeper from svn using the following command.
svn checkout

Build Eclipse project files

Then go to the trunk  folder ( using the terminal ) and execute the ant command "ant eclipse" this will generate the files needed for an eclipse project.

Import the project into Eclipse

After you run the ant command you can import it into. go to File --> Import in the pop box that appers select "Existing Projects into Workspace" under "Generel"

Click next and in the next window set the root folder of the project that you checked out and import the project. Now you should be able to run JUnit tests comfortably. 

Popular posts from this blog

Writing Unit Tests to test JMS Queue listener code with ActiveMQ

How to set up a Apache Spark cluster in your local machine

Apache Hadoop MapReduce - Detailed word count example from scratch