How to mock HTTP endpoints in Mule Functional Test?

Mule is an enterprise service bus (ESB) and integration framework. In Mule, we define flows and sub-flows in order to integrate applications and orchestrate services.These flows contain endpoints to integrate different applications or services. These endpoints can be HTTP, VM, JMS, etc. More details about development in mule can be found here. Below is a sample flow.
Screen Shot 2014-03-18 at 1.12.54 PM

In order to write unit test cases for mule flows, mule provides an abstract JUnit test case called org.mule.tck.junit4.FunctionalTestCase that runs Mule inside a test case and manages the lifecycle of the server.More details about can be found here.
Read more ›

Tagged with: , , ,
Posted in ESB

Vagrant – a swiss Army knife for every developer

Whenever we move to a new project, or we want to explore a new stack of technologies; we face the problem of environments. Being a developer we generally have a tendency to install everything on our local environment; which many times proves to be a disaster.

Today, modern web applications involve a lot of moving parts, numerous underlying technologies and a lot of complexity. Read more ›

Tagged with: , ,
Posted in continuous delivery, devops

Use ENUM and map to remove conditional logic in your code.

Using ENUM and a map could be a neat way to remove conditional logic, like switch cases in our code.
Another approach could be to use State design pattern, but if you don’t want to create many classes and your use case is pretty simple and using ENUM will not involve repetition of logic. Then using this approach might not be a bad option.

Let see an example :
Read more ›

Tagged with:
Posted in design patterns, java

Implement single click deployment using Jenkins and DeployIt

Problem statement : Implement single click deployment using Jenkins and DeployIt
Tools used: Jenkins CI Server, DeplyIt Plugin for Jenkins, Github plugin for jenkins, Maven for building artifact.

Detailed use case :
Lets suppose we have our code in github in a public repository and we want that every fix which goes to “deployment” branch should get propagated to a dev environment automatically.

In order to get this set up working we would need to do:
1.) Configure Jenkins with gitHub and deployIt Plugin.
2.) Configure application placeholder and environment (including infrastructure) in which deployment would take place in DeployIt.
Read more ›

Tagged with: , , ,
Posted in continuous delivery, continuous integration

chef-solo with vagrant

To learn the concepts of chef, we can start by using chef-solo with Vagrant.
See my previous post on Vagrant to install vagrant and know more about it.

Next, lets install chef-solo on our machine.
We will install chef-solo using ruby gem, make sure you have ruby installed.

root@intro:~# cd ~
root@intro:~# sudo gem install chef
Thank you for installing Chef!

So, now we have installed chef-solo and vagrant on our machine.
In this exercise, we will try and install apache2 on an ubuntu virtual machine (virtual box)
using chef-solo and vagrant.
To begin we would first need to understand few concepts; which would be required to run chef-solo in Vagrant.
Read more ›

Tagged with: ,
Posted in continuous delivery

What are Reentrant Locks?

In Java 5.0 a new addition was made to enhance the intrinsic locking capabilities, called as Reentrant Lock.
Prior to this, ‘synchronized’ and ‘volatile’ were the means for achieving concurrency.

public synchronized void doAtomicTransfer(){
     //enter synchronized block , acquire lock over this object.
    operation1()
    operation2();    
} // exiting synchronized block, release lock over this object.

Synchronized uses intrinsic locks or monitors. Every object in Java has an intrinsic lock associated with it. Whenever a thread tries to access a synchronized block or method it acquires the intrinsic lock or the monitor on that object. In case of static methods, the thread acquires the lock over the class object.
Intrinsic locking mechanism is a clean approach in terms of writing code and is pretty good for most of the use-cases. So why do we need additional feature of Explicit Locks? Lets discuss.

Read more ›

Tagged with: , , ,
Posted in concurrency, java

Set up my dev environment on ubuntu 13 (node.js, RoR, mysql)

This is just a basic blog; a guide to save time, while getting a new system up and ready for development.
1.) Install Ruby:
Install Ruby using RVM so you could manage different versions of ruby.
Read more ›

Tagged with: , ,
Posted in Ruby
Follow

Get every new post delivered to your Inbox.

Join 112 other followers