Posts

Showing posts from 2012

Writing Unit Tests to test JMS Queue listener code with ActiveMQ

During my GSoC project for OpenNMS i did some work with JMS and wanted to write test classes to make sure that my code was working well. In this article i will try to explain how you can use ActiveMQ to write test cases for your JMS code. This is very handy when your code has a part that listens to a JMS queue. Apache ActiveMQ  Apache ActiveMQ is a extremely popular and very powerful open source messaging and Integration Patterns server. You can check it out here . The part we will be using to run our test classes is the embedded broker that is provided by ActiveMQ. This allows you to create a temporary broker for test purposes to create a JMS queue in our case. If you want to learn more about the embedded broker check out this article . The easiet way to create a embedded broker is through the following code line. This will automatically create a embedded broker. ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.pe...

Setting up a ZooKeeper Quorum on Amazon EC2 with Exhibitor

Image
Hi in this post i will try to explain step by step how to set up a ZooKeeper Quorum in Amazon EC2 with the help of Exhibitor. This was done as a part of my final year project so i thought i should share this because it might be helpful to others. I assume that you know about ZooKeeper otherwise you want be reading this article right. anyway if you want to learn about ZooKeeper you can check out the ZooKeeper home page  here . Exhibitor So i will first introduce you to Exhibitor its actually a supervisory system that is built using java technology to monitor and supervise ZooKeeper. It provides some cool features that will help you manage your ZooKeeper instances. You can download Exhibitor here . And if you want to learn more about Exhibitor take a look at there wiki page here . Exhibitor allows you to configure ZooKeeper instances through a very clean web interface. the config panel will look like this. As you can see you can def...

Installing sun-java-6 with apt-get in Linux

Recently i ran into some trouble trying to install sun-java-6 into a Linux server because newer Ubuntu versions do not provide sun-java-6 packages. After some digging i was able to find a solution. You can get it working by adding new sources into apt-get sources.  There are two ways to get it done easily 1. by running add-apt-repository command sudo add-apt-repository "deb http://ppa.launchpad.net/ferramroberto/java/ubuntu oneiric main" If you do not have add-apt-repository already installed you can install it by doing sudo apt-get install python-software-properties 2. by directly changing the source list file sudo vim /etc/apt/sources.list Then add the line into the file. deb http://ppa.launchpad.net/ferramroberto/java/ubuntu oneiric main After you have added this line into the sources from any one of the above methods. perform sudo apt-get update Now you should be able to install sun-java-6 without any problem with apt-get install. 

Debugging Zookeeper with eclipse

Image
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 http://svn.apache.org/repos/asf/zookeeper/trunk/ Build Eclipse project files Then go to ...

Creating a Group Chat bot with Google App Engine

Hi in this post i will try to explain how to develop a chat bot for gmail actually this will work with any chat application that supports XMPP. Here i will explain how to develop a group chat application that can be used to chat with a group of people. I know you must be wondering why i would go through the trouble to make and app when gmail already supports group chats. Well the problem was that since our final year project was a 4 member group project we had a lot of online discussions but whenever someone would get disconnected they will loose the messages sent while they were offline and someone will have add that person back into the group. so one of my friends suggested me to write a app to solve this because i had written a small chat app before. Lets get started. What is Google App Engine I will assume that you are a bit familiar with Google App Engine. Well if you are not please take a look here  to get an general understanding you only need the ...