Fix checkstyle whitespace issues - WHITESPACE ONLY

Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
diff --git a/src/test/java/net/onrc/onos/apps/bgproute/PatriciaTrieTest.java b/src/test/java/net/onrc/onos/apps/bgproute/PatriciaTrieTest.java
index 871c828..af59af5 100644
--- a/src/test/java/net/onrc/onos/apps/bgproute/PatriciaTrieTest.java
+++ b/src/test/java/net/onrc/onos/apps/bgproute/PatriciaTrieTest.java
@@ -15,190 +15,190 @@
 
 public class PatriciaTrieTest {
 
-	IPatriciaTrie<RibEntry> ptrie;
-	Prefix[] prefixes;
-	Map<Prefix, RibEntry> mappings;
-	
-	@Before
-	public void setUp() throws Exception {
-		ptrie = new PatriciaTrie<RibEntry>(32);
-		mappings = new HashMap<Prefix, RibEntry>();
-		
-		prefixes = new Prefix[] {
-			new Prefix("192.168.10.0", 24),
-			new Prefix("192.168.8.0", 23),
-			new Prefix("192.168.8.0", 22),
-			new Prefix("192.0.0.0", 7),
-			new Prefix("192.168.11.0", 24),
-			new Prefix("10.0.23.128", 25),
-			new Prefix("206.17.144.0", 20),
-			new Prefix("9.17.0.0", 12),
-			new Prefix("192.168.0.0", 16)
-		};
-				
-		for (int i = 0; i < prefixes.length; i++) {
-			mappings.put(prefixes[i], new RibEntry("192.168.10.101", "192.168.20." + i));
-			ptrie.put(prefixes[i], new RibEntry("192.168.10.101", "192.168.20." + i));
-		}
-	}
+    IPatriciaTrie<RibEntry> ptrie;
+    Prefix[] prefixes;
+    Map<Prefix, RibEntry> mappings;
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    @Before
+    public void setUp() throws Exception {
+        ptrie = new PatriciaTrie<RibEntry>(32);
+        mappings = new HashMap<Prefix, RibEntry>();
 
-	@Test
-	public void testPut() {
-		IPatriciaTrie<RibEntry> ptrie = new PatriciaTrie<RibEntry>(32);
-		
-		Prefix p1 = new Prefix("192.168.240.0", 20);
-		RibEntry r1 = new RibEntry("192.168.10.101", "192.168.60.2");
-		RibEntry retval = ptrie.put(p1, r1);
-		assertNull(retval);
-		retval = ptrie.lookup(p1);
-		assertTrue(r1 == retval); //should be the same object
-		
-		Prefix p2 = new Prefix("192.160.0.0", 12);
-		RibEntry r2 = new RibEntry("192.168.10.101", "192.168.20.1");
-		retval = ptrie.put(p2, r2);
-		assertNull(retval);
-		
-		Prefix p3 = new Prefix("192.168.208.0", 20);
-		RibEntry r3 = new RibEntry("192.168.10.101", "192.168.30.1");
-		retval = ptrie.put(p3,  r3);
-		assertNull(retval);
-		
-		//Insert a new RibEntry entry over a previous one
-		RibEntry r3new = new RibEntry("192.168.10.101", "192.168.60.2");
-		retval = ptrie.put(p3, r3new);
-		assertNotNull(retval);
-		assertTrue(retval.equals(r3));
-		assertTrue(retval == r3); //should be the same object
-		
-		//Now we have an aggregate node with prefix 192.168.192.0/18.
-		//We will insert a RibEntry at this prefix
-		Prefix p4 = new Prefix("192.168.192.0", 18);
-		RibEntry r4 = new RibEntry("192.168.10.101", "192.168.40.1");
-		retval = ptrie.put(p4, r4);
-		assertNull(retval);
-		retval = ptrie.lookup(p4);
-		assertTrue(retval == r4); //should be the same object
-	}
+        prefixes = new Prefix[]{
+                new Prefix("192.168.10.0", 24),
+                new Prefix("192.168.8.0", 23),
+                new Prefix("192.168.8.0", 22),
+                new Prefix("192.0.0.0", 7),
+                new Prefix("192.168.11.0", 24),
+                new Prefix("10.0.23.128", 25),
+                new Prefix("206.17.144.0", 20),
+                new Prefix("9.17.0.0", 12),
+                new Prefix("192.168.0.0", 16)
+        };
 
-	@Test
-	public void testLookup() {
-		for (Map.Entry<Prefix, RibEntry> entry : mappings.entrySet()) {
-			RibEntry r = ptrie.lookup(entry.getKey());
-			assertTrue(entry.getValue().equals(r));
-		}
-		
-		//These are aggregate nodes in the tree. Shouldn't be returned by lookup
-		Prefix p1 = new Prefix("0.0.0.0", 0);
-		RibEntry retval = ptrie.lookup(p1);
-		assertNull(retval);
-		
-		//We'll put a RibEntry at an aggregate node and check if lookup returns correctly
-		Prefix p2 = new Prefix("192.0.0.0", 4);
-		RibEntry r2 = new RibEntry("192.168.10.101", "192.168.60.1");
-		retval = ptrie.put(p2, r2);
-		assertNull(retval);
-		retval = ptrie.lookup(p2);
-		assertTrue(retval.equals(r2));
-	}
+        for (int i = 0; i < prefixes.length; i++) {
+            mappings.put(prefixes[i], new RibEntry("192.168.10.101", "192.168.20." + i));
+            ptrie.put(prefixes[i], new RibEntry("192.168.10.101", "192.168.20." + i));
+        }
+    }
 
-	//@Ignore
-	@Test
-	public void testMatch() {
-		Prefix p1 = new Prefix("192.168.10.30", 32);
-		Prefix p2 = new Prefix("192.168.10.30", 31);
-		Prefix p3 = new Prefix("192.168.8.241", 32);
-		Prefix p4 = new Prefix("1.0.0.0", 32);
-		Prefix p5 = new Prefix("192.168.8.0", 22);
-		Prefix p6 = new Prefix("192.168.8.0", 21);
-		
-		assertTrue(ptrie.match(p1).equals(mappings.get(prefixes[0])));
-		assertTrue(ptrie.match(p2).equals(mappings.get(prefixes[0])));
-		assertTrue(ptrie.match(p3).equals(mappings.get(prefixes[1])));
-		assertNull(ptrie.match(p4));
-		assertTrue(ptrie.match(p5).equals(mappings.get(prefixes[2])));
-		//System.out.println(ptrie.match(p6).getNextHop().getHostAddress());
-		assertTrue(ptrie.match(p6).equals(mappings.get(prefixes[8])));
-		
-		
-		//TODO more extensive tests
-		//fail("Not yet implemented");
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Test
-	public void testRemove() {
-		Prefix p1 = new Prefix("192.168.8.0", 23);
-		RibEntry retval = ptrie.lookup(p1);
-		assertNotNull(retval);
-		boolean success = ptrie.remove(p1, retval);
-		assertTrue(success);
-		
-		Prefix p2 = new Prefix("192.168.8.0", 22);
-		Prefix p3 = new Prefix("192.168.10.0", 24);
-		
-		//Test it does the right thing with null arguments
-		success = ptrie.remove(null, null);
-		assertFalse(success);
-		success = ptrie.remove(p2, null);
-		assertFalse(success);
-		
-		//Check other prefixes are still there
-		retval = ptrie.lookup(p2);
-		assertNotNull(retval);
-		retval = ptrie.lookup(p3);
-		assertNotNull(retval);
-		
-		Prefix p4 = new Prefix("9.17.0.0", 12);
-		retval = ptrie.lookup(p4);
-		assertNotNull(retval);
-		success = ptrie.remove(p4, retval);
-		assertTrue(success);
-		success = ptrie.remove(p4, retval);
-		assertFalse(success);
-		
-		//Check other prefixes are still there
-		retval = ptrie.lookup(p2);
-		assertNotNull(retval);
-		retval = ptrie.lookup(p3);
-		assertNotNull(retval);
-		
-		Prefix p5 = new Prefix("192.0.0.0", 7);
-		retval = ptrie.lookup(p5);
-		assertNotNull(retval);
-		success = ptrie.remove(p5, retval);
-		assertTrue(success);
-		
-		//Check other prefixes are still there
-		retval = ptrie.lookup(p2);
-		assertNotNull(retval);
-		retval = ptrie.lookup(p3);
-		assertNotNull(retval);
-		
-		
-	}
+    @Test
+    public void testPut() {
+        IPatriciaTrie<RibEntry> ptrie = new PatriciaTrie<RibEntry>(32);
 
-	@Test(expected=java.util.NoSuchElementException.class)
-	public void testIterator() {		
-		int[] order = new int[] {7, 5, 3, 8, 2, 1, 0, 4, 6};
-		
-		Iterator<IPatriciaTrie.Entry<RibEntry>> it = ptrie.iterator();
-		int i = 0;
-		assertTrue(it.hasNext());
-		while (it.hasNext()) {
-			IPatriciaTrie.Entry<RibEntry> entry = it.next();
-			assertTrue(entry.getPrefix().equals(prefixes[order[i]]));
-			i++;
-		}
-		assertFalse(it.hasNext());
-		assertTrue(i == order.length);
-		
-		IPatriciaTrie<RibEntry> pt = new PatriciaTrie<RibEntry>(32);
-		Iterator<IPatriciaTrie.Entry<RibEntry>> it2 = pt.iterator();
-		assertFalse(it2.hasNext());
-		it.next(); //throws NoSuchElementException
-	}
+        Prefix p1 = new Prefix("192.168.240.0", 20);
+        RibEntry r1 = new RibEntry("192.168.10.101", "192.168.60.2");
+        RibEntry retval = ptrie.put(p1, r1);
+        assertNull(retval);
+        retval = ptrie.lookup(p1);
+        assertTrue(r1 == retval); //should be the same object
+
+        Prefix p2 = new Prefix("192.160.0.0", 12);
+        RibEntry r2 = new RibEntry("192.168.10.101", "192.168.20.1");
+        retval = ptrie.put(p2, r2);
+        assertNull(retval);
+
+        Prefix p3 = new Prefix("192.168.208.0", 20);
+        RibEntry r3 = new RibEntry("192.168.10.101", "192.168.30.1");
+        retval = ptrie.put(p3, r3);
+        assertNull(retval);
+
+        //Insert a new RibEntry entry over a previous one
+        RibEntry r3new = new RibEntry("192.168.10.101", "192.168.60.2");
+        retval = ptrie.put(p3, r3new);
+        assertNotNull(retval);
+        assertTrue(retval.equals(r3));
+        assertTrue(retval == r3); //should be the same object
+
+        //Now we have an aggregate node with prefix 192.168.192.0/18.
+        //We will insert a RibEntry at this prefix
+        Prefix p4 = new Prefix("192.168.192.0", 18);
+        RibEntry r4 = new RibEntry("192.168.10.101", "192.168.40.1");
+        retval = ptrie.put(p4, r4);
+        assertNull(retval);
+        retval = ptrie.lookup(p4);
+        assertTrue(retval == r4); //should be the same object
+    }
+
+    @Test
+    public void testLookup() {
+        for (Map.Entry<Prefix, RibEntry> entry : mappings.entrySet()) {
+            RibEntry r = ptrie.lookup(entry.getKey());
+            assertTrue(entry.getValue().equals(r));
+        }
+
+        //These are aggregate nodes in the tree. Shouldn't be returned by lookup
+        Prefix p1 = new Prefix("0.0.0.0", 0);
+        RibEntry retval = ptrie.lookup(p1);
+        assertNull(retval);
+
+        //We'll put a RibEntry at an aggregate node and check if lookup returns correctly
+        Prefix p2 = new Prefix("192.0.0.0", 4);
+        RibEntry r2 = new RibEntry("192.168.10.101", "192.168.60.1");
+        retval = ptrie.put(p2, r2);
+        assertNull(retval);
+        retval = ptrie.lookup(p2);
+        assertTrue(retval.equals(r2));
+    }
+
+    //@Ignore
+    @Test
+    public void testMatch() {
+        Prefix p1 = new Prefix("192.168.10.30", 32);
+        Prefix p2 = new Prefix("192.168.10.30", 31);
+        Prefix p3 = new Prefix("192.168.8.241", 32);
+        Prefix p4 = new Prefix("1.0.0.0", 32);
+        Prefix p5 = new Prefix("192.168.8.0", 22);
+        Prefix p6 = new Prefix("192.168.8.0", 21);
+
+        assertTrue(ptrie.match(p1).equals(mappings.get(prefixes[0])));
+        assertTrue(ptrie.match(p2).equals(mappings.get(prefixes[0])));
+        assertTrue(ptrie.match(p3).equals(mappings.get(prefixes[1])));
+        assertNull(ptrie.match(p4));
+        assertTrue(ptrie.match(p5).equals(mappings.get(prefixes[2])));
+        //System.out.println(ptrie.match(p6).getNextHop().getHostAddress());
+        assertTrue(ptrie.match(p6).equals(mappings.get(prefixes[8])));
+
+
+        //TODO more extensive tests
+        //fail("Not yet implemented");
+    }
+
+    @Test
+    public void testRemove() {
+        Prefix p1 = new Prefix("192.168.8.0", 23);
+        RibEntry retval = ptrie.lookup(p1);
+        assertNotNull(retval);
+        boolean success = ptrie.remove(p1, retval);
+        assertTrue(success);
+
+        Prefix p2 = new Prefix("192.168.8.0", 22);
+        Prefix p3 = new Prefix("192.168.10.0", 24);
+
+        //Test it does the right thing with null arguments
+        success = ptrie.remove(null, null);
+        assertFalse(success);
+        success = ptrie.remove(p2, null);
+        assertFalse(success);
+
+        //Check other prefixes are still there
+        retval = ptrie.lookup(p2);
+        assertNotNull(retval);
+        retval = ptrie.lookup(p3);
+        assertNotNull(retval);
+
+        Prefix p4 = new Prefix("9.17.0.0", 12);
+        retval = ptrie.lookup(p4);
+        assertNotNull(retval);
+        success = ptrie.remove(p4, retval);
+        assertTrue(success);
+        success = ptrie.remove(p4, retval);
+        assertFalse(success);
+
+        //Check other prefixes are still there
+        retval = ptrie.lookup(p2);
+        assertNotNull(retval);
+        retval = ptrie.lookup(p3);
+        assertNotNull(retval);
+
+        Prefix p5 = new Prefix("192.0.0.0", 7);
+        retval = ptrie.lookup(p5);
+        assertNotNull(retval);
+        success = ptrie.remove(p5, retval);
+        assertTrue(success);
+
+        //Check other prefixes are still there
+        retval = ptrie.lookup(p2);
+        assertNotNull(retval);
+        retval = ptrie.lookup(p3);
+        assertNotNull(retval);
+
+
+    }
+
+    @Test(expected = java.util.NoSuchElementException.class)
+    public void testIterator() {
+        int[] order = new int[]{7, 5, 3, 8, 2, 1, 0, 4, 6};
+
+        Iterator<IPatriciaTrie.Entry<RibEntry>> it = ptrie.iterator();
+        int i = 0;
+        assertTrue(it.hasNext());
+        while (it.hasNext()) {
+            IPatriciaTrie.Entry<RibEntry> entry = it.next();
+            assertTrue(entry.getPrefix().equals(prefixes[order[i]]));
+            i++;
+        }
+        assertFalse(it.hasNext());
+        assertTrue(i == order.length);
+
+        IPatriciaTrie<RibEntry> pt = new PatriciaTrie<RibEntry>(32);
+        Iterator<IPatriciaTrie.Entry<RibEntry>> it2 = pt.iterator();
+        assertFalse(it2.hasNext());
+        it.next(); //throws NoSuchElementException
+    }
 
 }
diff --git a/src/test/java/net/onrc/onos/apps/bgproute/PrefixTest.java b/src/test/java/net/onrc/onos/apps/bgproute/PrefixTest.java
index 3b9bef2..8c4b8d5 100644
--- a/src/test/java/net/onrc/onos/apps/bgproute/PrefixTest.java
+++ b/src/test/java/net/onrc/onos/apps/bgproute/PrefixTest.java
@@ -12,92 +12,90 @@
 
 public class PrefixTest {
 
-	@Before
-	public void setUp() throws Exception {
-	}
+    @Before
+    public void setUp() throws Exception {
+    }
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Test
-	public void testPrefixByteArray() {
-		byte[] b1 = new byte[] {(byte)0x8f, (byte)0xa0, (byte)0x00, (byte)0x00};
-		byte[] b2 = new byte[] {(byte)0x8f, (byte)0xa0, (byte)0xff, (byte)0xff};
-		byte[] b3 = new byte[] {(byte)0x8f, (byte)0xac, (byte)0x00, (byte)0x00};
-		byte[] b4 = new byte[] {(byte)0x8f, (byte)0xa0, (byte)0x00, (byte)0x00};
-		
-		Prefix p1 = new Prefix(b1, 12);
-		Prefix p2 = new Prefix(b2, 12);
-		Prefix p3 = new Prefix(b3, 12);
-		Prefix p4 = new Prefix(b4, 11);
-		
-		//Have different byte arrays, but should be equal after construction
-		assertTrue(p1.equals(p2));
-		assertTrue(p2.equals(p3));
-		
-		//Same byte array, but should be false
-		assertFalse(p1.equals(p4));
-		
-		assertTrue(Arrays.equals(p1.getAddress(), p3.getAddress()));
-		assertTrue(p1.toString().equals(p2.toString()));
-		assertTrue(Arrays.equals(p1.getAddress(), p4.getAddress()));
-		assertFalse(p1.toString().equals(p4.toString()));
-	}
+    @Test
+    public void testPrefixByteArray() {
+        byte[] b1 = new byte[]{(byte) 0x8f, (byte) 0xa0, (byte) 0x00, (byte) 0x00};
+        byte[] b2 = new byte[]{(byte) 0x8f, (byte) 0xa0, (byte) 0xff, (byte) 0xff};
+        byte[] b3 = new byte[]{(byte) 0x8f, (byte) 0xac, (byte) 0x00, (byte) 0x00};
+        byte[] b4 = new byte[]{(byte) 0x8f, (byte) 0xa0, (byte) 0x00, (byte) 0x00};
 
-	@Test
-	public void testPrefixString() {
-		Prefix p1 = new Prefix("192.168.166.0", 24);
-		Prefix p2 = new Prefix("192.168.166.0", 23);
-		Prefix p3 = new Prefix("192.168.166.128", 24);
-		Prefix p4 = new Prefix("192.168.166.128", 25);
-		
-		assertFalse(p1.equals(p2));
-		assertTrue(Arrays.equals(p1.getAddress(), p2.getAddress()));
-		
-		assertTrue(p1.equals(p3));
-		assertTrue(Arrays.equals(p1.getAddress(), p2.getAddress()));
-		
-		assertFalse(p3.equals(p4));
-		assertFalse(Arrays.equals(p3.getAddress(), p4.getAddress()));
-		
-		assertTrue(p1.toString().equals(p3.toString()));
-		assertEquals(p1.hashCode(), p3.hashCode());
-	}
+        Prefix p1 = new Prefix(b1, 12);
+        Prefix p2 = new Prefix(b2, 12);
+        Prefix p3 = new Prefix(b3, 12);
+        Prefix p4 = new Prefix(b4, 11);
 
-	@Test
-	public void testPrefixReturnsSame() {
-		//Create a prefix of all 1s for each prefix length.
-		//Check that Prefix doesn't mangle it
-		int MAX_PREFIX_LENGTH = 32;
-		for (int prefixLength = 1; prefixLength <= MAX_PREFIX_LENGTH; prefixLength++) {
-			byte address[] = new byte[MAX_PREFIX_LENGTH/Byte.SIZE];
-			
-			int lastByte = (prefixLength - 1) / Byte.SIZE;
-			int lastBit = (prefixLength - 1) % Byte.SIZE;
-			
-			for (int j = 0; j < address.length; j++) {
-				if (j < lastByte) {
-					address[j] = (byte)0xff;
-				}
-				else if (j == lastByte) {
-					byte b = 0;
-					byte msb = (byte) 0x80;
-					for (int k = 0; k < Byte.SIZE; k++) {
-						if (k <= lastBit) {
-							b |= (msb >> k);
-						}
-					}
-					address[j] = b;
-				}
-				else {
-					address[j] = 0;
-				}
-			}
-			
-			Prefix p = new Prefix(address, prefixLength);
-			System.out.println(p.printAsBits());
-			assertTrue(Arrays.equals(address, p.getAddress()));
-		}
-	}
+        //Have different byte arrays, but should be equal after construction
+        assertTrue(p1.equals(p2));
+        assertTrue(p2.equals(p3));
+
+        //Same byte array, but should be false
+        assertFalse(p1.equals(p4));
+
+        assertTrue(Arrays.equals(p1.getAddress(), p3.getAddress()));
+        assertTrue(p1.toString().equals(p2.toString()));
+        assertTrue(Arrays.equals(p1.getAddress(), p4.getAddress()));
+        assertFalse(p1.toString().equals(p4.toString()));
+    }
+
+    @Test
+    public void testPrefixString() {
+        Prefix p1 = new Prefix("192.168.166.0", 24);
+        Prefix p2 = new Prefix("192.168.166.0", 23);
+        Prefix p3 = new Prefix("192.168.166.128", 24);
+        Prefix p4 = new Prefix("192.168.166.128", 25);
+
+        assertFalse(p1.equals(p2));
+        assertTrue(Arrays.equals(p1.getAddress(), p2.getAddress()));
+
+        assertTrue(p1.equals(p3));
+        assertTrue(Arrays.equals(p1.getAddress(), p2.getAddress()));
+
+        assertFalse(p3.equals(p4));
+        assertFalse(Arrays.equals(p3.getAddress(), p4.getAddress()));
+
+        assertTrue(p1.toString().equals(p3.toString()));
+        assertEquals(p1.hashCode(), p3.hashCode());
+    }
+
+    @Test
+    public void testPrefixReturnsSame() {
+        //Create a prefix of all 1s for each prefix length.
+        //Check that Prefix doesn't mangle it
+        int MAX_PREFIX_LENGTH = 32;
+        for (int prefixLength = 1; prefixLength <= MAX_PREFIX_LENGTH; prefixLength++) {
+            byte address[] = new byte[MAX_PREFIX_LENGTH / Byte.SIZE];
+
+            int lastByte = (prefixLength - 1) / Byte.SIZE;
+            int lastBit = (prefixLength - 1) % Byte.SIZE;
+
+            for (int j = 0; j < address.length; j++) {
+                if (j < lastByte) {
+                    address[j] = (byte) 0xff;
+                } else if (j == lastByte) {
+                    byte b = 0;
+                    byte msb = (byte) 0x80;
+                    for (int k = 0; k < Byte.SIZE; k++) {
+                        if (k <= lastBit) {
+                            b |= (msb >> k);
+                        }
+                    }
+                    address[j] = b;
+                } else {
+                    address[j] = 0;
+                }
+            }
+
+            Prefix p = new Prefix(address, prefixLength);
+            System.out.println(p.printAsBits());
+            assertTrue(Arrays.equals(address, p.getAddress()));
+        }
+    }
 }
diff --git a/src/test/java/net/onrc/onos/apps/bgproute/PtreeTest.java b/src/test/java/net/onrc/onos/apps/bgproute/PtreeTest.java
index 0f820c2..f0fd40a 100644
--- a/src/test/java/net/onrc/onos/apps/bgproute/PtreeTest.java
+++ b/src/test/java/net/onrc/onos/apps/bgproute/PtreeTest.java
@@ -21,208 +21,208 @@
 import com.google.common.net.InetAddresses;
 
 public class PtreeTest {
-	
-	private Logger log = LoggerFactory.getLogger(PtreeTest.class);
-	
-	private Ptree ptree;
-	private PatriciaTrie<RibEntry> ooptrie;
-	
-	private Map<String, byte[]> byteAddresses;
 
-	@Before
-	public void setUp() throws Exception {
-		ptree = new Ptree(32);
-		ooptrie = new PatriciaTrie<RibEntry>(32);
-			
-		String[] strPrefixes = {
-			"192.168.10.0/24",
-			"192.168.10.0/23",
-			"192.168.10.0/22",
-			"192.0.0.0/7",
-			"192.168.11.0/24",
-			"10.0.23.128/25",
-			"206.17.144.0/20",
-			"9.17.0.0/12",
-			"192.168.0.0/16"
-		};
-		
-		byteAddresses = new HashMap<String, byte[]>(strPrefixes.length+10);
-		for (String prefix : strPrefixes) {
-			String address = prefix.split("/")[0];
-			int prefixLength = Integer.parseInt(prefix.split("/")[1]);
-			byteAddresses.put(prefix, InetAddresses.forString(address).getAddress());
-			
-			PtreeNode node = ptree.acquire(byteAddresses.get(prefix), prefixLength);
-			node.rib = new RibEntry("192.168.10.101", "192.168.60.1");
-			ooptrie.put(new Prefix(byteAddresses.get(prefix), prefixLength), 
-					new RibEntry("192.168.10.101", "192.168.60.1"));
-		}
-	}
+    private Logger log = LoggerFactory.getLogger(PtreeTest.class);
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    private Ptree ptree;
+    private PatriciaTrie<RibEntry> ooptrie;
 
-	@Ignore
-	@Test
-	public void testAcquireByteArray() {
-		fail("Not yet implemented");
-	}
+    private Map<String, byte[]> byteAddresses;
 
-	@Ignore
-	@Test
-	public void testAcquireByteArrayInt() {
-		//First let's test an empty Ptree
-		Ptree localPtree = new Ptree(32);
-		PtreeNode node = localPtree.acquire(new byte[] {0x00, 0x00, 0x00, 0x00});
-		assertTrue(node != null && node.rib == null);
-		
-		//Now let's look at the prepopulated tree
-		String testPrefix = "206.17.144.0/20";
-		PtreeNode existingNode = ptree.acquire(byteAddresses.get(testPrefix), 20);
-		printByteArray(existingNode.key);
-		printByteArray(byteAddresses.get(testPrefix));
-		assertTrue(existingNode != null && existingNode.rib == null);
-		
-		assertTrue(Arrays.equals(existingNode.key, byteAddresses.get(testPrefix)));
-	}
+    @Before
+    public void setUp() throws Exception {
+        ptree = new Ptree(32);
+        ooptrie = new PatriciaTrie<RibEntry>(32);
 
-	@Test
-	public void testLookup() {
-		String prefix1 = "192.168.10.12";
-		int length1 = 29;
-		PtreeNode node1 = ptree.lookup(InetAddresses.forString(prefix1).getAddress(), length1);
-		
-		//There should be no direct match
-		assertTrue(node1 == null);
-		
-		log.debug("{} null: {}", "node1", node1 == null ? "true" : "false");
-		
-		String prefix2 = "206.17.144.0";
-		int length2 = 20;
-		PtreeNode node2 = ptree.lookup(InetAddresses.forString(prefix2).getAddress(), length2);
-		
-		assertTrue(node2 != null);
-		assertTrue(Arrays.equals(node2.key, byteAddresses.get(prefix2 + "/" + length2)));
-		
-		log.debug("{} null: {}", "node2", node2 == null ? "true" : "false");
-		if (node2 != null) {
-			log.debug("{} key: {}, keybits: {}", new Object[] {"node2", node2.key, node2.keyBits});
-		}
-		
-		String prefix3 = "192.0.0.0";
-		int length3 = 7;
-		PtreeNode node3 = ptree.lookup(InetAddresses.forString(prefix3).getAddress(), length3);
-		assertTrue(node3 != null);
-	}
+        String[] strPrefixes = {
+                "192.168.10.0/24",
+                "192.168.10.0/23",
+                "192.168.10.0/22",
+                "192.0.0.0/7",
+                "192.168.11.0/24",
+                "10.0.23.128/25",
+                "206.17.144.0/20",
+                "9.17.0.0/12",
+                "192.168.0.0/16"
+        };
 
-	@Test
-	public void testMatch() {
-		String prefix1 = "192.168.10.12";
-		int length1 = 29;
-		PtreeNode node1 = ptree.match(InetAddresses.forString(prefix1).getAddress(), length1);
-		
-		//There should be no direct match, but we should get the covering prefix
-		assertTrue(node1 != null);
-		assertTrue(Arrays.equals(node1.key, byteAddresses.get("192.168.10.0/24")));
-		
-		log.debug("{} null: {}", "node1", node1 == null ? "true" : "false");
-		if (node1 != null) {
-			log.debug("{} key: {}, keybits: {}", new Object[] {"node1", node1.key, node1.keyBits});
-		}
-	}
-	
-	@Ignore
-	@Test
-	public void testTraverse() {
-		
-		String expected = "[0, 0, 0, 0]/0\n";
-		expected += "[8, 0, 0, 0]/6\n";
-		expected += "[9, 17, 0, 0]/12\n";
-		expected += "[10, 0, 23, -128]/25\n";
-		expected += "[-64, 0, 0, 0]/4\n";
-		expected += "[-64, -88, 0, 0]/16\n";
-		expected += "[-64, -88, 8, 0]/22\n";
-		expected += "[-64, -88, 10, 0]/23\n";
-		expected += "[-64, -88, 10, 0]/24\n";
-		expected += "[-64, -88, 11, 0]/24\n";
-		expected += "[-50, 17, -112, 0]/20\n";
-		
-		PtreeNode node;
-		String result = "";
-		
-		for (node = ptree.begin(); node != null; node = ptree.next(node)) {
-			result += printByteArray(node.key) + "/" + node.keyBits + "\n";
-		}
-		
-		assertEquals(expected, result);
-	}
+        byteAddresses = new HashMap<String, byte[]>(strPrefixes.length + 10);
+        for (String prefix : strPrefixes) {
+            String address = prefix.split("/")[0];
+            int prefixLength = Integer.parseInt(prefix.split("/")[1]);
+            byteAddresses.put(prefix, InetAddresses.forString(address).getAddress());
 
-	@Ignore
-	@Test
-	public void testBegin() {
-		fail("Not yet implemented");
-	}
+            PtreeNode node = ptree.acquire(byteAddresses.get(prefix), prefixLength);
+            node.rib = new RibEntry("192.168.10.101", "192.168.60.1");
+            ooptrie.put(new Prefix(byteAddresses.get(prefix), prefixLength),
+                    new RibEntry("192.168.10.101", "192.168.60.1"));
+        }
+    }
 
-	@Ignore
-	@Test
-	public void testNext() {
-		fail("Not yet implemented");
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Ignore
-	@Test
-	public void testDelReference() {
-		fail("Not yet implemented");
-	}
-	
-	@Ignore
-	@Test
-	public void testMisc() {
-		int bitIndex = -1;
-		int index = (int)(bitIndex / Byte.SIZE);
-	    int bit = (int)(bitIndex % Byte.SIZE);
-	    
-	    log.debug("index {} bit {}", index, bit); 
-	    log.debug("percent {}", 1%8);
-	    
-	    //PtreeNode node1 = new PtreeNode(new byte[] {0x0, 0x0, 0x0, 0x0}, 0, 4);
-	    PtreeNode node1 = new PtreeNode(null, 0, 4);
-	    log.debug("node1: key {}, keybits {}", printByteArray(node1.key), node1.keyBits);
-	    
-	    //PtreeNode node2 = new PtreeNode(new byte[] {(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff}, 
-	    PtreeNode node2 = new PtreeNode(null,
-	    		32, 4);
-	    log.debug("node2: key {}, keybits {}", printByteArray(node2.key), node2.keyBits);
-	}
-	
-	@Test
-	public void testIteration() {
-		Iterator<IPatriciaTrie.Entry<RibEntry>> it = ooptrie.iterator();
-		
-		while (it.hasNext()) {
-			IPatriciaTrie.Entry<RibEntry> entry = it.next();
-			log.debug("PatriciaTrie prefix {} \t {}", entry.getPrefix(), entry.getPrefix().printAsBits());
-		}
-		
-		try {
-			PtreeNode node;
-			for (node = ptree.begin(); node != null; node = ptree.next(node)) {
-				log.debug("Ptree prefix {}/{}", InetAddress.getByAddress(node.key).getHostAddress(), node.keyBits);
-			}
-		} catch (UnknownHostException e) {
-			
-		}
-	}
-	
-	private String printByteArray(byte[] array) {
-		String result = "[";
-		for (byte b : array) {
-			result += b + ", ";
-		}
-		result = result.substring(0, result.length() - 2);
-		result += "]";
-		return result;
-	}
+    @Ignore
+    @Test
+    public void testAcquireByteArray() {
+        fail("Not yet implemented");
+    }
+
+    @Ignore
+    @Test
+    public void testAcquireByteArrayInt() {
+        //First let's test an empty Ptree
+        Ptree localPtree = new Ptree(32);
+        PtreeNode node = localPtree.acquire(new byte[]{0x00, 0x00, 0x00, 0x00});
+        assertTrue(node != null && node.rib == null);
+
+        //Now let's look at the prepopulated tree
+        String testPrefix = "206.17.144.0/20";
+        PtreeNode existingNode = ptree.acquire(byteAddresses.get(testPrefix), 20);
+        printByteArray(existingNode.key);
+        printByteArray(byteAddresses.get(testPrefix));
+        assertTrue(existingNode != null && existingNode.rib == null);
+
+        assertTrue(Arrays.equals(existingNode.key, byteAddresses.get(testPrefix)));
+    }
+
+    @Test
+    public void testLookup() {
+        String prefix1 = "192.168.10.12";
+        int length1 = 29;
+        PtreeNode node1 = ptree.lookup(InetAddresses.forString(prefix1).getAddress(), length1);
+
+        //There should be no direct match
+        assertTrue(node1 == null);
+
+        log.debug("{} null: {}", "node1", node1 == null ? "true" : "false");
+
+        String prefix2 = "206.17.144.0";
+        int length2 = 20;
+        PtreeNode node2 = ptree.lookup(InetAddresses.forString(prefix2).getAddress(), length2);
+
+        assertTrue(node2 != null);
+        assertTrue(Arrays.equals(node2.key, byteAddresses.get(prefix2 + "/" + length2)));
+
+        log.debug("{} null: {}", "node2", node2 == null ? "true" : "false");
+        if (node2 != null) {
+            log.debug("{} key: {}, keybits: {}", new Object[]{"node2", node2.key, node2.keyBits});
+        }
+
+        String prefix3 = "192.0.0.0";
+        int length3 = 7;
+        PtreeNode node3 = ptree.lookup(InetAddresses.forString(prefix3).getAddress(), length3);
+        assertTrue(node3 != null);
+    }
+
+    @Test
+    public void testMatch() {
+        String prefix1 = "192.168.10.12";
+        int length1 = 29;
+        PtreeNode node1 = ptree.match(InetAddresses.forString(prefix1).getAddress(), length1);
+
+        //There should be no direct match, but we should get the covering prefix
+        assertTrue(node1 != null);
+        assertTrue(Arrays.equals(node1.key, byteAddresses.get("192.168.10.0/24")));
+
+        log.debug("{} null: {}", "node1", node1 == null ? "true" : "false");
+        if (node1 != null) {
+            log.debug("{} key: {}, keybits: {}", new Object[]{"node1", node1.key, node1.keyBits});
+        }
+    }
+
+    @Ignore
+    @Test
+    public void testTraverse() {
+
+        String expected = "[0, 0, 0, 0]/0\n";
+        expected += "[8, 0, 0, 0]/6\n";
+        expected += "[9, 17, 0, 0]/12\n";
+        expected += "[10, 0, 23, -128]/25\n";
+        expected += "[-64, 0, 0, 0]/4\n";
+        expected += "[-64, -88, 0, 0]/16\n";
+        expected += "[-64, -88, 8, 0]/22\n";
+        expected += "[-64, -88, 10, 0]/23\n";
+        expected += "[-64, -88, 10, 0]/24\n";
+        expected += "[-64, -88, 11, 0]/24\n";
+        expected += "[-50, 17, -112, 0]/20\n";
+
+        PtreeNode node;
+        String result = "";
+
+        for (node = ptree.begin(); node != null; node = ptree.next(node)) {
+            result += printByteArray(node.key) + "/" + node.keyBits + "\n";
+        }
+
+        assertEquals(expected, result);
+    }
+
+    @Ignore
+    @Test
+    public void testBegin() {
+        fail("Not yet implemented");
+    }
+
+    @Ignore
+    @Test
+    public void testNext() {
+        fail("Not yet implemented");
+    }
+
+    @Ignore
+    @Test
+    public void testDelReference() {
+        fail("Not yet implemented");
+    }
+
+    @Ignore
+    @Test
+    public void testMisc() {
+        int bitIndex = -1;
+        int index = (int) (bitIndex / Byte.SIZE);
+        int bit = (int) (bitIndex % Byte.SIZE);
+
+        log.debug("index {} bit {}", index, bit);
+        log.debug("percent {}", 1 % 8);
+
+        //PtreeNode node1 = new PtreeNode(new byte[] {0x0, 0x0, 0x0, 0x0}, 0, 4);
+        PtreeNode node1 = new PtreeNode(null, 0, 4);
+        log.debug("node1: key {}, keybits {}", printByteArray(node1.key), node1.keyBits);
+
+        //PtreeNode node2 = new PtreeNode(new byte[] {(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff},
+        PtreeNode node2 = new PtreeNode(null,
+                32, 4);
+        log.debug("node2: key {}, keybits {}", printByteArray(node2.key), node2.keyBits);
+    }
+
+    @Test
+    public void testIteration() {
+        Iterator<IPatriciaTrie.Entry<RibEntry>> it = ooptrie.iterator();
+
+        while (it.hasNext()) {
+            IPatriciaTrie.Entry<RibEntry> entry = it.next();
+            log.debug("PatriciaTrie prefix {} \t {}", entry.getPrefix(), entry.getPrefix().printAsBits());
+        }
+
+        try {
+            PtreeNode node;
+            for (node = ptree.begin(); node != null; node = ptree.next(node)) {
+                log.debug("Ptree prefix {}/{}", InetAddress.getByAddress(node.key).getHostAddress(), node.keyBits);
+            }
+        } catch (UnknownHostException e) {
+
+        }
+    }
+
+    private String printByteArray(byte[] array) {
+        String result = "[";
+        for (byte b : array) {
+            result += b + ", ";
+        }
+        result = result.substring(0, result.length() - 2);
+        result += "]";
+        return result;
+    }
 
 }
diff --git a/src/test/java/net/onrc/onos/core/datastore/hazelcast/HZTableTest.java b/src/test/java/net/onrc/onos/core/datastore/hazelcast/HZTableTest.java
index fcbe599..39e7e9f 100644
--- a/src/test/java/net/onrc/onos/core/datastore/hazelcast/HZTableTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/hazelcast/HZTableTest.java
@@ -28,344 +28,343 @@
 
 public class HZTableTest {
     @Rule
-    public TestName name= new TestName();
+    public TestName name = new TestName();
 
     static final String TEST_TABLE_NAME = "TableForUnitTest";
     HZTable table;
 
     @Before
     public void setUp() throws Exception {
-	table = (HZTable) HZClient.getClient().getTable(TEST_TABLE_NAME);
+        table = (HZTable) HZClient.getClient().getTable(TEST_TABLE_NAME);
     }
 
     @After
     public void tearDown() throws Exception {
-	HZClient.getClient().dropTable(table);
+        HZClient.getClient().dropTable(table);
     }
 
     public void assertEntryInTable(final byte[] key, final byte[] value, final long version) {
-	VersionedValue valueblob = table.getBackendMap().get(key);
-	assertNotNull(valueblob);
-	assertArrayEquals(value, valueblob.getValue());
-	assertEquals(version, valueblob.getVersion());
+        VersionedValue valueblob = table.getBackendMap().get(key);
+        assertNotNull(valueblob);
+        assertArrayEquals(value, valueblob.getValue());
+        assertEquals(version, valueblob.getVersion());
     }
 
     public void assertKeyNotInTable(final byte[] key) {
-	VersionedValue valueblob = table.getBackendMap().get(key);
-	assertNull(valueblob);
+        VersionedValue valueblob = table.getBackendMap().get(key);
+        assertNull(valueblob);
     }
 
     @Test
     public void testGetInitialVersion() {
-	final long version1 = HZTable.getInitialVersion();
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version1);
+        final long version1 = HZTable.getInitialVersion();
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version1);
 
-	final long version2 = HZTable.getInitialVersion();
-	assertNotEquals(HZClient.VERSION_NONEXISTENT, version2);
-	assertNotEquals(version1, version2);
+        final long version2 = HZTable.getInitialVersion();
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version2);
+        assertNotEquals(version1, version2);
     }
 
     @Test
     public void testGetNextVersion() {
-	final long nextVersion = HZTable.getNextVersion(1);
-	assertNotEquals(nextVersion, HZClient.VERSION_NONEXISTENT);
-	assertNotEquals(nextVersion, 1);
+        final long nextVersion = HZTable.getNextVersion(1);
+        assertNotEquals(nextVersion, HZClient.VERSION_NONEXISTENT);
+        assertNotEquals(nextVersion, 1);
 
-	final long nextVersion1 = HZTable.getNextVersion(Long.MAX_VALUE);
-	assertNotEquals(nextVersion1, HZClient.VERSION_NONEXISTENT);
-	assertNotEquals(nextVersion1, Long.MAX_VALUE);
+        final long nextVersion1 = HZTable.getNextVersion(Long.MAX_VALUE);
+        assertNotEquals(nextVersion1, HZClient.VERSION_NONEXISTENT);
+        assertNotEquals(nextVersion1, Long.MAX_VALUE);
 
-	final long nextVersion11 = HZTable.getNextVersion(HZClient.VERSION_NONEXISTENT-1);
-	assertNotEquals(nextVersion11, HZClient.VERSION_NONEXISTENT);
-	assertNotEquals(nextVersion11, HZClient.VERSION_NONEXISTENT-1);
+        final long nextVersion11 = HZTable.getNextVersion(HZClient.VERSION_NONEXISTENT - 1);
+        assertNotEquals(nextVersion11, HZClient.VERSION_NONEXISTENT);
+        assertNotEquals(nextVersion11, HZClient.VERSION_NONEXISTENT - 1);
     }
 
     @Ignore // nothing to test for now
     @Test
     public void testHZTable() {
-	fail("Not yet implemented");
+        fail("Not yet implemented");
     }
 
     @Test
     public void testGetTableName() {
-	assertEquals(TEST_TABLE_NAME, table.getTableName());
+        assertEquals(TEST_TABLE_NAME, table.getTableName());
     }
 
     @Test
     public void testVERSION_NONEXISTENT() {
-	assertEquals(HZClient.VERSION_NONEXISTENT, table.VERSION_NONEXISTENT());
+        assertEquals(HZClient.VERSION_NONEXISTENT, table.VERSION_NONEXISTENT());
     }
 
     @Test
     public void testGetTableId() {
-	// for Hazelcast implementation IKVTableID is table itself
-	assertEquals(table, table.getTableId());
+        // for Hazelcast implementation IKVTableID is table itself
+        assertEquals(table, table.getTableId());
     }
 
     @Test
     public void testCreate() throws ObjectExistsException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	final long version = table.create(key, value);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version);
+        final long version = table.create(key, value);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
 
-	assertEntryInTable(key, value, version);
+        assertEntryInTable(key, value, version);
     }
 
     @Test(expected = ObjectExistsException.class)
     public void testCreateConflict() throws ObjectExistsException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	final long version = table.create(key, value);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version);
+        final long version = table.create(key, value);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
 
-	assertEntryInTable(key, value, version);
+        assertEntryInTable(key, value, version);
 
-	table.create(key, value);
-	fail("Should have thrown exception");
+        table.create(key, value);
+        fail("Should have thrown exception");
     }
 
     @Test
     public void testForceCreate() {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	final long version = table.forceCreate(key, value);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version);
-	assertEntryInTable(key, value, version);
+        final long version = table.forceCreate(key, value);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
+        assertEntryInTable(key, value, version);
 
 
-	final long version1 = table.forceCreate(key, value);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version1);
-	assertNotEquals(version, version1);
-	assertEntryInTable(key, value, version1);
+        final long version1 = table.forceCreate(key, value);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version1);
+        assertNotEquals(version, version1);
+        assertEntryInTable(key, value, version1);
     }
 
     @Test
     public void testRead() throws ObjectDoesntExistException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	// put data to read
-	final long version = table.forceCreate(key, value);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version);
-	assertEntryInTable(key, value, version);
+        // put data to read
+        final long version = table.forceCreate(key, value);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
+        assertEntryInTable(key, value, version);
 
-	// test body
-	final IKVEntry readValue = table.read(key);
-	assertArrayEquals(key, readValue.getKey());
-	assertArrayEquals(value, readValue.getValue());
-	assertEquals(version, readValue.getVersion());
+        // test body
+        final IKVEntry readValue = table.read(key);
+        assertArrayEquals(key, readValue.getKey());
+        assertArrayEquals(value, readValue.getValue());
+        assertEquals(version, readValue.getVersion());
     }
 
 
     @Test(expected = ObjectDoesntExistException.class)
     public void testReadNotExist() throws ObjectDoesntExistException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
 
-	table.read(key);
-	fail("Should have thrown exception");
+        table.read(key);
+        fail("Should have thrown exception");
     }
 
     @Test
     public void testUpdateByteArrayByteArrayLongSuccess() throws ObjectDoesntExistException, WrongVersionException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	// put data to update
-	final long oldVersion = table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
-	assertEntryInTable(key, oldValue, oldVersion);
+        // put data to update
+        final long oldVersion = table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
+        assertEntryInTable(key, oldValue, oldVersion);
 
-	final long version = table.update(key, value, oldVersion);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version);
-	assertEntryInTable(key, value, version);
+        final long version = table.update(key, value, oldVersion);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
+        assertEntryInTable(key, value, version);
     }
 
     @Test(expected = ObjectDoesntExistException.class)
     public void testUpdateByteArrayByteArrayLongFailNoOldValue() throws ObjectDoesntExistException, WrongVersionException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	final long oldVersion = 0xDEAD;
+        final long oldVersion = 0xDEAD;
 
-	final long version = table.update(key, value, oldVersion);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version);
-	assertEntryInTable(key, value, version);
+        final long version = table.update(key, value, oldVersion);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
+        assertEntryInTable(key, value, version);
     }
 
     @Test(expected = WrongVersionException.class)
     public void testUpdateByteArrayByteArrayLongFailWrongVersion() throws ObjectDoesntExistException, WrongVersionException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	// put data to update
-	final long oldVersion = table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
-	assertEntryInTable(key, oldValue, oldVersion);
-	// some one updates (from different thread/process in reality)
-	table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
+        // put data to update
+        final long oldVersion = table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
+        assertEntryInTable(key, oldValue, oldVersion);
+        // some one updates (from different thread/process in reality)
+        table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
 
 
-	table.update(key, value, oldVersion);
-	fail("Should have thrown exception");
+        table.update(key, value, oldVersion);
+        fail("Should have thrown exception");
     }
 
     @Test
     public void testUpdateByteArrayByteArraySuccess() throws ObjectDoesntExistException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	// put data to update
-	final long oldVersion = table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
-	assertEntryInTable(key, oldValue, oldVersion);
+        // put data to update
+        final long oldVersion = table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
+        assertEntryInTable(key, oldValue, oldVersion);
 
-	final long version = table.update(key, value);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version);
-	assertEntryInTable(key, value, version);
+        final long version = table.update(key, value);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
+        assertEntryInTable(key, value, version);
     }
 
     @Test(expected = ObjectDoesntExistException.class)
     public void testUpdateByteArrayByteArrayFailNoOldValue() throws ObjectDoesntExistException, WrongVersionException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	final long version = table.update(key, value);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version);
-	assertEntryInTable(key, value, version);
-	fail("Should have thrown exception");
+        final long version = table.update(key, value);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
+        assertEntryInTable(key, value, version);
+        fail("Should have thrown exception");
     }
 
     @Test
     public void testUpdateByteArrayByteArraySuccessIgnoreVersion() throws ObjectDoesntExistException, WrongVersionException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
-	final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
 
-	// put data to update
-	final long oldVersion = table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
-	assertEntryInTable(key, oldValue, oldVersion);
-	// someone updates (from different thread/process in reality)
-	table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
+        // put data to update
+        final long oldVersion = table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
+        assertEntryInTable(key, oldValue, oldVersion);
+        // someone updates (from different thread/process in reality)
+        table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
 
 
-	final long version = table.update(key, value);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,version);
-	assertEntryInTable(key, value, version);
+        final long version = table.update(key, value);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
+        assertEntryInTable(key, value, version);
     }
 
     @Test
     public void testDelete() throws ObjectDoesntExistException, WrongVersionException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
 
-	// put data to delete
-	final long oldVersion = table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
-	assertEntryInTable(key, oldValue, oldVersion);
+        // put data to delete
+        final long oldVersion = table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
+        assertEntryInTable(key, oldValue, oldVersion);
 
-	long version = table.delete(key, oldVersion);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
-	assertEquals(oldVersion, version);
-	assertKeyNotInTable(key);
+        long version = table.delete(key, oldVersion);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
+        assertEquals(oldVersion, version);
+        assertKeyNotInTable(key);
     }
 
     @Test(expected = ObjectDoesntExistException.class)
     public void testDeleteFailNoEntry() throws ObjectDoesntExistException, WrongVersionException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
 
-	final long oldVersion = 0xDEAD;
+        final long oldVersion = 0xDEAD;
 
-	try {
-	    table.delete(key, oldVersion);
-	} catch (ObjectDoesntExistException | WrongVersionException e) {
-	    assertKeyNotInTable(key);
-	    throw e;
-	}
-	fail("Should have thrown exception");
+        try {
+            table.delete(key, oldVersion);
+        } catch (ObjectDoesntExistException | WrongVersionException e) {
+            assertKeyNotInTable(key);
+            throw e;
+        }
+        fail("Should have thrown exception");
     }
 
     @Test(expected = WrongVersionException.class)
     public void testDeleteFailWrongVersion() throws ObjectDoesntExistException, WrongVersionException {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
 
-	// put data to delete
-	final long oldVersion = table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
-	assertEntryInTable(key, oldValue, oldVersion);
-	// someone updates (from different thread/process in reality)
-	final long latestVersion = table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,latestVersion);
+        // put data to delete
+        final long oldVersion = table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
+        assertEntryInTable(key, oldValue, oldVersion);
+        // someone updates (from different thread/process in reality)
+        final long latestVersion = table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, latestVersion);
 
-	try {
-	    table.delete(key, oldVersion);
-	} catch (ObjectDoesntExistException | WrongVersionException e) {
-	    assertEntryInTable(key, oldValue, latestVersion);
-	    throw e;
-	}
-	fail("Should have thrown exception");
+        try {
+            table.delete(key, oldVersion);
+        } catch (ObjectDoesntExistException | WrongVersionException e) {
+            assertEntryInTable(key, oldValue, latestVersion);
+            throw e;
+        }
+        fail("Should have thrown exception");
     }
 
 
-
     @Test
     public void testForceDelete() {
-	final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
-	final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
+        final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
+        final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
 
-	// put data to delete
-	final long oldVersion = table.forceCreate(key, oldValue);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
-	assertEntryInTable(key, oldValue, oldVersion);
+        // put data to delete
+        final long oldVersion = table.forceCreate(key, oldValue);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
+        assertEntryInTable(key, oldValue, oldVersion);
 
-	long version = table.forceDelete(key);
-	assertNotEquals(HZClient.VERSION_NONEXISTENT,oldVersion);
-	assertEquals(oldVersion, version);
-	assertKeyNotInTable(key);
+        long version = table.forceDelete(key);
+        assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
+        assertEquals(oldVersion, version);
+        assertKeyNotInTable(key);
     }
 
     @Test
     public void testGetAllEntries() {
-	final int DATASETSIZE = 100;
-	final Map<byte[], VersionedValue> testdata = new TreeMap<>(ByteArrayComparator.BYTEARRAY_COMPARATOR);
-	for(int i = 0 ; i < DATASETSIZE ; ++i) {
-	    final byte[] key = (name.getMethodName()+i).getBytes(StandardCharsets.UTF_8);
-	    final byte[] value = ("Value"+i).getBytes(StandardCharsets.UTF_8);
+        final int DATASETSIZE = 100;
+        final Map<byte[], VersionedValue> testdata = new TreeMap<>(ByteArrayComparator.BYTEARRAY_COMPARATOR);
+        for (int i = 0; i < DATASETSIZE; ++i) {
+            final byte[] key = (name.getMethodName() + i).getBytes(StandardCharsets.UTF_8);
+            final byte[] value = ("Value" + i).getBytes(StandardCharsets.UTF_8);
 
-	    // put data to delete
-	    final long version = table.forceCreate(key, value);
-	    assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
-	    assertEntryInTable(key, value, version);
+            // put data to delete
+            final long version = table.forceCreate(key, value);
+            assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
+            assertEntryInTable(key, value, version);
 
-	    testdata.put(key, new VersionedValue(value, version));
-	}
+            testdata.put(key, new VersionedValue(value, version));
+        }
 
-	Iterable<IKVEntry> datastore = table.getAllEntries();
-	for( IKVEntry entry : datastore ) {
-	    VersionedValue expectedValue = testdata.get(entry.getKey());
-	    assertNotNull(expectedValue);
-	    assertArrayEquals(expectedValue.getValue(), entry.getValue());
-	    assertEquals(expectedValue.getVersion(), entry.getVersion());
+        Iterable<IKVEntry> datastore = table.getAllEntries();
+        for (IKVEntry entry : datastore) {
+            VersionedValue expectedValue = testdata.get(entry.getKey());
+            assertNotNull(expectedValue);
+            assertArrayEquals(expectedValue.getValue(), entry.getValue());
+            assertEquals(expectedValue.getVersion(), entry.getVersion());
 
-	    testdata.remove(entry.getKey());
-	}
+            testdata.remove(entry.getKey());
+        }
 
-	assertTrue(testdata.isEmpty());
+        assertTrue(testdata.isEmpty());
     }
 
     @Test
     public void testToString() {
-	assertEquals("[HZTable " + TEST_TABLE_NAME + "]", table.toString());
+        assertEquals("[HZTable " + TEST_TABLE_NAME + "]", table.toString());
     }
 
 }
diff --git a/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchNoDataStoreTest.java b/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchNoDataStoreTest.java
index 54eaf8c..b538aca 100644
--- a/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchNoDataStoreTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchNoDataStoreTest.java
@@ -14,72 +14,72 @@
 
     @Test
     public void testGetDpidFromKeyByteArray() {
-	// reference bytes
-	final byte[] key = KVSwitch.getSwitchID(0x1L);
+        // reference bytes
+        final byte[] key = KVSwitch.getSwitchID(0x1L);
 
-	assertEquals(0x1L, KVSwitch.getDpidFromKey(key));
+        assertEquals(0x1L, KVSwitch.getDpidFromKey(key));
     }
 
     @Test
     public void testGetDpidFromKeyByteBuffer() {
-	// reference bytes
-	final ByteBuffer key = ByteBuffer.wrap(KVSwitch.getSwitchID(0x1L));
+        // reference bytes
+        final ByteBuffer key = ByteBuffer.wrap(KVSwitch.getSwitchID(0x1L));
 
-	assertEquals(0x1L, KVSwitch.getDpidFromKey(key));
+        assertEquals(0x1L, KVSwitch.getDpidFromKey(key));
     }
 
     @Test
     public void testCreateFromKeyByteArray() {
-	// reference bytes
-	Long dpid = Long.valueOf(0x1L);
-	final byte[] key = KVSwitch.getSwitchID(dpid);
+        // reference bytes
+        Long dpid = Long.valueOf(0x1L);
+        final byte[] key = KVSwitch.getSwitchID(dpid);
 
-	KVSwitch sw = KVSwitch.createFromKey(key);
-	assertNotNull(sw);
-	assertEquals(dpid, sw.getDpid());
+        KVSwitch sw = KVSwitch.createFromKey(key);
+        assertNotNull(sw);
+        assertEquals(dpid, sw.getDpid());
     }
 
     @Test
     public void testGetStatus() {
-	KVSwitch sw = new KVSwitch(0x1L);
+        KVSwitch sw = new KVSwitch(0x1L);
 
-	assertEquals(STATUS.INACTIVE, sw.getStatus());
+        assertEquals(STATUS.INACTIVE, sw.getStatus());
     }
 
     @Test
     public void testSetStatus() {
-	KVSwitch sw = new KVSwitch(0x1L);
-	assertEquals(STATUS.INACTIVE, sw.getStatus());
+        KVSwitch sw = new KVSwitch(0x1L);
+        assertEquals(STATUS.INACTIVE, sw.getStatus());
 
-	sw.setStatus(STATUS.ACTIVE);
-	assertEquals(STATUS.ACTIVE, sw.getStatus());
+        sw.setStatus(STATUS.ACTIVE);
+        assertEquals(STATUS.ACTIVE, sw.getStatus());
     }
 
     @Test
     public void testGetDpid() {
-	Long dpid = 0x1L;
-	KVSwitch sw = new KVSwitch(dpid);
-	assertEquals(dpid, sw.getDpid());
+        Long dpid = 0x1L;
+        KVSwitch sw = new KVSwitch(dpid);
+        assertEquals(dpid, sw.getDpid());
     }
 
     @Test
     public void testGetId() {
-	// reference bytes
-	Long dpid = Long.valueOf(0x1L);
-	final byte[] key = KVSwitch.getSwitchID(dpid);
+        // reference bytes
+        Long dpid = Long.valueOf(0x1L);
+        final byte[] key = KVSwitch.getSwitchID(dpid);
 
-	KVSwitch sw = KVSwitch.createFromKey(key);
-	assertArrayEquals(key, sw.getId());
+        KVSwitch sw = KVSwitch.createFromKey(key);
+        assertArrayEquals(key, sw.getId());
     }
 
     @Test
     public void testToString() {
-	final String expected = "[" + "KVSwitch"
-		+ " 0x" + 1 + " STATUS:" + STATUS.INACTIVE + "]";
+        final String expected = "[" + "KVSwitch"
+                + " 0x" + 1 + " STATUS:" + STATUS.INACTIVE + "]";
 
-	Long dpid = 0x1L;
-	KVSwitch sw = new KVSwitch(dpid);
+        Long dpid = 0x1L;
+        KVSwitch sw = new KVSwitch(dpid);
 
-	assertEquals(expected, sw.toString());
+        assertEquals(expected, sw.toString());
     }
 }
diff --git a/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchTest.java b/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchTest.java
index 58b30a3..ba25903 100644
--- a/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/topology/KVSwitchTest.java
@@ -27,181 +27,182 @@
 
     @Before
     public void setUp() throws Exception {
-	switchTable = DataStoreClient.getClient().getTable(KVSwitch.GLOBAL_SWITCH_TABLE_NAME);
-	sw1 = new KVSwitch(dpid1);
+        switchTable = DataStoreClient.getClient().getTable(KVSwitch.GLOBAL_SWITCH_TABLE_NAME);
+        sw1 = new KVSwitch(dpid1);
     }
 
     @After
     public void tearDown() throws Exception {
-	DataStoreClient.getClient().dropTable(switchTable);
+        DataStoreClient.getClient().dropTable(switchTable);
     }
 
     public KVSwitch assertSwitchInDataStore(final Long dpid, final STATUS status) {
-	try {
-	    final KVSwitch sw = new KVSwitch(dpid);
-	    sw.read();
-	    assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
-	    assertEquals(dpid, sw.getDpid());
-	    assertEquals(status, sw.getStatus());
-	    return sw;
-	} catch (ObjectDoesntExistException e) {
-	    fail("Switch was not written to datastore");
-	}
-	return null;
+        try {
+            final KVSwitch sw = new KVSwitch(dpid);
+            sw.read();
+            assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+            assertEquals(dpid, sw.getDpid());
+            assertEquals(status, sw.getStatus());
+            return sw;
+        } catch (ObjectDoesntExistException e) {
+            fail("Switch was not written to datastore");
+        }
+        return null;
     }
+
     public void assertSwitchNotInDataStore(final Long dpid) {
-	final KVSwitch sw = new KVSwitch(dpid);
-	try {
-	    sw.read();
-	    fail("Switch was not supposed to be there in datastore");
-	} catch (ObjectDoesntExistException e) {
-	}
+        final KVSwitch sw = new KVSwitch(dpid);
+        try {
+            sw.read();
+            fail("Switch was not supposed to be there in datastore");
+        } catch (ObjectDoesntExistException e) {
+        }
     }
 
     @Test
     public void testGetAllSwitches() throws ObjectExistsException {
-	final int NUM_SWITCHES = 100;
-	Map<Long,KVSwitch> expected = new HashMap<>();
-	for (long dpid = 1 ; dpid <= NUM_SWITCHES ; ++dpid) {
-	    KVSwitch sw = new KVSwitch(dpid);
-	    sw.setStatus(STATUS.ACTIVE);
-	    sw.create();
-	    assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
-	    expected.put(sw.getDpid(), sw);
-	}
+        final int NUM_SWITCHES = 100;
+        Map<Long, KVSwitch> expected = new HashMap<>();
+        for (long dpid = 1; dpid <= NUM_SWITCHES; ++dpid) {
+            KVSwitch sw = new KVSwitch(dpid);
+            sw.setStatus(STATUS.ACTIVE);
+            sw.create();
+            assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+            expected.put(sw.getDpid(), sw);
+        }
 
-	Iterable<KVSwitch> switches = KVSwitch.getAllSwitches();
+        Iterable<KVSwitch> switches = KVSwitch.getAllSwitches();
 
-	for (KVSwitch sw : switches) {
-	    KVSwitch expectedSw = expected.get(sw.getDpid());
-	    assertNotNull(expectedSw);
-	    assertEquals(expectedSw.getDpid(), sw.getDpid());
-	    assertEquals(expectedSw.getStatus(), sw.getStatus());
-	    assertEquals(expectedSw.getVersion(), sw.getVersion());
+        for (KVSwitch sw : switches) {
+            KVSwitch expectedSw = expected.get(sw.getDpid());
+            assertNotNull(expectedSw);
+            assertEquals(expectedSw.getDpid(), sw.getDpid());
+            assertEquals(expectedSw.getStatus(), sw.getStatus());
+            assertEquals(expectedSw.getVersion(), sw.getVersion());
 
-	    assertArrayEquals(expectedSw.getKey(), sw.getKey());
-	}
+            assertArrayEquals(expectedSw.getKey(), sw.getKey());
+        }
     }
 
     @Test
     public void testCreate() throws ObjectExistsException {
-	sw1.setStatus(STATUS.ACTIVE);
-	sw1.create();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+        sw1.setStatus(STATUS.ACTIVE);
+        sw1.create();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
 
-	assertEquals(dpid1, sw1.getDpid());
-	assertEquals(STATUS.ACTIVE, sw1.getStatus());
+        assertEquals(dpid1, sw1.getDpid());
+        assertEquals(STATUS.ACTIVE, sw1.getStatus());
 
-	assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+        assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
     }
 
     @Test(expected = ObjectExistsException.class)
     public void testCreateFailAlreadyExist() throws ObjectExistsException {
-	// setup pre-existing Switch
-	KVSwitch sw = new KVSwitch(dpid1);
-	sw.forceCreate();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
-	assertSwitchInDataStore(dpid1, STATUS.INACTIVE);
+        // setup pre-existing Switch
+        KVSwitch sw = new KVSwitch(dpid1);
+        sw.forceCreate();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+        assertSwitchInDataStore(dpid1, STATUS.INACTIVE);
 
-	sw1.setStatus(STATUS.ACTIVE);
-	sw1.create();
-	fail("Should have thrown an exception");
+        sw1.setStatus(STATUS.ACTIVE);
+        sw1.create();
+        fail("Should have thrown an exception");
     }
 
     @Test
     public void testForceCreate() {
-	// setup pre-existing Switch
-	KVSwitch sw = new KVSwitch(dpid1);
-	sw.forceCreate();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
-	assertSwitchInDataStore(dpid1, STATUS.INACTIVE);
+        // setup pre-existing Switch
+        KVSwitch sw = new KVSwitch(dpid1);
+        sw.forceCreate();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+        assertSwitchInDataStore(dpid1, STATUS.INACTIVE);
 
 
-	sw1.setStatus(STATUS.ACTIVE);
-	sw1.forceCreate();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+        sw1.setStatus(STATUS.ACTIVE);
+        sw1.forceCreate();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
 
-	assertEquals(dpid1, sw1.getDpid());
-	assertEquals(STATUS.ACTIVE, sw1.getStatus());
-	assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+        assertEquals(dpid1, sw1.getDpid());
+        assertEquals(STATUS.ACTIVE, sw1.getStatus());
+        assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
     }
 
     @Test
     public void testRead() throws ObjectDoesntExistException {
-	// setup pre-existing Switch
-	KVSwitch sw = new KVSwitch(dpid1);
-	sw.setStatus(STATUS.ACTIVE);
-	sw.forceCreate();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
-	assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+        // setup pre-existing Switch
+        KVSwitch sw = new KVSwitch(dpid1);
+        sw.setStatus(STATUS.ACTIVE);
+        sw.forceCreate();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+        assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
 
-	sw1.read();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
-	assertEquals(sw.getVersion(), sw1.getVersion());
-	assertEquals(dpid1, sw1.getDpid());
-	assertEquals(STATUS.ACTIVE, sw1.getStatus());
+        sw1.read();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+        assertEquals(sw.getVersion(), sw1.getVersion());
+        assertEquals(dpid1, sw1.getDpid());
+        assertEquals(STATUS.ACTIVE, sw1.getStatus());
     }
 
     @Test(expected = ObjectDoesntExistException.class)
     public void testReadFailNoExist() throws ObjectDoesntExistException {
 
-	sw1.read();
-	fail("Should have thrown an exception");
+        sw1.read();
+        fail("Should have thrown an exception");
     }
 
     @Test
     public void testUpdate() throws ObjectDoesntExistException, WrongVersionException {
-	// setup pre-existing Switch
-	KVSwitch sw = new KVSwitch(dpid1);
-	sw.setStatus(STATUS.ACTIVE);
-	sw.forceCreate();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
-	assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+        // setup pre-existing Switch
+        KVSwitch sw = new KVSwitch(dpid1);
+        sw.setStatus(STATUS.ACTIVE);
+        sw.forceCreate();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+        assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
 
 
-	sw1.read();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+        sw1.read();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
 
-	sw1.setStatus(STATUS.INACTIVE);
-	sw1.update();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
-	assertNotEquals(sw.getVersion(), sw1.getVersion());
-	assertEquals(dpid1, sw1.getDpid());
-	assertEquals(STATUS.INACTIVE, sw1.getStatus());
+        sw1.setStatus(STATUS.INACTIVE);
+        sw1.update();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+        assertNotEquals(sw.getVersion(), sw1.getVersion());
+        assertEquals(dpid1, sw1.getDpid());
+        assertEquals(STATUS.INACTIVE, sw1.getStatus());
     }
 
     @Test
     public void testDelete() throws ObjectDoesntExistException, WrongVersionException {
-	// setup pre-existing Switch
-	KVSwitch sw = new KVSwitch(dpid1);
-	sw.setStatus(STATUS.ACTIVE);
-	sw.forceCreate();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
-	assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+        // setup pre-existing Switch
+        KVSwitch sw = new KVSwitch(dpid1);
+        sw.setStatus(STATUS.ACTIVE);
+        sw.forceCreate();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+        assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
 
 
-	try {
-	    sw1.read();
-	} catch (ObjectDoesntExistException e) {
-	    fail("Failed reading switch to delete");
-	}
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
-	sw1.delete();
-	assertSwitchNotInDataStore(dpid1);
+        try {
+            sw1.read();
+        } catch (ObjectDoesntExistException e) {
+            fail("Failed reading switch to delete");
+        }
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+        sw1.delete();
+        assertSwitchNotInDataStore(dpid1);
     }
 
     @Test
     public void testForceDelete() {
-	// setup pre-existing Switch
-	KVSwitch sw = new KVSwitch(dpid1);
-	sw.setStatus(STATUS.ACTIVE);
-	sw.forceCreate();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
-	assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
+        // setup pre-existing Switch
+        KVSwitch sw = new KVSwitch(dpid1);
+        sw.setStatus(STATUS.ACTIVE);
+        sw.forceCreate();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw.getVersion());
+        assertSwitchInDataStore(dpid1, STATUS.ACTIVE);
 
 
-	sw1.forceDelete();
-	assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
+        sw1.forceDelete();
+        assertNotEquals(DataStoreClient.getClient().VERSION_NONEXISTENT(), sw1.getVersion());
     }
 
 }
diff --git a/src/test/java/net/onrc/onos/core/datastore/topology/KVTopologyTest.java b/src/test/java/net/onrc/onos/core/datastore/topology/KVTopologyTest.java
index 2de84e5..d9c2478 100644
--- a/src/test/java/net/onrc/onos/core/datastore/topology/KVTopologyTest.java
+++ b/src/test/java/net/onrc/onos/core/datastore/topology/KVTopologyTest.java
@@ -36,7 +36,7 @@
 
     static final long VERSION_NONEXISTENT = DataStoreClient.getClient().VERSION_NONEXISTENT();
 
-    private static final byte[] DEVICE2_MAC_SW2P2 = new byte[] { 6, 5, 4, 3, 2, 1, 0 };
+    private static final byte[] DEVICE2_MAC_SW2P2 = new byte[]{6, 5, 4, 3, 2, 1, 0};
 
     private static final Long SW2_PORTNO2 = 2L;
 
@@ -44,7 +44,7 @@
 
     private static final Long DPID2 = 0x2L;
 
-    private static final byte[] DEVICE1_MAC_SW1P1 = new byte[] { 0, 1, 2, 3, 4, 5, 6 };
+    private static final byte[] DEVICE1_MAC_SW1P1 = new byte[]{0, 1, 2, 3, 4, 5, 6};
 
     private static final Long SW1_PORTNO2 = 2L;
 
@@ -55,377 +55,377 @@
     @Before
     @After
     public void wipeTopology() throws Exception {
-	IKVTable switchTable = DataStoreClient.getClient().getTable(KVSwitch.GLOBAL_SWITCH_TABLE_NAME);
-	DataStoreClient.getClient().dropTable(switchTable);
+        IKVTable switchTable = DataStoreClient.getClient().getTable(KVSwitch.GLOBAL_SWITCH_TABLE_NAME);
+        DataStoreClient.getClient().dropTable(switchTable);
 
-	IKVTable portTable = DataStoreClient.getClient().getTable(KVPort.GLOBAL_PORT_TABLE_NAME);
-	DataStoreClient.getClient().dropTable(portTable);
+        IKVTable portTable = DataStoreClient.getClient().getTable(KVPort.GLOBAL_PORT_TABLE_NAME);
+        DataStoreClient.getClient().dropTable(portTable);
 
-	IKVTable linkTable = DataStoreClient.getClient().getTable(KVLink.GLOBAL_LINK_TABLE_NAME);
-	DataStoreClient.getClient().dropTable(linkTable);
+        IKVTable linkTable = DataStoreClient.getClient().getTable(KVLink.GLOBAL_LINK_TABLE_NAME);
+        DataStoreClient.getClient().dropTable(linkTable);
 
-	IKVTable deviceTable = DataStoreClient.getClient().getTable(KVDevice.GLOBAL_DEVICE_TABLE_NAME);
-	DataStoreClient.getClient().dropTable(deviceTable);
+        IKVTable deviceTable = DataStoreClient.getClient().getTable(KVDevice.GLOBAL_DEVICE_TABLE_NAME);
+        DataStoreClient.getClient().dropTable(deviceTable);
     }
 
     @Test
     public void basic_switch_test() {
-	// create switch 0x1
-	try {
-	    KVSwitch sw = new KVSwitch(DPID1);
-	    sw.setStatus(KVSwitch.STATUS.ACTIVE);
-	    sw.create();
-	    assertNotEquals(VERSION_NONEXISTENT, sw.getVersion());
-	    assertEquals(DPID1, sw.getDpid());
-	    assertEquals(KVSwitch.STATUS.ACTIVE, sw.getStatus());
-	} catch (ObjectExistsException e) {
-	    e.printStackTrace();
-	    fail("Create Switch Failed " + e);
-	}
+        // create switch 0x1
+        try {
+            KVSwitch sw = new KVSwitch(DPID1);
+            sw.setStatus(KVSwitch.STATUS.ACTIVE);
+            sw.create();
+            assertNotEquals(VERSION_NONEXISTENT, sw.getVersion());
+            assertEquals(DPID1, sw.getDpid());
+            assertEquals(KVSwitch.STATUS.ACTIVE, sw.getStatus());
+        } catch (ObjectExistsException e) {
+            e.printStackTrace();
+            fail("Create Switch Failed " + e);
+        }
 
-	// read switch 0x1
-	KVSwitch swRead = new KVSwitch(DPID1);
-	try {
-	    swRead.read();
-	    assertNotEquals(VERSION_NONEXISTENT, swRead.getVersion());
-	    assertEquals(DPID1, swRead.getDpid());
-	    assertEquals(KVSwitch.STATUS.ACTIVE, swRead.getStatus());
-	} catch (ObjectDoesntExistException e) {
-	    e.printStackTrace();
-	    fail("Reading Switch Failed " + e);
-	}
+        // read switch 0x1
+        KVSwitch swRead = new KVSwitch(DPID1);
+        try {
+            swRead.read();
+            assertNotEquals(VERSION_NONEXISTENT, swRead.getVersion());
+            assertEquals(DPID1, swRead.getDpid());
+            assertEquals(KVSwitch.STATUS.ACTIVE, swRead.getStatus());
+        } catch (ObjectDoesntExistException e) {
+            e.printStackTrace();
+            fail("Reading Switch Failed " + e);
+        }
 
-	// and update 0x1
-	swRead.setStatus(KVSwitch.STATUS.INACTIVE);
-	try {
-	    swRead.update();
-	    assertNotEquals(VERSION_NONEXISTENT, swRead.getVersion());
-	    assertEquals(DPID1, swRead.getDpid());
-	    assertEquals(KVSwitch.STATUS.INACTIVE, swRead.getStatus());
-	} catch (ObjectDoesntExistException | WrongVersionException e) {
-	    e.printStackTrace();
-	    fail("Updating Switch Failed " + e);
-	}
+        // and update 0x1
+        swRead.setStatus(KVSwitch.STATUS.INACTIVE);
+        try {
+            swRead.update();
+            assertNotEquals(VERSION_NONEXISTENT, swRead.getVersion());
+            assertEquals(DPID1, swRead.getDpid());
+            assertEquals(KVSwitch.STATUS.INACTIVE, swRead.getStatus());
+        } catch (ObjectDoesntExistException | WrongVersionException e) {
+            e.printStackTrace();
+            fail("Updating Switch Failed " + e);
+        }
 
-	// read 0x1 again and delete
-	KVSwitch swRead2 = new KVSwitch(DPID1);
-	try {
-	    swRead2.read();
-	    assertNotEquals(VERSION_NONEXISTENT, swRead2.getVersion());
-	    assertEquals(DPID1, swRead2.getDpid());
-	    assertEquals(KVSwitch.STATUS.INACTIVE, swRead2.getStatus());
-	} catch (ObjectDoesntExistException e) {
-	    e.printStackTrace();
-	    fail("Reading Switch Again Failed " + e);
-	}
+        // read 0x1 again and delete
+        KVSwitch swRead2 = new KVSwitch(DPID1);
+        try {
+            swRead2.read();
+            assertNotEquals(VERSION_NONEXISTENT, swRead2.getVersion());
+            assertEquals(DPID1, swRead2.getDpid());
+            assertEquals(KVSwitch.STATUS.INACTIVE, swRead2.getStatus());
+        } catch (ObjectDoesntExistException e) {
+            e.printStackTrace();
+            fail("Reading Switch Again Failed " + e);
+        }
 
-	try {
-	    swRead2.delete();
-	    assertNotEquals(VERSION_NONEXISTENT, swRead2.getVersion());
-	} catch (ObjectDoesntExistException | WrongVersionException e) {
-	    e.printStackTrace();
-	    fail("Deleting Switch Failed " + e);
-	}
+        try {
+            swRead2.delete();
+            assertNotEquals(VERSION_NONEXISTENT, swRead2.getVersion());
+        } catch (ObjectDoesntExistException | WrongVersionException e) {
+            e.printStackTrace();
+            fail("Deleting Switch Failed " + e);
+        }
 
-	// make sure 0x1 is deleted
-	KVObject swRead3 = new KVSwitch(DPID1);
-	try {
-	    swRead3.read();
-	    fail(swRead3 + " was supposed to be deleted, but read succeed");
-	} catch (ObjectDoesntExistException e) {
-	    System.out.println("-- " + swRead3 + " not found as expected--");
-	    e.printStackTrace(System.out);
-	    System.out.println("---------------------------------------");
-	}
+        // make sure 0x1 is deleted
+        KVObject swRead3 = new KVSwitch(DPID1);
+        try {
+            swRead3.read();
+            fail(swRead3 + " was supposed to be deleted, but read succeed");
+        } catch (ObjectDoesntExistException e) {
+            System.out.println("-- " + swRead3 + " not found as expected--");
+            e.printStackTrace(System.out);
+            System.out.println("---------------------------------------");
+        }
     }
 
     @Test
     public void topology_setup_and_tear_down() {
-	topology_setup();
-	topology_walk();
-	topology_delete();
+        topology_setup();
+        topology_walk();
+        topology_delete();
     }
 
     private static void topology_setup() {
 
-	// d1 - s1p1 - s1 - s1p2 - s2p1 - s2 - s2p2
+        // d1 - s1p1 - s1 - s1p2 - s2p1 - s2 - s2p2
 
-	KVSwitch sw1 = new KVSwitch(DPID1);
-	sw1.setStatus(KVSwitch.STATUS.ACTIVE);
-	try {
-	    sw1.create();
-	    assertNotEquals(VERSION_NONEXISTENT, sw1.getVersion());
-	    assertEquals(DPID1, sw1.getDpid());
-	    assertEquals(KVSwitch.STATUS.ACTIVE, sw1.getStatus());
-	} catch (ObjectExistsException e) {
-	    e.printStackTrace();
-	    fail("Switch creation failed " + e);
-	}
+        KVSwitch sw1 = new KVSwitch(DPID1);
+        sw1.setStatus(KVSwitch.STATUS.ACTIVE);
+        try {
+            sw1.create();
+            assertNotEquals(VERSION_NONEXISTENT, sw1.getVersion());
+            assertEquals(DPID1, sw1.getDpid());
+            assertEquals(KVSwitch.STATUS.ACTIVE, sw1.getStatus());
+        } catch (ObjectExistsException e) {
+            e.printStackTrace();
+            fail("Switch creation failed " + e);
+        }
 
-	KVPort sw1p1 = new KVPort(DPID1, SW1_PORTNO1);
-	sw1p1.setStatus(KVPort.STATUS.ACTIVE);
-	KVPort sw1p2 = new KVPort(DPID1, SW1_PORTNO2);
-	sw1p2.setStatus(KVPort.STATUS.ACTIVE);
-	try {
-	    sw1p1.create();
-	    assertNotEquals(VERSION_NONEXISTENT, sw1p1.getVersion());
-	    assertEquals(DPID1, sw1p1.getDpid());
-	    assertEquals(SW1_PORTNO1, sw1p1.getNumber());
-	    assertEquals(KVPort.STATUS.ACTIVE, sw1p1.getStatus());
+        KVPort sw1p1 = new KVPort(DPID1, SW1_PORTNO1);
+        sw1p1.setStatus(KVPort.STATUS.ACTIVE);
+        KVPort sw1p2 = new KVPort(DPID1, SW1_PORTNO2);
+        sw1p2.setStatus(KVPort.STATUS.ACTIVE);
+        try {
+            sw1p1.create();
+            assertNotEquals(VERSION_NONEXISTENT, sw1p1.getVersion());
+            assertEquals(DPID1, sw1p1.getDpid());
+            assertEquals(SW1_PORTNO1, sw1p1.getNumber());
+            assertEquals(KVPort.STATUS.ACTIVE, sw1p1.getStatus());
 
-	    sw1p2.create();
-	    assertNotEquals(VERSION_NONEXISTENT, sw1p2.getVersion());
-	    assertEquals(DPID1, sw1p2.getDpid());
-	    assertEquals(SW1_PORTNO2, sw1p2.getNumber());
-	    assertEquals(KVPort.STATUS.ACTIVE, sw1p2.getStatus());
-	} catch (ObjectExistsException e) {
-	    e.printStackTrace();
-	    fail("Port creation failed " + e);
-	}
+            sw1p2.create();
+            assertNotEquals(VERSION_NONEXISTENT, sw1p2.getVersion());
+            assertEquals(DPID1, sw1p2.getDpid());
+            assertEquals(SW1_PORTNO2, sw1p2.getNumber());
+            assertEquals(KVPort.STATUS.ACTIVE, sw1p2.getStatus());
+        } catch (ObjectExistsException e) {
+            e.printStackTrace();
+            fail("Port creation failed " + e);
+        }
 
-	try {
-	    sw1.update();
-	    assertNotEquals(VERSION_NONEXISTENT, sw1.getVersion());
-	    assertEquals(DPID1, sw1.getDpid());
-	    assertEquals(KVSwitch.STATUS.ACTIVE, sw1.getStatus());
-	} catch (ObjectDoesntExistException | WrongVersionException e) {
-	    e.printStackTrace();
-	    fail("Switch update failed " + e);
-	}
+        try {
+            sw1.update();
+            assertNotEquals(VERSION_NONEXISTENT, sw1.getVersion());
+            assertEquals(DPID1, sw1.getDpid());
+            assertEquals(KVSwitch.STATUS.ACTIVE, sw1.getStatus());
+        } catch (ObjectDoesntExistException | WrongVersionException e) {
+            e.printStackTrace();
+            fail("Switch update failed " + e);
+        }
 
-	KVDevice d1 = new KVDevice(DEVICE1_MAC_SW1P1);
-	d1.addPortId(sw1p1.getId());
+        KVDevice d1 = new KVDevice(DEVICE1_MAC_SW1P1);
+        d1.addPortId(sw1p1.getId());
 
-	try {
-	    d1.create();
-	    assertNotEquals(VERSION_NONEXISTENT, d1.getVersion());
-	    assertEquals(1, d1.getAllPortIds().size());
-	    assertArrayEquals(sw1p1.getId(), d1.getAllPortIds().iterator().next());
+        try {
+            d1.create();
+            assertNotEquals(VERSION_NONEXISTENT, d1.getVersion());
+            assertEquals(1, d1.getAllPortIds().size());
+            assertArrayEquals(sw1p1.getId(), d1.getAllPortIds().iterator().next());
 
-	    try {
-		sw1p1.update();
-		assertNotEquals(VERSION_NONEXISTENT, sw1p1.getVersion());
-		assertEquals(DPID1, sw1p1.getDpid());
-		assertEquals(SW1_PORTNO1, sw1p1.getNumber());
-		assertEquals(KVPort.STATUS.ACTIVE, sw1p1.getStatus());
-	    } catch (ObjectDoesntExistException | WrongVersionException e) {
-		e.printStackTrace();
-		fail("Link update failed " + e);
-	    }
-	} catch (ObjectExistsException e) {
-	    e.printStackTrace();
-	    fail("Device creation failed " + e);
-	}
+            try {
+                sw1p1.update();
+                assertNotEquals(VERSION_NONEXISTENT, sw1p1.getVersion());
+                assertEquals(DPID1, sw1p1.getDpid());
+                assertEquals(SW1_PORTNO1, sw1p1.getNumber());
+                assertEquals(KVPort.STATUS.ACTIVE, sw1p1.getStatus());
+            } catch (ObjectDoesntExistException | WrongVersionException e) {
+                e.printStackTrace();
+                fail("Link update failed " + e);
+            }
+        } catch (ObjectExistsException e) {
+            e.printStackTrace();
+            fail("Device creation failed " + e);
+        }
 
-	KVSwitch sw2 = new KVSwitch(DPID2);
-	sw2.setStatus(KVSwitch.STATUS.ACTIVE);
-	KVPort sw2p1 = new KVPort(DPID2, SW2_PORTNO1);
-	sw2p1.setStatus(KVPort.STATUS.ACTIVE);
-	KVPort sw2p2 = new KVPort(DPID2, SW2_PORTNO2);
-	sw2p2.setStatus(KVPort.STATUS.ACTIVE);
+        KVSwitch sw2 = new KVSwitch(DPID2);
+        sw2.setStatus(KVSwitch.STATUS.ACTIVE);
+        KVPort sw2p1 = new KVPort(DPID2, SW2_PORTNO1);
+        sw2p1.setStatus(KVPort.STATUS.ACTIVE);
+        KVPort sw2p2 = new KVPort(DPID2, SW2_PORTNO2);
+        sw2p2.setStatus(KVPort.STATUS.ACTIVE);
 
-	KVDevice d2 = new KVDevice(DEVICE2_MAC_SW2P2);
-	d2.addPortId(sw2p2.getId());
+        KVDevice d2 = new KVDevice(DEVICE2_MAC_SW2P2);
+        d2.addPortId(sw2p2.getId());
 
-	IKVClient client = DataStoreClient.getClient();
+        IKVClient client = DataStoreClient.getClient();
 
-	List<WriteOp> groupOp = Arrays.asList(
-		sw2.createOp(client), sw2p1.createOp(client),
-		sw2p2.createOp(client), d2.createOp(client) );
-	boolean failed = KVObject.multiWrite(groupOp);
-	if (failed) {
-	    for ( WriteOp op : groupOp ) {
-		System.err.println(op);
-	    }
-	    fail("Some of Switch/Port/Device creation failed");
-	} else {
-	    assertNotEquals(VERSION_NONEXISTENT, sw2.getVersion());
-	    assertEquals(DPID2, sw2.getDpid());
-	    assertEquals(KVSwitch.STATUS.ACTIVE, sw2.getStatus());
+        List<WriteOp> groupOp = Arrays.asList(
+                sw2.createOp(client), sw2p1.createOp(client),
+                sw2p2.createOp(client), d2.createOp(client));
+        boolean failed = KVObject.multiWrite(groupOp);
+        if (failed) {
+            for (WriteOp op : groupOp) {
+                System.err.println(op);
+            }
+            fail("Some of Switch/Port/Device creation failed");
+        } else {
+            assertNotEquals(VERSION_NONEXISTENT, sw2.getVersion());
+            assertEquals(DPID2, sw2.getDpid());
+            assertEquals(KVSwitch.STATUS.ACTIVE, sw2.getStatus());
 
-	    assertNotEquals(VERSION_NONEXISTENT, sw2p1.getVersion());
-	    assertEquals(DPID2, sw2p1.getDpid());
-	    assertEquals(SW2_PORTNO1, sw2p1.getNumber());
-	    assertEquals(KVPort.STATUS.ACTIVE, sw2p1.getStatus());
+            assertNotEquals(VERSION_NONEXISTENT, sw2p1.getVersion());
+            assertEquals(DPID2, sw2p1.getDpid());
+            assertEquals(SW2_PORTNO1, sw2p1.getNumber());
+            assertEquals(KVPort.STATUS.ACTIVE, sw2p1.getStatus());
 
-	    assertNotEquals(VERSION_NONEXISTENT, sw2p2.getVersion());
-	    assertEquals(DPID2, sw2p2.getDpid());
-	    assertEquals(SW2_PORTNO2, sw2p2.getNumber());
-	    assertEquals(KVPort.STATUS.ACTIVE, sw2p2.getStatus());
+            assertNotEquals(VERSION_NONEXISTENT, sw2p2.getVersion());
+            assertEquals(DPID2, sw2p2.getDpid());
+            assertEquals(SW2_PORTNO2, sw2p2.getNumber());
+            assertEquals(KVPort.STATUS.ACTIVE, sw2p2.getStatus());
 
-	    assertNotEquals(VERSION_NONEXISTENT, d2.getVersion());
-	    assertEquals(1, d2.getAllPortIds().size());
-	    assertArrayEquals(sw2p2.getId(), d2.getAllPortIds().iterator().next());
-	}
+            assertNotEquals(VERSION_NONEXISTENT, d2.getVersion());
+            assertEquals(1, d2.getAllPortIds().size());
+            assertArrayEquals(sw2p2.getId(), d2.getAllPortIds().iterator().next());
+        }
 
-	KVLink l1 = new KVLink(DPID1, SW1_PORTNO2, DPID2, SW2_PORTNO1);
-	l1.setStatus(KVLink.STATUS.ACTIVE);
+        KVLink l1 = new KVLink(DPID1, SW1_PORTNO2, DPID2, SW2_PORTNO1);
+        l1.setStatus(KVLink.STATUS.ACTIVE);
 
-	try {
-	    l1.create();
-	    assertNotEquals(VERSION_NONEXISTENT, l1.getVersion());
-	    assertEquals(KVLink.STATUS.ACTIVE, l1.getStatus());
-	    assertArrayEquals(sw1.getId(), l1.getSrc().getSwitchID());
-	    assertArrayEquals(sw1p2.getId(), l1.getSrc().getPortID());
-	    assertArrayEquals(sw2.getId(), l1.getDst().getSwitchID());
-	    assertArrayEquals(sw2p1.getId(), l1.getDst().getPortID());
+        try {
+            l1.create();
+            assertNotEquals(VERSION_NONEXISTENT, l1.getVersion());
+            assertEquals(KVLink.STATUS.ACTIVE, l1.getStatus());
+            assertArrayEquals(sw1.getId(), l1.getSrc().getSwitchID());
+            assertArrayEquals(sw1p2.getId(), l1.getSrc().getPortID());
+            assertArrayEquals(sw2.getId(), l1.getDst().getSwitchID());
+            assertArrayEquals(sw2p1.getId(), l1.getDst().getPortID());
 
-	    try {
-		sw1p2.update();
-		assertNotEquals(VERSION_NONEXISTENT, sw1p2.getVersion());
-		assertEquals(DPID1, sw1p2.getDpid());
-		assertEquals(SW1_PORTNO2, sw1p2.getNumber());
-		assertEquals(KVPort.STATUS.ACTIVE, sw1p2.getStatus());
+            try {
+                sw1p2.update();
+                assertNotEquals(VERSION_NONEXISTENT, sw1p2.getVersion());
+                assertEquals(DPID1, sw1p2.getDpid());
+                assertEquals(SW1_PORTNO2, sw1p2.getNumber());
+                assertEquals(KVPort.STATUS.ACTIVE, sw1p2.getStatus());
 
-		sw2p1.update();
-		assertNotEquals(VERSION_NONEXISTENT, sw2p1.getVersion());
-		assertEquals(DPID2, sw2p1.getDpid());
-		assertEquals(SW2_PORTNO1, sw2p1.getNumber());
-		assertEquals(KVPort.STATUS.ACTIVE, sw2p1.getStatus());
-	    } catch (ObjectDoesntExistException | WrongVersionException e) {
-		e.printStackTrace();
-		fail("Port update failed " + e);
-	    }
-	} catch (ObjectExistsException e) {
-	    e.printStackTrace();
-	    fail("Link creation failed " + e);
-	}
+                sw2p1.update();
+                assertNotEquals(VERSION_NONEXISTENT, sw2p1.getVersion());
+                assertEquals(DPID2, sw2p1.getDpid());
+                assertEquals(SW2_PORTNO1, sw2p1.getNumber());
+                assertEquals(KVPort.STATUS.ACTIVE, sw2p1.getStatus());
+            } catch (ObjectDoesntExistException | WrongVersionException e) {
+                e.printStackTrace();
+                fail("Port update failed " + e);
+            }
+        } catch (ObjectExistsException e) {
+            e.printStackTrace();
+            fail("Link creation failed " + e);
+        }
     }
 
 
     private static void topology_walk() {
-	Iterable<KVSwitch> swIt = KVSwitch.getAllSwitches();
-	List<Long> switchesExpected = new ArrayList<>(Arrays.asList(DPID1, DPID2));
+        Iterable<KVSwitch> swIt = KVSwitch.getAllSwitches();
+        List<Long> switchesExpected = new ArrayList<>(Arrays.asList(DPID1, DPID2));
 
-	System.out.println("Enumerating Switches start");
-	for (KVSwitch sw : swIt) {
-	    System.out.println(sw + " @ " + sw.getVersion());
-	    assertNotEquals(VERSION_NONEXISTENT, sw.getVersion());
-	    assertEquals(KVSwitch.STATUS.ACTIVE, sw.getStatus());
-	    assertThat(sw.getDpid(), is(anyOf(equalTo(DPID1), equalTo(DPID2))));
-	    assertThat(switchesExpected, hasItem(sw.getDpid()));
-	    switchesExpected.remove(sw.getDpid());
-	}
-	System.out.println("Enumerating Switches end");
+        System.out.println("Enumerating Switches start");
+        for (KVSwitch sw : swIt) {
+            System.out.println(sw + " @ " + sw.getVersion());
+            assertNotEquals(VERSION_NONEXISTENT, sw.getVersion());
+            assertEquals(KVSwitch.STATUS.ACTIVE, sw.getStatus());
+            assertThat(sw.getDpid(), is(anyOf(equalTo(DPID1), equalTo(DPID2))));
+            assertThat(switchesExpected, hasItem(sw.getDpid()));
+            switchesExpected.remove(sw.getDpid());
+        }
+        System.out.println("Enumerating Switches end");
 
-	KVSwitch sw1 = new KVSwitch(DPID1);
-	try {
-	    sw1.read();
-	    assertNotEquals(VERSION_NONEXISTENT, sw1.getVersion());
-	    assertEquals(DPID1, sw1.getDpid());
-	    assertEquals(KVSwitch.STATUS.ACTIVE, sw1.getStatus());
-	} catch (ObjectDoesntExistException e) {
-	    e.printStackTrace();
-	    fail("Reading switch failed " + e);
-	}
+        KVSwitch sw1 = new KVSwitch(DPID1);
+        try {
+            sw1.read();
+            assertNotEquals(VERSION_NONEXISTENT, sw1.getVersion());
+            assertEquals(DPID1, sw1.getDpid());
+            assertEquals(KVSwitch.STATUS.ACTIVE, sw1.getStatus());
+        } catch (ObjectDoesntExistException e) {
+            e.printStackTrace();
+            fail("Reading switch failed " + e);
+        }
 
-	KVSwitch sw2 = new KVSwitch(DPID2);
-	if (KVObject.multiRead( Arrays.asList(sw2) )) {
-	    fail("Failed to read switch " + sw2);
-	} else {
-	    assertNotEquals(VERSION_NONEXISTENT, sw2.getVersion());
-	    assertEquals(DPID2, sw2.getDpid());
-	    assertEquals(KVSwitch.STATUS.ACTIVE, sw2.getStatus());
-	}
+        KVSwitch sw2 = new KVSwitch(DPID2);
+        if (KVObject.multiRead(Arrays.asList(sw2))) {
+            fail("Failed to read switch " + sw2);
+        } else {
+            assertNotEquals(VERSION_NONEXISTENT, sw2.getVersion());
+            assertEquals(DPID2, sw2.getDpid());
+            assertEquals(KVSwitch.STATUS.ACTIVE, sw2.getStatus());
+        }
 
 
-	// DPID -> [port_no]
-	@SuppressWarnings("serial")
-	Map<Long,List<Long>> expectedPorts = new HashMap<Long,List<Long>>() {{
-	    put(DPID1, new ArrayList<>(Arrays.asList(SW1_PORTNO1, SW1_PORTNO2)));
-	    put(DPID2, new ArrayList<>(Arrays.asList(SW2_PORTNO1, SW2_PORTNO2)));
-	}};
+        // DPID -> [port_no]
+        @SuppressWarnings("serial")
+        Map<Long, List<Long>> expectedPorts = new HashMap<Long, List<Long>>() {{
+            put(DPID1, new ArrayList<>(Arrays.asList(SW1_PORTNO1, SW1_PORTNO2)));
+            put(DPID2, new ArrayList<>(Arrays.asList(SW2_PORTNO1, SW2_PORTNO2)));
+        }};
 
-	for (KVPort port : KVPort.getAllPorts()) {
-	    System.out.println(port + " @ " + port.getVersion());
-	    assertNotEquals(VERSION_NONEXISTENT, port.getVersion());
-	    assertEquals(KVPort.STATUS.ACTIVE, port.getStatus());
-	    assertThat(port.getDpid(), is(anyOf(equalTo(DPID1), equalTo(DPID2))));
-	    assertThat(port.getNumber(), is(anyOf(equalTo(SW1_PORTNO1), equalTo(SW1_PORTNO2))));
+        for (KVPort port : KVPort.getAllPorts()) {
+            System.out.println(port + " @ " + port.getVersion());
+            assertNotEquals(VERSION_NONEXISTENT, port.getVersion());
+            assertEquals(KVPort.STATUS.ACTIVE, port.getStatus());
+            assertThat(port.getDpid(), is(anyOf(equalTo(DPID1), equalTo(DPID2))));
+            assertThat(port.getNumber(), is(anyOf(equalTo(SW1_PORTNO1), equalTo(SW1_PORTNO2))));
 
-	    assertThat(expectedPorts, hasKey(port.getDpid()));
-	    assertThat(expectedPorts.get(port.getDpid()), hasItem(port.getNumber()));
-	    expectedPorts.get(port.getDpid()).remove(port.getNumber());
-	}
+            assertThat(expectedPorts, hasKey(port.getDpid()));
+            assertThat(expectedPorts.get(port.getDpid()), hasItem(port.getNumber()));
+            expectedPorts.get(port.getDpid()).remove(port.getNumber());
+        }
 
-	// DeviceID -> PortID
-	@SuppressWarnings("serial")
-	Map<byte[], byte[]> expectedDevice = new TreeMap<byte[], byte[]>(ByteArrayComparator.BYTEARRAY_COMPARATOR) {{
-	    put(DEVICE1_MAC_SW1P1, KVPort.getPortID(DPID1, SW1_PORTNO1));
-	    put(DEVICE2_MAC_SW2P2, KVPort.getPortID(DPID2, SW2_PORTNO2));
-	}};
+        // DeviceID -> PortID
+        @SuppressWarnings("serial")
+        Map<byte[], byte[]> expectedDevice = new TreeMap<byte[], byte[]>(ByteArrayComparator.BYTEARRAY_COMPARATOR) {{
+            put(DEVICE1_MAC_SW1P1, KVPort.getPortID(DPID1, SW1_PORTNO1));
+            put(DEVICE2_MAC_SW2P2, KVPort.getPortID(DPID2, SW2_PORTNO2));
+        }};
 
-	for (KVDevice device : KVDevice.getAllDevices()) {
-	    System.out.println(device + " @ " + device.getVersion());
-	    assertNotEquals(VERSION_NONEXISTENT, device.getVersion());
+        for (KVDevice device : KVDevice.getAllDevices()) {
+            System.out.println(device + " @ " + device.getVersion());
+            assertNotEquals(VERSION_NONEXISTENT, device.getVersion());
 
-	    assertThat(expectedDevice, hasKey(device.getMac()));
-	    assertThat(device.getAllPortIds(), hasItem(expectedDevice.get(device.getMac())));
-	    expectedDevice.remove(device.getMac());
-	}
+            assertThat(expectedDevice, hasKey(device.getMac()));
+            assertThat(device.getAllPortIds(), hasItem(expectedDevice.get(device.getMac())));
+            expectedDevice.remove(device.getMac());
+        }
 
-	for (KVLink link : KVLink.getAllLinks()) {
-	    System.out.println(link + " @ " + link.getVersion());
-	    assertNotEquals(VERSION_NONEXISTENT, link.getVersion());
+        for (KVLink link : KVLink.getAllLinks()) {
+            System.out.println(link + " @ " + link.getVersion());
+            assertNotEquals(VERSION_NONEXISTENT, link.getVersion());
 
-	    // there is currently only 1 link SW1P2->SW2P1
-	    assertEquals(DPID1, link.getSrc().dpid);
-	    assertEquals(SW1_PORTNO2, link.getSrc().number);
-	    assertEquals(DPID2, link.getDst().dpid);
-	    assertEquals(SW2_PORTNO1, link.getDst().number);
-	}
+            // there is currently only 1 link SW1P2->SW2P1
+            assertEquals(DPID1, link.getSrc().dpid);
+            assertEquals(SW1_PORTNO2, link.getSrc().number);
+            assertEquals(DPID2, link.getDst().dpid);
+            assertEquals(SW2_PORTNO1, link.getDst().number);
+        }
 
     }
 
 
     private static void topology_delete() {
 
-	for (KVSwitch sw : KVSwitch.getAllSwitches()) {
-	    try {
-		sw.read();
-		sw.delete();
-		assertNotEquals(VERSION_NONEXISTENT, sw.getVersion());
-	    } catch (ObjectDoesntExistException | WrongVersionException e) {
-		e.printStackTrace();
-		fail("Delete Switch Failed " + e);
-	    }
-	}
+        for (KVSwitch sw : KVSwitch.getAllSwitches()) {
+            try {
+                sw.read();
+                sw.delete();
+                assertNotEquals(VERSION_NONEXISTENT, sw.getVersion());
+            } catch (ObjectDoesntExistException | WrongVersionException e) {
+                e.printStackTrace();
+                fail("Delete Switch Failed " + e);
+            }
+        }
 
-	for (KVPort p : KVPort.getAllPorts()) {
-	    try {
-		p.read();
-		p.delete();
-		assertNotEquals(VERSION_NONEXISTENT, p.getVersion());
-	    } catch (ObjectDoesntExistException | WrongVersionException e) {
-		e.printStackTrace();
-		fail("Delete Port Failed " + e);
-	    }
-	}
+        for (KVPort p : KVPort.getAllPorts()) {
+            try {
+                p.read();
+                p.delete();
+                assertNotEquals(VERSION_NONEXISTENT, p.getVersion());
+            } catch (ObjectDoesntExistException | WrongVersionException e) {
+                e.printStackTrace();
+                fail("Delete Port Failed " + e);
+            }
+        }
 
-	for (KVDevice d : KVDevice.getAllDevices()) {
-	    d.forceDelete();
-	    assertNotEquals(VERSION_NONEXISTENT, d.getVersion());
-	}
+        for (KVDevice d : KVDevice.getAllDevices()) {
+            d.forceDelete();
+            assertNotEquals(VERSION_NONEXISTENT, d.getVersion());
+        }
 
-	for (KVLink l : KVLink.getAllLinks()) {
-	    try {
-		l.read();
-		l.delete();
-		assertNotEquals(VERSION_NONEXISTENT, l.getVersion());
-	    } catch (ObjectDoesntExistException | WrongVersionException e) {
-		e.printStackTrace();
-		fail("Delete Link Failed " + e);
-	    }
-	}
+        for (KVLink l : KVLink.getAllLinks()) {
+            try {
+                l.read();
+                l.delete();
+                assertNotEquals(VERSION_NONEXISTENT, l.getVersion());
+            } catch (ObjectDoesntExistException | WrongVersionException e) {
+                e.printStackTrace();
+                fail("Delete Link Failed " + e);
+            }
+        }
     }
 
     public static void main(final String[] argv) {
 
-	topology_setup();
-	topology_walk();
-	topology_delete();
+        topology_setup();
+        topology_walk();
+        topology_delete();
 
-	System.exit(0);
+        System.exit(0);
     }
 
 }
diff --git a/src/test/java/net/onrc/onos/core/flowprogrammer/FlowPusherTest.java b/src/test/java/net/onrc/onos/core/flowprogrammer/FlowPusherTest.java
index be7834c..1c25e75 100644
--- a/src/test/java/net/onrc/onos/core/flowprogrammer/FlowPusherTest.java
+++ b/src/test/java/net/onrc/onos/core/flowprogrammer/FlowPusherTest.java
@@ -41,515 +41,517 @@
 import org.openflow.protocol.factory.BasicFactory;
 
 public class FlowPusherTest {
-	private FlowPusher pusher;
-	private FloodlightContext context;
-	private FloodlightModuleContext modContext;
-	private BasicFactory factory;
-	private OFMessageDamper damper;
-	private IFloodlightProviderService flProviderService;
-	private IThreadPoolService threadPoolService;
+    private FlowPusher pusher;
+    private FloodlightContext context;
+    private FloodlightModuleContext modContext;
+    private BasicFactory factory;
+    private OFMessageDamper damper;
+    private IFloodlightProviderService flProviderService;
+    private IThreadPoolService threadPoolService;
 
-	/**
-	 * Test single OFMessage is correctly sent to single switch via MessageDamper.
-	 */
-	@Test
-	public void testAddMessage() {
-		beginInitMock();
-		
-		OFMessage msg = EasyMock.createMock(OFMessage.class);
-		EasyMock.expect(msg.getXid()).andReturn(1).anyTimes();
-		EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
-		EasyMock.replay(msg);
-		
-		IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
-		EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
-		sw.flush();
-		EasyMock.expectLastCall().once();
-		EasyMock.replay(sw);
-		
-		try {
-			EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
-				.andReturn(true).once();
-		} catch (IOException e1) {
-			fail("Failed in OFMessageDamper#write()");
-		}
-		
-		endInitMock();
-		initPusher(1);
-		
-		boolean add_result = pusher.add(sw, msg);
-		assertTrue(add_result);
-		
-		try {
-			// wait until message is processed.
-			Thread.sleep(1000);
-		} catch (InterruptedException e) {
-			fail("Failed in Thread.sleep()");
-		}
-		EasyMock.verify(msg);
-		EasyMock.verify(sw);
-		verifyAll();
-		
-		pusher.stop();
-	}
-	
-	/**
-	 * Test bunch of OFMessages are correctly sent to single switch via MessageDamper.
-	 */
-	@Test
-	public void testMassiveAddMessage() {
-		final int NUM_MSG = 10000;
-		
-		beginInitMock();
+    /**
+     * Test single OFMessage is correctly sent to single switch via MessageDamper.
+     */
+    @Test
+    public void testAddMessage() {
+        beginInitMock();
 
-		IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
-		EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
-		sw.flush();
-		EasyMock.expectLastCall().atLeastOnce();
-		EasyMock.replay(sw);
-		
-		List<OFMessage> messages = new ArrayList<OFMessage>();
-		
-		for (int i = 0; i < NUM_MSG; ++i) {
-			OFMessage msg = EasyMock.createMock(OFMessage.class);
-			EasyMock.expect(msg.getXid()).andReturn(i).anyTimes();
-			EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
-			EasyMock.replay(msg);
-			messages.add(msg);
-			
-			try {
-				EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
-					.andReturn(true).once();
-			} catch (IOException e1) {
-				fail("Failed in OFMessageDamper#write()");
-			}
-		}
-		
-		endInitMock();
-		initPusher(1);
-		
-		for (OFMessage msg : messages) {
-			boolean add_result = pusher.add(sw, msg);
-			assertTrue(add_result);
-		}
-		
-		try {
-			// wait until message is processed.
-			Thread.sleep(5000);
-		} catch (InterruptedException e) {
-			fail("Failed in Thread.sleep()");
-		}
-		
-		for (OFMessage msg : messages) {
-			EasyMock.verify(msg);
-		}
-		EasyMock.verify(sw);
-		verifyAll();
-		
-		pusher.stop();
-	}
-	
-	/**
-	 * Test bunch of OFMessages are correctly sent to multiple switches with single threads.
-	 */
-	@Test
-	public void testMultiSwitchAddMessage() {
-		final int NUM_SWITCH = 10;
-		final int NUM_MSG = 100;	// messages per thread
-		
-		beginInitMock();
+        OFMessage msg = EasyMock.createMock(OFMessage.class);
+        EasyMock.expect(msg.getXid()).andReturn(1).anyTimes();
+        EasyMock.expect(msg.getLength()).andReturn((short) 100).anyTimes();
+        EasyMock.replay(msg);
 
-		Map<IOFSwitch, List<OFMessage>> sw_map = new HashMap<IOFSwitch, List<OFMessage>>();
-		for (int i = 0; i < NUM_SWITCH; ++i) {
-			IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
-			EasyMock.expect(sw.getId()).andReturn((long)i).anyTimes();
-			sw.flush();
-			EasyMock.expectLastCall().atLeastOnce();
-			EasyMock.replay(sw);
-			
-			List<OFMessage> messages = new ArrayList<OFMessage>();
-			
-			for (int j = 0; j < NUM_MSG; ++j) {
-				OFMessage msg = EasyMock.createMock(OFMessage.class);
-				EasyMock.expect(msg.getXid()).andReturn(j).anyTimes();
-				EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
-				EasyMock.replay(msg);
-				messages.add(msg);
-				
-				try {
-					EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
-						.andReturn(true).once();
-				} catch (IOException e1) {
-					fail("Failed in OFMessageDamper#write()");
-				}
-			}
-			sw_map.put(sw, messages);
-		}
-		
-		endInitMock();
-		initPusher(1);
-		
-		for (IOFSwitch sw : sw_map.keySet()) {
-			for (OFMessage msg : sw_map.get(sw)) {
-				boolean add_result = pusher.add(sw, msg);
-				assertTrue(add_result);
-			}
-		}
-		
-		try {
-			// wait until message is processed.
-			Thread.sleep(1000);
-		} catch (InterruptedException e) {
-			fail("Failed in Thread.sleep()");
-		}
-		
-		for (IOFSwitch sw : sw_map.keySet()) {
-			for (OFMessage msg : sw_map.get(sw)) {
-				EasyMock.verify(msg);
-			}
-			
-			EasyMock.verify(sw);
-		}
-		verifyAll();
+        IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+        EasyMock.expect(sw.getId()).andReturn((long) 1).anyTimes();
+        sw.flush();
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(sw);
 
-		pusher.stop();
-	}
-	
-	/**
-	 * Test bunch of OFMessages are correctly sent to multiple switches using multiple threads.
-	 */
-	@Test
-	public void testMultiThreadedAddMessage() {
-		final int NUM_THREAD = 10;
-		final int NUM_MSG = 100;	// messages per thread
-		
-		beginInitMock();
+        try {
+            EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+                    .andReturn(true).once();
+        } catch (IOException e1) {
+            fail("Failed in OFMessageDamper#write()");
+        }
 
-		Map<IOFSwitch, List<OFMessage>> sw_map = new HashMap<IOFSwitch, List<OFMessage>>();
-		for (int i = 0; i < NUM_THREAD; ++i) {
-			IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
-			EasyMock.expect(sw.getId()).andReturn((long)i).anyTimes();
-			sw.flush();
-			EasyMock.expectLastCall().atLeastOnce();
-			EasyMock.replay(sw);
-			
-			List<OFMessage> messages = new ArrayList<OFMessage>();
-			
-			for (int j = 0; j < NUM_MSG; ++j) {
-				OFMessage msg = EasyMock.createMock(OFMessage.class);
-				EasyMock.expect(msg.getXid()).andReturn(j).anyTimes();
-				EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
-				EasyMock.replay(msg);
-				messages.add(msg);
-				
-				try {
-					EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
-						.andReturn(true).once();
-				} catch (IOException e1) {
-					fail("Failed in OFMessageDamper#write()");
-				}
-			}
-			sw_map.put(sw, messages);
-		}
-		
-		endInitMock();
-		initPusher(NUM_THREAD);
-		
-		for (IOFSwitch sw : sw_map.keySet()) {
-			for (OFMessage msg : sw_map.get(sw)) {
-				boolean add_result = pusher.add(sw, msg);
-				assertTrue(add_result);
-			}
-		}
-		
-		try {
-			// wait until message is processed.
-			Thread.sleep(1000);
-		} catch (InterruptedException e) {
-			fail("Failed in Thread.sleep()");
-		}
-		
-		for (IOFSwitch sw : sw_map.keySet()) {
-			for (OFMessage msg : sw_map.get(sw)) {
-				EasyMock.verify(msg);
-			}
-			
-			EasyMock.verify(sw);
-		}
-		verifyAll();
+        endInitMock();
+        initPusher(1);
 
-		pusher.stop();
-	}
-	
-	private long barrierTime = 0;
-	/**
-	 * Test rate limitation of messages works correctly.
-	 */
-	@Test
-	public void testRateLimitedAddMessage() {
-		final long LIMIT_RATE = 100; // [bytes/ms]
-		final int NUM_MSG = 1000;
-		
-		// Accuracy of FlowPusher's rate calculation can't be measured by unit test
-		// because switch doesn't return BARRIER_REPLY.
-		// In unit test we use approximate way to measure rate. This value is 
-		// acceptable margin of measured rate.
-		final double ACCEPTABLE_RATE = LIMIT_RATE * 1.2;
-		
-		beginInitMock();
+        boolean add_result = pusher.add(sw, msg);
+        assertTrue(add_result);
 
-		IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
-		EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
-		sw.flush();
-		EasyMock.expectLastCall().atLeastOnce();
-		prepareBarrier(sw);
-		EasyMock.replay(sw);
-		
-		List<OFMessage> messages = new ArrayList<OFMessage>();
-		
-		for (int i = 0; i < NUM_MSG; ++i) {
-			OFMessage msg = EasyMock.createMock(OFMessage.class);
-			EasyMock.expect(msg.getXid()).andReturn(1).anyTimes();
-			EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
-			EasyMock.expect(msg.getLengthU()).andReturn(100).anyTimes();
-			EasyMock.replay(msg);
-			messages.add(msg);
-			
-			try {
-				EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
-					.andReturn(true).once();
-			} catch (IOException e) {
-				fail("Failed in OFMessageDamper#write()");
-			}
-		}
-		
-		try {
-			EasyMock.expect(damper.write(EasyMock.eq(sw), (OFMessage)EasyMock.anyObject(), EasyMock.eq(context)))
-				.andAnswer(new IAnswer<Boolean>() {
-					@Override
-					public Boolean answer() throws Throwable {
-						OFMessage msg = (OFMessage)EasyMock.getCurrentArguments()[1];
-						if (msg.getType() == OFType.BARRIER_REQUEST) {
-							barrierTime = System.currentTimeMillis();
-						}
-						return true;
-					}
-				}).once();
-		} catch (IOException e1) {
-			fail("Failed in OFMessageDamper#write()");
-		}
+        try {
+            // wait until message is processed.
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+            fail("Failed in Thread.sleep()");
+        }
+        EasyMock.verify(msg);
+        EasyMock.verify(sw);
+        verifyAll();
 
-		endInitMock();
-		initPusher(1);
-		
-		pusher.createQueue(sw);
-		pusher.setRate(sw, LIMIT_RATE);
-		
-		long beginTime = System.currentTimeMillis();
-		for (OFMessage msg : messages) {
-			boolean add_result = pusher.add(sw, msg);
-			assertTrue(add_result);
-		}
-		
-		pusher.barrierAsync(sw);
+        pusher.stop();
+    }
 
-		try {
-			do {
-				Thread.sleep(1000);
-			} while (barrierTime == 0);
-		} catch (InterruptedException e) {
-			fail("Failed to sleep");
-		}
-		
-		double measured_rate = NUM_MSG * 100 /  (barrierTime - beginTime);
-		assertTrue(measured_rate < ACCEPTABLE_RATE);
-		
-		for (OFMessage msg : messages) {
-			EasyMock.verify(msg);
-		}
-		EasyMock.verify(sw);
-		verifyAll();
+    /**
+     * Test bunch of OFMessages are correctly sent to single switch via MessageDamper.
+     */
+    @Test
+    public void testMassiveAddMessage() {
+        final int NUM_MSG = 10000;
 
-		pusher.stop();
-	}
+        beginInitMock();
 
-	/**
-	 * Test barrier message is correctly sent to a switch.
-	 */
-	@Test
-	public void testBarrierMessage() {
-		beginInitMock();
-		
-		IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
-		EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
-		sw.flush();
-		EasyMock.expectLastCall().atLeastOnce();
-		prepareBarrier(sw);
-		EasyMock.replay(sw);
+        IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+        EasyMock.expect(sw.getId()).andReturn((long) 1).anyTimes();
+        sw.flush();
+        EasyMock.expectLastCall().atLeastOnce();
+        EasyMock.replay(sw);
 
-		try {
-			EasyMock.expect(damper.write(EasyMock.eq(sw), (OFMessage)EasyMock.anyObject(), EasyMock.eq(context)))
-				.andReturn(true).once();
-		} catch (IOException e1) {
-			fail("Failed in OFMessageDamper#write()");
-		}
+        List<OFMessage> messages = new ArrayList<OFMessage>();
 
-		endInitMock();
-		initPusher(1);
+        for (int i = 0; i < NUM_MSG; ++i) {
+            OFMessage msg = EasyMock.createMock(OFMessage.class);
+            EasyMock.expect(msg.getXid()).andReturn(i).anyTimes();
+            EasyMock.expect(msg.getLength()).andReturn((short) 100).anyTimes();
+            EasyMock.replay(msg);
+            messages.add(msg);
 
-		OFBarrierReplyFuture future = pusher.barrierAsync(sw);
-		
-		assertNotNull(future);
-		
-		try {
-			Thread.sleep(1000);
-		} catch (InterruptedException e) {
-			fail("Failed to sleep");
-		}
-		
-		verifyAll();
+            try {
+                EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+                        .andReturn(true).once();
+            } catch (IOException e1) {
+                fail("Failed in OFMessageDamper#write()");
+            }
+        }
 
-		pusher.stop();
-	}
-	
-	static final int XID_TO_VERIFY = 100;
-	static final long DPID_TO_VERIFY = 10;
-	/**
-	 * Test FlowObject is correctly converted to message and is sent to a switch.
-	 */
-	@SuppressWarnings("unchecked")
-	@Test
-	public void testAddFlow() {
-		// instantiate required objects
-		FlowEntry flowEntry1 = new FlowEntry();
-		flowEntry1.setDpid(new Dpid(DPID_TO_VERIFY));
-		flowEntry1.setFlowId(new FlowId(1));
-		flowEntry1.setInPort(new Port((short) 1));
-		flowEntry1.setOutPort(new Port((short) 11));
-		flowEntry1.setFlowEntryId(new FlowEntryId(1));
-		flowEntry1.setFlowEntryMatch(new FlowEntryMatch());
-		flowEntry1.setFlowEntryActions(new FlowEntryActions());
-		flowEntry1.setFlowEntryErrorState(new FlowEntryErrorState());
-		flowEntry1.setFlowEntryUserState(FlowEntryUserState.FE_USER_ADD);
-		
-		beginInitMock();
-		
-		OFFlowMod msg = EasyMock.createMock(OFFlowMod.class);
-		EasyMock.expect(msg.setIdleTimeout(EasyMock.anyShort())).andReturn(msg);
-		EasyMock.expect(msg.setHardTimeout(EasyMock.anyShort())).andReturn(msg);
-		EasyMock.expect(msg.setPriority(EasyMock.anyShort())).andReturn(msg);
-		EasyMock.expect(msg.setBufferId(EasyMock.anyInt())).andReturn(msg);
-		EasyMock.expect(msg.setCookie(EasyMock.anyLong())).andReturn(msg);
-		EasyMock.expect(msg.setCommand(EasyMock.anyShort())).andReturn(msg);
-		EasyMock.expect(msg.setMatch(EasyMock.anyObject(OFMatch.class))).andReturn(msg);
-		EasyMock.expect(msg.setActions((List<OFAction>)EasyMock.anyObject())).andReturn(msg);
-		EasyMock.expect(msg.setLengthU(EasyMock.anyShort())).andReturn(msg);
-		EasyMock.expect(msg.setOutPort(EasyMock.anyShort())).andReturn(msg).atLeastOnce();
-		EasyMock.expect(msg.getXid()).andReturn(XID_TO_VERIFY).anyTimes();
-		EasyMock.expect(msg.getType()).andReturn(OFType.FLOW_MOD).anyTimes();
-		EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
-		EasyMock.replay(msg);
-		
-		EasyMock.expect(factory.getMessage(EasyMock.eq(OFType.FLOW_MOD))).andReturn(msg);
+        endInitMock();
+        initPusher(1);
 
-		IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
-		EasyMock.expect(sw.getId()).andReturn(DPID_TO_VERIFY).anyTimes();
-		EasyMock.expect(sw.getStringId()).andReturn("1").anyTimes();
-		sw.flush();
-		EasyMock.expectLastCall().once();
-		
-		try {
-			EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.anyObject(OFMessage.class), EasyMock.eq(context)))
-				.andAnswer(new IAnswer<Boolean>() {
-					@Override
-					public Boolean answer() throws Throwable {
-						OFMessage msg = (OFMessage)EasyMock.getCurrentArguments()[1];
-						if (msg.getType() == OFType.FLOW_MOD) {
-							assertEquals(msg.getXid(), XID_TO_VERIFY);
-						}
-						return true;
-					}
-				}).atLeastOnce();
-		} catch (IOException e1) {
-			fail("Failed in OFMessageDamper#write()");
-		}
-		
-		EasyMock.replay(sw);
-		
-		endInitMock();
-		initPusher(1);
+        for (OFMessage msg : messages) {
+            boolean add_result = pusher.add(sw, msg);
+            assertTrue(add_result);
+        }
 
-		pusher.pushFlowEntry(sw, flowEntry1);
-		
-		try {
-			Thread.sleep(1000);
-		} catch (InterruptedException e) {
-			fail("Failed to sleep");
-		}
-		
-		EasyMock.verify(sw);
-		verifyAll();
+        try {
+            // wait until message is processed.
+            Thread.sleep(5000);
+        } catch (InterruptedException e) {
+            fail("Failed in Thread.sleep()");
+        }
 
-		pusher.stop();
-	}
-	
-	private void beginInitMock() {
-		context = EasyMock.createMock(FloodlightContext.class);
-		modContext = EasyMock.createMock(FloodlightModuleContext.class);
-		factory = EasyMock.createMock(BasicFactory.class);
-		damper = EasyMock.createMock(OFMessageDamper.class);
-		flProviderService = EasyMock.createMock(IFloodlightProviderService.class);
-		threadPoolService = EasyMock.createMock(IThreadPoolService.class);
-		
-		EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(IThreadPoolService.class)))
-			.andReturn(threadPoolService).once();
-		EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(IFloodlightProviderService.class)))
-			.andReturn(flProviderService).once();
-		flProviderService.addOFMessageListener(EasyMock.eq(OFType.BARRIER_REPLY),
-				(FlowPusher) EasyMock.anyObject());
-		EasyMock.expectLastCall().once();
-		
-		ScheduledExecutorService executor = EasyMock.createMock(ScheduledExecutorService.class);
-		EasyMock.expect(executor.schedule((Runnable)EasyMock.anyObject(), EasyMock.anyLong(),
-				(TimeUnit)EasyMock.anyObject())).andReturn(null).once();
-		EasyMock.replay(executor);
-		EasyMock.expect(threadPoolService.getScheduledExecutor()).andReturn(executor).anyTimes();
-	}
-	
-	private void endInitMock() {
-		EasyMock.replay(threadPoolService);
-		EasyMock.replay(flProviderService);
-		EasyMock.replay(damper);
-		EasyMock.replay(factory);
-		EasyMock.replay(modContext);
-		EasyMock.replay(context);
-	}
-	
-	private void verifyAll() {
-		EasyMock.verify(threadPoolService);
-		EasyMock.verify(flProviderService);
-		EasyMock.verify(damper);
-		EasyMock.verify(factory);
-		EasyMock.verify(modContext);
-		EasyMock.verify(context);
-	}
-		
-	private void initPusher(int num_thread) {
-		pusher = new FlowPusher(num_thread);
-		pusher.init(context, modContext, factory, damper);
-		pusher.start();
-	}
-	
-	private void prepareBarrier(IOFSwitch sw) {
-		OFBarrierRequest req = EasyMock.createMock(OFBarrierRequest.class);
-		req.setXid(EasyMock.anyInt());
-		EasyMock.expectLastCall().once();
-		EasyMock.expect(req.getXid()).andReturn(1).anyTimes();
-		EasyMock.expect(req.getType()).andReturn(OFType.BARRIER_REQUEST).anyTimes();
-		EasyMock.expect(req.getLength()).andReturn((short)100).anyTimes();
-		EasyMock.replay(req);
-		EasyMock.expect(factory.getMessage(EasyMock.eq(OFType.BARRIER_REQUEST))).andReturn(req).anyTimes();
-		EasyMock.expect(sw.getNextTransactionId()).andReturn(1);
-	}
-	
+        for (OFMessage msg : messages) {
+            EasyMock.verify(msg);
+        }
+        EasyMock.verify(sw);
+        verifyAll();
+
+        pusher.stop();
+    }
+
+    /**
+     * Test bunch of OFMessages are correctly sent to multiple switches with single threads.
+     */
+    @Test
+    public void testMultiSwitchAddMessage() {
+        final int NUM_SWITCH = 10;
+        final int NUM_MSG = 100;    // messages per thread
+
+        beginInitMock();
+
+        Map<IOFSwitch, List<OFMessage>> sw_map = new HashMap<IOFSwitch, List<OFMessage>>();
+        for (int i = 0; i < NUM_SWITCH; ++i) {
+            IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+            EasyMock.expect(sw.getId()).andReturn((long) i).anyTimes();
+            sw.flush();
+            EasyMock.expectLastCall().atLeastOnce();
+            EasyMock.replay(sw);
+
+            List<OFMessage> messages = new ArrayList<OFMessage>();
+
+            for (int j = 0; j < NUM_MSG; ++j) {
+                OFMessage msg = EasyMock.createMock(OFMessage.class);
+                EasyMock.expect(msg.getXid()).andReturn(j).anyTimes();
+                EasyMock.expect(msg.getLength()).andReturn((short) 100).anyTimes();
+                EasyMock.replay(msg);
+                messages.add(msg);
+
+                try {
+                    EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+                            .andReturn(true).once();
+                } catch (IOException e1) {
+                    fail("Failed in OFMessageDamper#write()");
+                }
+            }
+            sw_map.put(sw, messages);
+        }
+
+        endInitMock();
+        initPusher(1);
+
+        for (IOFSwitch sw : sw_map.keySet()) {
+            for (OFMessage msg : sw_map.get(sw)) {
+                boolean add_result = pusher.add(sw, msg);
+                assertTrue(add_result);
+            }
+        }
+
+        try {
+            // wait until message is processed.
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+            fail("Failed in Thread.sleep()");
+        }
+
+        for (IOFSwitch sw : sw_map.keySet()) {
+            for (OFMessage msg : sw_map.get(sw)) {
+                EasyMock.verify(msg);
+            }
+
+            EasyMock.verify(sw);
+        }
+        verifyAll();
+
+        pusher.stop();
+    }
+
+    /**
+     * Test bunch of OFMessages are correctly sent to multiple switches using multiple threads.
+     */
+    @Test
+    public void testMultiThreadedAddMessage() {
+        final int NUM_THREAD = 10;
+        final int NUM_MSG = 100;    // messages per thread
+
+        beginInitMock();
+
+        Map<IOFSwitch, List<OFMessage>> sw_map = new HashMap<IOFSwitch, List<OFMessage>>();
+        for (int i = 0; i < NUM_THREAD; ++i) {
+            IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+            EasyMock.expect(sw.getId()).andReturn((long) i).anyTimes();
+            sw.flush();
+            EasyMock.expectLastCall().atLeastOnce();
+            EasyMock.replay(sw);
+
+            List<OFMessage> messages = new ArrayList<OFMessage>();
+
+            for (int j = 0; j < NUM_MSG; ++j) {
+                OFMessage msg = EasyMock.createMock(OFMessage.class);
+                EasyMock.expect(msg.getXid()).andReturn(j).anyTimes();
+                EasyMock.expect(msg.getLength()).andReturn((short) 100).anyTimes();
+                EasyMock.replay(msg);
+                messages.add(msg);
+
+                try {
+                    EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+                            .andReturn(true).once();
+                } catch (IOException e1) {
+                    fail("Failed in OFMessageDamper#write()");
+                }
+            }
+            sw_map.put(sw, messages);
+        }
+
+        endInitMock();
+        initPusher(NUM_THREAD);
+
+        for (IOFSwitch sw : sw_map.keySet()) {
+            for (OFMessage msg : sw_map.get(sw)) {
+                boolean add_result = pusher.add(sw, msg);
+                assertTrue(add_result);
+            }
+        }
+
+        try {
+            // wait until message is processed.
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+            fail("Failed in Thread.sleep()");
+        }
+
+        for (IOFSwitch sw : sw_map.keySet()) {
+            for (OFMessage msg : sw_map.get(sw)) {
+                EasyMock.verify(msg);
+            }
+
+            EasyMock.verify(sw);
+        }
+        verifyAll();
+
+        pusher.stop();
+    }
+
+    private long barrierTime = 0;
+
+    /**
+     * Test rate limitation of messages works correctly.
+     */
+    @Test
+    public void testRateLimitedAddMessage() {
+        final long LIMIT_RATE = 100; // [bytes/ms]
+        final int NUM_MSG = 1000;
+
+        // Accuracy of FlowPusher's rate calculation can't be measured by unit test
+        // because switch doesn't return BARRIER_REPLY.
+        // In unit test we use approximate way to measure rate. This value is
+        // acceptable margin of measured rate.
+        final double ACCEPTABLE_RATE = LIMIT_RATE * 1.2;
+
+        beginInitMock();
+
+        IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+        EasyMock.expect(sw.getId()).andReturn((long) 1).anyTimes();
+        sw.flush();
+        EasyMock.expectLastCall().atLeastOnce();
+        prepareBarrier(sw);
+        EasyMock.replay(sw);
+
+        List<OFMessage> messages = new ArrayList<OFMessage>();
+
+        for (int i = 0; i < NUM_MSG; ++i) {
+            OFMessage msg = EasyMock.createMock(OFMessage.class);
+            EasyMock.expect(msg.getXid()).andReturn(1).anyTimes();
+            EasyMock.expect(msg.getLength()).andReturn((short) 100).anyTimes();
+            EasyMock.expect(msg.getLengthU()).andReturn(100).anyTimes();
+            EasyMock.replay(msg);
+            messages.add(msg);
+
+            try {
+                EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+                        .andReturn(true).once();
+            } catch (IOException e) {
+                fail("Failed in OFMessageDamper#write()");
+            }
+        }
+
+        try {
+            EasyMock.expect(damper.write(EasyMock.eq(sw), (OFMessage) EasyMock.anyObject(), EasyMock.eq(context)))
+                    .andAnswer(new IAnswer<Boolean>() {
+                        @Override
+                        public Boolean answer() throws Throwable {
+                            OFMessage msg = (OFMessage) EasyMock.getCurrentArguments()[1];
+                            if (msg.getType() == OFType.BARRIER_REQUEST) {
+                                barrierTime = System.currentTimeMillis();
+                            }
+                            return true;
+                        }
+                    }).once();
+        } catch (IOException e1) {
+            fail("Failed in OFMessageDamper#write()");
+        }
+
+        endInitMock();
+        initPusher(1);
+
+        pusher.createQueue(sw);
+        pusher.setRate(sw, LIMIT_RATE);
+
+        long beginTime = System.currentTimeMillis();
+        for (OFMessage msg : messages) {
+            boolean add_result = pusher.add(sw, msg);
+            assertTrue(add_result);
+        }
+
+        pusher.barrierAsync(sw);
+
+        try {
+            do {
+                Thread.sleep(1000);
+            } while (barrierTime == 0);
+        } catch (InterruptedException e) {
+            fail("Failed to sleep");
+        }
+
+        double measured_rate = NUM_MSG * 100 / (barrierTime - beginTime);
+        assertTrue(measured_rate < ACCEPTABLE_RATE);
+
+        for (OFMessage msg : messages) {
+            EasyMock.verify(msg);
+        }
+        EasyMock.verify(sw);
+        verifyAll();
+
+        pusher.stop();
+    }
+
+    /**
+     * Test barrier message is correctly sent to a switch.
+     */
+    @Test
+    public void testBarrierMessage() {
+        beginInitMock();
+
+        IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+        EasyMock.expect(sw.getId()).andReturn((long) 1).anyTimes();
+        sw.flush();
+        EasyMock.expectLastCall().atLeastOnce();
+        prepareBarrier(sw);
+        EasyMock.replay(sw);
+
+        try {
+            EasyMock.expect(damper.write(EasyMock.eq(sw), (OFMessage) EasyMock.anyObject(), EasyMock.eq(context)))
+                    .andReturn(true).once();
+        } catch (IOException e1) {
+            fail("Failed in OFMessageDamper#write()");
+        }
+
+        endInitMock();
+        initPusher(1);
+
+        OFBarrierReplyFuture future = pusher.barrierAsync(sw);
+
+        assertNotNull(future);
+
+        try {
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+            fail("Failed to sleep");
+        }
+
+        verifyAll();
+
+        pusher.stop();
+    }
+
+    static final int XID_TO_VERIFY = 100;
+    static final long DPID_TO_VERIFY = 10;
+
+    /**
+     * Test FlowObject is correctly converted to message and is sent to a switch.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testAddFlow() {
+        // instantiate required objects
+        FlowEntry flowEntry1 = new FlowEntry();
+        flowEntry1.setDpid(new Dpid(DPID_TO_VERIFY));
+        flowEntry1.setFlowId(new FlowId(1));
+        flowEntry1.setInPort(new Port((short) 1));
+        flowEntry1.setOutPort(new Port((short) 11));
+        flowEntry1.setFlowEntryId(new FlowEntryId(1));
+        flowEntry1.setFlowEntryMatch(new FlowEntryMatch());
+        flowEntry1.setFlowEntryActions(new FlowEntryActions());
+        flowEntry1.setFlowEntryErrorState(new FlowEntryErrorState());
+        flowEntry1.setFlowEntryUserState(FlowEntryUserState.FE_USER_ADD);
+
+        beginInitMock();
+
+        OFFlowMod msg = EasyMock.createMock(OFFlowMod.class);
+        EasyMock.expect(msg.setIdleTimeout(EasyMock.anyShort())).andReturn(msg);
+        EasyMock.expect(msg.setHardTimeout(EasyMock.anyShort())).andReturn(msg);
+        EasyMock.expect(msg.setPriority(EasyMock.anyShort())).andReturn(msg);
+        EasyMock.expect(msg.setBufferId(EasyMock.anyInt())).andReturn(msg);
+        EasyMock.expect(msg.setCookie(EasyMock.anyLong())).andReturn(msg);
+        EasyMock.expect(msg.setCommand(EasyMock.anyShort())).andReturn(msg);
+        EasyMock.expect(msg.setMatch(EasyMock.anyObject(OFMatch.class))).andReturn(msg);
+        EasyMock.expect(msg.setActions((List<OFAction>) EasyMock.anyObject())).andReturn(msg);
+        EasyMock.expect(msg.setLengthU(EasyMock.anyShort())).andReturn(msg);
+        EasyMock.expect(msg.setOutPort(EasyMock.anyShort())).andReturn(msg).atLeastOnce();
+        EasyMock.expect(msg.getXid()).andReturn(XID_TO_VERIFY).anyTimes();
+        EasyMock.expect(msg.getType()).andReturn(OFType.FLOW_MOD).anyTimes();
+        EasyMock.expect(msg.getLength()).andReturn((short) 100).anyTimes();
+        EasyMock.replay(msg);
+
+        EasyMock.expect(factory.getMessage(EasyMock.eq(OFType.FLOW_MOD))).andReturn(msg);
+
+        IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+        EasyMock.expect(sw.getId()).andReturn(DPID_TO_VERIFY).anyTimes();
+        EasyMock.expect(sw.getStringId()).andReturn("1").anyTimes();
+        sw.flush();
+        EasyMock.expectLastCall().once();
+
+        try {
+            EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.anyObject(OFMessage.class), EasyMock.eq(context)))
+                    .andAnswer(new IAnswer<Boolean>() {
+                        @Override
+                        public Boolean answer() throws Throwable {
+                            OFMessage msg = (OFMessage) EasyMock.getCurrentArguments()[1];
+                            if (msg.getType() == OFType.FLOW_MOD) {
+                                assertEquals(msg.getXid(), XID_TO_VERIFY);
+                            }
+                            return true;
+                        }
+                    }).atLeastOnce();
+        } catch (IOException e1) {
+            fail("Failed in OFMessageDamper#write()");
+        }
+
+        EasyMock.replay(sw);
+
+        endInitMock();
+        initPusher(1);
+
+        pusher.pushFlowEntry(sw, flowEntry1);
+
+        try {
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+            fail("Failed to sleep");
+        }
+
+        EasyMock.verify(sw);
+        verifyAll();
+
+        pusher.stop();
+    }
+
+    private void beginInitMock() {
+        context = EasyMock.createMock(FloodlightContext.class);
+        modContext = EasyMock.createMock(FloodlightModuleContext.class);
+        factory = EasyMock.createMock(BasicFactory.class);
+        damper = EasyMock.createMock(OFMessageDamper.class);
+        flProviderService = EasyMock.createMock(IFloodlightProviderService.class);
+        threadPoolService = EasyMock.createMock(IThreadPoolService.class);
+
+        EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(IThreadPoolService.class)))
+                .andReturn(threadPoolService).once();
+        EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(IFloodlightProviderService.class)))
+                .andReturn(flProviderService).once();
+        flProviderService.addOFMessageListener(EasyMock.eq(OFType.BARRIER_REPLY),
+                (FlowPusher) EasyMock.anyObject());
+        EasyMock.expectLastCall().once();
+
+        ScheduledExecutorService executor = EasyMock.createMock(ScheduledExecutorService.class);
+        EasyMock.expect(executor.schedule((Runnable) EasyMock.anyObject(), EasyMock.anyLong(),
+                (TimeUnit) EasyMock.anyObject())).andReturn(null).once();
+        EasyMock.replay(executor);
+        EasyMock.expect(threadPoolService.getScheduledExecutor()).andReturn(executor).anyTimes();
+    }
+
+    private void endInitMock() {
+        EasyMock.replay(threadPoolService);
+        EasyMock.replay(flProviderService);
+        EasyMock.replay(damper);
+        EasyMock.replay(factory);
+        EasyMock.replay(modContext);
+        EasyMock.replay(context);
+    }
+
+    private void verifyAll() {
+        EasyMock.verify(threadPoolService);
+        EasyMock.verify(flProviderService);
+        EasyMock.verify(damper);
+        EasyMock.verify(factory);
+        EasyMock.verify(modContext);
+        EasyMock.verify(context);
+    }
+
+    private void initPusher(int num_thread) {
+        pusher = new FlowPusher(num_thread);
+        pusher.init(context, modContext, factory, damper);
+        pusher.start();
+    }
+
+    private void prepareBarrier(IOFSwitch sw) {
+        OFBarrierRequest req = EasyMock.createMock(OFBarrierRequest.class);
+        req.setXid(EasyMock.anyInt());
+        EasyMock.expectLastCall().once();
+        EasyMock.expect(req.getXid()).andReturn(1).anyTimes();
+        EasyMock.expect(req.getType()).andReturn(OFType.BARRIER_REQUEST).anyTimes();
+        EasyMock.expect(req.getLength()).andReturn((short) 100).anyTimes();
+        EasyMock.replay(req);
+        EasyMock.expect(factory.getMessage(EasyMock.eq(OFType.BARRIER_REQUEST))).andReturn(req).anyTimes();
+        EasyMock.expect(sw.getNextTransactionId()).andReturn(1);
+    }
+
 }
diff --git a/src/test/java/net/onrc/onos/core/flowprogrammer/FlowSynchronizerTest.java b/src/test/java/net/onrc/onos/core/flowprogrammer/FlowSynchronizerTest.java
index 9222a8a..2d97d4f 100644
--- a/src/test/java/net/onrc/onos/core/flowprogrammer/FlowSynchronizerTest.java
+++ b/src/test/java/net/onrc/onos/core/flowprogrammer/FlowSynchronizerTest.java
@@ -37,286 +37,290 @@
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({FlowSynchronizer.class})
 public class FlowSynchronizerTest {
-	private FlowPusher pusher;
-	private FlowSynchronizer sync;
-	private List<Long> idAdded;
-	private List<Long> idRemoved;
+    private FlowPusher pusher;
+    private FlowSynchronizer sync;
+    private List<Long> idAdded;
+    private List<Long> idRemoved;
 
-	@Before
-	public void setUp() throws Exception {
-		idAdded = new ArrayList<Long>();
-		idRemoved = new ArrayList<Long>();
-		
-		pusher = EasyMock.createMock(FlowPusher.class);
-		EasyMock.expect(pusher.suspend(EasyMock.anyObject(IOFSwitch.class))).andReturn(true).anyTimes();
-		EasyMock.expect(pusher.resume(EasyMock.anyObject(IOFSwitch.class))).andReturn(true).anyTimes();
-		pusher.add(EasyMock.anyObject(IOFSwitch.class), EasyMock.anyObject(OFMessage.class),
-				EasyMock.eq(MsgPriority.HIGH));
-		EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-				@Override
-				public Object answer() throws Throwable {
-					OFMessage msg = (OFMessage)EasyMock.getCurrentArguments()[1];
-					if (msg.getType().equals(OFType.FLOW_MOD)) {
-						OFFlowMod fm = (OFFlowMod)msg;
-						if (fm.getCommand() == OFFlowMod.OFPFC_DELETE_STRICT) {
-							idRemoved.add(fm.getCookie());
-						}
-					}
-					return null;
-				}
-			}).anyTimes();
-		pusher.pushFlowEntry(EasyMock.anyObject(IOFSwitch.class), EasyMock.anyObject(FlowEntry.class),
-				EasyMock.eq(MsgPriority.HIGH));
-		EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-			@Override
-			public Object answer() throws Throwable {
-				FlowEntry flow = (FlowEntry)EasyMock.getCurrentArguments()[1];
-				idAdded.add(flow.flowEntryId().value());
-				return null;
-			}
-		}).anyTimes();
-		EasyMock.replay(pusher);
-	}
+    @Before
+    public void setUp() throws Exception {
+        idAdded = new ArrayList<Long>();
+        idRemoved = new ArrayList<Long>();
 
-	@After
-	public void tearDown() throws Exception {
-	}
+        pusher = EasyMock.createMock(FlowPusher.class);
+        EasyMock.expect(pusher.suspend(EasyMock.anyObject(IOFSwitch.class))).andReturn(true).anyTimes();
+        EasyMock.expect(pusher.resume(EasyMock.anyObject(IOFSwitch.class))).andReturn(true).anyTimes();
+        pusher.add(EasyMock.anyObject(IOFSwitch.class), EasyMock.anyObject(OFMessage.class),
+                EasyMock.eq(MsgPriority.HIGH));
+        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+            @Override
+            public Object answer() throws Throwable {
+                OFMessage msg = (OFMessage) EasyMock.getCurrentArguments()[1];
+                if (msg.getType().equals(OFType.FLOW_MOD)) {
+                    OFFlowMod fm = (OFFlowMod) msg;
+                    if (fm.getCommand() == OFFlowMod.OFPFC_DELETE_STRICT) {
+                        idRemoved.add(fm.getCookie());
+                    }
+                }
+                return null;
+            }
+        }).anyTimes();
+        pusher.pushFlowEntry(EasyMock.anyObject(IOFSwitch.class), EasyMock.anyObject(FlowEntry.class),
+                EasyMock.eq(MsgPriority.HIGH));
+        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+            @Override
+            public Object answer() throws Throwable {
+                FlowEntry flow = (FlowEntry) EasyMock.getCurrentArguments()[1];
+                idAdded.add(flow.flowEntryId().value());
+                return null;
+            }
+        }).anyTimes();
+        EasyMock.replay(pusher);
+    }
 
-	/**
-	 * Test that synchronization doesn't affect anything in case either DB and
-	 * flow table has the same entries.
-	 */
-	@Test
-	public void testStable() {
-		// Create mock of flow table : flow 1
-		IOFSwitch sw = createMockSwitch(new long[] {1});
-		
-		// Create mock of flow entries : flow 1
-		initMockGraph(new long[] {1});
-		
-		// synchronize
-		doSynchronization(sw);
-		
-		// check if flow is not changed
-		assertEquals(0, idAdded.size());
-		assertEquals(0, idRemoved.size());
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	/**
-	 * Test that an flow is added in case DB has an extra FlowEntry.
-	 */
-	@Test
-	public void testSingleAdd() {
-		// Create mock of flow table : null
-		IOFSwitch sw = createMockSwitch(new long[] {});
-		
-		// Create mock of flow entries : flow 1
-		initMockGraph(new long[] {1});
-		
-		// synchronize
-		doSynchronization(sw);
-		
-		// check if single flow is installed
-		assertEquals(1, idAdded.size());
-		assertTrue(idAdded.contains((long)1));
-		assertEquals(0, idRemoved.size());
-	}
+    /**
+     * Test that synchronization doesn't affect anything in case either DB and
+     * flow table has the same entries.
+     */
+    @Test
+    public void testStable() {
+        // Create mock of flow table : flow 1
+        IOFSwitch sw = createMockSwitch(new long[]{1});
 
-	/**
-	 * Test that an flow is deleted in case switch has an extra FlowEntry.
-	 */
-	@Test
-	public void testSingleDelete() {
-		// Create mock of flow table : flow 1
-		IOFSwitch sw = createMockSwitch(new long[] {1});
-		
-		// Create mock of flow entries : null
-		initMockGraph(new long[] {});
-		
-		// synchronize
-		doSynchronization(sw);
-		
-		// check if single flow is deleted
-		assertEquals(0, idAdded.size());
-		assertEquals(1, idRemoved.size());
-		assertTrue(idRemoved.contains((long)1));
-	}
-	
-	/**
-	 * Test that appropriate flows are added and other appropriate flows are deleted
-	 * in case flows in DB are overlapping flows in switch.
-	 */
-	@Test
-	public void testMixed() {
-		// Create mock of flow table : flow 1,2,3
-		IOFSwitch sw = createMockSwitch(new long[] {1,2,3});
-		
-		// Create mock of flow entries : flow 2,3,4,5
-		initMockGraph(new long[] {2,3,4,5});
-		
-		// synchronize
-		doSynchronization(sw);
-		
-		// check if two flows {4,5} is installed and one flow {1} is deleted
-		assertEquals(2, idAdded.size());
-		assertTrue(idAdded.contains((long)4));
-		assertTrue(idAdded.contains((long)5));
-		assertEquals(1, idRemoved.size());
-		assertTrue(idRemoved.contains((long)1));
-	}
-	
+        // Create mock of flow entries : flow 1
+        initMockGraph(new long[]{1});
 
-	@Test
-	public void testMassive() {
-		// Create mock of flow table : flow 0-1999
-		long [] swIdList = new long [2000];
-		for (long i = 0; i < 2000; ++i) {
-			swIdList[(int)i] = i;
-		}
-		IOFSwitch sw = createMockSwitch(swIdList);
-		
-		// Create mock of flow entries : flow 1500-3499
-		long [] dbIdList = new long [2000];
-		for (long i = 0; i < 2000; ++i) {
-			dbIdList[(int)i] = 1500 + i;
-		}
-		initMockGraph(dbIdList);
+        // synchronize
+        doSynchronization(sw);
 
-		// synchronize
-		doSynchronization(sw);
-		
-		// check if 1500 flows {2000-3499} is installed and 1500 flows {0,...,1499} is deleted
-		assertEquals(1500, idAdded.size());
-		for (long i = 2000; i < 3500; ++i) {
-			assertTrue(idAdded.contains(i));
-		}
-		assertEquals(1500, idRemoved.size());
-		for (long i = 0; i < 1500; ++i) {
-			assertTrue(idRemoved.contains(i));
-		}
-	}
+        // check if flow is not changed
+        assertEquals(0, idAdded.size());
+        assertEquals(0, idRemoved.size());
+    }
 
-	/**
-	 * Create mock IOFSwitch with flow table which has arbitrary flows.
-	 * @param cookieList List of FlowEntry IDs switch has.
-	 * @return Mock object.
-	 */
-	private IOFSwitch createMockSwitch(long[] cookieList) {
-		IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
-		EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
-		
-		List<OFStatistics> stats = new ArrayList<OFStatistics>();
-		for (long cookie : cookieList) {
-			stats.add(createReply(cookie));
-		}
-		
-		@SuppressWarnings("unchecked")
-		Future<List<OFStatistics>> future = EasyMock.createMock(Future.class);
-		try {
-			EasyMock.expect(future.get()).andReturn(stats).once();
-		} catch (InterruptedException e1) {
-			fail("Failed in Future#get()");
-		} catch (ExecutionException e1) {
-			fail("Failed in Future#get()");
-		}
-		EasyMock.replay(future);
-		
-		try {
-			EasyMock.expect(sw.getStatistics(EasyMock.anyObject(OFStatisticsRequest.class)))
-				.andReturn(future).once();
-		} catch (IOException e) {
-			fail("Failed in IOFSwitch#getStatistics()");
-		}
-		
-		EasyMock.replay(sw);
-		return sw;
-	}
-	
-	/**
-	 * Create single OFFlowStatisticsReply object which is actually obtained from switch.
-	 * @param cookie Cookie value, which indicates ID of FlowEntry installed to switch.
-	 * @return Created object.
-	 */
-	private OFFlowStatisticsReply createReply(long cookie) {
-		OFFlowStatisticsReply stat = new OFFlowStatisticsReply();
-		OFMatch match = new OFMatch();
-		
-		stat.setCookie(cookie);
-		stat.setMatch(match);
-		stat.setPriority((short)1);
+    /**
+     * Test that an flow is added in case DB has an extra FlowEntry.
+     */
+    @Test
+    public void testSingleAdd() {
+        // Create mock of flow table : null
+        IOFSwitch sw = createMockSwitch(new long[]{});
 
-		return stat;
-	}
-	
-	/**
-	 * Create mock FlowDatabaseOperation to mock DB.
-	 * @param idList List of FlowEntry IDs stored in DB.
-	 */
-	private void initMockGraph(long[] idList) {
-	    /*
-	     * TODO: The old FlowDatabaseOperation class is gone, so the method
-	     * below needs to be rewritten.
-	     */
-	    /*
-		List<IFlowEntry> flowEntryList = new ArrayList<IFlowEntry>();
-		
-		for (long id : idList) {
-			IFlowEntry entry = EasyMock.createMock(IFlowEntry.class);
-			EasyMock.expect(entry.getFlowEntryId()).andReturn(String.valueOf(id)).anyTimes();
-			EasyMock.replay(entry);
-			flowEntryList.add(entry);
-		}
-		
-		ISwitchObject swObj = EasyMock.createMock(ISwitchObject.class);
-		EasyMock.expect(swObj.getFlowEntries()).andReturn(flowEntryList).once();
-		EasyMock.replay(swObj);
-		
-		DBOperation mockOp = PowerMock.createMock(DBOperation.class);
-		EasyMock.expect(mockOp.searchSwitch(EasyMock.anyObject(String.class))).andReturn(swObj).once();
-		
-		PowerMock.mockStatic(FlowDatabaseOperation.class);
-		for (IFlowEntry entry : flowEntryList) {
-			EasyMock.expect(FlowDatabaseOperation.extractFlowEntry(EasyMock.eq(entry)))
-				.andAnswer(new IAnswer<FlowEntry>() {
-					@Override
-					public FlowEntry answer() throws Throwable {
-						IFlowEntry iflow = (IFlowEntry)EasyMock.getCurrentArguments()[0];
-						long flowEntryId = Long.valueOf(iflow.getFlowEntryId());
-						
-						FlowEntry flow = EasyMock.createMock(FlowEntry.class);
-						EasyMock.expect(flow.flowEntryId()).andReturn(new FlowEntryId(flowEntryId)).anyTimes();
-						EasyMock.replay(flow);
-						return flow;
-					}
-					
-				}).anyTimes();
-			EasyMock.expect(mockOp.searchFlowEntry(EasyMock.eq(new FlowEntryId(entry.getFlowEntryId()))))
-				.andReturn(entry);
-		}
-		PowerMock.replay(FlowDatabaseOperation.class);
-		EasyMock.replay(mockOp);
-		
-		try {
-			PowerMock.expectNew(DBOperation.class).andReturn(mockOp);
-		} catch (Exception e) {
-			fail("Failed to create DBOperation");
-		}
-		PowerMock.replay(DBOperation.class);
-	    */
-	}
-	
-	/**
-	 * Instantiate FlowSynchronizer and sync flows.
-	 * @param sw Target IOFSwitch object
-	 */
-	private void doSynchronization(IOFSwitch sw) {
-		sync = new FlowSynchronizer();
-		sync.init(pusher);
-		Future<SyncResult> future = sync.synchronize(sw);
-		try {
-			future.get();
-		} catch (Exception e) {
-			fail("Failed to Future#get()");
-		}
-	}
+        // Create mock of flow entries : flow 1
+        initMockGraph(new long[]{1});
+
+        // synchronize
+        doSynchronization(sw);
+
+        // check if single flow is installed
+        assertEquals(1, idAdded.size());
+        assertTrue(idAdded.contains((long) 1));
+        assertEquals(0, idRemoved.size());
+    }
+
+    /**
+     * Test that an flow is deleted in case switch has an extra FlowEntry.
+     */
+    @Test
+    public void testSingleDelete() {
+        // Create mock of flow table : flow 1
+        IOFSwitch sw = createMockSwitch(new long[]{1});
+
+        // Create mock of flow entries : null
+        initMockGraph(new long[]{});
+
+        // synchronize
+        doSynchronization(sw);
+
+        // check if single flow is deleted
+        assertEquals(0, idAdded.size());
+        assertEquals(1, idRemoved.size());
+        assertTrue(idRemoved.contains((long) 1));
+    }
+
+    /**
+     * Test that appropriate flows are added and other appropriate flows are deleted
+     * in case flows in DB are overlapping flows in switch.
+     */
+    @Test
+    public void testMixed() {
+        // Create mock of flow table : flow 1,2,3
+        IOFSwitch sw = createMockSwitch(new long[]{1, 2, 3});
+
+        // Create mock of flow entries : flow 2,3,4,5
+        initMockGraph(new long[]{2, 3, 4, 5});
+
+        // synchronize
+        doSynchronization(sw);
+
+        // check if two flows {4,5} is installed and one flow {1} is deleted
+        assertEquals(2, idAdded.size());
+        assertTrue(idAdded.contains((long) 4));
+        assertTrue(idAdded.contains((long) 5));
+        assertEquals(1, idRemoved.size());
+        assertTrue(idRemoved.contains((long) 1));
+    }
+
+
+    @Test
+    public void testMassive() {
+        // Create mock of flow table : flow 0-1999
+        long[] swIdList = new long[2000];
+        for (long i = 0; i < 2000; ++i) {
+            swIdList[(int) i] = i;
+        }
+        IOFSwitch sw = createMockSwitch(swIdList);
+
+        // Create mock of flow entries : flow 1500-3499
+        long[] dbIdList = new long[2000];
+        for (long i = 0; i < 2000; ++i) {
+            dbIdList[(int) i] = 1500 + i;
+        }
+        initMockGraph(dbIdList);
+
+        // synchronize
+        doSynchronization(sw);
+
+        // check if 1500 flows {2000-3499} is installed and 1500 flows {0,...,1499} is deleted
+        assertEquals(1500, idAdded.size());
+        for (long i = 2000; i < 3500; ++i) {
+            assertTrue(idAdded.contains(i));
+        }
+        assertEquals(1500, idRemoved.size());
+        for (long i = 0; i < 1500; ++i) {
+            assertTrue(idRemoved.contains(i));
+        }
+    }
+
+    /**
+     * Create mock IOFSwitch with flow table which has arbitrary flows.
+     *
+     * @param cookieList List of FlowEntry IDs switch has.
+     * @return Mock object.
+     */
+    private IOFSwitch createMockSwitch(long[] cookieList) {
+        IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+        EasyMock.expect(sw.getId()).andReturn((long) 1).anyTimes();
+
+        List<OFStatistics> stats = new ArrayList<OFStatistics>();
+        for (long cookie : cookieList) {
+            stats.add(createReply(cookie));
+        }
+
+        @SuppressWarnings("unchecked")
+        Future<List<OFStatistics>> future = EasyMock.createMock(Future.class);
+        try {
+            EasyMock.expect(future.get()).andReturn(stats).once();
+        } catch (InterruptedException e1) {
+            fail("Failed in Future#get()");
+        } catch (ExecutionException e1) {
+            fail("Failed in Future#get()");
+        }
+        EasyMock.replay(future);
+
+        try {
+            EasyMock.expect(sw.getStatistics(EasyMock.anyObject(OFStatisticsRequest.class)))
+                    .andReturn(future).once();
+        } catch (IOException e) {
+            fail("Failed in IOFSwitch#getStatistics()");
+        }
+
+        EasyMock.replay(sw);
+        return sw;
+    }
+
+    /**
+     * Create single OFFlowStatisticsReply object which is actually obtained from switch.
+     *
+     * @param cookie Cookie value, which indicates ID of FlowEntry installed to switch.
+     * @return Created object.
+     */
+    private OFFlowStatisticsReply createReply(long cookie) {
+        OFFlowStatisticsReply stat = new OFFlowStatisticsReply();
+        OFMatch match = new OFMatch();
+
+        stat.setCookie(cookie);
+        stat.setMatch(match);
+        stat.setPriority((short) 1);
+
+        return stat;
+    }
+
+    /**
+     * Create mock FlowDatabaseOperation to mock DB.
+     *
+     * @param idList List of FlowEntry IDs stored in DB.
+     */
+    private void initMockGraph(long[] idList) {
+        /*
+             * TODO: The old FlowDatabaseOperation class is gone, so the method
+             * below needs to be rewritten.
+             */
+            /*
+                List<IFlowEntry> flowEntryList = new ArrayList<IFlowEntry>();
+                
+                for (long id : idList) {
+                        IFlowEntry entry = EasyMock.createMock(IFlowEntry.class);
+                        EasyMock.expect(entry.getFlowEntryId()).andReturn(String.valueOf(id)).anyTimes();
+                        EasyMock.replay(entry);
+                        flowEntryList.add(entry);
+                }
+                
+                ISwitchObject swObj = EasyMock.createMock(ISwitchObject.class);
+                EasyMock.expect(swObj.getFlowEntries()).andReturn(flowEntryList).once();
+                EasyMock.replay(swObj);
+                
+                DBOperation mockOp = PowerMock.createMock(DBOperation.class);
+                EasyMock.expect(mockOp.searchSwitch(EasyMock.anyObject(String.class))).andReturn(swObj).once();
+                
+                PowerMock.mockStatic(FlowDatabaseOperation.class);
+                for (IFlowEntry entry : flowEntryList) {
+                        EasyMock.expect(FlowDatabaseOperation.extractFlowEntry(EasyMock.eq(entry)))
+                                .andAnswer(new IAnswer<FlowEntry>() {
+                                        @Override
+                                        public FlowEntry answer() throws Throwable {
+                                                IFlowEntry iflow = (IFlowEntry)EasyMock.getCurrentArguments()[0];
+                                                long flowEntryId = Long.valueOf(iflow.getFlowEntryId());
+                                                
+                                                FlowEntry flow = EasyMock.createMock(FlowEntry.class);
+                                                EasyMock.expect(flow.flowEntryId()).andReturn(new FlowEntryId(flowEntryId)).anyTimes();
+                                                EasyMock.replay(flow);
+                                                return flow;
+                                        }
+                                        
+                                }).anyTimes();
+                        EasyMock.expect(mockOp.searchFlowEntry(EasyMock.eq(new FlowEntryId(entry.getFlowEntryId()))))
+                                .andReturn(entry);
+                }
+                PowerMock.replay(FlowDatabaseOperation.class);
+                EasyMock.replay(mockOp);
+                
+                try {
+                        PowerMock.expectNew(DBOperation.class).andReturn(mockOp);
+                } catch (Exception e) {
+                        fail("Failed to create DBOperation");
+                }
+                PowerMock.replay(DBOperation.class);
+            */
+    }
+
+    /**
+     * Instantiate FlowSynchronizer and sync flows.
+     *
+     * @param sw Target IOFSwitch object
+     */
+    private void doSynchronization(IOFSwitch sw) {
+        sync = new FlowSynchronizer();
+        sync.init(pusher);
+        Future<SyncResult> future = sync.synchronize(sw);
+        try {
+            future.get();
+        } catch (Exception e) {
+            fail("Failed to Future#get()");
+        }
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java b/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java
index be9f344..1a12cf9 100644
--- a/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java
@@ -3,6 +3,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+
 import net.onrc.onos.core.intent.IntentOperation.Operator;
 import net.onrc.onos.core.topology.LinkEvent;
 import net.onrc.onos.core.topology.Path;
@@ -15,132 +16,131 @@
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class ConstrainedBFSTreeTest {
-	static long LOCAL_PORT = 0xFFFEL;
+    static long LOCAL_PORT = 0xFFFEL;
 
-	@Before
-	public void setUp() throws Exception {
-	}
+    @Before
+    public void setUp() throws Exception {
+    }
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Test
-	public void testCreate() {
-		MockNetworkGraph graph = new MockNetworkGraph();
-		graph.createSampleTopology1();
-		ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L));
-		assertNotNull(tree);
-	}
+    @Test
+    public void testCreate() {
+        MockNetworkGraph graph = new MockNetworkGraph();
+        graph.createSampleTopology1();
+        ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L));
+        assertNotNull(tree);
+    }
 
-	@Test
-	public void testCreateConstrained() {
-		MockNetworkGraph graph = new MockNetworkGraph();
-		graph.createSampleTopology1();
-		PathIntentMap intents = new PathIntentMap();
-		ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 1000.0);
-		assertNotNull(tree);
-	}
+    @Test
+    public void testCreateConstrained() {
+        MockNetworkGraph graph = new MockNetworkGraph();
+        graph.createSampleTopology1();
+        PathIntentMap intents = new PathIntentMap();
+        ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 1000.0);
+        assertNotNull(tree);
+    }
 
-	@Test
-	public void testGetPath() {
-		MockNetworkGraph graph = new MockNetworkGraph();
-		graph.createSampleTopology1();
-		ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L));
-		Path path11 = tree.getPath(graph.getSwitch(1L));
-		Path path12 = tree.getPath(graph.getSwitch(2L));
-		Path path13 = tree.getPath(graph.getSwitch(3L));
-		Path path14 = tree.getPath(graph.getSwitch(4L));
+    @Test
+    public void testGetPath() {
+        MockNetworkGraph graph = new MockNetworkGraph();
+        graph.createSampleTopology1();
+        ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L));
+        Path path11 = tree.getPath(graph.getSwitch(1L));
+        Path path12 = tree.getPath(graph.getSwitch(2L));
+        Path path13 = tree.getPath(graph.getSwitch(3L));
+        Path path14 = tree.getPath(graph.getSwitch(4L));
 
-		assertNotNull(path11);
-		assertEquals(0, path11.size());
+        assertNotNull(path11);
+        assertEquals(0, path11.size());
 
-		assertNotNull(path12);
-		assertEquals(1, path12.size());
-		assertEquals(new LinkEvent(graph.getLink(1L, 12L)), path12.get(0));
+        assertNotNull(path12);
+        assertEquals(1, path12.size());
+        assertEquals(new LinkEvent(graph.getLink(1L, 12L)), path12.get(0));
 
-		assertNotNull(path13);
-		assertEquals(2, path13.size());
-		if (path13.get(0).getDst().getDpid() == 2L) {
-			assertEquals(new LinkEvent(graph.getLink(1L, 12L)), path13.get(0));
-			assertEquals(new LinkEvent(graph.getLink(2L, 23L)), path13.get(1));
-		}
-		else {
-			assertEquals(new LinkEvent(graph.getLink(1L, 14L)), path13.get(0));
-			assertEquals(new LinkEvent(graph.getLink(4L, 43L)), path13.get(1));
-		}
+        assertNotNull(path13);
+        assertEquals(2, path13.size());
+        if (path13.get(0).getDst().getDpid() == 2L) {
+            assertEquals(new LinkEvent(graph.getLink(1L, 12L)), path13.get(0));
+            assertEquals(new LinkEvent(graph.getLink(2L, 23L)), path13.get(1));
+        } else {
+            assertEquals(new LinkEvent(graph.getLink(1L, 14L)), path13.get(0));
+            assertEquals(new LinkEvent(graph.getLink(4L, 43L)), path13.get(1));
+        }
 
-		assertNotNull(path14);
-		assertEquals(1, path14.size());
-		assertEquals(new LinkEvent(graph.getLink(1L, 14L)), path14.get(0));
-	}
+        assertNotNull(path14);
+        assertEquals(1, path14.size());
+        assertEquals(new LinkEvent(graph.getLink(1L, 14L)), path14.get(0));
+    }
 
-	@Test
-	public void testGetPathNull() {
-		MockNetworkGraph graph = new MockNetworkGraph();
-		graph.createSampleTopology1();
-		graph.removeLink(1L, 12L, 2L, 21L);
-		graph.removeLink(1L, 14L, 4L, 41L);
-		// now, there is no path from switch 1, but to switch1
+    @Test
+    public void testGetPathNull() {
+        MockNetworkGraph graph = new MockNetworkGraph();
+        graph.createSampleTopology1();
+        graph.removeLink(1L, 12L, 2L, 21L);
+        graph.removeLink(1L, 14L, 4L, 41L);
+        // now, there is no path from switch 1, but to switch1
 
-		ConstrainedBFSTree tree1 = new ConstrainedBFSTree(graph.getSwitch(1L));
-		Path path12 = tree1.getPath(graph.getSwitch(2L));
-		Path path13 = tree1.getPath(graph.getSwitch(3L));
-		Path path14 = tree1.getPath(graph.getSwitch(4L));
+        ConstrainedBFSTree tree1 = new ConstrainedBFSTree(graph.getSwitch(1L));
+        Path path12 = tree1.getPath(graph.getSwitch(2L));
+        Path path13 = tree1.getPath(graph.getSwitch(3L));
+        Path path14 = tree1.getPath(graph.getSwitch(4L));
 
-		ConstrainedBFSTree tree2 = new ConstrainedBFSTree(graph.getSwitch(2L));
-		Path path21 = tree2.getPath(graph.getSwitch(1L));
+        ConstrainedBFSTree tree2 = new ConstrainedBFSTree(graph.getSwitch(2L));
+        Path path21 = tree2.getPath(graph.getSwitch(1L));
 
-		assertNull(path12);
-		assertNull(path13);
-		assertNull(path14);
-		assertNotNull(path21);
-		assertEquals(1, path21.size());
-		assertEquals(new LinkEvent(graph.getLink(2L, 21L)), path21.get(0));
-	}
+        assertNull(path12);
+        assertNull(path13);
+        assertNull(path14);
+        assertNotNull(path21);
+        assertEquals(1, path21.size());
+        assertEquals(new LinkEvent(graph.getLink(2L, 21L)), path21.get(0));
+    }
 
-	@Test
-	public void testGetConstrainedPath() {
-		MockNetworkGraph graph = new MockNetworkGraph();
-		graph.createSampleTopology1();
-		PathIntentMap intents = new PathIntentMap();
-		IntentOperationList intentOps = new IntentOperationList();
+    @Test
+    public void testGetConstrainedPath() {
+        MockNetworkGraph graph = new MockNetworkGraph();
+        graph.createSampleTopology1();
+        PathIntentMap intents = new PathIntentMap();
+        IntentOperationList intentOps = new IntentOperationList();
 
-		// create constrained shortest path intents that have the same source destination ports
-		ConstrainedShortestPathIntent intent1 = new ConstrainedShortestPathIntent(
-				"1", 1L, LOCAL_PORT, 0x111L, 2L, LOCAL_PORT, 0x222L, 600.0);
-		ConstrainedShortestPathIntent intent2 = new ConstrainedShortestPathIntent(
-				"2", 1L, LOCAL_PORT, 0x333L, 2L, LOCAL_PORT, 0x444L, 600.0);
+        // create constrained shortest path intents that have the same source destination ports
+        ConstrainedShortestPathIntent intent1 = new ConstrainedShortestPathIntent(
+                "1", 1L, LOCAL_PORT, 0x111L, 2L, LOCAL_PORT, 0x222L, 600.0);
+        ConstrainedShortestPathIntent intent2 = new ConstrainedShortestPathIntent(
+                "2", 1L, LOCAL_PORT, 0x333L, 2L, LOCAL_PORT, 0x444L, 600.0);
 
-		// calculate path of the intent1
-		ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 600.0);
-		Path path1 = tree.getPath(graph.getSwitch(2L));
+        // calculate path of the intent1
+        ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 600.0);
+        Path path1 = tree.getPath(graph.getSwitch(2L));
 
-		assertNotNull(path1);
-		assertEquals(1, path1.size());
-		assertEquals(new LinkEvent(graph.getLink(1L, 12L)), path1.get(0));
+        assertNotNull(path1);
+        assertEquals(1, path1.size());
+        assertEquals(new LinkEvent(graph.getLink(1L, 12L)), path1.get(0));
 
-		PathIntent pathIntent1 = new PathIntent("pi1", path1, 600.0, intent1);
-		intentOps.add(Operator.ADD, pathIntent1);
-		intents.executeOperations(intentOps);
+        PathIntent pathIntent1 = new PathIntent("pi1", path1, 600.0, intent1);
+        intentOps.add(Operator.ADD, pathIntent1);
+        intents.executeOperations(intentOps);
 
-		// calculate path of the intent2
-		tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 600.0);
-		Path path2 = tree.getPath(graph.getSwitch(2L));
+        // calculate path of the intent2
+        tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 600.0);
+        Path path2 = tree.getPath(graph.getSwitch(2L));
 
-		assertNotNull(path2);
-		assertEquals(2, path2.size());
-		assertEquals(new LinkEvent(graph.getLink(1L, 14L)), path2.get(0));
-		assertEquals(new LinkEvent(graph.getLink(4L, 42L)), path2.get(1));
+        assertNotNull(path2);
+        assertEquals(2, path2.size());
+        assertEquals(new LinkEvent(graph.getLink(1L, 14L)), path2.get(0));
+        assertEquals(new LinkEvent(graph.getLink(4L, 42L)), path2.get(1));
 
-		PathIntent pathIntent2 = new PathIntent("pi2", path2, 600.0, intent2);
-		intentOps.add(Operator.ADD, pathIntent2);
-		intents.executeOperations(intentOps);
+        PathIntent pathIntent2 = new PathIntent("pi2", path2, 600.0, intent2);
+        intentOps.add(Operator.ADD, pathIntent2);
+        intents.executeOperations(intentOps);
 
-		// calculate path of the intent3
-		tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 600.0);
-		Path path3 = tree.getPath(graph.getSwitch(2L));
+        // calculate path of the intent3
+        tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 600.0);
+        Path path3 = tree.getPath(graph.getSwitch(2L));
 
-		assertNull(path3);
-	}
+        assertNull(path3);
+    }
 }
\ No newline at end of file
diff --git a/src/test/java/net/onrc/onos/core/intent/ConstrainedShortestPathIntentTest.java b/src/test/java/net/onrc/onos/core/intent/ConstrainedShortestPathIntentTest.java
index e7df8d5..6b13f6d 100644
--- a/src/test/java/net/onrc/onos/core/intent/ConstrainedShortestPathIntentTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/ConstrainedShortestPathIntentTest.java
@@ -1,6 +1,7 @@
 package net.onrc.onos.core.intent;
 
 import static org.junit.Assert.assertEquals;
+
 import net.onrc.onos.core.util.serializers.KryoFactory;
 
 import org.junit.After;
@@ -15,52 +16,52 @@
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class ConstrainedShortestPathIntentTest {
-	@Before
-	public void setUp() throws Exception {
-	}
+    @Before
+    public void setUp() throws Exception {
+    }
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Test
-	public void testCreate() {
-		ConstrainedShortestPathIntent intent1 =
-				new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
+    @Test
+    public void testCreate() {
+        ConstrainedShortestPathIntent intent1 =
+                new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
 
-		assertEquals("1", intent1.getId());
-		assertEquals(2L, intent1.getSrcSwitchDpid());
-		assertEquals(3L, intent1.getSrcPortNumber());
-		assertEquals(4L, intent1.getSrcMac());
-		assertEquals(5L, intent1.getDstSwitchDpid());
-		assertEquals(6L, intent1.getDstPortNumber());
-		assertEquals(7L, intent1.getDstMac());
-		assertEquals(1000.0, intent1.getBandwidth(), 0.0);
-	}
+        assertEquals("1", intent1.getId());
+        assertEquals(2L, intent1.getSrcSwitchDpid());
+        assertEquals(3L, intent1.getSrcPortNumber());
+        assertEquals(4L, intent1.getSrcMac());
+        assertEquals(5L, intent1.getDstSwitchDpid());
+        assertEquals(6L, intent1.getDstPortNumber());
+        assertEquals(7L, intent1.getDstMac());
+        assertEquals(1000.0, intent1.getBandwidth(), 0.0);
+    }
 
-	@Test
-	public void testKryo() {
-		KryoFactory factory = new KryoFactory();
-		Kryo kryo = factory.newKryo();
-		Output output = new Output(1000);
+    @Test
+    public void testKryo() {
+        KryoFactory factory = new KryoFactory();
+        Kryo kryo = factory.newKryo();
+        Output output = new Output(1000);
 
-		ConstrainedShortestPathIntent intent1 =
-				new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
-		kryo.writeObject(output, intent1);
+        ConstrainedShortestPathIntent intent1 =
+                new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
+        kryo.writeObject(output, intent1);
 
-		output.close();
-		byte bytes[] = output.toBytes();
+        output.close();
+        byte bytes[] = output.toBytes();
 
-		Input input = new Input(bytes);
-		ConstrainedShortestPathIntent intent2 = kryo.readObject(input, ConstrainedShortestPathIntent.class);
-		input.close();
-		assertEquals("1", intent2.getId());
-		assertEquals(2L, intent2.getSrcSwitchDpid());
-		assertEquals(3L, intent2.getSrcPortNumber());
-		assertEquals(4L, intent2.getSrcMac());
-		assertEquals(5L, intent2.getDstSwitchDpid());
-		assertEquals(6L, intent2.getDstPortNumber());
-		assertEquals(7L, intent2.getDstMac());
-		assertEquals(1000.0, intent2.getBandwidth(), 0.0);
-	}
+        Input input = new Input(bytes);
+        ConstrainedShortestPathIntent intent2 = kryo.readObject(input, ConstrainedShortestPathIntent.class);
+        input.close();
+        assertEquals("1", intent2.getId());
+        assertEquals(2L, intent2.getSrcSwitchDpid());
+        assertEquals(3L, intent2.getSrcPortNumber());
+        assertEquals(4L, intent2.getSrcMac());
+        assertEquals(5L, intent2.getDstSwitchDpid());
+        assertEquals(6L, intent2.getDstPortNumber());
+        assertEquals(7L, intent2.getDstMac());
+        assertEquals(1000.0, intent2.getBandwidth(), 0.0);
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/intent/ErrorIntentTest.java b/src/test/java/net/onrc/onos/core/intent/ErrorIntentTest.java
index 81f8991..82b6061 100644
--- a/src/test/java/net/onrc/onos/core/intent/ErrorIntentTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/ErrorIntentTest.java
@@ -1,6 +1,7 @@
 package net.onrc.onos.core.intent;
 
 import static org.junit.Assert.assertEquals;
+
 import net.onrc.onos.core.intent.ErrorIntent.ErrorType;
 
 import org.junit.After;
@@ -9,6 +10,7 @@
 
 /**
  * Unit tests for the ErrorIntent class.
+ *
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class ErrorIntentTest {
diff --git a/src/test/java/net/onrc/onos/core/intent/IntentMapTest.java b/src/test/java/net/onrc/onos/core/intent/IntentMapTest.java
index 46cfff1..5a6c9fa 100644
--- a/src/test/java/net/onrc/onos/core/intent/IntentMapTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/IntentMapTest.java
@@ -3,6 +3,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
+
 import net.onrc.onos.core.intent.ErrorIntent.ErrorType;
 import net.onrc.onos.core.intent.Intent.IntentState;
 import net.onrc.onos.core.intent.IntentMap.ChangedEventType;
@@ -18,221 +19,221 @@
  */
 public class IntentMapTest {
 
-	@Before
-	public void setUp() throws Exception {
-	}
+    @Before
+    public void setUp() throws Exception {
+    }
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Test
-	public void testCreate() {
-		IntentMap intents = new IntentMap();
-		assertEquals(0, intents.getAllIntents().size());
-	}
+    @Test
+    public void testCreate() {
+        IntentMap intents = new IntentMap();
+        assertEquals(0, intents.getAllIntents().size());
+    }
 
-	@Test
-	public void testChangedEventCreate() {
-		IntentMap intents = new IntentMap();
-		IntentMap.ChangedEvent event = intents.new ChangedEvent(
-				ChangedEventType.ADDED,
-				new Intent("id1"));
-		assertEquals(ChangedEventType.ADDED, event.eventType);
-		assertEquals("id1", event.intent.getId());
-	}
+    @Test
+    public void testChangedEventCreate() {
+        IntentMap intents = new IntentMap();
+        IntentMap.ChangedEvent event = intents.new ChangedEvent(
+                ChangedEventType.ADDED,
+                new Intent("id1"));
+        assertEquals(ChangedEventType.ADDED, event.eventType);
+        assertEquals("id1", event.intent.getId());
+    }
 
-	@Test
-	public void testAddOperations() {
-		IntentMap intents = new IntentMap();
-		assertEquals(0, intents.getAllIntents().size());
+    @Test
+    public void testAddOperations() {
+        IntentMap intents = new IntentMap();
+        assertEquals(0, intents.getAllIntents().size());
 
-		Intent intent1 = new Intent("1");
-		ShortestPathIntent intent2 =
-				new ShortestPathIntent("2", 21L, 22L, 23L, 24L, 25L, 26L);
-		ConstrainedShortestPathIntent intent3 =
-				new ConstrainedShortestPathIntent("3", 31L, 32L, 33L, 34L, 35L, 36L, 1000.0);
+        Intent intent1 = new Intent("1");
+        ShortestPathIntent intent2 =
+                new ShortestPathIntent("2", 21L, 22L, 23L, 24L, 25L, 26L);
+        ConstrainedShortestPathIntent intent3 =
+                new ConstrainedShortestPathIntent("3", 31L, 32L, 33L, 34L, 35L, 36L, 1000.0);
 
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, intent1);
-		operations.add(Operator.ADD, intent2);
-		operations.add(Operator.ADD, intent3);
-		assertEquals(3, operations.size());
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, intent1);
+        operations.add(Operator.ADD, intent2);
+        operations.add(Operator.ADD, intent3);
+        assertEquals(3, operations.size());
 
-		intents.executeOperations(operations);
-		assertEquals(3, intents.getAllIntents().size());
-		assertSame(intent1, intents.getIntent("1"));
-		assertSame(intent2, intents.getIntent("2"));
-		assertSame(intent3, intents.getIntent("3"));
-	}
+        intents.executeOperations(operations);
+        assertEquals(3, intents.getAllIntents().size());
+        assertSame(intent1, intents.getIntent("1"));
+        assertSame(intent2, intents.getIntent("2"));
+        assertSame(intent3, intents.getIntent("3"));
+    }
 
-	@Test
-	public void testAddOperationsOverwrite() {
-		IntentMap intents = new IntentMap();
+    @Test
+    public void testAddOperationsOverwrite() {
+        IntentMap intents = new IntentMap();
 
-		Intent intent1 = new Intent("1");
-		Intent intent2 = new Intent("2");
-		Intent intent3 = new Intent("3");
-		Intent intent4 = new Intent("1");
-		Intent intent5 = new Intent("2");
-		Intent intent6 = new Intent("4");
+        Intent intent1 = new Intent("1");
+        Intent intent2 = new Intent("2");
+        Intent intent3 = new Intent("3");
+        Intent intent4 = new Intent("1");
+        Intent intent5 = new Intent("2");
+        Intent intent6 = new Intent("4");
 
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, intent1);
-		operations.add(Operator.ADD, intent2);
-		operations.add(Operator.ADD, intent3);
-		assertEquals(3, operations.size());
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, intent1);
+        operations.add(Operator.ADD, intent2);
+        operations.add(Operator.ADD, intent3);
+        assertEquals(3, operations.size());
 
-		intents.executeOperations(operations);
-		assertEquals(3, intents.getAllIntents().size());
-		assertSame(intent1, intents.getIntent("1"));
-		assertSame(intent2, intents.getIntent("2"));
-		assertSame(intent3, intents.getIntent("3"));
+        intents.executeOperations(operations);
+        assertEquals(3, intents.getAllIntents().size());
+        assertSame(intent1, intents.getIntent("1"));
+        assertSame(intent2, intents.getIntent("2"));
+        assertSame(intent3, intents.getIntent("3"));
 
-		operations.clear();
-		operations.add(Operator.ADD, intent4);
-		operations.add(Operator.ADD, intent5);
-		operations.add(Operator.ADD, intent6);
-		assertEquals(3, operations.size());
+        operations.clear();
+        operations.add(Operator.ADD, intent4);
+        operations.add(Operator.ADD, intent5);
+        operations.add(Operator.ADD, intent6);
+        assertEquals(3, operations.size());
 
-		intents.executeOperations(operations);
-		assertEquals(4, intents.getAllIntents().size());
-		assertSame(intent4, intents.getIntent("1"));
-		assertSame(intent5, intents.getIntent("2"));
-		assertSame(intent3, intents.getIntent("3"));
-		assertSame(intent6, intents.getIntent("4"));
-	}
+        intents.executeOperations(operations);
+        assertEquals(4, intents.getAllIntents().size());
+        assertSame(intent4, intents.getIntent("1"));
+        assertSame(intent5, intents.getIntent("2"));
+        assertSame(intent3, intents.getIntent("3"));
+        assertSame(intent6, intents.getIntent("4"));
+    }
 
-	@Test
-	public void testRemoveOperation() {
-		IntentMap intents = new IntentMap();
+    @Test
+    public void testRemoveOperation() {
+        IntentMap intents = new IntentMap();
 
-		Intent intent1 = new Intent("1");
-		ShortestPathIntent intent2 =
-				new ShortestPathIntent("2", 21L, 22L, 23L, 24L, 25L, 26L);
-		ConstrainedShortestPathIntent intent3 =
-				new ConstrainedShortestPathIntent("3", 31L, 32L, 33L, 34L, 35L, 36L, 1000.0);
+        Intent intent1 = new Intent("1");
+        ShortestPathIntent intent2 =
+                new ShortestPathIntent("2", 21L, 22L, 23L, 24L, 25L, 26L);
+        ConstrainedShortestPathIntent intent3 =
+                new ConstrainedShortestPathIntent("3", 31L, 32L, 33L, 34L, 35L, 36L, 1000.0);
 
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, intent1);
-		operations.add(Operator.ADD, intent2);
-		operations.add(Operator.ADD, intent3);
-		intents.executeOperations(operations);
-		assertEquals(3, intents.getAllIntents().size());
-		assertSame(intent1, intents.getIntent("1"));
-		assertSame(intent2, intents.getIntent("2"));
-		assertSame(intent3, intents.getIntent("3"));
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, intent1);
+        operations.add(Operator.ADD, intent2);
+        operations.add(Operator.ADD, intent3);
+        intents.executeOperations(operations);
+        assertEquals(3, intents.getAllIntents().size());
+        assertSame(intent1, intents.getIntent("1"));
+        assertSame(intent2, intents.getIntent("2"));
+        assertSame(intent3, intents.getIntent("3"));
 
-		operations.clear();
-		operations.add(Operator.REMOVE, new Intent("1"));
-		operations.add(Operator.REMOVE, new Intent("3"));
-		intents.executeOperations(operations);
-		assertEquals(3, intents.getAllIntents().size());
-		assertSame(intent1, intents.getIntent("1"));
-		assertSame(intent2, intents.getIntent("2"));
-		assertSame(intent3, intents.getIntent("3"));
-		assertEquals(IntentState.DEL_REQ, intents.getIntent("1").getState());
-		assertEquals(IntentState.CREATED, intents.getIntent("2").getState());
-		assertEquals(IntentState.DEL_REQ, intents.getIntent("3").getState());
-	}
+        operations.clear();
+        operations.add(Operator.REMOVE, new Intent("1"));
+        operations.add(Operator.REMOVE, new Intent("3"));
+        intents.executeOperations(operations);
+        assertEquals(3, intents.getAllIntents().size());
+        assertSame(intent1, intents.getIntent("1"));
+        assertSame(intent2, intents.getIntent("2"));
+        assertSame(intent3, intents.getIntent("3"));
+        assertEquals(IntentState.DEL_REQ, intents.getIntent("1").getState());
+        assertEquals(IntentState.CREATED, intents.getIntent("2").getState());
+        assertEquals(IntentState.DEL_REQ, intents.getIntent("3").getState());
+    }
 
-	@Test
-	public void testErrorOperation() {
-		IntentMap intents = new IntentMap();
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, new Intent("1", IntentState.CREATED));
-		operations.add(Operator.ADD, new Intent("2", IntentState.INST_REQ));
-		operations.add(Operator.ADD, new Intent("3", IntentState.INST_ACK));
-		operations.add(Operator.ADD, new Intent("4", IntentState.INST_NACK));
-		operations.add(Operator.ADD, new Intent("5", IntentState.REROUTE_REQ));
-		operations.add(Operator.ADD, new Intent("6", IntentState.DEL_REQ));
-		operations.add(Operator.ADD, new Intent("7", IntentState.DEL_ACK));
-		operations.add(Operator.ADD, new Intent("8", IntentState.DEL_PENDING));
-		intents.executeOperations(operations);
-		assertEquals(8, intents.getAllIntents().size());
+    @Test
+    public void testErrorOperation() {
+        IntentMap intents = new IntentMap();
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, new Intent("1", IntentState.CREATED));
+        operations.add(Operator.ADD, new Intent("2", IntentState.INST_REQ));
+        operations.add(Operator.ADD, new Intent("3", IntentState.INST_ACK));
+        operations.add(Operator.ADD, new Intent("4", IntentState.INST_NACK));
+        operations.add(Operator.ADD, new Intent("5", IntentState.REROUTE_REQ));
+        operations.add(Operator.ADD, new Intent("6", IntentState.DEL_REQ));
+        operations.add(Operator.ADD, new Intent("7", IntentState.DEL_ACK));
+        operations.add(Operator.ADD, new Intent("8", IntentState.DEL_PENDING));
+        intents.executeOperations(operations);
+        assertEquals(8, intents.getAllIntents().size());
 
-		operations.clear();
-		operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("1")));
-		operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("2")));
-		operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("3")));
-		operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("4")));
-		operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("5")));
-		operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("6")));
-		operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("7")));
-		operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("8")));
-		intents.executeOperations(operations);
+        operations.clear();
+        operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("1")));
+        operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("2")));
+        operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("3")));
+        operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("4")));
+        operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("5")));
+        operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("6")));
+        operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("7")));
+        operations.add(Operator.ERROR, new ErrorIntent(ErrorType.PATH_NOT_FOUND, "", new Intent("8")));
+        intents.executeOperations(operations);
 
-		assertEquals(IntentState.INST_NACK, intents.getIntent("1").getState());
-		assertEquals(IntentState.INST_NACK, intents.getIntent("2").getState());
-		assertEquals(IntentState.INST_NACK, intents.getIntent("3").getState());
-		assertEquals(IntentState.INST_NACK, intents.getIntent("4").getState());
-		assertEquals(IntentState.INST_NACK, intents.getIntent("5").getState());
-		assertEquals(IntentState.DEL_PENDING, intents.getIntent("6").getState());
-		assertEquals(IntentState.DEL_ACK, intents.getIntent("7").getState());
-		assertEquals(IntentState.DEL_PENDING, intents.getIntent("8").getState());
-	}
+        assertEquals(IntentState.INST_NACK, intents.getIntent("1").getState());
+        assertEquals(IntentState.INST_NACK, intents.getIntent("2").getState());
+        assertEquals(IntentState.INST_NACK, intents.getIntent("3").getState());
+        assertEquals(IntentState.INST_NACK, intents.getIntent("4").getState());
+        assertEquals(IntentState.INST_NACK, intents.getIntent("5").getState());
+        assertEquals(IntentState.DEL_PENDING, intents.getIntent("6").getState());
+        assertEquals(IntentState.DEL_ACK, intents.getIntent("7").getState());
+        assertEquals(IntentState.DEL_PENDING, intents.getIntent("8").getState());
+    }
 
-	@Test
-	public void testPurge() {
-		IntentMap intents = new IntentMap();
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, new Intent("1", IntentState.CREATED));
-		operations.add(Operator.ADD, new Intent("2", IntentState.INST_REQ));
-		operations.add(Operator.ADD, new Intent("3", IntentState.INST_ACK));
-		operations.add(Operator.ADD, new Intent("4", IntentState.INST_NACK));
-		operations.add(Operator.ADD, new Intent("5", IntentState.REROUTE_REQ));
-		operations.add(Operator.ADD, new Intent("6", IntentState.DEL_REQ));
-		operations.add(Operator.ADD, new Intent("7", IntentState.DEL_ACK));
-		operations.add(Operator.ADD, new Intent("8", IntentState.DEL_PENDING));
-		intents.executeOperations(operations);
-		assertEquals(8, intents.getAllIntents().size());
+    @Test
+    public void testPurge() {
+        IntentMap intents = new IntentMap();
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, new Intent("1", IntentState.CREATED));
+        operations.add(Operator.ADD, new Intent("2", IntentState.INST_REQ));
+        operations.add(Operator.ADD, new Intent("3", IntentState.INST_ACK));
+        operations.add(Operator.ADD, new Intent("4", IntentState.INST_NACK));
+        operations.add(Operator.ADD, new Intent("5", IntentState.REROUTE_REQ));
+        operations.add(Operator.ADD, new Intent("6", IntentState.DEL_REQ));
+        operations.add(Operator.ADD, new Intent("7", IntentState.DEL_ACK));
+        operations.add(Operator.ADD, new Intent("8", IntentState.DEL_PENDING));
+        intents.executeOperations(operations);
+        assertEquals(8, intents.getAllIntents().size());
 
-		intents.purge();
+        intents.purge();
 
-		assertEquals(6, intents.getAllIntents().size());
-		assertEquals("1", intents.getIntent("1").getId());
-		assertEquals("2", intents.getIntent("2").getId());
-		assertEquals("3", intents.getIntent("3").getId());
-		assertNull(intents.getIntent("4"));
-		assertEquals("5", intents.getIntent("5").getId());
-		assertEquals("6", intents.getIntent("6").getId());
-		assertNull("7", intents.getIntent("7"));
-		assertEquals("8", intents.getIntent("8").getId());
-	}
+        assertEquals(6, intents.getAllIntents().size());
+        assertEquals("1", intents.getIntent("1").getId());
+        assertEquals("2", intents.getIntent("2").getId());
+        assertEquals("3", intents.getIntent("3").getId());
+        assertNull(intents.getIntent("4"));
+        assertEquals("5", intents.getIntent("5").getId());
+        assertEquals("6", intents.getIntent("6").getId());
+        assertNull("7", intents.getIntent("7"));
+        assertEquals("8", intents.getIntent("8").getId());
+    }
 
-	@Test
-	public void testChangeStates() {
-		IntentMap intents = new IntentMap();
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, new Intent("1", IntentState.CREATED));
-		operations.add(Operator.ADD, new Intent("2", IntentState.INST_REQ));
-		operations.add(Operator.ADD, new Intent("3", IntentState.INST_ACK));
-		operations.add(Operator.ADD, new Intent("4", IntentState.INST_NACK));
-		operations.add(Operator.ADD, new Intent("5", IntentState.REROUTE_REQ));
-		operations.add(Operator.ADD, new Intent("6", IntentState.DEL_REQ));
-		operations.add(Operator.ADD, new Intent("7", IntentState.DEL_ACK));
-		operations.add(Operator.ADD, new Intent("8", IntentState.DEL_PENDING));
-		intents.executeOperations(operations);
-		assertEquals(8, intents.getAllIntents().size());
+    @Test
+    public void testChangeStates() {
+        IntentMap intents = new IntentMap();
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, new Intent("1", IntentState.CREATED));
+        operations.add(Operator.ADD, new Intent("2", IntentState.INST_REQ));
+        operations.add(Operator.ADD, new Intent("3", IntentState.INST_ACK));
+        operations.add(Operator.ADD, new Intent("4", IntentState.INST_NACK));
+        operations.add(Operator.ADD, new Intent("5", IntentState.REROUTE_REQ));
+        operations.add(Operator.ADD, new Intent("6", IntentState.DEL_REQ));
+        operations.add(Operator.ADD, new Intent("7", IntentState.DEL_ACK));
+        operations.add(Operator.ADD, new Intent("8", IntentState.DEL_PENDING));
+        intents.executeOperations(operations);
+        assertEquals(8, intents.getAllIntents().size());
 
-		IntentStateList states = new IntentStateList();
-		states.put("8", IntentState.CREATED);
-		states.put("1", IntentState.INST_REQ);
-		states.put("2", IntentState.INST_ACK);
-		states.put("3", IntentState.INST_NACK);
-		states.put("4", IntentState.REROUTE_REQ);
-		states.put("5", IntentState.DEL_REQ);
-		states.put("6", IntentState.DEL_ACK);
-		states.put("7", IntentState.DEL_PENDING);
-		intents.changeStates(states);
+        IntentStateList states = new IntentStateList();
+        states.put("8", IntentState.CREATED);
+        states.put("1", IntentState.INST_REQ);
+        states.put("2", IntentState.INST_ACK);
+        states.put("3", IntentState.INST_NACK);
+        states.put("4", IntentState.REROUTE_REQ);
+        states.put("5", IntentState.DEL_REQ);
+        states.put("6", IntentState.DEL_ACK);
+        states.put("7", IntentState.DEL_PENDING);
+        intents.changeStates(states);
 
-		assertEquals(IntentState.INST_REQ, intents.getIntent("1").getState());
-		assertEquals(IntentState.INST_ACK, intents.getIntent("2").getState());
-		assertEquals(IntentState.INST_NACK, intents.getIntent("3").getState());
-		assertEquals(IntentState.REROUTE_REQ, intents.getIntent("4").getState());
-		assertEquals(IntentState.DEL_REQ, intents.getIntent("5").getState());
-		assertEquals(IntentState.DEL_ACK, intents.getIntent("6").getState());
-		assertEquals(IntentState.DEL_PENDING, intents.getIntent("7").getState());
-		assertEquals(IntentState.CREATED, intents.getIntent("8").getState());
-	}
+        assertEquals(IntentState.INST_REQ, intents.getIntent("1").getState());
+        assertEquals(IntentState.INST_ACK, intents.getIntent("2").getState());
+        assertEquals(IntentState.INST_NACK, intents.getIntent("3").getState());
+        assertEquals(IntentState.REROUTE_REQ, intents.getIntent("4").getState());
+        assertEquals(IntentState.DEL_REQ, intents.getIntent("5").getState());
+        assertEquals(IntentState.DEL_ACK, intents.getIntent("6").getState());
+        assertEquals(IntentState.DEL_PENDING, intents.getIntent("7").getState());
+        assertEquals(IntentState.CREATED, intents.getIntent("8").getState());
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/intent/IntentOperationListTest.java b/src/test/java/net/onrc/onos/core/intent/IntentOperationListTest.java
index 711cef8..2d09a8d 100644
--- a/src/test/java/net/onrc/onos/core/intent/IntentOperationListTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/IntentOperationListTest.java
@@ -1,6 +1,7 @@
 package net.onrc.onos.core.intent;
 
 import static org.junit.Assert.assertEquals;
+
 import net.onrc.onos.core.topology.LinkEvent;
 import net.onrc.onos.core.topology.Path;
 import net.onrc.onos.core.util.serializers.KryoFactory;
@@ -18,53 +19,53 @@
  */
 public class IntentOperationListTest {
 
-	@Before
-	public void setUp() throws Exception {
-	}
+    @Before
+    public void setUp() throws Exception {
+    }
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Test
-	public void test() {
-		IntentOperationList opList = new IntentOperationList();
+    @Test
+    public void test() {
+        IntentOperationList opList = new IntentOperationList();
 
-		ConstrainedShortestPathIntent cspIntent1 =
-				new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
+        ConstrainedShortestPathIntent cspIntent1 =
+                new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
 
-		Path path = new Path();
-		path.add(new LinkEvent(1L, 2L, 3L, 4L));
-		path.add(new LinkEvent(5L, 6L, 7L, 8L));
-		path.add(new LinkEvent(9L, 0L, 1L, 2L));
+        Path path = new Path();
+        path.add(new LinkEvent(1L, 2L, 3L, 4L));
+        path.add(new LinkEvent(5L, 6L, 7L, 8L));
+        path.add(new LinkEvent(9L, 0L, 1L, 2L));
 
-		PathIntent pathIntent1 = new PathIntent("11", path, 123.45, cspIntent1);
-		opList.add(IntentOperation.Operator.ADD, pathIntent1);
-		opList.add(IntentOperation.Operator.REMOVE, new Intent("22"));
+        PathIntent pathIntent1 = new PathIntent("11", path, 123.45, cspIntent1);
+        opList.add(IntentOperation.Operator.ADD, pathIntent1);
+        opList.add(IntentOperation.Operator.REMOVE, new Intent("22"));
 
-		KryoFactory factory = new KryoFactory();
-		Kryo kryo = factory.newKryo();
-		Output output = new Output(1024);
-		kryo.writeObject(output, opList);
-		output.close();
+        KryoFactory factory = new KryoFactory();
+        Kryo kryo = factory.newKryo();
+        Output output = new Output(1024);
+        kryo.writeObject(output, opList);
+        output.close();
 
-		byte[] bytes = output.toBytes();
+        byte[] bytes = output.toBytes();
 
-		Input input = new Input(bytes);
-		IntentOperationList rcvOpList = kryo.readObject(input, IntentOperationList.class);
+        Input input = new Input(bytes);
+        IntentOperationList rcvOpList = kryo.readObject(input, IntentOperationList.class);
 
-		assertEquals(2, rcvOpList.size());
+        assertEquals(2, rcvOpList.size());
 
-		IntentOperation op1 = rcvOpList.get(0);
-		IntentOperation op2 = rcvOpList.get(1);
+        IntentOperation op1 = rcvOpList.get(0);
+        IntentOperation op2 = rcvOpList.get(1);
 
-		assertEquals(IntentOperation.Operator.ADD, op1.operator);
-		PathIntent intent1 = (PathIntent) op1.intent;
-		assertEquals("11", intent1.getId());
-		assertEquals(3, intent1.getPath().size());
+        assertEquals(IntentOperation.Operator.ADD, op1.operator);
+        PathIntent intent1 = (PathIntent) op1.intent;
+        assertEquals("11", intent1.getId());
+        assertEquals(3, intent1.getPath().size());
 
-		assertEquals(IntentOperation.Operator.REMOVE, op2.operator);
-		Intent intent2 = op2.intent;
-		assertEquals("22", intent2.getId());
-	}
+        assertEquals(IntentOperation.Operator.REMOVE, op2.operator);
+        Intent intent2 = op2.intent;
+        assertEquals("22", intent2.getId());
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/intent/IntentOperationTest.java b/src/test/java/net/onrc/onos/core/intent/IntentOperationTest.java
index 5092f16..6519508 100644
--- a/src/test/java/net/onrc/onos/core/intent/IntentOperationTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/IntentOperationTest.java
@@ -1,6 +1,7 @@
 package net.onrc.onos.core.intent;
 
 import static org.junit.Assert.assertEquals;
+
 import net.onrc.onos.core.intent.IntentOperation.Operator;
 
 import org.junit.After;
@@ -9,6 +10,7 @@
 
 /**
  * Unit tests for the IntentOperation class.
+ *
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class IntentOperationTest {
diff --git a/src/test/java/net/onrc/onos/core/intent/IntentTest.java b/src/test/java/net/onrc/onos/core/intent/IntentTest.java
index d63ddea..64139a4 100644
--- a/src/test/java/net/onrc/onos/core/intent/IntentTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/IntentTest.java
@@ -12,68 +12,68 @@
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class IntentTest {
-	@Test
-	public void testCreateIntent() {
-		Intent intent = new Intent("id");
-		assertEquals("id", intent.getId());
-		assertEquals(Intent.IntentState.CREATED, intent.getState());
-	}
+    @Test
+    public void testCreateIntent() {
+        Intent intent = new Intent("id");
+        assertEquals("id", intent.getId());
+        assertEquals(Intent.IntentState.CREATED, intent.getState());
+    }
 
-	@Test
-	public void testCreateIntentWithState() {
-		Intent intent = new Intent("id", Intent.IntentState.INST_REQ);
-		assertEquals("id", intent.getId());
-		assertEquals(Intent.IntentState.INST_REQ, intent.getState());
-	}
+    @Test
+    public void testCreateIntentWithState() {
+        Intent intent = new Intent("id", Intent.IntentState.INST_REQ);
+        assertEquals("id", intent.getId());
+        assertEquals(Intent.IntentState.INST_REQ, intent.getState());
+    }
 
-	@Test
-	public void testSetState() {
-		Intent intent = new Intent("id");
+    @Test
+    public void testSetState() {
+        Intent intent = new Intent("id");
 
-		intent.setState(Intent.IntentState.INST_REQ);
-		assertEquals(Intent.IntentState.INST_REQ, intent.getState());
+        intent.setState(Intent.IntentState.INST_REQ);
+        assertEquals(Intent.IntentState.INST_REQ, intent.getState());
 
-		intent.setState(Intent.IntentState.DEL_REQ);
-		assertEquals(Intent.IntentState.DEL_REQ, intent.getState());
-	}
+        intent.setState(Intent.IntentState.DEL_REQ);
+        assertEquals(Intent.IntentState.DEL_REQ, intent.getState());
+    }
 
-	@Test
-	public void testEquals() {
-		Intent intent1 = new Intent("id1");
-		Intent intent2 = new Intent("id1");
-		Intent intent3 = new Intent("id2");
-		Intent intent4 = new Intent("id2");
+    @Test
+    public void testEquals() {
+        Intent intent1 = new Intent("id1");
+        Intent intent2 = new Intent("id1");
+        Intent intent3 = new Intent("id2");
+        Intent intent4 = new Intent("id2");
 
-		assertEquals(intent1, intent2);
-		assertEquals(intent3, intent4);
+        assertEquals(intent1, intent2);
+        assertEquals(intent3, intent4);
 
-		assertFalse(intent1.equals(intent3));
-		assertFalse(intent3.equals(intent1));
+        assertFalse(intent1.equals(intent3));
+        assertFalse(intent3.equals(intent1));
 
-		intent1.setState(Intent.IntentState.INST_ACK);
-		intent2.setState(Intent.IntentState.INST_NACK);
-		assertEquals(intent1, intent2);
-	}
+        intent1.setState(Intent.IntentState.INST_ACK);
+        intent2.setState(Intent.IntentState.INST_NACK);
+        assertEquals(intent1, intent2);
+    }
 
-	@Test
-	public void testHashCode() {
-		Intent intent1 = new Intent("id1");
-		intent1.setState(Intent.IntentState.INST_ACK);
-		Intent intent2 = new Intent("id1");
-		intent2.setState(Intent.IntentState.INST_NACK);
-		Intent intent3 = new Intent("id2");
-		Intent intent4 = new Intent("id2");
+    @Test
+    public void testHashCode() {
+        Intent intent1 = new Intent("id1");
+        intent1.setState(Intent.IntentState.INST_ACK);
+        Intent intent2 = new Intent("id1");
+        intent2.setState(Intent.IntentState.INST_NACK);
+        Intent intent3 = new Intent("id2");
+        Intent intent4 = new Intent("id2");
 
-		HashSet<Intent> intents = new HashSet<>();
-		intents.add(intent1);
-		intents.add(intent2);
-		intents.add(intent3);
-		intents.add(intent4);
+        HashSet<Intent> intents = new HashSet<>();
+        intents.add(intent1);
+        intents.add(intent2);
+        intents.add(intent3);
+        intents.add(intent4);
 
-		assertEquals(2, intents.size());
-		assertTrue(intents.contains(intent1));
-		assertTrue(intents.contains(intent2));
-		assertTrue(intents.contains(intent3));
-		assertTrue(intents.contains(intent4));
-	}
+        assertEquals(2, intents.size());
+        assertTrue(intents.contains(intent1));
+        assertTrue(intents.contains(intent2));
+        assertTrue(intents.contains(intent3));
+        assertTrue(intents.contains(intent4));
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/intent/MockNetworkGraph.java b/src/test/java/net/onrc/onos/core/intent/MockNetworkGraph.java
index 3b40259..b2435d6 100644
--- a/src/test/java/net/onrc/onos/core/intent/MockNetworkGraph.java
+++ b/src/test/java/net/onrc/onos/core/intent/MockNetworkGraph.java
@@ -15,85 +15,86 @@
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class MockNetworkGraph extends NetworkGraphImpl {
-	public static Long LOCAL_PORT = 0xFFFEL;
-	public SwitchImpl sw1, sw2, sw3, sw4;
+    public static Long LOCAL_PORT = 0xFFFEL;
+    public SwitchImpl sw1, sw2, sw3, sw4;
 
-	class DetachableLinkImpl extends LinkImpl {
-		public DetachableLinkImpl(NetworkGraph graph, Port srcPort, Port dstPort) {
-			super(graph, srcPort, dstPort);
-		}
+    class DetachableLinkImpl extends LinkImpl {
+        public DetachableLinkImpl(NetworkGraph graph, Port srcPort, Port dstPort) {
+            super(graph, srcPort, dstPort);
+        }
 
-		public void detachFromGraph() {
-			unsetFromPorts();
-		}
-	}
-	public Switch addSwitch(Long switchId) {
-		SwitchImpl sw = new SwitchImpl(this, switchId);
-		this.putSwitch(sw);
-		return sw;
-	}
+        public void detachFromGraph() {
+            unsetFromPorts();
+        }
+    }
 
-	public Link addLink(Long srcDpid, Long srcPortNo, Long dstDpid, Long dstPortNo) {
-		return new DetachableLinkImpl(
-				this,
-				getSwitch(srcDpid).getPort(srcPortNo),
-				getSwitch(dstDpid).getPort(dstPortNo));
-	}
+    public Switch addSwitch(Long switchId) {
+        SwitchImpl sw = new SwitchImpl(this, switchId);
+        this.putSwitch(sw);
+        return sw;
+    }
 
-	public Link[] addBidirectionalLinks(Long srcDpid, Long srcPortNo, Long dstDpid, Long dstPortNo) {
-		Link[] links = new Link[2];
-		links[0] = addLink(srcDpid, srcPortNo, dstDpid, dstPortNo);
-		links[1] = addLink(dstDpid, dstPortNo, srcDpid, srcPortNo);
+    public Link addLink(Long srcDpid, Long srcPortNo, Long dstDpid, Long dstPortNo) {
+        return new DetachableLinkImpl(
+                this,
+                getSwitch(srcDpid).getPort(srcPortNo),
+                getSwitch(dstDpid).getPort(dstPortNo));
+    }
 
-		return links;
-	}
+    public Link[] addBidirectionalLinks(Long srcDpid, Long srcPortNo, Long dstDpid, Long dstPortNo) {
+        Link[] links = new Link[2];
+        links[0] = addLink(srcDpid, srcPortNo, dstDpid, dstPortNo);
+        links[1] = addLink(dstDpid, dstPortNo, srcDpid, srcPortNo);
 
-	/**
-	 * create sample topology of 4 switches and 5 bidirectional links.
-	 * <pre>
-	 * [1] --- [2]
-	 *  |    /  |
-	 *  |  /    |
-	 * [4] --- [3]
-	 * </pre>
-	 */
-	public void createSampleTopology1() {
-		sw1 = (SwitchImpl) addSwitch(1L);
-		sw1.addPort(LOCAL_PORT);
-		sw2 = (SwitchImpl) addSwitch(2L);
-		sw2.addPort(LOCAL_PORT);
-		sw3 = (SwitchImpl) addSwitch(3L);
-		sw3.addPort(LOCAL_PORT);
-		sw4 = (SwitchImpl) addSwitch(4L);
-		sw4.addPort(LOCAL_PORT);
+        return links;
+    }
 
-		sw1.addPort(12L); // sw1 -> sw2
-		sw1.addPort(14L); // sw1 -> sw4
-		sw2.addPort(21L); // sw2 -> sw1
-		sw2.addPort(23L); // sw2 -> sw3
-		sw2.addPort(24L); // sw2 -> sw4
-		sw3.addPort(32L); // sw3 -> sw2
-		sw3.addPort(34L); // sw3 -> sw4
-		sw4.addPort(41L); // sw4 -> sw1
-		sw4.addPort(42L); // sw4 -> sw2
-		sw4.addPort(43L); // sw4 -> sw3
+    /**
+     * create sample topology of 4 switches and 5 bidirectional links.
+     * <pre>
+     * [1] --- [2]
+     *  |    /  |
+     *  |  /    |
+     * [4] --- [3]
+     * </pre>
+     */
+    public void createSampleTopology1() {
+        sw1 = (SwitchImpl) addSwitch(1L);
+        sw1.addPort(LOCAL_PORT);
+        sw2 = (SwitchImpl) addSwitch(2L);
+        sw2.addPort(LOCAL_PORT);
+        sw3 = (SwitchImpl) addSwitch(3L);
+        sw3.addPort(LOCAL_PORT);
+        sw4 = (SwitchImpl) addSwitch(4L);
+        sw4.addPort(LOCAL_PORT);
 
-		addBidirectionalLinks(1L, 12L, 2L, 21L);
-		addBidirectionalLinks(2L, 23L, 3L, 32L);
-		addBidirectionalLinks(3L, 34L, 4L, 43L);
-		addBidirectionalLinks(4L, 41L, 1L, 14L);
-		addBidirectionalLinks(2L, 24L, 4L, 42L);
+        sw1.addPort(12L); // sw1 -> sw2
+        sw1.addPort(14L); // sw1 -> sw4
+        sw2.addPort(21L); // sw2 -> sw1
+        sw2.addPort(23L); // sw2 -> sw3
+        sw2.addPort(24L); // sw2 -> sw4
+        sw3.addPort(32L); // sw3 -> sw2
+        sw3.addPort(34L); // sw3 -> sw4
+        sw4.addPort(41L); // sw4 -> sw1
+        sw4.addPort(42L); // sw4 -> sw2
+        sw4.addPort(43L); // sw4 -> sw3
 
-		// set capacity of all links to 1000Mbps
-		for (Link link: getLinks()) {
-			((LinkImpl)link).setCapacity(1000.0);
-		}
-	}
+        addBidirectionalLinks(1L, 12L, 2L, 21L);
+        addBidirectionalLinks(2L, 23L, 3L, 32L);
+        addBidirectionalLinks(3L, 34L, 4L, 43L);
+        addBidirectionalLinks(4L, 41L, 1L, 14L);
+        addBidirectionalLinks(2L, 24L, 4L, 42L);
 
-	public void removeLink(Long srcDpid, Long srcPortNo, Long dstDpid, Long dstPortNo) {
-		DetachableLinkImpl link = (DetachableLinkImpl)getSwitch(srcDpid).getPort(srcPortNo).getOutgoingLink();
-		if (link.getDstSwitch().getDpid().equals(dstDpid) && link.getDstPort().getNumber().equals(dstPortNo)) {
-			link.detachFromGraph();
-		}
-	}
+        // set capacity of all links to 1000Mbps
+        for (Link link : getLinks()) {
+            ((LinkImpl) link).setCapacity(1000.0);
+        }
+    }
+
+    public void removeLink(Long srcDpid, Long srcPortNo, Long dstDpid, Long dstPortNo) {
+        DetachableLinkImpl link = (DetachableLinkImpl) getSwitch(srcDpid).getPort(srcPortNo).getOutgoingLink();
+        if (link.getDstSwitch().getDpid().equals(dstDpid) && link.getDstPort().getNumber().equals(dstPortNo)) {
+            link.detachFromGraph();
+        }
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/intent/PathIntentMapTest.java b/src/test/java/net/onrc/onos/core/intent/PathIntentMapTest.java
index bbf17a0..a67d2b5 100644
--- a/src/test/java/net/onrc/onos/core/intent/PathIntentMapTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/PathIntentMapTest.java
@@ -20,181 +20,181 @@
 import org.junit.Test;
 
 public class PathIntentMapTest {
-	Link link12, link23, link24;
-	Switch sw1, sw2, sw3, sw4;
-	Port port11, port22, port21, port23, port31, port41;
-	Path path1, path2;
-	PathIntent intent1, intent2;
+    Link link12, link23, link24;
+    Switch sw1, sw2, sw3, sw4;
+    Port port11, port22, port21, port23, port31, port41;
+    Path path1, path2;
+    PathIntent intent1, intent2;
 
-	@Before
-	public void setUp() throws Exception {
-		sw1 = createMock(Switch.class);
-		sw2 = createMock(Switch.class);
-		sw3 = createMock(Switch.class);
-		sw4 = createMock(Switch.class);
-		expect(sw1.getDpid()).andReturn(1L).anyTimes();
-		expect(sw2.getDpid()).andReturn(2L).anyTimes();
-		expect(sw3.getDpid()).andReturn(3L).anyTimes();
-		expect(sw4.getDpid()).andReturn(4L).anyTimes();
-		replay(sw1);
-		replay(sw2);
-		replay(sw3);
-		replay(sw4);
+    @Before
+    public void setUp() throws Exception {
+        sw1 = createMock(Switch.class);
+        sw2 = createMock(Switch.class);
+        sw3 = createMock(Switch.class);
+        sw4 = createMock(Switch.class);
+        expect(sw1.getDpid()).andReturn(1L).anyTimes();
+        expect(sw2.getDpid()).andReturn(2L).anyTimes();
+        expect(sw3.getDpid()).andReturn(3L).anyTimes();
+        expect(sw4.getDpid()).andReturn(4L).anyTimes();
+        replay(sw1);
+        replay(sw2);
+        replay(sw3);
+        replay(sw4);
 
-		port11 = createMock(Port.class);
-		port22 = createMock(Port.class);
-		port21 = createMock(Port.class);
-		port23 = createMock(Port.class);
-		port31 = createMock(Port.class);
-		port41 = createMock(Port.class);
-		expect(port11.getNumber()).andReturn(1L).anyTimes();
-		expect(port22.getNumber()).andReturn(2L).anyTimes();
-		expect(port21.getNumber()).andReturn(1L).anyTimes();
-		expect(port23.getNumber()).andReturn(3L).anyTimes();
-		expect(port31.getNumber()).andReturn(1L).anyTimes();
-		expect(port41.getNumber()).andReturn(1L).anyTimes();
-		replay(port11);
-		replay(port22);
-		replay(port21);
-		replay(port23);
-		replay(port31);
-		replay(port41);
+        port11 = createMock(Port.class);
+        port22 = createMock(Port.class);
+        port21 = createMock(Port.class);
+        port23 = createMock(Port.class);
+        port31 = createMock(Port.class);
+        port41 = createMock(Port.class);
+        expect(port11.getNumber()).andReturn(1L).anyTimes();
+        expect(port22.getNumber()).andReturn(2L).anyTimes();
+        expect(port21.getNumber()).andReturn(1L).anyTimes();
+        expect(port23.getNumber()).andReturn(3L).anyTimes();
+        expect(port31.getNumber()).andReturn(1L).anyTimes();
+        expect(port41.getNumber()).andReturn(1L).anyTimes();
+        replay(port11);
+        replay(port22);
+        replay(port21);
+        replay(port23);
+        replay(port31);
+        replay(port41);
 
-		link12 = createMock(Link.class);
-		link23 = createMock(Link.class);
-		link24 = createMock(Link.class);
-		expect(link12.getCapacity()).andReturn(1000.0).anyTimes();
-		expect(link23.getCapacity()).andReturn(1000.0).anyTimes();
-		expect(link24.getCapacity()).andReturn(1000.0).anyTimes();
-		expect(link12.getSrcSwitch()).andReturn(sw1).anyTimes();
-		expect(link23.getSrcSwitch()).andReturn(sw2).anyTimes();
-		expect(link24.getSrcSwitch()).andReturn(sw2).anyTimes();
-		expect(link12.getSrcPort()).andReturn(port11).anyTimes();
-		expect(link23.getSrcPort()).andReturn(port21).anyTimes();
-		expect(link24.getSrcPort()).andReturn(port23).anyTimes();
-		expect(link12.getDstSwitch()).andReturn(sw2).anyTimes();
-		expect(link23.getDstSwitch()).andReturn(sw3).anyTimes();
-		expect(link24.getDstSwitch()).andReturn(sw4).anyTimes();
-		expect(link12.getDstPort()).andReturn(port22).anyTimes();
-		expect(link23.getDstPort()).andReturn(port31).anyTimes();
-		expect(link24.getDstPort()).andReturn(port41).anyTimes();
-		replay(link12);
-		replay(link23);
-		replay(link24);
+        link12 = createMock(Link.class);
+        link23 = createMock(Link.class);
+        link24 = createMock(Link.class);
+        expect(link12.getCapacity()).andReturn(1000.0).anyTimes();
+        expect(link23.getCapacity()).andReturn(1000.0).anyTimes();
+        expect(link24.getCapacity()).andReturn(1000.0).anyTimes();
+        expect(link12.getSrcSwitch()).andReturn(sw1).anyTimes();
+        expect(link23.getSrcSwitch()).andReturn(sw2).anyTimes();
+        expect(link24.getSrcSwitch()).andReturn(sw2).anyTimes();
+        expect(link12.getSrcPort()).andReturn(port11).anyTimes();
+        expect(link23.getSrcPort()).andReturn(port21).anyTimes();
+        expect(link24.getSrcPort()).andReturn(port23).anyTimes();
+        expect(link12.getDstSwitch()).andReturn(sw2).anyTimes();
+        expect(link23.getDstSwitch()).andReturn(sw3).anyTimes();
+        expect(link24.getDstSwitch()).andReturn(sw4).anyTimes();
+        expect(link12.getDstPort()).andReturn(port22).anyTimes();
+        expect(link23.getDstPort()).andReturn(port31).anyTimes();
+        expect(link24.getDstPort()).andReturn(port41).anyTimes();
+        replay(link12);
+        replay(link23);
+        replay(link24);
 
-		path1 = new Path();
-		path1.add(new LinkEvent(link12));
-		path1.add(new LinkEvent(link23));
+        path1 = new Path();
+        path1.add(new LinkEvent(link12));
+        path1.add(new LinkEvent(link23));
 
-		path2 = new Path();
-		path2.add(new LinkEvent(link12));
-		path2.add(new LinkEvent(link24));
+        path2 = new Path();
+        path2.add(new LinkEvent(link12));
+        path2.add(new LinkEvent(link24));
 
-		intent1 = new PathIntent("1", path1, 400.0, new Intent("_1"));
-		intent2 = new PathIntent("2", path2, 400.0, new Intent("_2"));
-	}
+        intent1 = new PathIntent("1", path1, 400.0, new Intent("_1"));
+        intent2 = new PathIntent("2", path2, 400.0, new Intent("_2"));
+    }
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Test
-	public void testCreate() {
-		PathIntentMap intents = new PathIntentMap();
-		assertEquals(0, intents.getAllIntents().size());
-	}
+    @Test
+    public void testCreate() {
+        PathIntentMap intents = new PathIntentMap();
+        assertEquals(0, intents.getAllIntents().size());
+    }
 
-	@Test
-	public void testGetIntentsByDpid() {
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, intent1);
-		operations.add(Operator.ADD, intent2);
-		assertEquals(2, operations.size());
+    @Test
+    public void testGetIntentsByDpid() {
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, intent1);
+        operations.add(Operator.ADD, intent2);
+        assertEquals(2, operations.size());
 
-		PathIntentMap intents = new PathIntentMap();
-		intents.executeOperations(operations);
-		assertEquals(2, intents.getAllIntents().size());
+        PathIntentMap intents = new PathIntentMap();
+        intents.executeOperations(operations);
+        assertEquals(2, intents.getAllIntents().size());
 
-		Collection<PathIntent> pathIntents = intents.getIntentsByDpid(1L);
-		assertEquals(2, pathIntents.size());
-		assertTrue(pathIntents.contains(intent1));
-		assertTrue(pathIntents.contains(intent2));
+        Collection<PathIntent> pathIntents = intents.getIntentsByDpid(1L);
+        assertEquals(2, pathIntents.size());
+        assertTrue(pathIntents.contains(intent1));
+        assertTrue(pathIntents.contains(intent2));
 
-		pathIntents = intents.getIntentsByDpid(2L);
-		assertEquals(2, pathIntents.size());
-		assertTrue(pathIntents.contains(intent1));
-		assertTrue(pathIntents.contains(intent2));
+        pathIntents = intents.getIntentsByDpid(2L);
+        assertEquals(2, pathIntents.size());
+        assertTrue(pathIntents.contains(intent1));
+        assertTrue(pathIntents.contains(intent2));
 
-		pathIntents = intents.getIntentsByDpid(3L);
-		assertEquals(1, pathIntents.size());
-		assertTrue(pathIntents.contains(intent1));
+        pathIntents = intents.getIntentsByDpid(3L);
+        assertEquals(1, pathIntents.size());
+        assertTrue(pathIntents.contains(intent1));
 
-		pathIntents = intents.getIntentsByDpid(4L);
-		assertEquals(1, pathIntents.size());
-		assertTrue(pathIntents.contains(intent2));
-	}
+        pathIntents = intents.getIntentsByDpid(4L);
+        assertEquals(1, pathIntents.size());
+        assertTrue(pathIntents.contains(intent2));
+    }
 
-	@Test
-	public void testGetPathIntentsByPort() {
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, intent1);
-		operations.add(Operator.ADD, intent2);
-		assertEquals(2, operations.size());
+    @Test
+    public void testGetPathIntentsByPort() {
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, intent1);
+        operations.add(Operator.ADD, intent2);
+        assertEquals(2, operations.size());
 
-		PathIntentMap intents = new PathIntentMap();
-		intents.executeOperations(operations);
-		assertEquals(2, intents.getAllIntents().size());
+        PathIntentMap intents = new PathIntentMap();
+        intents.executeOperations(operations);
+        assertEquals(2, intents.getAllIntents().size());
 
-		Collection<PathIntent> pathIntents = intents.getIntentsByPort(1L, 1L);
-		assertEquals(2, pathIntents.size());
-		assertTrue(pathIntents.contains(intent1));
-		assertTrue(pathIntents.contains(intent2));
+        Collection<PathIntent> pathIntents = intents.getIntentsByPort(1L, 1L);
+        assertEquals(2, pathIntents.size());
+        assertTrue(pathIntents.contains(intent1));
+        assertTrue(pathIntents.contains(intent2));
 
-		pathIntents = intents.getIntentsByPort(2L, 1L);
-		assertEquals(1, pathIntents.size());
-		assertTrue(pathIntents.contains(intent1));
+        pathIntents = intents.getIntentsByPort(2L, 1L);
+        assertEquals(1, pathIntents.size());
+        assertTrue(pathIntents.contains(intent1));
 
-		pathIntents = intents.getIntentsByPort(2L, 3L);
-		assertEquals(1, pathIntents.size());
-		assertTrue(pathIntents.contains(intent2));
-	}
+        pathIntents = intents.getIntentsByPort(2L, 3L);
+        assertEquals(1, pathIntents.size());
+        assertTrue(pathIntents.contains(intent2));
+    }
 
-	@Test
-	public void testGetPathIntentsByLink() {
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, intent1);
-		operations.add(Operator.ADD, intent2);
-		assertEquals(2, operations.size());
+    @Test
+    public void testGetPathIntentsByLink() {
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, intent1);
+        operations.add(Operator.ADD, intent2);
+        assertEquals(2, operations.size());
 
-		PathIntentMap intents = new PathIntentMap();
-		intents.executeOperations(operations);
-		assertEquals(2, intents.getAllIntents().size());
+        PathIntentMap intents = new PathIntentMap();
+        intents.executeOperations(operations);
+        assertEquals(2, intents.getAllIntents().size());
 
-		Collection<PathIntent> pathIntents = intents.getIntentsByLink(new LinkEvent(link12));
-		assertEquals(2, pathIntents.size());
-		assertTrue(pathIntents.contains(intent1));
-		assertTrue(pathIntents.contains(intent2));
+        Collection<PathIntent> pathIntents = intents.getIntentsByLink(new LinkEvent(link12));
+        assertEquals(2, pathIntents.size());
+        assertTrue(pathIntents.contains(intent1));
+        assertTrue(pathIntents.contains(intent2));
 
-		pathIntents = intents.getIntentsByLink(new LinkEvent(link23));
-		assertEquals(1, pathIntents.size());
-		assertTrue(pathIntents.contains(intent1));
+        pathIntents = intents.getIntentsByLink(new LinkEvent(link23));
+        assertEquals(1, pathIntents.size());
+        assertTrue(pathIntents.contains(intent1));
 
-		pathIntents = intents.getIntentsByLink(new LinkEvent(link24));
-		assertEquals(1, pathIntents.size());
-		assertTrue(pathIntents.contains(intent2));
-	}
+        pathIntents = intents.getIntentsByLink(new LinkEvent(link24));
+        assertEquals(1, pathIntents.size());
+        assertTrue(pathIntents.contains(intent2));
+    }
 
-	@Test
-	public void testGetAvailableBandwidth() {
-		IntentOperationList operations = new IntentOperationList();
-		operations.add(Operator.ADD, intent1);
-		operations.add(Operator.ADD, intent2);
-		assertEquals(2, operations.size());
+    @Test
+    public void testGetAvailableBandwidth() {
+        IntentOperationList operations = new IntentOperationList();
+        operations.add(Operator.ADD, intent1);
+        operations.add(Operator.ADD, intent2);
+        assertEquals(2, operations.size());
 
-		PathIntentMap intents = new PathIntentMap();
-		intents.executeOperations(operations);
-		assertEquals(2, intents.getAllIntents().size());
+        PathIntentMap intents = new PathIntentMap();
+        intents.executeOperations(operations);
+        assertEquals(2, intents.getAllIntents().size());
 
-		assertEquals(200.0, intents.getAvailableBandwidth(link12), 0.0);
-	}
+        assertEquals(200.0, intents.getAvailableBandwidth(link12), 0.0);
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/intent/PathIntentTest.java b/src/test/java/net/onrc/onos/core/intent/PathIntentTest.java
index 499c362..1b400df 100644
--- a/src/test/java/net/onrc/onos/core/intent/PathIntentTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/PathIntentTest.java
@@ -1,6 +1,7 @@
 package net.onrc.onos.core.intent;
 
 import static org.junit.Assert.assertEquals;
+
 import net.onrc.onos.core.topology.LinkEvent;
 import net.onrc.onos.core.topology.Path;
 import net.onrc.onos.core.util.serializers.KryoFactory;
@@ -17,85 +18,85 @@
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class PathIntentTest {
-	@Before
-	public void setUp() throws Exception {
-	}
+    @Before
+    public void setUp() throws Exception {
+    }
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Test
-	public void testCreateFirstId() {
-		String id = PathIntent.createFirstId("100");
-		assertEquals("100___0", id);
-	}
+    @Test
+    public void testCreateFirstId() {
+        String id = PathIntent.createFirstId("100");
+        assertEquals("100___0", id);
+    }
 
-	@Test
-	public void testCreateNextId() {
-		String id = PathIntent.createNextId("100___999");
-		assertEquals("100___1000", id);
-	}
+    @Test
+    public void testCreateNextId() {
+        String id = PathIntent.createNextId("100___999");
+        assertEquals("100___1000", id);
+    }
 
-	@Test
-	public void test() {
-		KryoFactory factory = new KryoFactory();
-		Kryo kryo = factory.newKryo();
-		Output output = new Output(1024);
+    @Test
+    public void test() {
+        KryoFactory factory = new KryoFactory();
+        Kryo kryo = factory.newKryo();
+        Output output = new Output(1024);
 
-		ConstrainedShortestPathIntent cspIntent1 =
-				new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
+        ConstrainedShortestPathIntent cspIntent1 =
+                new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
 
-		Path path = new Path();
-		path.add(new LinkEvent(1L, 1L, 2L, 2L));
-		path.add(new LinkEvent(2L, 1L, 3L, 2L));
-		path.add(new LinkEvent(3L, 1L, 4L, 2L));
+        Path path = new Path();
+        path.add(new LinkEvent(1L, 1L, 2L, 2L));
+        path.add(new LinkEvent(2L, 1L, 3L, 2L));
+        path.add(new LinkEvent(3L, 1L, 4L, 2L));
 
-		PathIntent pathIntent1 = new PathIntent("11", path, 123.45, cspIntent1);
+        PathIntent pathIntent1 = new PathIntent("11", path, 123.45, cspIntent1);
 
-		kryo.writeObject(output, pathIntent1);
-		output.close();
+        kryo.writeObject(output, pathIntent1);
+        output.close();
 
-		Input input = new Input(output.toBytes());
+        Input input = new Input(output.toBytes());
 
-		// create pathIntent from bytes
+        // create pathIntent from bytes
 
-		PathIntent pathIntent2 =
-				kryo.readObject(input, PathIntent.class);
-		input.close();
+        PathIntent pathIntent2 =
+                kryo.readObject(input, PathIntent.class);
+        input.close();
 
-		// check
+        // check
 
-		assertEquals("11", pathIntent2.getId());
-		Path path2 = pathIntent2.getPath();
+        assertEquals("11", pathIntent2.getId());
+        Path path2 = pathIntent2.getPath();
 
-		assertEquals(Long.valueOf(1L), path2.get(0).getSrc().getDpid());
-		assertEquals(Long.valueOf(1L), path2.get(0).getSrc().getNumber());
-		assertEquals(Long.valueOf(2L), path2.get(0).getDst().getDpid());
-		assertEquals(Long.valueOf(2L), path2.get(0).getDst().getNumber());
+        assertEquals(Long.valueOf(1L), path2.get(0).getSrc().getDpid());
+        assertEquals(Long.valueOf(1L), path2.get(0).getSrc().getNumber());
+        assertEquals(Long.valueOf(2L), path2.get(0).getDst().getDpid());
+        assertEquals(Long.valueOf(2L), path2.get(0).getDst().getNumber());
 
-		assertEquals(Long.valueOf(2L), path2.get(1).getSrc().getDpid());
-		assertEquals(Long.valueOf(1L), path2.get(1).getSrc().getNumber());
-		assertEquals(Long.valueOf(3L), path2.get(1).getDst().getDpid());
-		assertEquals(Long.valueOf(2L), path2.get(1).getDst().getNumber());
+        assertEquals(Long.valueOf(2L), path2.get(1).getSrc().getDpid());
+        assertEquals(Long.valueOf(1L), path2.get(1).getSrc().getNumber());
+        assertEquals(Long.valueOf(3L), path2.get(1).getDst().getDpid());
+        assertEquals(Long.valueOf(2L), path2.get(1).getDst().getNumber());
 
-		assertEquals(Long.valueOf(3L), path2.get(2).getSrc().getDpid());
-		assertEquals(Long.valueOf(1L), path2.get(2).getSrc().getNumber());
-		assertEquals(Long.valueOf(4L), path2.get(2).getDst().getDpid());
-		assertEquals(Long.valueOf(2L), path2.get(2).getDst().getNumber());
+        assertEquals(Long.valueOf(3L), path2.get(2).getSrc().getDpid());
+        assertEquals(Long.valueOf(1L), path2.get(2).getSrc().getNumber());
+        assertEquals(Long.valueOf(4L), path2.get(2).getDst().getDpid());
+        assertEquals(Long.valueOf(2L), path2.get(2).getDst().getNumber());
 
-		assertEquals(123.45, pathIntent2.getBandwidth(), 0.0);
+        assertEquals(123.45, pathIntent2.getBandwidth(), 0.0);
 
-		ConstrainedShortestPathIntent cspIntent2 =
-				(ConstrainedShortestPathIntent) pathIntent2.getParentIntent();
+        ConstrainedShortestPathIntent cspIntent2 =
+                (ConstrainedShortestPathIntent) pathIntent2.getParentIntent();
 
-		assertEquals("1", cspIntent2.getId());
-		assertEquals(2L, cspIntent2.getSrcSwitchDpid());
-		assertEquals(3L, cspIntent2.getSrcPortNumber());
-		assertEquals(4L, cspIntent2.getSrcMac());
-		assertEquals(5L, cspIntent2.getDstSwitchDpid());
-		assertEquals(6L, cspIntent2.getDstPortNumber());
-		assertEquals(7L, cspIntent2.getDstMac());
-		assertEquals(1000.0, cspIntent2.getBandwidth(), 0.0);
-	}
+        assertEquals("1", cspIntent2.getId());
+        assertEquals(2L, cspIntent2.getSrcSwitchDpid());
+        assertEquals(3L, cspIntent2.getSrcPortNumber());
+        assertEquals(4L, cspIntent2.getSrcMac());
+        assertEquals(5L, cspIntent2.getDstSwitchDpid());
+        assertEquals(6L, cspIntent2.getDstPortNumber());
+        assertEquals(7L, cspIntent2.getDstMac());
+        assertEquals(1000.0, cspIntent2.getBandwidth(), 0.0);
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/intent/ShortestPathIntentTest.java b/src/test/java/net/onrc/onos/core/intent/ShortestPathIntentTest.java
index 2adc57f..87397c0 100644
--- a/src/test/java/net/onrc/onos/core/intent/ShortestPathIntentTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/ShortestPathIntentTest.java
@@ -14,36 +14,36 @@
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class ShortestPathIntentTest {
-	@Before
-	public void setUp() throws Exception {
-	}
+    @Before
+    public void setUp() throws Exception {
+    }
 
-	@After
-	public void tearDown() throws Exception {
-	}
+    @After
+    public void tearDown() throws Exception {
+    }
 
-	@Test
-	public void test() {
-		Kryo kryo = new Kryo();
-		Output output = new Output(1024);
+    @Test
+    public void test() {
+        Kryo kryo = new Kryo();
+        Output output = new Output(1024);
 
-		ShortestPathIntent intent1 =
-				new ShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L);
+        ShortestPathIntent intent1 =
+                new ShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L);
 
-		kryo.writeObject(output, intent1);
-		output.close();
+        kryo.writeObject(output, intent1);
+        output.close();
 
-		Input input = new Input(output.toBytes());
-		ShortestPathIntent intent2 =
-				kryo.readObject(input, ShortestPathIntent.class);
-		input.close();
+        Input input = new Input(output.toBytes());
+        ShortestPathIntent intent2 =
+                kryo.readObject(input, ShortestPathIntent.class);
+        input.close();
 
-		assertEquals("1", intent2.getId());
-		assertEquals(2L, intent2.getSrcSwitchDpid());
-		assertEquals(3L, intent2.getSrcPortNumber());
-		assertEquals(4L, intent2.getSrcMac());
-		assertEquals(5L, intent2.getDstSwitchDpid());
-		assertEquals(6L, intent2.getDstPortNumber());
-		assertEquals(7L, intent2.getDstMac());
-	}
+        assertEquals("1", intent2.getId());
+        assertEquals(2L, intent2.getSrcSwitchDpid());
+        assertEquals(3L, intent2.getSrcPortNumber());
+        assertEquals(4L, intent2.getSrcMac());
+        assertEquals(5L, intent2.getDstSwitchDpid());
+        assertEquals(6L, intent2.getDstPortNumber());
+        assertEquals(7L, intent2.getDstMac());
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
index 3532abc..93f01ca 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
@@ -52,13 +52,12 @@
 
 /**
  * @author Ray Milkey (ray@onlab.us)
- *
- * Unit tests for the Path Calculation Runtime module (PathCalcRuntimeModule).
- * These test cases check the results of creating paths, deleting paths, and
- * rerouting paths.  The network graph, controller registry, and data grid are
- * mocked out.  The individual tests check the high level intents and the
- * resulting operation lists to be sure they match the intended APIs.
- *
+ *         <p/>
+ *         Unit tests for the Path Calculation Runtime module (PathCalcRuntimeModule).
+ *         These test cases check the results of creating paths, deleting paths, and
+ *         rerouting paths.  The network graph, controller registry, and data grid are
+ *         mocked out.  The individual tests check the high level intents and the
+ *         resulting operation lists to be sure they match the intended APIs.
  */
 @RunWith(PowerMockRunner.class)
 @PrepareForTest(PathCalcRuntimeModule.class)
@@ -139,7 +138,7 @@
         @Override
         public boolean matchesSafely(Collection<Intent> intents) {
             assertThat(intents,
-                       hasItem(Matchers.<Intent>hasProperty("id", equalTo(id))));
+                    hasItem(Matchers.<Intent>hasProperty("id", equalTo(id))));
             return true;
         }
 
@@ -155,6 +154,7 @@
     /**
      * Factory method to create an Intent entry Matcher.  Returns a matcher
      * for the Intent with the given id.
+     *
      * @param id id of the intent to match
      * @return Matcher object
      */
@@ -203,7 +203,7 @@
                                            Description mismatchDescription) {
             if (intent != null) {
                 mismatchDescription.appendText("was ").
-                                    appendText(intent.getState().toString());
+                        appendText(intent.getState().toString());
             } else {
                 mismatchDescription.appendText("that intent was not found");
             }
@@ -215,7 +215,7 @@
      * Factory method to create a Matcher for an IntentMap that looks for an
      * Intent with a given id and state.
      *
-     * @param id id of the Intent to match
+     * @param id    id of the Intent to match
      * @param state if the Intent is found, its state must match this
      * @return Matcher object
      */
@@ -239,7 +239,7 @@
      * Test the result of executing a path calculation on an
      * Intent Operation List which contains a path that references a
      * non-existent switch.
-     *
+     * <p/>
      * A 3 path list is created where one of the paths references a switch
      * that is not in the topology.  The test checks that the resulting
      * Operation List has entries for the 2 correct paths, and that the
@@ -302,7 +302,7 @@
     /**
      * Test the result of executing a path calculation on an
      * Intent Operation List and then removing one of the switches.
-     *
+     * <p/>
      * A 3 path list is created and then one of the paths is removed.
      * The test checks that the resulting Operation List is correct,
      * and that the high level intents contain a proper "delete requested"
@@ -315,13 +315,13 @@
         final IntentOperationList opList = new IntentOperationList();
         opList.add(Operator.ADD,
                 new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L,
-                                       LOCAL_PORT));
+                        LOCAL_PORT));
         opList.add(Operator.ADD,
                 new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L,
-                                       LOCAL_PORT));
+                        LOCAL_PORT));
         opList.add(Operator.ADD,
                 new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L,
-                                       LOCAL_PORT));
+                        LOCAL_PORT));
 
         // compile high-level intent operations into low-level intent
         // operations (calculate paths)
@@ -351,15 +351,15 @@
 
         //  Check that switch 1 was correctly processed
         assertThat(highLevelIntents,
-                   hasIntentWithIdAndState("1", IntentState.INST_REQ));
+                hasIntentWithIdAndState("1", IntentState.INST_REQ));
 
         //  Check that switch 2 was correctly processed
         assertThat(highLevelIntents,
-                   hasIntentWithIdAndState("2", IntentState.INST_REQ));
+                hasIntentWithIdAndState("2", IntentState.INST_REQ));
 
         //  Check that switch 3 was correctly processed
         assertThat(highLevelIntents,
-                   hasIntentWithIdAndState("3", IntentState.INST_REQ));
+                hasIntentWithIdAndState("3", IntentState.INST_REQ));
 
         //  Now delete one path and check the results
         final IntentOperationList opListForRemoval = new IntentOperationList();
@@ -402,7 +402,7 @@
     /**
      * Test the result of executing a path calculation on an
      * Intent Operation List and then forcing a reroute.
-     *
+     * <p/>
      * A 3 path list is created and then one of the links is removed.
      * The test checks that the resulting Operation List is correct,
      * and that the high level intents contain a proper "reroute requested"
@@ -415,15 +415,15 @@
         final IntentOperationList opList = new IntentOperationList();
         final ShortestPathIntent pathIntent1 =
                 new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L,
-                                       LOCAL_PORT);
+                        LOCAL_PORT);
 
         opList.add(Operator.ADD, pathIntent1);
         opList.add(Operator.ADD,
                 new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L,
-                                       LOCAL_PORT));
+                        LOCAL_PORT));
         opList.add(Operator.ADD,
                 new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L,
-                                       LOCAL_PORT));
+                        LOCAL_PORT));
 
         // compile high-level intent operations into low-level intent
         // operations (calculate paths)
@@ -453,15 +453,15 @@
 
         //  Check that switch 1 was correctly processed
         assertThat(highLevelIntents,
-                   hasIntentWithIdAndState("1", IntentState.INST_REQ));
+                hasIntentWithIdAndState("1", IntentState.INST_REQ));
 
         //  Check that switch 2 was correctly processed
         assertThat(highLevelIntents,
-                   hasIntentWithIdAndState("2", IntentState.INST_REQ));
+                hasIntentWithIdAndState("2", IntentState.INST_REQ));
 
         //  Check that switch 3 was correctly processed
         assertThat(highLevelIntents,
-                   hasIntentWithIdAndState("3", IntentState.INST_REQ));
+                hasIntentWithIdAndState("3", IntentState.INST_REQ));
 
         //  Now add a different path to one of the switches path and check
         //  the results
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
index 645ffe5..fbb7313 100755
--- a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
@@ -50,257 +50,257 @@
 @RunWith(PowerMockRunner.class)
 @PrepareForTest(PathCalcRuntimeModule.class)
 public class UseCaseTest {
-	private NetworkGraph g;
-	private FloodlightModuleContext modContext;
-	private IDatagridService datagridService;
-	private INetworkGraphService networkGraphService;
-	private IControllerRegistryService controllerRegistryService;
-	private PersistIntent persistIntent;
-	@SuppressWarnings("rawtypes")
-	private IEventChannel eventChannel;
+    private NetworkGraph g;
+    private FloodlightModuleContext modContext;
+    private IDatagridService datagridService;
+    private INetworkGraphService networkGraphService;
+    private IControllerRegistryService controllerRegistryService;
+    private PersistIntent persistIntent;
+    @SuppressWarnings("rawtypes")
+    private IEventChannel eventChannel;
 
-	private static Long LOCAL_PORT = 0xFFFEL;
+    private static Long LOCAL_PORT = 0xFFFEL;
 
-	@SuppressWarnings("unchecked")
-	@Before
-	public void setUp() throws Exception {
-		MockNetworkGraph graph = new MockNetworkGraph();
-		graph.createSampleTopology1();
-		g = graph;
+    @SuppressWarnings("unchecked")
+    @Before
+    public void setUp() throws Exception {
+        MockNetworkGraph graph = new MockNetworkGraph();
+        graph.createSampleTopology1();
+        g = graph;
 
-		datagridService = createMock(IDatagridService.class);
-		networkGraphService = createMock(INetworkGraphService.class);
-		controllerRegistryService = createMock(IControllerRegistryService.class);
-		modContext = createMock(FloodlightModuleContext.class);
-		eventChannel = createMock(IEventChannel.class);
-		persistIntent = PowerMock.createMock(PersistIntent.class);
+        datagridService = createMock(IDatagridService.class);
+        networkGraphService = createMock(INetworkGraphService.class);
+        controllerRegistryService = createMock(IControllerRegistryService.class);
+        modContext = createMock(FloodlightModuleContext.class);
+        eventChannel = createMock(IEventChannel.class);
+        persistIntent = PowerMock.createMock(PersistIntent.class);
 
-		PowerMock.expectNew(PersistIntent.class,
-				anyObject(IControllerRegistryService.class),
-				anyObject(INetworkGraphService.class)).andReturn(persistIntent);
+        PowerMock.expectNew(PersistIntent.class,
+                anyObject(IControllerRegistryService.class),
+                anyObject(INetworkGraphService.class)).andReturn(persistIntent);
 
-		expect(modContext.getServiceImpl(IDatagridService.class))
-		.andReturn(datagridService).once();
-		expect(modContext.getServiceImpl(INetworkGraphService.class))
-		.andReturn(networkGraphService).once();
-		expect(modContext.getServiceImpl(IControllerRegistryService.class))
-		.andReturn(controllerRegistryService).once();
-		expect(persistIntent.getKey()).andReturn(1L).anyTimes();
-		expect(persistIntent.persistIfLeader(eq(1L),
-				anyObject(IntentOperationList.class))).andReturn(true).anyTimes();
+        expect(modContext.getServiceImpl(IDatagridService.class))
+                .andReturn(datagridService).once();
+        expect(modContext.getServiceImpl(INetworkGraphService.class))
+                .andReturn(networkGraphService).once();
+        expect(modContext.getServiceImpl(IControllerRegistryService.class))
+                .andReturn(controllerRegistryService).once();
+        expect(persistIntent.getKey()).andReturn(1L).anyTimes();
+        expect(persistIntent.persistIfLeader(eq(1L),
+                anyObject(IntentOperationList.class))).andReturn(true).anyTimes();
 
-		expect(networkGraphService.getNetworkGraph()).andReturn(g).anyTimes();
-		networkGraphService.registerNetworkGraphListener(anyObject(INetworkGraphListener.class));
-		expectLastCall();
+        expect(networkGraphService.getNetworkGraph()).andReturn(g).anyTimes();
+        networkGraphService.registerNetworkGraphListener(anyObject(INetworkGraphListener.class));
+        expectLastCall();
 
-		expect(datagridService.createChannel("onos.pathintent", Long.class, IntentOperationList.class))
-		.andReturn(eventChannel).once();
+        expect(datagridService.createChannel("onos.pathintent", Long.class, IntentOperationList.class))
+                .andReturn(eventChannel).once();
 
-		expect(datagridService.addListener(
-				eq("onos.pathintent_state"),
-				anyObject(IEventChannelListener.class),
-				eq(Long.class),
-				eq(IntentStateList.class)))
-		.andReturn(eventChannel).once();
+        expect(datagridService.addListener(
+                eq("onos.pathintent_state"),
+                anyObject(IEventChannelListener.class),
+                eq(Long.class),
+                eq(IntentStateList.class)))
+                .andReturn(eventChannel).once();
 
-		replay(datagridService);
-		replay(networkGraphService);
-		replay(modContext);
-		replay(controllerRegistryService);
-		PowerMock.replay(persistIntent, PersistIntent.class);
-	}
+        replay(datagridService);
+        replay(networkGraphService);
+        replay(modContext);
+        replay(controllerRegistryService);
+        PowerMock.replay(persistIntent, PersistIntent.class);
+    }
 
-	@After
-	public void tearDown() {
-		verify(datagridService);
-		verify(networkGraphService);
-		verify(modContext);
-		verify(controllerRegistryService);
-		PowerMock.verify(persistIntent, PersistIntent.class);
-	}
+    @After
+    public void tearDown() {
+        verify(datagridService);
+        verify(networkGraphService);
+        verify(modContext);
+        verify(controllerRegistryService);
+        PowerMock.verify(persistIntent, PersistIntent.class);
+    }
 
-	private void showResult(PathIntentMap intents) {
-		for (Intent intent: intents.getAllIntents()) {
-			PathIntent pathIntent = (PathIntent)intent;
-			System.out.println("Path intent:" + pathIntent);
-			System.out.println("Parent intent: " + pathIntent.getParentIntent().toString());
-		}
-	}
+    private void showResult(PathIntentMap intents) {
+        for (Intent intent : intents.getAllIntents()) {
+            PathIntent pathIntent = (PathIntent) intent;
+            System.out.println("Path intent:" + pathIntent);
+            System.out.println("Parent intent: " + pathIntent.getParentIntent().toString());
+        }
+    }
 
-	@Test
-	public void createShortestPaths() throws FloodlightModuleException {
-		// create shortest path intents
-		IntentOperationList opList = new IntentOperationList();
-		opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
-		opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
-		opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
+    @Test
+    public void createShortestPaths() throws FloodlightModuleException {
+        // create shortest path intents
+        IntentOperationList opList = new IntentOperationList();
+        opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
+        opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
+        opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
 
-		// compile high-level intent operations into low-level intent operations (calculate paths)
-		PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
-		runtime1.init(modContext);
-		runtime1.startUp(modContext);
-		IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+        // compile high-level intent operations into low-level intent operations (calculate paths)
+        PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+        runtime1.init(modContext);
+        runtime1.startUp(modContext);
+        IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
 
-		// compile low-level intents into flow entry installation plan
-		PlanCalcRuntime runtime2 = new PlanCalcRuntime();
-		List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+        // compile low-level intents into flow entry installation plan
+        PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+        List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
 
-		// show results
-		showResult((PathIntentMap) runtime1.getPathIntents());
-		System.out.println(plan);
-	}
+        // show results
+        showResult((PathIntentMap) runtime1.getPathIntents());
+        System.out.println(plan);
+    }
 
-	@Test
-	public void createConstrainedShortestPaths() throws FloodlightModuleException {
-		// create constrained shortest path intents
-		IntentOperationList opList = new IntentOperationList();
-		opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
-		opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
-		opList.add(Operator.ADD, new ConstrainedShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT, 400.0));
-		opList.add(Operator.ADD, new ConstrainedShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT, 400.0));
-		opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
+    @Test
+    public void createConstrainedShortestPaths() throws FloodlightModuleException {
+        // create constrained shortest path intents
+        IntentOperationList opList = new IntentOperationList();
+        opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
+        opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
+        opList.add(Operator.ADD, new ConstrainedShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT, 400.0));
+        opList.add(Operator.ADD, new ConstrainedShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT, 400.0));
+        opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
 
-		// compile high-level intent operations into low-level intent operations (calculate paths)
-		PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
-		runtime1.init(modContext);
-		runtime1.startUp(modContext);
-		IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+        // compile high-level intent operations into low-level intent operations (calculate paths)
+        PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+        runtime1.init(modContext);
+        runtime1.startUp(modContext);
+        IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
 
-		// compile low-level intents into flow entry installation plan
-		PlanCalcRuntime runtime2 = new PlanCalcRuntime();
-		List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+        // compile low-level intents into flow entry installation plan
+        PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+        List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
 
-		// show results
-		showResult((PathIntentMap) runtime1.getPathIntents());
-		System.out.println(plan);
-	}
+        // show results
+        showResult((PathIntentMap) runtime1.getPathIntents());
+        System.out.println(plan);
+    }
 
-	@Test
-	public void createMixedShortestPaths() throws FloodlightModuleException {
-		// create constrained & best effort shortest path intents
-		IntentOperationList opList = new IntentOperationList();
-		opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
-		opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
-		opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT));
-		opList.add(Operator.ADD, new ShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
-		opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
+    @Test
+    public void createMixedShortestPaths() throws FloodlightModuleException {
+        // create constrained & best effort shortest path intents
+        IntentOperationList opList = new IntentOperationList();
+        opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
+        opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
+        opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT));
+        opList.add(Operator.ADD, new ShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
+        opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
 
-		// compile high-level intent operations into low-level intent operations (calculate paths)
-		PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
-		runtime1.init(modContext);
-		runtime1.startUp(modContext);
-		IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+        // compile high-level intent operations into low-level intent operations (calculate paths)
+        PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+        runtime1.init(modContext);
+        runtime1.startUp(modContext);
+        IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
 
-		// compile low-level intents into flow entry installation plan
-		PlanCalcRuntime runtime2 = new PlanCalcRuntime();
-		List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+        // compile low-level intents into flow entry installation plan
+        PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+        List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
 
-		// show results
-		showResult((PathIntentMap) runtime1.getPathIntents());
-		System.out.println(plan);
-	}
+        // show results
+        showResult((PathIntentMap) runtime1.getPathIntents());
+        System.out.println(plan);
+    }
 
-	@Test
-	public void rerouteShortestPaths() throws FloodlightModuleException {
-		List<SwitchEvent> addedSwitchEvents = new LinkedList<>();
-		List<SwitchEvent> removedSwitchEvents = new LinkedList<>();
-		List<PortEvent> addedPortEvents = new LinkedList<>();
-		List<PortEvent> removedPortEvents = new LinkedList<>();
-		List<LinkEvent> addedLinkEvents = new LinkedList<>();
-		List<LinkEvent> removedLinkEvents = new LinkedList<>();
-		List<DeviceEvent> addedDeviceEvents = new LinkedList<>();
-		List<DeviceEvent> removedDeviceEvents = new LinkedList<>();
+    @Test
+    public void rerouteShortestPaths() throws FloodlightModuleException {
+        List<SwitchEvent> addedSwitchEvents = new LinkedList<>();
+        List<SwitchEvent> removedSwitchEvents = new LinkedList<>();
+        List<PortEvent> addedPortEvents = new LinkedList<>();
+        List<PortEvent> removedPortEvents = new LinkedList<>();
+        List<LinkEvent> addedLinkEvents = new LinkedList<>();
+        List<LinkEvent> removedLinkEvents = new LinkedList<>();
+        List<DeviceEvent> addedDeviceEvents = new LinkedList<>();
+        List<DeviceEvent> removedDeviceEvents = new LinkedList<>();
 
-		// create shortest path intents
-		IntentOperationList opList = new IntentOperationList();
-		opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
-		opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
-		opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
+        // create shortest path intents
+        IntentOperationList opList = new IntentOperationList();
+        opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
+        opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
+        opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
 
-		// compile high-level intent operations into low-level intent operations (calculate paths)
-		PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
-		runtime1.init(modContext);
-		runtime1.startUp(modContext);
-		IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+        // compile high-level intent operations into low-level intent operations (calculate paths)
+        PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+        runtime1.init(modContext);
+        runtime1.startUp(modContext);
+        IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
 
-		// compile low-level intents into flow entry installation plan
-		PlanCalcRuntime runtime2 = new PlanCalcRuntime();
-		List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+        // compile low-level intents into flow entry installation plan
+        PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+        List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
 
-		// show results step1
-		showResult((PathIntentMap) runtime1.getPathIntents());
-		System.out.println(plan);
+        // show results step1
+        showResult((PathIntentMap) runtime1.getPathIntents());
+        System.out.println(plan);
 
-		// TODO this state changes should be triggered by notification of plan module
-		IntentStateList states = new IntentStateList();
-		states.put("1", IntentState.INST_ACK);
-		states.put("2", IntentState.INST_ACK);
-		states.put("3", IntentState.INST_ACK);
-		runtime1.getHighLevelIntents().changeStates(states);
-		states.clear();
-		states.put("1___0", IntentState.INST_ACK);
-		states.put("2___0", IntentState.INST_ACK);
-		states.put("3___0", IntentState.INST_ACK);
-		runtime1.getPathIntents().changeStates(states);
+        // TODO this state changes should be triggered by notification of plan module
+        IntentStateList states = new IntentStateList();
+        states.put("1", IntentState.INST_ACK);
+        states.put("2", IntentState.INST_ACK);
+        states.put("3", IntentState.INST_ACK);
+        runtime1.getHighLevelIntents().changeStates(states);
+        states.clear();
+        states.put("1___0", IntentState.INST_ACK);
+        states.put("2___0", IntentState.INST_ACK);
+        states.put("3___0", IntentState.INST_ACK);
+        runtime1.getPathIntents().changeStates(states);
 
-		// link down
-		((MockNetworkGraph)g).removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
-		((MockNetworkGraph)g).removeLink(2L, 21L, 1L, 12L);
-		LinkEvent linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
-		LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
-		removedLinkEvents.clear();
-		removedLinkEvents.add(linkEvent1);
-		removedLinkEvents.add(linkEvent2);
-		runtime1.networkGraphEvents(
-				addedSwitchEvents,
-				removedSwitchEvents,
-				addedPortEvents,
-				removedPortEvents,
-				addedLinkEvents,
-				removedLinkEvents,
-				addedDeviceEvents,
-				removedDeviceEvents);
-		System.out.println("Link goes down.");
+        // link down
+        ((MockNetworkGraph) g).removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
+        ((MockNetworkGraph) g).removeLink(2L, 21L, 1L, 12L);
+        LinkEvent linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
+        LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
+        removedLinkEvents.clear();
+        removedLinkEvents.add(linkEvent1);
+        removedLinkEvents.add(linkEvent2);
+        runtime1.networkGraphEvents(
+                addedSwitchEvents,
+                removedSwitchEvents,
+                addedPortEvents,
+                removedPortEvents,
+                addedLinkEvents,
+                removedLinkEvents,
+                addedDeviceEvents,
+                removedDeviceEvents);
+        System.out.println("Link goes down.");
 
-		// show results step2
-		showResult((PathIntentMap) runtime1.getPathIntents());
-		// TODO: show results of plan computation
-	}
+        // show results step2
+        showResult((PathIntentMap) runtime1.getPathIntents());
+        // TODO: show results of plan computation
+    }
 
 
-	@Test
-	public void createAndRemoveShortestPaths() throws FloodlightModuleException {
-		// create shortest path intents
-		IntentOperationList opList = new IntentOperationList();
-		opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
-		opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
-		opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
+    @Test
+    public void createAndRemoveShortestPaths() throws FloodlightModuleException {
+        // create shortest path intents
+        IntentOperationList opList = new IntentOperationList();
+        opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
+        opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
+        opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
 
-		// compile high-level intent operations into low-level intent operations (calculate paths)
-		PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
-		runtime1.init(modContext);
-		runtime1.startUp(modContext);
-		IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+        // compile high-level intent operations into low-level intent operations (calculate paths)
+        PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+        runtime1.init(modContext);
+        runtime1.startUp(modContext);
+        IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
 
-		// compile low-level intents into flow entry installation plan
-		PlanCalcRuntime runtime2 = new PlanCalcRuntime();
-		List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+        // compile low-level intents into flow entry installation plan
+        PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+        List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
 
-		// show results
-		showResult((PathIntentMap) runtime1.getPathIntents());
-		System.out.println(plan);
+        // show results
+        showResult((PathIntentMap) runtime1.getPathIntents());
+        System.out.println(plan);
 
-		// create remove operations
-		opList.clear();
-		opList.add(Operator.REMOVE, new Intent("1"));
-		opList.add(Operator.REMOVE, new Intent("2"));
+        // create remove operations
+        opList.clear();
+        opList.add(Operator.REMOVE, new Intent("1"));
+        opList.add(Operator.REMOVE, new Intent("2"));
 
-		// compile
-		runtime1.executeIntentOperations(opList);
+        // compile
+        runtime1.executeIntentOperations(opList);
 
-		// show results
-		showResult((PathIntentMap) runtime1.getPathIntents());
-		System.out.println(plan);
-	}
+        // show results
+        showResult((PathIntentMap) runtime1.getPathIntents());
+        System.out.println(plan);
+    }
 
 }
diff --git a/src/test/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManagerTest.java
index 0ebb6de..da9d30b 100644
--- a/src/test/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManagerTest.java
+++ b/src/test/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManagerTest.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed under the Apache License, Version 2.0 (the "License"); you may
-*    not use this file except in compliance with the License. You may obtain
-*    a copy of the License at
-*
-*         http://www.apache.org/licenses/LICENSE-2.0
-*
-*    Unless required by applicable law or agreed to in writing, software
-*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-*    License for the specific language governing permissions and limitations
-*    under the License.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
 
 package net.onrc.onos.core.linkdiscovery.internal;
 
@@ -47,14 +47,13 @@
 import org.slf4j.LoggerFactory;
 
 /**
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public class LinkDiscoveryManagerTest extends FloodlightTestCase {
 
     private TestLinkDiscoveryManager ldm;
     protected final static Logger log = LoggerFactory.getLogger(LinkDiscoveryManagerTest.class);
-    
+
     public class TestLinkDiscoveryManager extends LinkDiscoveryManager {
         public boolean isSendLLDPsCalled = false;
         public boolean isClearLinksCalled = false;
@@ -70,7 +69,7 @@
             isClearLinksCalled = false;
         }
     }
-    
+
     public LinkDiscoveryManager getTopology() {
         return ldm;
     }
@@ -115,8 +114,8 @@
 
         Link lt = new Link(1L, 2, 2L, 1);
         LinkInfo info = new LinkInfo(System.currentTimeMillis(),
-                                     System.currentTimeMillis(), null,
-                                     0, 0);
+                System.currentTimeMillis(), null,
+                0, 0);
         topology.addOrUpdateLink(lt, info);
 
 
@@ -139,8 +138,8 @@
 
         Link lt = new Link(1L, 2, 2L, 1);
         LinkInfo info = new LinkInfo(System.currentTimeMillis(),
-                                     System.currentTimeMillis(), null,
-                                     0, 0);
+                System.currentTimeMillis(), null,
+                0, 0);
         topology.addOrUpdateLink(lt, info);
         topology.deleteLinks(Collections.singletonList(lt), "Test");
 
@@ -161,8 +160,8 @@
         NodePortTuple dstNpt = new NodePortTuple(2L, 3);
 
         LinkInfo info = new LinkInfo(System.currentTimeMillis(),
-                                     System.currentTimeMillis(), null,
-                                     0, 0);
+                System.currentTimeMillis(), null,
+                0, 0);
         topology.addOrUpdateLink(lt, info);
 
         // check invariants hold
@@ -184,8 +183,8 @@
         NodePortTuple dstNpt = new NodePortTuple(2L, 3);
 
         LinkInfo info = new LinkInfo(System.currentTimeMillis(),
-                                     System.currentTimeMillis(), null,
-                                     0, 0);
+                System.currentTimeMillis(), null,
+                0, 0);
         topology.addOrUpdateLink(lt, info);
         topology.deleteLinks(Collections.singletonList(lt), "Test to self");
 
@@ -205,8 +204,8 @@
         NodePortTuple srcNpt = new NodePortTuple(1L, 2);
         NodePortTuple dstNpt = new NodePortTuple(2L, 1);
         LinkInfo info = new LinkInfo(System.currentTimeMillis(),
-                                     System.currentTimeMillis(), null,
-                                     0, 0);
+                System.currentTimeMillis(), null,
+                0, 0);
         topology.addOrUpdateLink(lt, info);
 
         IOFSwitch sw1 = getMockFloodlightProvider().getSwitches().get(1L);
@@ -230,8 +229,8 @@
         replay(sw1);
         Link lt = new Link(1L, 2, 1L, 3);
         LinkInfo info = new LinkInfo(System.currentTimeMillis(),
-                                     System.currentTimeMillis(), null,
-                                     0, 0);
+                System.currentTimeMillis(), null,
+                0, 0);
         topology.addOrUpdateLink(lt, info);
 
         // Mock up our expected behavior
@@ -252,12 +251,12 @@
         Link lt = new Link(1L, 1, 2L, 1);
         NodePortTuple srcNpt = new NodePortTuple(1L, 1);
         NodePortTuple dstNpt = new NodePortTuple(2L, 1);
-        
+
         LinkInfo info;
 
         info = new LinkInfo(System.currentTimeMillis() - 40000,
-                            System.currentTimeMillis() - 40000, null,
-                                     0, 0);
+                System.currentTimeMillis() - 40000, null,
+                0, 0);
         topology.addOrUpdateLink(lt, info);
 
         // check invariants hold
@@ -277,8 +276,8 @@
 
 
         info = new LinkInfo(System.currentTimeMillis(),/* firstseen */
-                            null,/* unicast */
-                            System.currentTimeMillis(), 0, 0);
+                null,/* unicast */
+                System.currentTimeMillis(), 0, 0);
         topology.addOrUpdateLink(lt, info);
         assertTrue(topology.links.get(lt).getUnicastValidTime() == null);
         assertTrue(topology.links.get(lt).getMulticastValidTime() != null);
@@ -292,7 +291,7 @@
         // with LT_OPENFLOW_LINK, the link property should be changed to LT_NON_OPENFLOW
         // by the addOrUpdateLink method.
         info = new LinkInfo(System.currentTimeMillis() - 40000,
-                            System.currentTimeMillis() - 40000, null, 0, 0);
+                System.currentTimeMillis() - 40000, null, 0, 0);
         topology.addOrUpdateLink(lt, info);
         assertTrue(topology.portBroadcastDomainLinks.get(srcNpt) == null ||
                 topology.portBroadcastDomainLinks.get(srcNpt).contains(lt) == false);
@@ -309,7 +308,7 @@
 
         // Set the multicastValidTime to be old and see if that also times out.
         info = new LinkInfo(System.currentTimeMillis() - 40000,
-                            null, System.currentTimeMillis() - 40000, 0, 0);
+                null, System.currentTimeMillis() - 40000, 0, 0);
         topology.addOrUpdateLink(lt, info);
         topology.timeoutLinks();
         assertTrue(topology.links.get(lt) == null);
@@ -321,7 +320,7 @@
 
         // Test again only with multicast LLDP
         info = new LinkInfo(System.currentTimeMillis() - 40000,
-                            null, System.currentTimeMillis() - 40000, 0, 0);
+                null, System.currentTimeMillis() - 40000, 0, 0);
         topology.addOrUpdateLink(lt, info);
         assertTrue(topology.links.get(lt).getUnicastValidTime() == null);
         assertTrue(topology.links.get(lt).getMulticastValidTime() != null);
@@ -341,7 +340,7 @@
         srcNpt = new NodePortTuple(1L, 1);
         dstNpt = new NodePortTuple(1L, 2);
         info = new LinkInfo(System.currentTimeMillis() - 40000,
-                            null, System.currentTimeMillis() - 40000, 0, 0);
+                null, System.currentTimeMillis() - 40000, 0, 0);
         topology.addOrUpdateLink(lt, info);
         assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
         assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
@@ -352,7 +351,7 @@
         srcNpt = new NodePortTuple(1L, 1);
         dstNpt = new NodePortTuple(1L, 3);
         info = new LinkInfo(System.currentTimeMillis() - 40000,
-                            null, System.currentTimeMillis() - 40000, 0, 0);
+                null, System.currentTimeMillis() - 40000, 0, 0);
         topology.addOrUpdateLink(lt, info);
         assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
         assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
@@ -363,7 +362,7 @@
         srcNpt = new NodePortTuple(1L, 4);
         dstNpt = new NodePortTuple(1L, 5);
         info = new LinkInfo(System.currentTimeMillis() - 40000,
-                            null, System.currentTimeMillis() - 40000, 0, 0);
+                null, System.currentTimeMillis() - 40000, 0, 0);
         topology.addOrUpdateLink(lt, info);
         assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
         assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
@@ -374,7 +373,7 @@
         srcNpt = new NodePortTuple(1L, 3);
         dstNpt = new NodePortTuple(1L, 5);
         info = new LinkInfo(System.currentTimeMillis() - 40000,
-                            null, System.currentTimeMillis() - 40000, 0, 0);
+                null, System.currentTimeMillis() - 40000, 0, 0);
         topology.addOrUpdateLink(lt, info);
         assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
         assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
diff --git a/src/test/java/net/onrc/onos/core/packet/BSNTest.java b/src/test/java/net/onrc/onos/core/packet/BSNTest.java
index 35027e6..83f4a41 100644
--- a/src/test/java/net/onrc/onos/core/packet/BSNTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/BSNTest.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed under the Apache License, Version 2.0 (the "License"); you may
-*    not use this file except in compliance with the License. You may obtain
-*    a copy of the License at
-*
-*         http://www.apache.org/licenses/LICENSE-2.0
-*
-*    Unless required by applicable law or agreed to in writing, software
-*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-*    License for the specific language governing permissions and limitations
-*    under the License.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
 
 /**
  *
@@ -28,38 +28,36 @@
 import org.junit.Test;
 
 /**
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
- *
  */
-public class BSNTest {       
+public class BSNTest {
     protected byte[] probePkt = {
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // src mac
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x04, // dst mac
-		(byte) 0x89, 0x42, // BSN type
-        0x20, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x00, // BSN header
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // controller id
-		0x00, 0x00, 0x00, 0x03, // sequence id
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // src mac
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x04, // dst mac
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, // switch dpid
-		0x00, 0x00, 0x00, 0x01 // port number
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // src mac
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x04, // dst mac
+            (byte) 0x89, 0x42, // BSN type
+            0x20, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x00, // BSN header
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // controller id
+            0x00, 0x00, 0x00, 0x03, // sequence id
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // src mac
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x04, // dst mac
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, // switch dpid
+            0x00, 0x00, 0x00, 0x01 // port number
     };
-    
+
     protected Ethernet getProbePacket() {
         return (Ethernet) new Ethernet()
-            .setSourceMACAddress("00:00:00:00:00:04")
-            .setDestinationMACAddress("00:00:00:00:00:01")
-            .setEtherType(Ethernet.TYPE_BSN)
-            .setPayload(new BSN(BSN.BSN_TYPE_PROBE)
-	            .setPayload(new BSNPROBE()
-		            .setSequenceId(3)
-		            .setSrcMac(new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x01})
-		            .setDstMac(new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x04})
-		            .setSrcSwDpid(0x06)
-		            .setSrcPortNo(0x01)
-		            )
-	            );
+                .setSourceMACAddress("00:00:00:00:00:04")
+                .setDestinationMACAddress("00:00:00:00:00:01")
+                .setEtherType(Ethernet.TYPE_BSN)
+                .setPayload(new BSN(BSN.BSN_TYPE_PROBE)
+                        .setPayload(new BSNPROBE()
+                                .setSequenceId(3)
+                                .setSrcMac(new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x01})
+                                .setDstMac(new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x04})
+                                .setSrcSwDpid(0x06)
+                                .setSrcPortNo(0x01)
+                        )
+                );
     }
 
     @Test
diff --git a/src/test/java/net/onrc/onos/core/packet/DHCPTest.java b/src/test/java/net/onrc/onos/core/packet/DHCPTest.java
index 4c5aebd..67e552f 100644
--- a/src/test/java/net/onrc/onos/core/packet/DHCPTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/DHCPTest.java
@@ -1,27 +1,26 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed under the Apache License, Version 2.0 (the "License"); you may
-*    not use this file except in compliance with the License. You may obtain
-*    a copy of the License at
-*
-*         http://www.apache.org/licenses/LICENSE-2.0
-*
-*    Unless required by applicable law or agreed to in writing, software
-*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-*    License for the specific language governing permissions and limitations
-*    under the License.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
 
 /**
- * 
+ *
  */
 package net.onrc.onos.core.packet;
 
 
-
 import java.util.Arrays;
 import java.util.ListIterator;
 
@@ -30,10 +29,9 @@
 
 /**
  * @author David Erickson (daviderickson@cs.stanford.edu)
- *
  */
 public class DHCPTest extends TestCase {
-    public byte[] dhcpPacket = new byte[] {
+    public byte[] dhcpPacket = new byte[]{
             (byte) 0x01, (byte) 0x01,
             (byte) 0x06, (byte) 0x00, (byte) 0x66, (byte) 0xf2, (byte) 0x8a,
             (byte) 0x11, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00,
@@ -97,7 +95,7 @@
             (byte) 0x00, (byte) 0x00, (byte) 0x00
     };
 
-    public byte[] dhcpPacket2 = new byte[] { (byte) 0xff, (byte) 0xff,
+    public byte[] dhcpPacket2 = new byte[]{(byte) 0xff, (byte) 0xff,
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00,
             (byte) 0xc0, (byte) 0x9f, (byte) 0x9e, (byte) 0x11, (byte) 0x84,
             (byte) 0x08, (byte) 0x00, (byte) 0x45, (byte) 0x00, (byte) 0x02,
@@ -215,73 +213,73 @@
             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00 };
-    
-    public byte[] dhcpPacket3 = new byte[] { 
+            (byte) 0x00, (byte) 0x00, (byte) 0x00};
+
+    public byte[] dhcpPacket3 = new byte[]{
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
-            (byte) 0xff, (byte) 0x74, (byte) 0x44, (byte) 0x01, (byte) 0x72, 
-            (byte) 0xd8, (byte) 0x41, (byte) 0x08, (byte) 0x00, (byte) 0x45, 
-            (byte) 0x00, (byte) 0x01, (byte) 0x1f, (byte) 0x48, (byte) 0xcd, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x11, (byte) 0x6f, 
-            (byte) 0x6a, (byte) 0xc0, (byte) 0xa8, (byte) 0x00, (byte) 0xef, 
-            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00, 
-            (byte) 0x44, (byte) 0x00, (byte) 0x43, (byte) 0x01, (byte) 0x0b, 
-            (byte) 0xb3, (byte) 0x0f, (byte) 0x01, (byte) 0x01, (byte) 0x06, 
-            (byte) 0x00, (byte) 0x82, (byte) 0x88, (byte) 0xa6, (byte) 0xc9, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x74, (byte) 0x44, (byte) 0x01, (byte) 0x72, (byte) 0xd8, 
-            (byte) 0x41, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, 
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x63, (byte) 0x82, 
-            (byte) 0x53, (byte) 0x63, (byte) 0x35, (byte) 0x01, (byte) 0x01, 
-            (byte) 0x32, (byte) 0x04, (byte) 0xc0, (byte) 0xa8, (byte) 0x0a, 
-            (byte) 0xa9, (byte) 0x39, (byte) 0x02, (byte) 0x02, (byte) 0x40, 
-            (byte) 0x37, (byte) 0x03, (byte) 0x01, (byte) 0x03, (byte) 0x06, 
-            (byte) 0xff                               
+            (byte) 0xff, (byte) 0x74, (byte) 0x44, (byte) 0x01, (byte) 0x72,
+            (byte) 0xd8, (byte) 0x41, (byte) 0x08, (byte) 0x00, (byte) 0x45,
+            (byte) 0x00, (byte) 0x01, (byte) 0x1f, (byte) 0x48, (byte) 0xcd,
+            (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x11, (byte) 0x6f,
+            (byte) 0x6a, (byte) 0xc0, (byte) 0xa8, (byte) 0x00, (byte) 0xef,
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00,
+            (byte) 0x44, (byte) 0x00, (byte) 0x43, (byte) 0x01, (byte) 0x0b,
+            (byte) 0xb3, (byte) 0x0f, (byte) 0x01, (byte) 0x01, (byte) 0x06,
+            (byte) 0x00, (byte) 0x82, (byte) 0x88, (byte) 0xa6, (byte) 0xc9,
+            (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x74, (byte) 0x44, (byte) 0x01, (byte) 0x72, (byte) 0xd8,
+            (byte) 0x41, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x63, (byte) 0x82,
+            (byte) 0x53, (byte) 0x63, (byte) 0x35, (byte) 0x01, (byte) 0x01,
+            (byte) 0x32, (byte) 0x04, (byte) 0xc0, (byte) 0xa8, (byte) 0x0a,
+            (byte) 0xa9, (byte) 0x39, (byte) 0x02, (byte) 0x02, (byte) 0x40,
+            (byte) 0x37, (byte) 0x03, (byte) 0x01, (byte) 0x03, (byte) 0x06,
+            (byte) 0xff
     };
-    
-    public byte[] dhcpPacketPXE = new byte[] { (byte) 0xff, (byte) 0xff,
+
+    public byte[] dhcpPacketPXE = new byte[]{(byte) 0xff, (byte) 0xff,
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00,
             (byte) 0x19, (byte) 0xb9, (byte) 0xb0, (byte) 0x01, (byte) 0x44,
             (byte) 0x08, (byte) 0x00, (byte) 0x45, (byte) 0x10, (byte) 0x01,
@@ -352,7 +350,7 @@
             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
     };
 
-    public byte[] dhcpPacketBadOption1 = new byte[] { (byte) 0xff, (byte) 0xff,
+    public byte[] dhcpPacketBadOption1 = new byte[]{(byte) 0xff, (byte) 0xff,
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00,
             (byte) 0x19, (byte) 0xb9, (byte) 0xb0, (byte) 0x01, (byte) 0x44,
             (byte) 0x08, (byte) 0x00, (byte) 0x45, (byte) 0x10, (byte) 0x01,
@@ -422,8 +420,8 @@
             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
     };
-    
-    public byte[] dhcpPacketBadHeader = new byte[] { (byte) 0xff, (byte) 0xff,
+
+    public byte[] dhcpPacketBadHeader = new byte[]{(byte) 0xff, (byte) 0xff,
             (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00,
             (byte) 0x19, (byte) 0xb9, (byte) 0xb0, (byte) 0x01, (byte) 0x44,
             (byte) 0x08, (byte) 0x00, (byte) 0x45, (byte) 0x10, (byte) 0x01,
@@ -480,12 +478,12 @@
             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
     };
-    
+
     private void resetChecksumsAndLengths(IPv4 ipv4, UDP udp) {
-        ipv4.setChecksum((short)0);
-        udp.setChecksum((short)0);
+        ipv4.setChecksum((short) 0);
+        udp.setChecksum((short) 0);
     }
-    
+
     public void testSerialize() {
         DHCP dhcp = new DHCP();
         dhcp.deserialize(dhcpPacket, 0, dhcpPacket.length);
@@ -508,14 +506,14 @@
         resetChecksumsAndLengths(ipv4, udp);
         assertEquals(DHCP.OPCODE_REQUEST, dhcp.getOpCode());
     }
-    
+
     public void testDeSerializeReSerialize() {
         Ethernet eth = new Ethernet();
         eth.deserialize(dhcpPacket3, 0, dhcpPacket3.length);
         assertTrue(eth.getPayload() instanceof IPv4);
         IPv4 ipv4 = (IPv4) eth.getPayload();
         assertTrue(ipv4.getPayload() instanceof UDP);
-        
+
         byte[] serializedPacket = eth.serialize();
         Ethernet eth2 = new Ethernet();
         eth2.deserialize(serializedPacket, 0, serializedPacket.length);
@@ -523,7 +521,7 @@
 
         short ipchecksum = ipv42.getChecksum();
         ipv42.setChecksum((short) 0);
-        eth2.serialize();        
+        eth2.serialize();
         assertEquals(ipchecksum, ipv42.getChecksum());
     }
 
@@ -540,14 +538,14 @@
          *  length field so that the serialize() function can re-compute them
          */
         resetChecksumsAndLengths(ipv4, udp);
-        
+
         assertEquals(DHCP.OPCODE_REPLY, dhcp.getOpCode());
         assertEquals("xenserver_5.6/pxelinux.0", dhcp.getBootFileName());
 
         byte[] result = eth.serialize();
         assertTrue(Arrays.equals(this.dhcpPacketPXE, result));
     }
-    
+
     public void testDeSerializeBad1() {
         Ethernet eth = new Ethernet();
         eth.deserialize(dhcpPacketBadOption1, 0, dhcpPacketBadOption1.length);
@@ -561,21 +559,21 @@
          *  length field so that the serialize() function can re-compute them
          */
         resetChecksumsAndLengths(ipv4, udp);
-        
+
         assertEquals(DHCP.OPCODE_REPLY, dhcp.getOpCode());
         ListIterator<DHCPOption> lit = dhcp.getOptions().listIterator();
         // Expect 5 correct options and an END option.
         assertEquals(dhcp.getOptions().size(), 6);
         while (lit.hasNext()) {
             DHCPOption option = lit.next();
-            assertFalse(option.code == (byte)0x0c);
+            assertFalse(option.code == (byte) 0x0c);
         }
 
         byte[] result = eth.serialize();
         // Since one option is badly formated, the result is different.
         assertFalse(Arrays.equals(this.dhcpPacketPXE, result));
     }
-    
+
     public void testDeSerializeBadHeader() {
         Ethernet eth = new Ethernet();
         eth.deserialize(dhcpPacketBadHeader, 0, dhcpPacketBadHeader.length);
@@ -588,7 +586,7 @@
 
         assertEquals(UDP.DHCP_CLIENT_PORT, udp.getSourcePort());
         assertEquals(UDP.DHCP_SERVER_PORT, udp.getDestinationPort());
-        
+
         // should get invalid opCode of 0
         assertEquals(0, dhcp.getOpCode());
     }
diff --git a/src/test/java/net/onrc/onos/core/packet/EthernetTest.java b/src/test/java/net/onrc/onos/core/packet/EthernetTest.java
index 8d60586..9ee7064 100644
--- a/src/test/java/net/onrc/onos/core/packet/EthernetTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/EthernetTest.java
@@ -1,22 +1,22 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed under the Apache License, Version 2.0 (the "License"); you may
-*    not use this file except in compliance with the License. You may obtain
-*    a copy of the License at
-*
-*         http://www.apache.org/licenses/LICENSE-2.0
-*
-*    Unless required by applicable law or agreed to in writing, software
-*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-*    License for the specific language governing permissions and limitations
-*    under the License.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
 
 /**
- * 
+ *
  */
 package net.onrc.onos.core.packet;
 
@@ -29,12 +29,11 @@
 
 /**
  * @author David Erickson (daviderickson@cs.stanford.edu)
- *
  */
 public class EthernetTest {
     @Test
     public void testToMACAddress() {
-        byte[] address = new byte[] { 0x0, 0x11, 0x22, (byte) 0xff,
+        byte[] address = new byte[]{0x0, 0x11, 0x22, (byte) 0xff,
                 (byte) 0xee, (byte) 0xdd};
         assertTrue(Arrays.equals(address, Ethernet
                 .toMACAddress("00:11:22:ff:ee:dd")));
@@ -45,13 +44,13 @@
     @Test
     public void testSerialize() {
         Ethernet ethernet = new Ethernet()
-            .setDestinationMACAddress("de:ad:be:ef:de:ad")
-            .setSourceMACAddress("be:ef:de:ad:be:ef")
-            .setEtherType((short) 0);
-        byte[] expected = new byte[] { (byte) 0xde, (byte) 0xad, (byte) 0xbe,
+                .setDestinationMACAddress("de:ad:be:ef:de:ad")
+                .setSourceMACAddress("be:ef:de:ad:be:ef")
+                .setEtherType((short) 0);
+        byte[] expected = new byte[]{(byte) 0xde, (byte) 0xad, (byte) 0xbe,
                 (byte) 0xef, (byte) 0xde, (byte) 0xad, (byte) 0xbe,
                 (byte) 0xef, (byte) 0xde, (byte) 0xad, (byte) 0xbe,
-                (byte) 0xef, 0x0, 0x0 };
+                (byte) 0xef, 0x0, 0x0};
         assertTrue(Arrays.equals(expected, ethernet.serialize()));
     }
 
@@ -59,17 +58,17 @@
     public void testToLong() {
         assertEquals(
                 281474976710655L,
-                Ethernet.toLong(new byte[] { (byte) 0xff, (byte) 0xff,
-                        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }));
+                Ethernet.toLong(new byte[]{(byte) 0xff, (byte) 0xff,
+                        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}));
 
         assertEquals(
                 1103823438081L,
-                Ethernet.toLong(new byte[] { (byte) 0x01, (byte) 0x01,
-                        (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01 }));
+                Ethernet.toLong(new byte[]{(byte) 0x01, (byte) 0x01,
+                        (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01}));
 
         assertEquals(
                 141289400074368L,
-                Ethernet.toLong(new byte[] { (byte) 0x80, (byte) 0x80,
-                        (byte) 0x80, (byte) 0x80, (byte) 0x80, (byte) 0x80 }));
+                Ethernet.toLong(new byte[]{(byte) 0x80, (byte) 0x80,
+                        (byte) 0x80, (byte) 0x80, (byte) 0x80, (byte) 0x80}));
     }
 }
diff --git a/src/test/java/net/onrc/onos/core/packet/ICMPTest.java b/src/test/java/net/onrc/onos/core/packet/ICMPTest.java
index 14df760..9d5f084 100644
--- a/src/test/java/net/onrc/onos/core/packet/ICMPTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/ICMPTest.java
@@ -1,22 +1,22 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed under the Apache License, Version 2.0 (the "License"); you may
-*    not use this file except in compliance with the License. You may obtain
-*    a copy of the License at
-*
-*         http://www.apache.org/licenses/LICENSE-2.0
-*
-*    Unless required by applicable law or agreed to in writing, software
-*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-*    License for the specific language governing permissions and limitations
-*    under the License.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
 
 /**
- * 
+ *
  */
 package net.onrc.onos.core.packet;
 
@@ -30,7 +30,7 @@
  * @author shudong.zhou@bigswitch.com
  */
 public class ICMPTest {
-    private byte[] pktSerialized = new byte[] {
+    private byte[] pktSerialized = new byte[]{
             // (byte) 0xc8, 0x2a, 0x14, 0x2d, 0x35, (byte) 0xf1,
             // 0x00, 0x0c, 0x29, 0x3b, (byte) 0x95, (byte) 0xf2, 0x08, 0x0,
             0x45, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01,
@@ -38,25 +38,26 @@
             (byte) 0xc0, (byte) 0xa8, (byte) 0x0a, (byte) 0xe7,
             (byte) 0xc0, (byte) 0xa8, (byte) 0x0a, (byte) 0xdb,
             0x08, 0x00, 0x7f, 0x0a, 0x76, (byte) 0xf2, 0x00, 0x02,
-            0x01, 0x01, 0x01 };
+            0x01, 0x01, 0x01};
+
     @Test
     public void testSerialize() {
         IPacket packet = new IPv4()
-            .setIdentification((short) 0)
-            .setFlags((byte) 0x02)
-            .setTtl((byte) 64)
-            .setSourceAddress("192.168.10.231")
-            .setDestinationAddress("192.168.10.219")
-            .setPayload(new ICMP()
-                            .setIcmpType((byte) 8)
-                            .setIcmpCode((byte) 0)
-                            .setPayload(new Data(new byte[]
-                                        {0x76, (byte) 0xf2, 0x0, 0x2, 0x1, 0x1, 0x1}))
-                       );
+                .setIdentification((short) 0)
+                .setFlags((byte) 0x02)
+                .setTtl((byte) 64)
+                .setSourceAddress("192.168.10.231")
+                .setDestinationAddress("192.168.10.219")
+                .setPayload(new ICMP()
+                        .setIcmpType((byte) 8)
+                        .setIcmpCode((byte) 0)
+                        .setPayload(new Data(new byte[]
+                                {0x76, (byte) 0xf2, 0x0, 0x2, 0x1, 0x1, 0x1}))
+                );
         byte[] actual = packet.serialize();
         assertTrue(Arrays.equals(pktSerialized, actual));
     }
-    
+
     @Test
     public void testDeserialize() {
         IPacket packet = new IPv4();
diff --git a/src/test/java/net/onrc/onos/core/packet/IPv4Test.java b/src/test/java/net/onrc/onos/core/packet/IPv4Test.java
index c764159..c113219 100644
--- a/src/test/java/net/onrc/onos/core/packet/IPv4Test.java
+++ b/src/test/java/net/onrc/onos/core/packet/IPv4Test.java
@@ -1,22 +1,22 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed under the Apache License, Version 2.0 (the "License"); you may
-*    not use this file except in compliance with the License. You may obtain
-*    a copy of the License at
-*
-*         http://www.apache.org/licenses/LICENSE-2.0
-*
-*    Unless required by applicable law or agreed to in writing, software
-*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-*    License for the specific language governing permissions and limitations
-*    under the License.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
 
 /**
- * 
+ *
  */
 package net.onrc.onos.core.packet;
 
@@ -30,14 +30,13 @@
 
 /**
  * @author David Erickson (daviderickson@cs.stanford.edu)
- *
  */
 public class IPv4Test {
     @Test
     public void testToIPv4Address() {
         int intIp = 0xc0a80001;
         String stringIp = "192.168.0.1";
-        byte[] byteIp = new byte[] {(byte)192, (byte)168, (byte)0, (byte)1};
+        byte[] byteIp = new byte[]{(byte) 192, (byte) 168, (byte) 0, (byte) 1};
         assertEquals(intIp, IPv4.toIPv4Address(stringIp));
         assertEquals(intIp, IPv4.toIPv4Address(byteIp));
         assertTrue(Arrays.equals(byteIp, IPv4.toIPv4AddressBytes(intIp)));
@@ -46,33 +45,33 @@
 
     @Test
     public void testToIPv4AddressBytes() {
-        byte[] expected = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff};
+        byte[] expected = new byte[]{(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff};
         Assert.assertArrayEquals(expected, IPv4.toIPv4AddressBytes("255.255.255.255"));
-        expected = new byte[] {(byte) 0x80, (byte) 0x80, (byte) 0x80, (byte) 0x80};
+        expected = new byte[]{(byte) 0x80, (byte) 0x80, (byte) 0x80, (byte) 0x80};
         Assert.assertArrayEquals(expected, IPv4.toIPv4AddressBytes("128.128.128.128"));
-        expected = new byte[] {0x7f,0x7f,0x7f,0x7f};
+        expected = new byte[]{0x7f, 0x7f, 0x7f, 0x7f};
         Assert.assertArrayEquals(expected, IPv4.toIPv4AddressBytes("127.127.127.127"));
     }
 
     @Test
     public void testSerialize() {
-        byte[] expected = new byte[] { 0x45, 0x00, 0x00, 0x14, 0x5e, 0x4e,
+        byte[] expected = new byte[]{0x45, 0x00, 0x00, 0x14, 0x5e, 0x4e,
                 0x00, 0x00, 0x3f, 0x06, 0x31, 0x2e, (byte) 0xac, 0x18,
-                0x4a, (byte) 0xdf, (byte) 0xab, 0x40, 0x4a, 0x30 };
+                0x4a, (byte) 0xdf, (byte) 0xab, 0x40, 0x4a, 0x30};
         IPv4 packet = new IPv4()
-            .setIdentification((short) 24142)
-            .setTtl((byte) 63)
-            .setProtocol((byte) 0x06)
-            .setSourceAddress("172.24.74.223")
-            .setDestinationAddress("171.64.74.48");
+                .setIdentification((short) 24142)
+                .setTtl((byte) 63)
+                .setProtocol((byte) 0x06)
+                .setSourceAddress("172.24.74.223")
+                .setDestinationAddress("171.64.74.48");
         byte[] actual = packet.serialize();
         assertTrue(Arrays.equals(expected, actual));
     }
-    
+
     @Test
     public void testDeserialize() {
         // A real TLSv1 packet
-        byte[] pktSerialized = new byte[] { 0x45, 0x00,
+        byte[] pktSerialized = new byte[]{0x45, 0x00,
                 0x00, 0x2e, 0x41, (byte) 0xbe, 0x40, 0x00, 0x40, 0x06,
                 (byte) 0xd4, (byte) 0xf0, (byte) 0xc0, (byte) 0xa8, 0x02, (byte) 0xdb, (byte) 0xd0, 0x55,
                 (byte) 0x90, 0x42, (byte) 0xd5, 0x48, 0x01, (byte) 0xbb, (byte) 0xe3, 0x50,
diff --git a/src/test/java/net/onrc/onos/core/packet/LLDPOrganizationalTLVTest.java b/src/test/java/net/onrc/onos/core/packet/LLDPOrganizationalTLVTest.java
index ddb8bd5..f680e93 100644
--- a/src/test/java/net/onrc/onos/core/packet/LLDPOrganizationalTLVTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/LLDPOrganizationalTLVTest.java
@@ -23,15 +23,15 @@
 import org.junit.Test;
 
 public class LLDPOrganizationalTLVTest {
-    private final byte[] expected = new byte[] {
-        //  Type: 127, Length: 13
-        (byte) 254, 13,
-        // OpenFlow OUI: 00-26-E1
-        0x0, 0x26, (byte)0xe1,
-        //  SubType: 12
-        0xc,
-        //  Bytes in "ExtraInfo"
-        0x45, 0x78, 0x74, 0x72, 0x61, 0x49, 0x6e, 0x66, 0x6f
+    private final byte[] expected = new byte[]{
+            //  Type: 127, Length: 13
+            (byte) 254, 13,
+            // OpenFlow OUI: 00-26-E1
+            0x0, 0x26, (byte) 0xe1,
+            //  SubType: 12
+            0xc,
+            //  Bytes in "ExtraInfo"
+            0x45, 0x78, 0x74, 0x72, 0x61, 0x49, 0x6e, 0x66, 0x6f
     };
 
     @Test(expected = IllegalArgumentException.class)
@@ -70,14 +70,14 @@
         LLDPOrganizationalTLV tlv = new LLDPOrganizationalTLV();
         tlv.setLength((short) 13);
         // OpenFlow OUI is 00-26-E1
-        tlv.setOUI(new byte[] {0x0, 0x26, (byte) 0xe1});
+        tlv.setOUI(new byte[]{0x0, 0x26, (byte) 0xe1});
         tlv.setSubType((byte) 12);
         tlv.setInfoString("ExtraInfo".getBytes(Charset.forName("UTF-8")));
 
-        assertThat(tlv.getType(), is((byte)127));
-        assertThat(tlv.getLength(), is((short)13));
-        assertThat(tlv.getOUI(), is(new byte[] {0x0, 0x26, (byte) 0xe1}));
-        assertThat(tlv.getSubType(), is((byte)12));
+        assertThat(tlv.getType(), is((byte) 127));
+        assertThat(tlv.getLength(), is((short) 13));
+        assertThat(tlv.getOUI(), is(new byte[]{0x0, 0x26, (byte) 0xe1}));
+        assertThat(tlv.getSubType(), is((byte) 12));
         assertThat(tlv.serialize(), is(expected));
     }
 
@@ -86,10 +86,10 @@
         LLDPOrganizationalTLV tlv = new LLDPOrganizationalTLV();
         tlv.deserialize(ByteBuffer.wrap(expected));
 
-        assertThat(tlv.getType(), is((byte)127));
-        assertThat(tlv.getLength(), is((short)13));
-        assertThat(tlv.getOUI(), is(new byte[] {0x0, 0x26, (byte) 0xe1}));
-        assertThat(tlv.getSubType(), is((byte)12));
+        assertThat(tlv.getType(), is((byte) 127));
+        assertThat(tlv.getLength(), is((short) 13));
+        assertThat(tlv.getOUI(), is(new byte[]{0x0, 0x26, (byte) 0xe1}));
+        assertThat(tlv.getSubType(), is((byte) 12));
         assertThat(tlv.getInfoString(), is("ExtraInfo".getBytes(Charset.forName("UTF-8"))));
     }
 }
diff --git a/src/test/java/net/onrc/onos/core/packet/LLDPTest.java b/src/test/java/net/onrc/onos/core/packet/LLDPTest.java
index 4905e9f..928ee72 100755
--- a/src/test/java/net/onrc/onos/core/packet/LLDPTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/LLDPTest.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed under the Apache License, Version 2.0 (the "License"); you may
-*    not use this file except in compliance with the License. You may obtain
-*    a copy of the License at
-*
-*         http://www.apache.org/licenses/LICENSE-2.0
-*
-*    Unless required by applicable law or agreed to in writing, software
-*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-*    License for the specific language governing permissions and limitations
-*    under the License.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
 
 /**
  *
@@ -28,29 +28,27 @@
 import org.junit.Test;
 
 /**
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
- *
  */
 public class LLDPTest {
-    protected byte[] pkt = {0x01,0x23,0x20,0x00,0x00,0x01,0x00,0x12,(byte) 0xe2,0x78,0x67,0x78,(byte) 0x88,(byte) 0xcc,0x02,0x07,
-            0x04,0x00,0x12,(byte) 0xe2,0x78,0x67,0x64,0x04,0x03,0x02,0x00,0x06,0x06,0x02,0x00,0x78,
-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+    protected byte[] pkt = {0x01, 0x23, 0x20, 0x00, 0x00, 0x01, 0x00, 0x12, (byte) 0xe2, 0x78, 0x67, 0x78, (byte) 0x88, (byte) 0xcc, 0x02, 0x07,
+            0x04, 0x00, 0x12, (byte) 0xe2, 0x78, 0x67, 0x64, 0x04, 0x03, 0x02, 0x00, 0x06, 0x06, 0x02, 0x00, 0x78,
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
     protected IPacket getPacket() {
         return new Ethernet()
-        .setPad(true)
-        .setDestinationMACAddress("01:23:20:00:00:01")
-        .setSourceMACAddress("00:12:e2:78:67:78")
-        .setEtherType(Ethernet.TYPE_LLDP)
-        .setPayload(
-                new LLDP()
-                .setChassisId(new LLDPTLV().setType((byte) 1).setLength((short) 7).setValue(new byte[] {0x04, 0x00, 0x12, (byte) 0xe2, 0x78, 0x67, 0x64}))
-                .setPortId(new LLDPTLV().setType((byte) 2).setLength((short) 3).setValue(new byte[] {0x02, 0x00, 0x06}))
-                .setTtl(new LLDPTLV().setType((byte) 3).setLength((short) 2).setValue(new byte[] {0x00, 0x78}))
-            
-        );
+                .setPad(true)
+                .setDestinationMACAddress("01:23:20:00:00:01")
+                .setSourceMACAddress("00:12:e2:78:67:78")
+                .setEtherType(Ethernet.TYPE_LLDP)
+                .setPayload(
+                        new LLDP()
+                                .setChassisId(new LLDPTLV().setType((byte) 1).setLength((short) 7).setValue(new byte[]{0x04, 0x00, 0x12, (byte) 0xe2, 0x78, 0x67, 0x64}))
+                                .setPortId(new LLDPTLV().setType((byte) 2).setLength((short) 3).setValue(new byte[]{0x02, 0x00, 0x06}))
+                                .setTtl(new LLDPTLV().setType((byte) 3).setLength((short) 2).setValue(new byte[]{0x00, 0x78}))
+
+                );
     }
 
     @Test
diff --git a/src/test/java/net/onrc/onos/core/packet/PacketTest.java b/src/test/java/net/onrc/onos/core/packet/PacketTest.java
index e57cba6..ab5247e 100644
--- a/src/test/java/net/onrc/onos/core/packet/PacketTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/PacketTest.java
@@ -11,83 +11,83 @@
     protected IPacket pkt1, pkt2, pkt3, pkt4;
     protected IPacket dummyPkt;
     protected IPacket[] packets;
-    
+
     @Before
     public void setUp() {
         this.pkt1 = new Ethernet()
-        .setDestinationMACAddress("00:11:22:33:44:55")
-        .setSourceMACAddress("00:44:33:22:11:00")
-        .setEtherType(Ethernet.TYPE_IPv4)
-        .setPayload(
-                    new IPv4()
-                    .setTtl((byte) 128)
-                    .setSourceAddress("192.168.1.1")
-                    .setDestinationAddress("192.168.1.2")
-                    .setPayload(new UDP()
-                    .setSourcePort((short) 5000)
-                    .setDestinationPort((short) 5001)
-                    .setPayload(new Data(new byte[] {0x01}))));
-        
+                .setDestinationMACAddress("00:11:22:33:44:55")
+                .setSourceMACAddress("00:44:33:22:11:00")
+                .setEtherType(Ethernet.TYPE_IPv4)
+                .setPayload(
+                        new IPv4()
+                                .setTtl((byte) 128)
+                                .setSourceAddress("192.168.1.1")
+                                .setDestinationAddress("192.168.1.2")
+                                .setPayload(new UDP()
+                                        .setSourcePort((short) 5000)
+                                        .setDestinationPort((short) 5001)
+                                        .setPayload(new Data(new byte[]{0x01}))));
+
         this.pkt2 = new Ethernet()
-        .setSourceMACAddress("00:44:33:22:11:01")
-        .setDestinationMACAddress("00:11:22:33:44:55")
-        .setEtherType(Ethernet.TYPE_ARP)
-        .setVlanID((short)5)
-        .setPayload(
-                    new ARP()
-                    .setHardwareType(ARP.HW_TYPE_ETHERNET)
-                    .setProtocolType(ARP.PROTO_TYPE_IP)
-                    .setHardwareAddressLength((byte) 6)
-                    .setProtocolAddressLength((byte) 4)
-                    .setOpCode(ARP.OP_REPLY)
-                    .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:01"))
-                    .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
-                    .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
-                    .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
-        
-        
+                .setSourceMACAddress("00:44:33:22:11:01")
+                .setDestinationMACAddress("00:11:22:33:44:55")
+                .setEtherType(Ethernet.TYPE_ARP)
+                .setVlanID((short) 5)
+                .setPayload(
+                        new ARP()
+                                .setHardwareType(ARP.HW_TYPE_ETHERNET)
+                                .setProtocolType(ARP.PROTO_TYPE_IP)
+                                .setHardwareAddressLength((byte) 6)
+                                .setProtocolAddressLength((byte) 4)
+                                .setOpCode(ARP.OP_REPLY)
+                                .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:01"))
+                                .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
+                                .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
+                                .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
+
+
         this.pkt3 = new Ethernet()
-        .setSourceMACAddress("00:44:33:22:11:01")
-        .setDestinationMACAddress("00:11:22:33:44:55")
-        .setEtherType(Ethernet.TYPE_ARP)
-        .setPayload(
-                    new ARP()
-                    .setHardwareType(ARP.HW_TYPE_ETHERNET)
-                    .setProtocolType(ARP.PROTO_TYPE_IP)
-                    .setHardwareAddressLength((byte) 6)
-                    .setProtocolAddressLength((byte) 4)
-                    .setOpCode(ARP.OP_REPLY)
-                    .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:01"))
-                    .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
-                    .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
-                    .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
-        
+                .setSourceMACAddress("00:44:33:22:11:01")
+                .setDestinationMACAddress("00:11:22:33:44:55")
+                .setEtherType(Ethernet.TYPE_ARP)
+                .setPayload(
+                        new ARP()
+                                .setHardwareType(ARP.HW_TYPE_ETHERNET)
+                                .setProtocolType(ARP.PROTO_TYPE_IP)
+                                .setHardwareAddressLength((byte) 6)
+                                .setProtocolAddressLength((byte) 4)
+                                .setOpCode(ARP.OP_REPLY)
+                                .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:01"))
+                                .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
+                                .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
+                                .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
+
         this.pkt4 = new Ethernet()
-        .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
-        .setSourceMACAddress("00:11:33:55:77:01")
-        .setEtherType(Ethernet.TYPE_IPv4)
-        .setPayload(
-                    new IPv4()
-                    .setTtl((byte) 128)
-                    .setSourceAddress("192.168.10.1")
-                    .setDestinationAddress("192.168.255.255")
-                    .setPayload(new UDP()
-                    .setSourcePort((short) 5000)
-                    .setDestinationPort((short) 5001)
-                    .setPayload(new Data(new byte[] {0x01}))));
-        
-        this.dummyPkt =  new IPv4()
-        .setTtl((byte) 32)
-        .setSourceAddress("1.2.3.4")
-        .setDestinationAddress("5.6.7.8");
-        
-        this.packets = new IPacket[] { pkt1, pkt2, pkt3, pkt4 };
+                .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
+                .setSourceMACAddress("00:11:33:55:77:01")
+                .setEtherType(Ethernet.TYPE_IPv4)
+                .setPayload(
+                        new IPv4()
+                                .setTtl((byte) 128)
+                                .setSourceAddress("192.168.10.1")
+                                .setDestinationAddress("192.168.255.255")
+                                .setPayload(new UDP()
+                                        .setSourcePort((short) 5000)
+                                        .setDestinationPort((short) 5001)
+                                        .setPayload(new Data(new byte[]{0x01}))));
+
+        this.dummyPkt = new IPv4()
+                .setTtl((byte) 32)
+                .setSourceAddress("1.2.3.4")
+                .setDestinationAddress("5.6.7.8");
+
+        this.packets = new IPacket[]{pkt1, pkt2, pkt3, pkt4};
     }
-    
+
     protected void doTestClone(IPacket pkt) {
         if (pkt.getPayload() != null)
             doTestClone(pkt.getPayload());
-        IPacket newPkt = (IPacket)pkt.clone();
+        IPacket newPkt = (IPacket) pkt.clone();
         assertSame(pkt.getClass(), newPkt.getClass());
         assertNotSame(pkt, newPkt);
         assertSame(pkt.getParent(), newPkt.getParent());
@@ -95,35 +95,35 @@
         assertEquals(pkt.getPayload(), newPkt.getPayload());
         if (pkt.getPayload() != null)
             assertNotSame(pkt.getPayload(), newPkt.getPayload());
-        
+
         if (pkt instanceof Ethernet) {
-            Ethernet eth = (Ethernet)pkt;
-            Ethernet newEth = (Ethernet)newPkt;
-            newEth.setDestinationMACAddress(new byte[] { 1,2,3,4,5,6});
+            Ethernet eth = (Ethernet) pkt;
+            Ethernet newEth = (Ethernet) newPkt;
+            newEth.setDestinationMACAddress(new byte[]{1, 2, 3, 4, 5, 6});
             assertEquals(false, newEth.getDestinationMAC()
-                                .equals(eth.getDestinationMAC()));
+                    .equals(eth.getDestinationMAC()));
             assertEquals(false, newPkt.equals(pkt));
         }
         if (pkt instanceof ARP) {
-            ARP arp = (ARP)pkt;
-            ARP newArp = (ARP)newPkt;
-            newArp.setSenderProtocolAddress(new byte[] {1,2,3,4});
+            ARP arp = (ARP) pkt;
+            ARP newArp = (ARP) newPkt;
+            newArp.setSenderProtocolAddress(new byte[]{1, 2, 3, 4});
             assertEquals(false, newArp.getSenderProtocolAddress()
-                                .equals(arp.getSenderProtocolAddress()));
+                    .equals(arp.getSenderProtocolAddress()));
             assertEquals(false, newPkt.equals(pkt));
         }
-        
+
         byte[] dummyData = dummyPkt.serialize().clone();
-        newPkt = (IPacket)pkt.clone();
+        newPkt = (IPacket) pkt.clone();
         newPkt.deserialize(dummyData, 0, dummyData.length);
         assertEquals(false, newPkt.equals(pkt));
     }
-    
+
     @Test
     public void testClone() {
-        for (IPacket pkt: packets) {
+        for (IPacket pkt : packets) {
             doTestClone(pkt);
         }
     }
-    
+
 }
diff --git a/src/test/java/net/onrc/onos/core/packet/TCPTest.java b/src/test/java/net/onrc/onos/core/packet/TCPTest.java
index 38e6a92..8843490 100644
--- a/src/test/java/net/onrc/onos/core/packet/TCPTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/TCPTest.java
@@ -1,22 +1,22 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed under the Apache License, Version 2.0 (the "License"); you may
-*    not use this file except in compliance with the License. You may obtain
-*    a copy of the License at
-*
-*         http://www.apache.org/licenses/LICENSE-2.0
-*
-*    Unless required by applicable law or agreed to in writing, software
-*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-*    License for the specific language governing permissions and limitations
-*    under the License.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
 
 /**
- * 
+ *
  */
 package net.onrc.onos.core.packet;
 
@@ -30,7 +30,7 @@
  * @author shudong.zhou@bigswitch.com
  */
 public class TCPTest {
-    private byte[] pktSerialized = new byte[] { 0x45, 0x20,
+    private byte[] pktSerialized = new byte[]{0x45, 0x20,
             0x00, 0x34, 0x1d, (byte) 0x85, 0x00, 0x00, 0x32, 0x06,
             0x31, 0x1e, 0x4a, 0x7d, 0x2d, 0x6d, (byte) 0xc0, (byte) 0xa8,
             0x01, 0x6f, 0x03, (byte) 0xe1, (byte) 0xc0, 0x32, (byte) 0xe3, (byte) 0xad,
@@ -38,17 +38,17 @@
             0x01, 0x0b, 0x59, 0x33, 0x00, 0x00, 0x01, 0x01,
             0x08, 0x0a, 0x20, (byte) 0x9a, 0x41, 0x04, 0x07, 0x76,
             0x53, 0x1f};
-    
+
     @Test
     public void testSerialize() {
         IPacket packet = new IPv4()
-        .setDiffServ((byte) 0x20)
-        .setIdentification((short) 0x1d85)
-        .setFlags((byte) 0x00)
-        .setTtl((byte) 50)
-        .setSourceAddress("74.125.45.109")
-        .setDestinationAddress("192.168.1.111")
-        .setPayload(new TCP()
+                .setDiffServ((byte) 0x20)
+                .setIdentification((short) 0x1d85)
+                .setFlags((byte) 0x00)
+                .setTtl((byte) 50)
+                .setSourceAddress("74.125.45.109")
+                .setDestinationAddress("192.168.1.111")
+                .setPayload(new TCP()
                         .setSourcePort((short) 993)
                         .setDestinationPort((short) 49202)
                         .setSequence(0xe3adee88)
@@ -56,14 +56,14 @@
                         .setDataOffset((byte) 8)
                         .setFlags((short) 0x10)
                         .setWindowSize((short) 267)
-                        .setOptions(new byte[] {0x01, 0x01, 0x08, 0x0a, 0x20, (byte) 0x9a,
-                                                0x41, 0x04, 0x07, 0x76, 0x53, 0x1f})
+                        .setOptions(new byte[]{0x01, 0x01, 0x08, 0x0a, 0x20, (byte) 0x9a,
+                                0x41, 0x04, 0x07, 0x76, 0x53, 0x1f})
                         .setPayload(null)
-                   );
+                );
         byte[] actual = packet.serialize();
         assertTrue(Arrays.equals(pktSerialized, actual));
     }
-    
+
     @Test
     public void testDeserialize() {
         IPacket packet = new IPv4();
diff --git a/src/test/java/net/onrc/onos/core/packet/UDPTest.java b/src/test/java/net/onrc/onos/core/packet/UDPTest.java
index 3c76e4a..34cf19e 100644
--- a/src/test/java/net/onrc/onos/core/packet/UDPTest.java
+++ b/src/test/java/net/onrc/onos/core/packet/UDPTest.java
@@ -1,22 +1,22 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed under the Apache License, Version 2.0 (the "License"); you may
-*    not use this file except in compliance with the License. You may obtain
-*    a copy of the License at
-*
-*         http://www.apache.org/licenses/LICENSE-2.0
-*
-*    Unless required by applicable law or agreed to in writing, software
-*    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-*    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-*    License for the specific language governing permissions and limitations
-*    under the License.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
 
 /**
- * 
+ *
  */
 package net.onrc.onos.core.packet;
 
@@ -28,27 +28,26 @@
 
 /**
  * @author David Erickson (daviderickson@cs.stanford.edu)
- *
  */
 public class UDPTest {
 
     @Test
     public void testSerialize() {
-        byte[] expected = new byte[] { 0x45, 0x00, 0x00, 0x1d, 0x56, 0x23,
+        byte[] expected = new byte[]{0x45, 0x00, 0x00, 0x1d, 0x56, 0x23,
                 0x00, 0x00, (byte) 0x80, 0x11, 0x48, 0x7f, (byte) 0xc0,
                 (byte) 0xa8, 0x01, 0x02, 0x0c, (byte) 0x81, (byte) 0xce, 0x02,
                 0x17, (byte) 0xe1, 0x04, 0x5f, 0x00, 0x09, 0x46, 0x6e,
-                0x01 };
+                0x01};
         IPacket packet = new IPv4()
-            .setIdentification((short) 22051)
-            .setTtl((byte) 128)
-            .setSourceAddress("192.168.1.2")
-            .setDestinationAddress("12.129.206.2")
-            .setPayload(new UDP()
-                            .setSourcePort((short) 6113)
-                            .setDestinationPort((short) 1119)
-                            .setPayload(new Data(new byte[] {0x01}))
-                       );
+                .setIdentification((short) 22051)
+                .setTtl((byte) 128)
+                .setSourceAddress("192.168.1.2")
+                .setDestinationAddress("12.129.206.2")
+                .setPayload(new UDP()
+                        .setSourcePort((short) 6113)
+                        .setDestinationPort((short) 1119)
+                        .setPayload(new Data(new byte[]{0x01}))
+                );
         byte[] actual = packet.serialize();
         assertTrue(Arrays.equals(expected, actual));
     }
diff --git a/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java b/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java
index 38df943..a8ea8e1 100644
--- a/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java
+++ b/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java
@@ -27,441 +27,471 @@
 
 /**
  * Unit test for {@link StandaloneRegistry}.
- * @author Naoki Shiota
  *
+ * @author Naoki Shiota
  */
 public class StandaloneRegistryTest {
-	protected static final long TIMEOUT_MSEC = 1000;
-	
-	protected StandaloneRegistry registry;
-	
-	/**
-	 * Implementation of {@link ControlChangeCallback} which defines callback interfaces called by Registry.
-	 * This class remembers past callback parameters and provides methods to access them.
-	 * This class also provides CountDownLatch so one can wait until the callback be called
-	 * specific times (specified by constructor parameter). Particularly, the first time callback
-	 * called is supposed for registration, this class has an independent latch to wait for
-	 * the first callback.
-	 * @author Naoki Shiota
-	 */
-	public static class LoggingCallback implements ControlChangeCallback {
-		private LinkedList<Long> dpidsCalledback = new LinkedList<Long>();
-		private LinkedList<Boolean> controlsCalledback = new LinkedList<Boolean>();
-		private CountDownLatch lock = null, registerLock = null;;
-		
-		/**
-		 * Constructor with number of times callback to be called.
-		 * @param numberToCall Number of times expected callback to be called
-		 */
-		public LoggingCallback(int numberToCall) {
-			lock = new CountDownLatch(numberToCall);
-			registerLock = new CountDownLatch(1);
-		}
+    protected static final long TIMEOUT_MSEC = 1000;
 
-		/**
-		 * Wait until registration is finished (callback is called for the first time).
-		 * @throws InterruptedException
-		 */
-		public void waitForRegistration() throws InterruptedException {
-			registerLock.await();
-		}
-		
-		/**
-		 * Wait for registration specifying timeout.
-		 * @param msec Milliseconds to timeout
-		 * @throws InterruptedException
-		 */
-		public void waitForRegistration(long msec) throws InterruptedException {
-			registerLock.await(msec, TimeUnit.MILLISECONDS);
-		}
+    protected StandaloneRegistry registry;
 
-		/**
-		 * Wait until callback is called specific times.
-		 * @throws InterruptedException
-		 */
-		public void waitUntilCalled() throws InterruptedException {
-			lock.await();
-		}
-		
-		/**
-		 * Wait until callback is called specific times, specifying timeout.
-		 * @param msec Milliseconds to timeout
-		 * @throws InterruptedException
-		 */
-		public void waitUntilCalled(long msec) throws InterruptedException {
-			lock.await(msec, TimeUnit.MILLISECONDS);
-		}
-		
-		/**
-		 * Get DPID parameter given by specific callback time.
-		 * @param index Specify which time to get parameter
-		 * @return DPID value by number.
-		 */
-		public Long getDpid(int index) { return dpidsCalledback.get(index); }
-		
-		/**
-		 * Get hasControl parameter given by specific callback time.
-		 * @param index Specify which time to get parameter
-		 * @return hasControl value
-		 */
-		public Boolean getControl(int index) { return controlsCalledback.get(index); }
-		
-		/**
-		 * Get DPID parameter given by latest call.
-		 * @return DPID value by number
-		 */
-		public Long getLatestDpid() { return dpidsCalledback.peekLast(); }
-		
-		/**
-		 * Get hasControl parameter given by latest call
-		 * @return hasControl value
-		 */
-		public Boolean getLatestControl() { return controlsCalledback.peekLast(); }
-		
-		@Override
-		public void controlChanged(long dpid, boolean hasControl) {
-			dpidsCalledback.addLast(dpid);
-			controlsCalledback.addLast(hasControl);
-			
-			lock.countDown();
-			registerLock.countDown();
-		}
-	};
-	
-	@Before
-	public void setUp() throws Exception {
+    /**
+     * Implementation of {@link ControlChangeCallback} which defines callback interfaces called by Registry.
+     * This class remembers past callback parameters and provides methods to access them.
+     * This class also provides CountDownLatch so one can wait until the callback be called
+     * specific times (specified by constructor parameter). Particularly, the first time callback
+     * called is supposed for registration, this class has an independent latch to wait for
+     * the first callback.
+     *
+     * @author Naoki Shiota
+     */
+    public static class LoggingCallback implements ControlChangeCallback {
+        private LinkedList<Long> dpidsCalledback = new LinkedList<Long>();
+        private LinkedList<Boolean> controlsCalledback = new LinkedList<Boolean>();
+        private CountDownLatch lock = null, registerLock = null;
+        ;
+
+        /**
+         * Constructor with number of times callback to be called.
+         *
+         * @param numberToCall Number of times expected callback to be called
+         */
+        public LoggingCallback(int numberToCall) {
+            lock = new CountDownLatch(numberToCall);
+            registerLock = new CountDownLatch(1);
+        }
+
+        /**
+         * Wait until registration is finished (callback is called for the first time).
+         *
+         * @throws InterruptedException
+         */
+        public void waitForRegistration() throws InterruptedException {
+            registerLock.await();
+        }
+
+        /**
+         * Wait for registration specifying timeout.
+         *
+         * @param msec Milliseconds to timeout
+         * @throws InterruptedException
+         */
+        public void waitForRegistration(long msec) throws InterruptedException {
+            registerLock.await(msec, TimeUnit.MILLISECONDS);
+        }
+
+        /**
+         * Wait until callback is called specific times.
+         *
+         * @throws InterruptedException
+         */
+        public void waitUntilCalled() throws InterruptedException {
+            lock.await();
+        }
+
+        /**
+         * Wait until callback is called specific times, specifying timeout.
+         *
+         * @param msec Milliseconds to timeout
+         * @throws InterruptedException
+         */
+        public void waitUntilCalled(long msec) throws InterruptedException {
+            lock.await(msec, TimeUnit.MILLISECONDS);
+        }
+
+        /**
+         * Get DPID parameter given by specific callback time.
+         *
+         * @param index Specify which time to get parameter
+         * @return DPID value by number.
+         */
+        public Long getDpid(int index) {
+            return dpidsCalledback.get(index);
+        }
+
+        /**
+         * Get hasControl parameter given by specific callback time.
+         *
+         * @param index Specify which time to get parameter
+         * @return hasControl value
+         */
+        public Boolean getControl(int index) {
+            return controlsCalledback.get(index);
+        }
+
+        /**
+         * Get DPID parameter given by latest call.
+         *
+         * @return DPID value by number
+         */
+        public Long getLatestDpid() {
+            return dpidsCalledback.peekLast();
+        }
+
+        /**
+         * Get hasControl parameter given by latest call
+         *
+         * @return hasControl value
+         */
+        public Boolean getLatestControl() {
+            return controlsCalledback.peekLast();
+        }
+
+        @Override
+        public void controlChanged(long dpid, boolean hasControl) {
+            dpidsCalledback.addLast(dpid);
+            controlsCalledback.addLast(hasControl);
+
+            lock.countDown();
+            registerLock.countDown();
+        }
+    }
+
+    ;
+
+    @Before
+    public void setUp() throws Exception {
         FloodlightModuleContext fmc = new FloodlightModuleContext();
-		registry = new StandaloneRegistry();
-		registry.init(fmc);
-	}
+        registry = new StandaloneRegistry();
+        registry.init(fmc);
+    }
 
-	@After
-	public void tearDown() {
-	}
-	
-	/**
-	 * Test if {@link StandaloneRegistry#registerController(String)} can run without error.
-	 */
-	@Test
-	public void testRegisterController() {
-		String controllerIdToRegister = "test";
-		try {
-			registry.registerController(controllerIdToRegister);
-		} catch (RegistryException e) {
-			e.printStackTrace();
-			fail(e.getMessage());
-		}
-		
-		// Register Controller ID doubly 
-		try {
-			registry.registerController(controllerIdToRegister);
-			fail("Double registration goes through without exception");
-		} catch (RegistryException e) {
-			// expected behavior
-		}
-	}
-	
-	/**
-	 * Test if {@link StandaloneRegistry#getControllerId()} can return correct ID.
-	 * @throws RegistryException
-	 */
-	@Test
-	public void testGetControllerId() throws RegistryException {
-		String controllerIdToRegister = "test";
-		
-		// try before controller is registered
-		String controllerId = registry.getControllerId();
-		assertNull(controllerId);
-		
-		// register
-		registry.registerController(controllerIdToRegister);
+    @After
+    public void tearDown() {
+    }
 
-		// call getControllerId and verify
-		controllerId = registry.getControllerId();
-		assertNotNull(controllerId);
-		assertEquals(controllerIdToRegister, controllerId);
-	}
+    /**
+     * Test if {@link StandaloneRegistry#registerController(String)} can run without error.
+     */
+    @Test
+    public void testRegisterController() {
+        String controllerIdToRegister = "test";
+        try {
+            registry.registerController(controllerIdToRegister);
+        } catch (RegistryException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
 
-	/**
-	 * Test if {@link StandaloneRegistry#getAllControllers()} can return correct list of controllers.
-	 * @throws RegistryException
-	 */
-	@Test
-	public void testGetAllControllers() throws RegistryException {
-		String controllerIdToRegister = "test";
-		
-		// Test before register controller
-		try {
-			Collection<String> ctrls = registry.getAllControllers();
-			assertFalse(ctrls.contains(controllerIdToRegister));
-		} catch (RegistryException e) {
-			e.printStackTrace();
-			fail(e.getMessage());
-		}
-		
-		// register
-		registry.registerController(controllerIdToRegister);
+        // Register Controller ID doubly
+        try {
+            registry.registerController(controllerIdToRegister);
+            fail("Double registration goes through without exception");
+        } catch (RegistryException e) {
+            // expected behavior
+        }
+    }
 
-		// Test after register controller
-		try {
-			Collection<String> ctrls = registry.getAllControllers();
-			assertTrue(ctrls.contains(controllerIdToRegister));
-		} catch (RegistryException e) {
-			e.printStackTrace();
-			fail(e.getMessage());
-		}
-	}
+    /**
+     * Test if {@link StandaloneRegistry#getControllerId()} can return correct ID.
+     *
+     * @throws RegistryException
+     */
+    @Test
+    public void testGetControllerId() throws RegistryException {
+        String controllerIdToRegister = "test";
 
-	/**
-	 * Test if {@link StandaloneRegistry#requestControl(long, ControlChangeCallback)} can correctly take control for switch so that callback is called.
-	 * @throws RegistryException
-	 * @throws InterruptedException
-	 */
-	@Test
-	public void testRequestControl() throws InterruptedException, RegistryException {
-		String controllerId = "test";
-		registry.registerController(controllerId);
+        // try before controller is registered
+        String controllerId = registry.getControllerId();
+        assertNull(controllerId);
 
-		LoggingCallback callback = new LoggingCallback(1);
-		long dpidToRequest = 1000L;
+        // register
+        registry.registerController(controllerIdToRegister);
 
-		try {
-			registry.requestControl(dpidToRequest, callback);
-		} catch (RegistryException e) {
-			e.printStackTrace();
-			fail(e.getMessage());
-		}
-		
-		callback.waitForRegistration();
-		
-		long dpidCallback = callback.getLatestDpid();
-		boolean controlCallback = callback.getLatestControl();
-		
-		assertEquals(dpidToRequest, dpidCallback);
-		assertTrue(controlCallback);
-	}
+        // call getControllerId and verify
+        controllerId = registry.getControllerId();
+        assertNotNull(controllerId);
+        assertEquals(controllerIdToRegister, controllerId);
+    }
 
-	/**
-	 * Test if {@link StandaloneRegistry#releaseControl(long)} can correctly release the control so that callback is called.
-	 * @throws InterruptedException
-	 * @throws RegistryException
-	 */
-	@Test
-	public void testReleaseControl() throws InterruptedException, RegistryException {
-		String controllerId = "test";
-		registry.registerController(controllerId);
-		
-		long dpidToRequest = 1000L;
-		LoggingCallback callback = new LoggingCallback(2);
-		
-		// to request and wait to take control
-		registry.requestControl(dpidToRequest, callback);
-		callback.waitForRegistration();
-		
-		registry.releaseControl(dpidToRequest);
-		
-		// verify
-		callback.waitUntilCalled();
-		assertEquals(dpidToRequest, (long)callback.getLatestDpid());
-		assertFalse(callback.getLatestControl());
-	}
+    /**
+     * Test if {@link StandaloneRegistry#getAllControllers()} can return correct list of controllers.
+     *
+     * @throws RegistryException
+     */
+    @Test
+    public void testGetAllControllers() throws RegistryException {
+        String controllerIdToRegister = "test";
 
-	/**
-	 * Test if {@link StandaloneRegistry#hasControl(long)} returns correct status.
-	 * @throws InterruptedException
-	 * @throws RegistryException
-	 */
-	@Test
-	public void testHasControl() throws InterruptedException, RegistryException {
-		String controllerId = "test";
-		registry.registerController(controllerId);
-		
-		long dpidToRequest = 1000L;
-		LoggingCallback callback = new LoggingCallback(2);
-		
-		// Test before request control
-		assertFalse(registry.hasControl(dpidToRequest));
-		
-		registry.requestControl(dpidToRequest, callback);
-		callback.waitForRegistration();
-		
-		// Test after take control
-		assertTrue(registry.hasControl(dpidToRequest));
-		
-		registry.releaseControl(dpidToRequest);
-		
-		callback.waitUntilCalled();
+        // Test before register controller
+        try {
+            Collection<String> ctrls = registry.getAllControllers();
+            assertFalse(ctrls.contains(controllerIdToRegister));
+        } catch (RegistryException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
 
-		// Test after release control
-		assertFalse(registry.hasControl(dpidToRequest));
-	}
+        // register
+        registry.registerController(controllerIdToRegister);
 
-	/**
-	 * Test if {@link StandaloneRegistry#getControllerForSwitch(long)} returns correct controller ID.
-	 * @throws InterruptedException
-	 * @throws RegistryException
-	 */
-	@Test
-	public void testGetControllerForSwitch() throws InterruptedException, RegistryException {
-		String controllerId = "test";
-		registry.registerController(controllerId);
-		
-		long dpidToRequest = 1000L;
-		LoggingCallback callback = new LoggingCallback(2);
-		
-		// Test before request control
-		try {
-			String controllerForSw = registry.getControllerForSwitch(dpidToRequest);
-			assertNotEquals(controllerId,controllerForSw);
-		} catch (RegistryException e) {
-			fail("Failed before request control : " + e.getMessage());
-			e.printStackTrace();
-		}
+        // Test after register controller
+        try {
+            Collection<String> ctrls = registry.getAllControllers();
+            assertTrue(ctrls.contains(controllerIdToRegister));
+        } catch (RegistryException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
 
-		registry.requestControl(dpidToRequest, callback);
-		callback.waitForRegistration();
+    /**
+     * Test if {@link StandaloneRegistry#requestControl(long, ControlChangeCallback)} can correctly take control for switch so that callback is called.
+     *
+     * @throws RegistryException
+     * @throws InterruptedException
+     */
+    @Test
+    public void testRequestControl() throws InterruptedException, RegistryException {
+        String controllerId = "test";
+        registry.registerController(controllerId);
 
-		// Test after take control
-		try {
-			String controllerForSw = registry.getControllerForSwitch(dpidToRequest);
-			assertEquals(controllerId,controllerForSw);
-		} catch (RegistryException e) {
-			fail("Failed after take control : " + e.getMessage());
-			e.printStackTrace();
-		}
+        LoggingCallback callback = new LoggingCallback(1);
+        long dpidToRequest = 1000L;
 
-		registry.releaseControl(dpidToRequest);
-		callback.waitUntilCalled();
+        try {
+            registry.requestControl(dpidToRequest, callback);
+        } catch (RegistryException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
 
-		// Test after release control
-		try {
-			String controllerForSw = registry.getControllerForSwitch(dpidToRequest);
-			assertNotEquals(controllerId,controllerForSw);
-		} catch (RegistryException e) {
-			fail("Failed after release control : " + e.getMessage());
-			e.printStackTrace();
-		}
-	}
+        callback.waitForRegistration();
 
-	/**
-	 * Test if {@link StandaloneRegistry#getAllSwitches()} returns correct list of switches.
-	 * @throws InterruptedException
-	 * @throws RegistryException
-	 */
-	@Test
-	public void testGetAllSwitches() throws InterruptedException, RegistryException {
-		String controllerId = "test";
-		registry.registerController(controllerId);
+        long dpidCallback = callback.getLatestDpid();
+        boolean controlCallback = callback.getLatestControl();
 
-		long dpidToRequest = 1000L;
-		String dpidToRequestStr = HexString.toHexString(dpidToRequest);
-		LoggingCallback callback = new LoggingCallback(2);
+        assertEquals(dpidToRequest, dpidCallback);
+        assertTrue(controlCallback);
+    }
 
-		// Test before request control
-		Map<String, List<ControllerRegistryEntry>> switches = registry.getAllSwitches();
-		assertNotNull(switches);
-		assertFalse(switches.keySet().contains(dpidToRequestStr));
+    /**
+     * Test if {@link StandaloneRegistry#releaseControl(long)} can correctly release the control so that callback is called.
+     *
+     * @throws InterruptedException
+     * @throws RegistryException
+     */
+    @Test
+    public void testReleaseControl() throws InterruptedException, RegistryException {
+        String controllerId = "test";
+        registry.registerController(controllerId);
 
-		registry.requestControl(dpidToRequest, callback);
-		callback.waitForRegistration();
+        long dpidToRequest = 1000L;
+        LoggingCallback callback = new LoggingCallback(2);
 
-		// Test after take control
-		switches = registry.getAllSwitches();
-		assertNotNull(switches);
-		assertTrue(switches.keySet().contains(dpidToRequestStr));
-		int count = 0;
-		for(ControllerRegistryEntry ctrl : switches.get(dpidToRequestStr)) {
-			if(ctrl.getControllerId().equals(controllerId)) {
-				++count;
-			}
-		}
-		assertEquals(1,count);
-		
-		registry.releaseControl(dpidToRequest);
-		callback.waitUntilCalled();
+        // to request and wait to take control
+        registry.requestControl(dpidToRequest, callback);
+        callback.waitForRegistration();
 
-		// Test after release control
-		switches = registry.getAllSwitches();
-		assertNotNull(switches);
-		assertFalse(switches.keySet().contains(dpidToRequestStr));
-	}
+        registry.releaseControl(dpidToRequest);
 
-	/**
-	 * Test if {@link StandaloneRegistry#getSwitchesControlledByController(String)} returns correct list of switches.
-	 * @throws InterruptedException
-	 * @throws RegistryException
-	 */
-	// TODO: remove @Ignore after implement StandaloneRegistry#getSwitchesControlledByController
-	@Ignore @Test
-	public void testGetSwitchesControlledByController() throws InterruptedException, RegistryException {
-		String controllerId = "test";
-		registry.registerController(controllerId);
+        // verify
+        callback.waitUntilCalled();
+        assertEquals(dpidToRequest, (long) callback.getLatestDpid());
+        assertFalse(callback.getLatestControl());
+    }
 
-		long dpidToRequest = 1000L;
-		String dpidToRequestStr = HexString.toHexString(dpidToRequest);
-		LoggingCallback callback = new LoggingCallback(2);
+    /**
+     * Test if {@link StandaloneRegistry#hasControl(long)} returns correct status.
+     *
+     * @throws InterruptedException
+     * @throws RegistryException
+     */
+    @Test
+    public void testHasControl() throws InterruptedException, RegistryException {
+        String controllerId = "test";
+        registry.registerController(controllerId);
 
-		// Test before request control
-		Collection<Long> switches = registry.getSwitchesControlledByController(controllerId);
-		assertNotNull(switches);
-		assertFalse(switches.contains(dpidToRequestStr));
+        long dpidToRequest = 1000L;
+        LoggingCallback callback = new LoggingCallback(2);
 
-		registry.requestControl(dpidToRequest, callback);
-		callback.waitForRegistration();
+        // Test before request control
+        assertFalse(registry.hasControl(dpidToRequest));
 
-		// Test after take control
-		switches = registry.getSwitchesControlledByController(controllerId);
-		assertNotNull(switches);
-		assertTrue(switches.contains(dpidToRequestStr));
-		int count = 0;
-		for(Long dpid : switches) {
-			if((long)dpid == dpidToRequest) {
-				++count;
-			}
-		}
-		assertEquals(1, count);
-		
-		registry.releaseControl(dpidToRequest);
-		callback.waitUntilCalled();
+        registry.requestControl(dpidToRequest, callback);
+        callback.waitForRegistration();
 
-		// Test after release control
-		switches = registry.getSwitchesControlledByController(controllerId);
-		assertNotNull(switches);
-		assertFalse(switches.contains(dpidToRequestStr));
-	}
+        // Test after take control
+        assertTrue(registry.hasControl(dpidToRequest));
 
-	/**
-	 * Test if {@link StandaloneRegistry#allocateUniqueIdBlock()} returns appropriate object.
-	 * Get bulk of IdBlocks and check if they do have unique range of IDs.
-	 */
-	@Test
-	public void testAllocateUniqueIdBlock() {
-		// Number of blocks to be verified that any of them has unique block
-		final int NUM_BLOCKS = 100;
-		ArrayList<IdBlock> blocks = new ArrayList<IdBlock>(NUM_BLOCKS);
-		
-		for(int i = 0; i < NUM_BLOCKS; ++i) {
-			blocks.add(registry.allocateUniqueIdBlock());
-		}
-		
-		for(int i = 0; i < NUM_BLOCKS; ++i) {
-			IdBlock block1 = blocks.get(i);
-			for(int j = i + 1; j < NUM_BLOCKS; ++j) {
-				IdBlock block2 = blocks.get(j);
-				IdBlock lower,higher;
-				
-				if(block1.getStart() < block2.getStart()) {
-					lower = block1;
-					higher = block2;
-				} else {
-					lower = block2;
-					higher = block1;
-				}
-				
-				assertTrue(lower.getSize() > 0L);
-				assertTrue(higher.getSize() > 0L);
-				assertTrue(lower.getEnd() < higher.getStart());
-			}
-		}
-	}
+        registry.releaseControl(dpidToRequest);
+
+        callback.waitUntilCalled();
+
+        // Test after release control
+        assertFalse(registry.hasControl(dpidToRequest));
+    }
+
+    /**
+     * Test if {@link StandaloneRegistry#getControllerForSwitch(long)} returns correct controller ID.
+     *
+     * @throws InterruptedException
+     * @throws RegistryException
+     */
+    @Test
+    public void testGetControllerForSwitch() throws InterruptedException, RegistryException {
+        String controllerId = "test";
+        registry.registerController(controllerId);
+
+        long dpidToRequest = 1000L;
+        LoggingCallback callback = new LoggingCallback(2);
+
+        // Test before request control
+        try {
+            String controllerForSw = registry.getControllerForSwitch(dpidToRequest);
+            assertNotEquals(controllerId, controllerForSw);
+        } catch (RegistryException e) {
+            fail("Failed before request control : " + e.getMessage());
+            e.printStackTrace();
+        }
+
+        registry.requestControl(dpidToRequest, callback);
+        callback.waitForRegistration();
+
+        // Test after take control
+        try {
+            String controllerForSw = registry.getControllerForSwitch(dpidToRequest);
+            assertEquals(controllerId, controllerForSw);
+        } catch (RegistryException e) {
+            fail("Failed after take control : " + e.getMessage());
+            e.printStackTrace();
+        }
+
+        registry.releaseControl(dpidToRequest);
+        callback.waitUntilCalled();
+
+        // Test after release control
+        try {
+            String controllerForSw = registry.getControllerForSwitch(dpidToRequest);
+            assertNotEquals(controllerId, controllerForSw);
+        } catch (RegistryException e) {
+            fail("Failed after release control : " + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Test if {@link StandaloneRegistry#getAllSwitches()} returns correct list of switches.
+     *
+     * @throws InterruptedException
+     * @throws RegistryException
+     */
+    @Test
+    public void testGetAllSwitches() throws InterruptedException, RegistryException {
+        String controllerId = "test";
+        registry.registerController(controllerId);
+
+        long dpidToRequest = 1000L;
+        String dpidToRequestStr = HexString.toHexString(dpidToRequest);
+        LoggingCallback callback = new LoggingCallback(2);
+
+        // Test before request control
+        Map<String, List<ControllerRegistryEntry>> switches = registry.getAllSwitches();
+        assertNotNull(switches);
+        assertFalse(switches.keySet().contains(dpidToRequestStr));
+
+        registry.requestControl(dpidToRequest, callback);
+        callback.waitForRegistration();
+
+        // Test after take control
+        switches = registry.getAllSwitches();
+        assertNotNull(switches);
+        assertTrue(switches.keySet().contains(dpidToRequestStr));
+        int count = 0;
+        for (ControllerRegistryEntry ctrl : switches.get(dpidToRequestStr)) {
+            if (ctrl.getControllerId().equals(controllerId)) {
+                ++count;
+            }
+        }
+        assertEquals(1, count);
+
+        registry.releaseControl(dpidToRequest);
+        callback.waitUntilCalled();
+
+        // Test after release control
+        switches = registry.getAllSwitches();
+        assertNotNull(switches);
+        assertFalse(switches.keySet().contains(dpidToRequestStr));
+    }
+
+    /**
+     * Test if {@link StandaloneRegistry#getSwitchesControlledByController(String)} returns correct list of switches.
+     *
+     * @throws InterruptedException
+     * @throws RegistryException
+     */
+    // TODO: remove @Ignore after implement StandaloneRegistry#getSwitchesControlledByController
+    @Ignore
+    @Test
+    public void testGetSwitchesControlledByController() throws InterruptedException, RegistryException {
+        String controllerId = "test";
+        registry.registerController(controllerId);
+
+        long dpidToRequest = 1000L;
+        String dpidToRequestStr = HexString.toHexString(dpidToRequest);
+        LoggingCallback callback = new LoggingCallback(2);
+
+        // Test before request control
+        Collection<Long> switches = registry.getSwitchesControlledByController(controllerId);
+        assertNotNull(switches);
+        assertFalse(switches.contains(dpidToRequestStr));
+
+        registry.requestControl(dpidToRequest, callback);
+        callback.waitForRegistration();
+
+        // Test after take control
+        switches = registry.getSwitchesControlledByController(controllerId);
+        assertNotNull(switches);
+        assertTrue(switches.contains(dpidToRequestStr));
+        int count = 0;
+        for (Long dpid : switches) {
+            if ((long) dpid == dpidToRequest) {
+                ++count;
+            }
+        }
+        assertEquals(1, count);
+
+        registry.releaseControl(dpidToRequest);
+        callback.waitUntilCalled();
+
+        // Test after release control
+        switches = registry.getSwitchesControlledByController(controllerId);
+        assertNotNull(switches);
+        assertFalse(switches.contains(dpidToRequestStr));
+    }
+
+    /**
+     * Test if {@link StandaloneRegistry#allocateUniqueIdBlock()} returns appropriate object.
+     * Get bulk of IdBlocks and check if they do have unique range of IDs.
+     */
+    @Test
+    public void testAllocateUniqueIdBlock() {
+        // Number of blocks to be verified that any of them has unique block
+        final int NUM_BLOCKS = 100;
+        ArrayList<IdBlock> blocks = new ArrayList<IdBlock>(NUM_BLOCKS);
+
+        for (int i = 0; i < NUM_BLOCKS; ++i) {
+            blocks.add(registry.allocateUniqueIdBlock());
+        }
+
+        for (int i = 0; i < NUM_BLOCKS; ++i) {
+            IdBlock block1 = blocks.get(i);
+            for (int j = i + 1; j < NUM_BLOCKS; ++j) {
+                IdBlock block2 = blocks.get(j);
+                IdBlock lower, higher;
+
+                if (block1.getStart() < block2.getStart()) {
+                    lower = block1;
+                    higher = block2;
+                } else {
+                    lower = block2;
+                    higher = block1;
+                }
+
+                assertTrue(lower.getSize() > 0L);
+                assertTrue(higher.getSize() > 0L);
+                assertTrue(lower.getEnd() < higher.getStart());
+            }
+        }
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java b/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java
index 45562e9..8275a84 100644
--- a/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java
+++ b/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java
@@ -42,555 +42,573 @@
 /**
  * Unit test for {@link ZookeeperRegistry}.
  * NOTE: {@link FloodlightTestCase} conflicts with PowerMock. If FloodLight-related methods need to be tested,
- *       implement another test class to test them.
- * @author Naoki Shiota
+ * implement another test class to test them.
  *
+ * @author Naoki Shiota
  */
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({ZookeeperRegistry.class, CuratorFramework.class, CuratorFrameworkFactory.class,
-	ServiceDiscoveryBuilder.class, ServiceDiscovery.class, ServiceCache.class, PathChildrenCache.class,
-	ZookeeperRegistry.SwitchPathCacheListener.class})
+        ServiceDiscoveryBuilder.class, ServiceDiscovery.class, ServiceCache.class, PathChildrenCache.class,
+        ZookeeperRegistry.SwitchPathCacheListener.class})
 public class ZookeeperRegistryTest extends FloodlightTestCase {
-	private final static Long ID_BLOCK_SIZE = 0x100000000L;
-	
-	protected ZookeeperRegistry registry;
-	protected CuratorFramework client;
-	
-	protected PathChildrenCacheListener pathChildrenCacheListener;
-	protected final String CONTROLLER_ID = "controller2013";
+    private final static Long ID_BLOCK_SIZE = 0x100000000L;
 
-	/**
-	 * Initialize {@link ZookeeperRegistry} Object and inject initial value with {@link ZookeeperRegistry#init(FloodlightModuleContext)} method.
-	 * This setup code also tests {@link ZookeeperRegistry#init(FloodlightModuleContext)} method itself.
-	 */
-	@Before
-	public void setUp() throws Exception {
-		super.setUp();
-		
-		pathChildrenCacheListener = null;
-		
-		// Mock of CuratorFramework
-		client = createCuratorFrameworkMock();
-		
-		// Mock of CuratorFrameworkFactory
-		PowerMock.mockStatic(CuratorFrameworkFactory.class);
-		EasyMock.expect(CuratorFrameworkFactory.newClient((String)EasyMock.anyObject(),
-				EasyMock.anyInt(), EasyMock.anyInt(), (RetryPolicy)EasyMock.anyObject())).andReturn(client);
-		PowerMock.replay(CuratorFrameworkFactory.class);
+    protected ZookeeperRegistry registry;
+    protected CuratorFramework client;
 
-		FloodlightModuleContext fmc = new FloodlightModuleContext();
-		registry = new ZookeeperRegistry();
-		fmc.addService(ZookeeperRegistry.class, registry);
-		
-		registry.init(fmc);
-		
-		PowerMock.verify(client, CuratorFrameworkFactory.class);
-	}
+    protected PathChildrenCacheListener pathChildrenCacheListener;
+    protected final String CONTROLLER_ID = "controller2013";
 
-	/**
-	 * Clean up member variables (empty for now).
-	 */
-	@After
-	public void tearDown() throws Exception {
-		super.tearDown();
-	}
+    /**
+     * Initialize {@link ZookeeperRegistry} Object and inject initial value with {@link ZookeeperRegistry#init(FloodlightModuleContext)} method.
+     * This setup code also tests {@link ZookeeperRegistry#init(FloodlightModuleContext)} method itself.
+     */
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
 
-	/**
-	 * Test if {@link ZookeeperRegistry#registerController(String)} method can go through without exception.
-	 * (Exceptions are usually out of test target, but {@link ZookeeperRegistry#registerController(String)} throws an exception in case of invalid registration.)
-	 */
-	@Test
-	public void testRegisterController() {
-		String controllerIdToRegister = "controller2013";
-		
-		try {
-			registry.registerController(controllerIdToRegister);
-		} catch (RegistryException e) {
-			e.printStackTrace();
-			fail(e.getMessage());
-		}
-	}
+        pathChildrenCacheListener = null;
 
-	/**
-	 * Test if {@link ZookeeperRegistry#getControllerId()} correctly returns registered ID.
-	 * @throws Exception
-	 */
-	@Test
-	public void testGetControllerId() throws Exception {
-		String controllerIdToRegister = "controller1";
-		
-		// try before controller is registered
-		String controllerId = registry.getControllerId();
-		assertNull(controllerId);
-		
-		// register
-		registry.registerController(controllerIdToRegister);
-	
-		// call getControllerId and verify
-		controllerId = registry.getControllerId();
-		assertNotNull(controllerId);
-		assertEquals(controllerIdToRegister, controllerId);
-	}
+        // Mock of CuratorFramework
+        client = createCuratorFrameworkMock();
 
-	/**
-	 * Test if {@link ZookeeperRegistry#getAllControllers()} returns all controllers.
-	 * Controllers to be returned are injected while setup. See {@link ZookeeperRegistryTest#createCuratorFrameworkMock()}
-	 * to what controllers are injected using mock {@link ServiceCache}.
-	 * @throws Exception
-	 */
-	@Test
-	public void testGetAllControllers() throws Exception {
-		String controllerIdRegistered = "controller1";
-		String controllerIdNotRegistered = "controller2013";
+        // Mock of CuratorFrameworkFactory
+        PowerMock.mockStatic(CuratorFrameworkFactory.class);
+        EasyMock.expect(CuratorFrameworkFactory.newClient((String) EasyMock.anyObject(),
+                EasyMock.anyInt(), EasyMock.anyInt(), (RetryPolicy) EasyMock.anyObject())).andReturn(client);
+        PowerMock.replay(CuratorFrameworkFactory.class);
 
-		try {
-			Collection<String> ctrls = registry.getAllControllers();
-			assertTrue(ctrls.contains(controllerIdRegistered));
-			assertFalse(ctrls.contains(controllerIdNotRegistered));
-		} catch (RegistryException e) {
-			e.printStackTrace();
-			fail(e.getMessage());
-		}
-	}
+        FloodlightModuleContext fmc = new FloodlightModuleContext();
+        registry = new ZookeeperRegistry();
+        fmc.addService(ZookeeperRegistry.class, registry);
 
-	/**
-	 * Test if {@link ZookeeperRegistry#requestControl(long, net.onrc.onos.core.registry.IControllerRegistryService.ControlChangeCallback)}
-	 * correctly take control of specific switch. Because {@link ZookeeperRegistry#requestControl(long, net.onrc.onos.core.registry.IControllerRegistryService.ControlChangeCallback)}
-	 * doesn't return values, inject mock {@link LeaderLatch} object and verify latch is correctly set up.
-	 * @throws Exception
-	 */
-	@Test
-	public void testRequestControl() throws Exception {
-		// Mock LeaderLatch
-		LeaderLatch latch = EasyMock.createMock(LeaderLatch.class);
-		latch.addListener(EasyMock.anyObject(SwitchLeaderListener.class));
-		EasyMock.expectLastCall().once();
-		latch.start();
-		EasyMock.expectLastCall().once();
-		EasyMock.replay(latch);
-		
-		PowerMock.expectNew(LeaderLatch.class,
-				EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))
-				.andReturn(latch).once();
-		PowerMock.replay(LeaderLatch.class);
-		
-		String controllerId = "controller2013";
-		registry.registerController(controllerId);
+        registry.init(fmc);
 
-		LoggingCallback callback = new LoggingCallback(1);
-		long dpidToRequest = 2000L;
+        PowerMock.verify(client, CuratorFrameworkFactory.class);
+    }
 
-		try {
-			registry.requestControl(dpidToRequest, callback);
-		} catch (RegistryException e) {
-			e.printStackTrace();
-			fail(e.getMessage());
-		}
-		
-		EasyMock.verify(latch);
-	}
+    /**
+     * Clean up member variables (empty for now).
+     */
+    @After
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
 
-	/**
-	 * Test if {@link ZookeeperRegistry#releaseControl(long)} correctly release control of specific switch.
-	 * Because {@link ZookeeperRegistry#releaseControl(long)} doesn't return values, inject mock
-	 * {@link LeaderLatch} object and verify latch is correctly set up.
-	 * @throws Exception
-	 */
-	@Test
-	public void testReleaseControl() throws Exception {
-		// Mock of LeaderLatch
-		LeaderLatch latch = EasyMock.createMock(LeaderLatch.class);
-		latch.addListener(EasyMock.anyObject(SwitchLeaderListener.class));
-		EasyMock.expectLastCall().once();
-		latch.start();
-		EasyMock.expectLastCall().once();
-		latch.removeListener(EasyMock.anyObject(SwitchLeaderListener.class));
-		EasyMock.expectLastCall().once();
-		latch.close();
-		EasyMock.expectLastCall().once();
-		EasyMock.replay(latch);
-		
-		PowerMock.expectNew(LeaderLatch.class,
-				EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))
-				.andReturn(latch).once();
-		PowerMock.replay(LeaderLatch.class);
-		
-		String controllerId = "controller2013";
-		registry.registerController(controllerId);
-		
-		long dpidToRequest = 2000L;
-		LoggingCallback callback = new LoggingCallback(1);
-		
-		registry.requestControl(dpidToRequest, callback);
-		registry.releaseControl(dpidToRequest);
-		
-		EasyMock.verify(latch);
-	}
+    /**
+     * Test if {@link ZookeeperRegistry#registerController(String)} method can go through without exception.
+     * (Exceptions are usually out of test target, but {@link ZookeeperRegistry#registerController(String)} throws an exception in case of invalid registration.)
+     */
+    @Test
+    public void testRegisterController() {
+        String controllerIdToRegister = "controller2013";
 
-	/**
-	 * Test if {@link ZookeeperRegistry#hasControl(long)} returns correct status whether controller has control of specific switch.
-	 * @throws Exception
-	 */
-	@Test
-	public void testHasControl() throws Exception {
-		// Mock of LeaderLatch
-		LeaderLatch latch = EasyMock.createMock(LeaderLatch.class);
-		latch.addListener(EasyMock.anyObject(SwitchLeaderListener.class));
-		EasyMock.expectLastCall().once();
-		latch.start();
-		EasyMock.expectLastCall().once();
-		EasyMock.expect(latch.hasLeadership()).andReturn(true).anyTimes();
-		latch.removeListener(EasyMock.anyObject(SwitchLeaderListener.class));
-		EasyMock.expectLastCall().once();
-		latch.close();
-		EasyMock.expectLastCall().once();
-		EasyMock.replay(latch);
-		
-		PowerMock.expectNew(LeaderLatch.class,
-				EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))
-				.andReturn(latch);
-		PowerMock.replay(LeaderLatch.class);
-		
-		String controllerId = "controller2013";
-		registry.registerController(controllerId);
-		
-		long dpidToRequest = 2000L;
-		LoggingCallback callback = new LoggingCallback(2);
-		
-		// Test before request control
-		assertFalse(registry.hasControl(dpidToRequest));
+        try {
+            registry.registerController(controllerIdToRegister);
+        } catch (RegistryException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
 
-		registry.requestControl(dpidToRequest, callback);
-		
-		// Test after request control
-		assertTrue(registry.hasControl(dpidToRequest));
-		
-		registry.releaseControl(dpidToRequest);
-		
-		// Test after release control
-		assertFalse(registry.hasControl(dpidToRequest));
-		
-		EasyMock.verify(latch);
-	}
+    /**
+     * Test if {@link ZookeeperRegistry#getControllerId()} correctly returns registered ID.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testGetControllerId() throws Exception {
+        String controllerIdToRegister = "controller1";
 
-	/**
-	 * Test if {@link ZookeeperRegistry#getControllerForSwitch(long)} correctly returns controller ID of specific switch.
-	 * Relation between controllers and switches are defined by {@link ZookeeperRegistryTest#setPathChildrenCache()} function.
-	 * @throws Throwable
-	 */
-	@Test
-	public void testGetControllerForSwitch() throws Throwable {
-		long dpidRegistered = 1000L;
-		long dpidNotRegistered = 2000L;
-		
-		setPathChildrenCache();
-		
-		String controllerForSw = registry.getControllerForSwitch(dpidRegistered);
-		assertEquals("controller1",controllerForSw);
+        // try before controller is registered
+        String controllerId = registry.getControllerId();
+        assertNull(controllerId);
 
-		controllerForSw = registry.getControllerForSwitch(dpidNotRegistered);
-		assertEquals(null, controllerForSw);
-	}
+        // register
+        registry.registerController(controllerIdToRegister);
 
-	/**
-	 * Test if {@link ZookeeperRegistry#getSwitchesControlledByController(String)} returns correct list of
-	 * switches controlled by a controller.
-	 * @throws Exception
-	 */
-	// TODO: Test after getSwitchesControlledByController() is implemented.
-	@Ignore @Test
-	public void testGetSwitchesControlledByController() throws Exception {
-		String controllerIdRegistered = "controller1";
-		String dpidRegistered = HexString.toHexString(1000L);
-		String controllerIdNotRegistered = CONTROLLER_ID;
-		
-		Collection<Long> switches = registry.getSwitchesControlledByController(controllerIdRegistered);
-		assertNotNull(switches);
-		assertTrue(switches.contains(dpidRegistered));
+        // call getControllerId and verify
+        controllerId = registry.getControllerId();
+        assertNotNull(controllerId);
+        assertEquals(controllerIdToRegister, controllerId);
+    }
 
-		switches = registry.getSwitchesControlledByController(controllerIdNotRegistered);
-		assertNotNull(switches);
-		assertEquals(0, switches.size());
-	}
+    /**
+     * Test if {@link ZookeeperRegistry#getAllControllers()} returns all controllers.
+     * Controllers to be returned are injected while setup. See {@link ZookeeperRegistryTest#createCuratorFrameworkMock()}
+     * to what controllers are injected using mock {@link ServiceCache}.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testGetAllControllers() throws Exception {
+        String controllerIdRegistered = "controller1";
+        String controllerIdNotRegistered = "controller2013";
 
-	/**
-	 * Test if {@link ZookeeperRegistry#getAllSwitches()} returns correct list of all switches.
-	 * Switches are injected in {@link ZookeeperRegistryTest#setPathChildrenCache()} function.
-	 * @throws Exception
-	 */
-	@Test
-	public void testGetAllSwitches() throws Exception {
-		String [] dpids = {
-				HexString.toHexString(1000L),
-				HexString.toHexString(1001L),
-				HexString.toHexString(1002L),
-		};
-		
-		setPathChildrenCache();
+        try {
+            Collection<String> ctrls = registry.getAllControllers();
+            assertTrue(ctrls.contains(controllerIdRegistered));
+            assertFalse(ctrls.contains(controllerIdNotRegistered));
+        } catch (RegistryException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
 
-		Map<String, List<ControllerRegistryEntry>> switches = registry.getAllSwitches();
-		assertNotNull(switches);
-		assertEquals(dpids.length, switches.size());
-		for(String dpid : dpids) {
-			assertTrue(switches.keySet().contains(dpid));
-		}
-	}
+    /**
+     * Test if {@link ZookeeperRegistry#requestControl(long, net.onrc.onos.core.registry.IControllerRegistryService.ControlChangeCallback)}
+     * correctly take control of specific switch. Because {@link ZookeeperRegistry#requestControl(long, net.onrc.onos.core.registry.IControllerRegistryService.ControlChangeCallback)}
+     * doesn't return values, inject mock {@link LeaderLatch} object and verify latch is correctly set up.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testRequestControl() throws Exception {
+        // Mock LeaderLatch
+        LeaderLatch latch = EasyMock.createMock(LeaderLatch.class);
+        latch.addListener(EasyMock.anyObject(SwitchLeaderListener.class));
+        EasyMock.expectLastCall().once();
+        latch.start();
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(latch);
 
-	/**
-	 * Test if {@link ZookeeperRegistry#allocateUniqueIdBlock()} can assign IdBlock without duplication.
-	 */
-	@Test
-	public void testAllocateUniqueIdBlock() {
-		// Number of blocks to be verified that any of them has unique block
-		final int NUM_BLOCKS = 100;
-		ArrayList<IdBlock> blocks = new ArrayList<IdBlock>(NUM_BLOCKS);
-		
-		for(int i = 0; i < NUM_BLOCKS; ++i) {
-			IdBlock block = registry.allocateUniqueIdBlock();
-			assertNotNull(block);
-			blocks.add(block);
-		}
-		
-		for(int i = 0; i < NUM_BLOCKS; ++i) {
-			IdBlock block1 = blocks.get(i);
-			for(int j = i + 1; j < NUM_BLOCKS; ++j) {
-				IdBlock block2 = blocks.get(j);
-				IdBlock lower,higher;
-				
-				if(block1.getStart() < block2.getStart()) {
-					lower = block1;
-					higher = block2;
-				} else {
-					lower = block2;
-					higher = block1;
-				}
-				
-				assertTrue(lower.getSize() > 0L);
-				assertTrue(higher.getSize() > 0L);
-				assertTrue(lower.getEnd() <= higher.getStart());
-			}
-		}
-	}
-	
-	
-	//-------------------------- Creation of mock objects --------------------------
-	/**
-	 * Create mock {@link CuratorFramework} object with initial value below.<br>
-	 *   [Ctrl ID]    : [DPID]<br>
-	 * controller1    :  1000<br>
-	 * controller2    :  1001<br>
-	 * controller2    :  1002<br>
-	 * controller2013 : nothing
-	 * @return Created mock object
-	 * @throws Exception
-	 */
-	@SuppressWarnings({ "serial", "unchecked" })
-	private CuratorFramework createCuratorFrameworkMock() throws Exception {
-		// Mock of AtomicValue
-		AtomicValue<Long> atomicValue = EasyMock.createMock(AtomicValue.class);
-		EasyMock.expect(atomicValue.succeeded()).andReturn(true).anyTimes();
-		EasyMock.expect(atomicValue.preValue()).andAnswer(new IAnswer<Long>() {
-			private long value = 0;
-			@Override
-			public Long answer() throws Throwable {
-				value += ID_BLOCK_SIZE;
-				return value;
-			}
-		}).anyTimes();
-		EasyMock.expect(atomicValue.postValue()).andAnswer(new IAnswer<Long>() {
-			private long value = ID_BLOCK_SIZE;
-			@Override
-			public Long answer() throws Throwable {
-				value += ID_BLOCK_SIZE;
-				return value;
-			}
-		}).anyTimes();
-		EasyMock.replay(atomicValue);
-		
-		// Mock DistributedAtomicLong
-		DistributedAtomicLong daLong = EasyMock.createMock(DistributedAtomicLong.class);
-		EasyMock.expect(daLong.add(EasyMock.anyLong())).andReturn(atomicValue).anyTimes();
-		EasyMock.replay(daLong);
-		PowerMock.expectNew(DistributedAtomicLong.class,
-				new Class<?> [] {CuratorFramework.class, String.class, RetryPolicy.class},
-				EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(RetryPolicy.class)).
-				andReturn(daLong).anyTimes();
-		PowerMock.replay(DistributedAtomicLong.class);
-		
-		// Mock ListenerContainer
-		ListenerContainer<PathChildrenCacheListener> listenerContainer = EasyMock.createMock(ListenerContainer.class);
-		listenerContainer.addListener(EasyMock.anyObject(PathChildrenCacheListener.class));
-		EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-			@Override
-			public Object answer() throws Throwable {
-				pathChildrenCacheListener = (PathChildrenCacheListener)EasyMock.getCurrentArguments()[0];
-				return null;
-			}
-		}).once();
-		EasyMock.replay(listenerContainer);
+        PowerMock.expectNew(LeaderLatch.class,
+                EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))
+                .andReturn(latch).once();
+        PowerMock.replay(LeaderLatch.class);
 
-		// Mock PathChildrenCache
-		PathChildrenCache pathChildrenCacheMain = createPathChildrenCacheMock(CONTROLLER_ID, new String[] {"/switches"}, listenerContainer);
-		PathChildrenCache pathChildrenCache1 = createPathChildrenCacheMock("controller1", new String[] {HexString.toHexString(1000L)}, listenerContainer);
-		PathChildrenCache pathChildrenCache2 = createPathChildrenCacheMock("controller2", new String[] { 
-			HexString.toHexString(1001L), HexString.toHexString(1002L) },listenerContainer);
-		
-		// Mock PathChildrenCache constructor
-		PowerMock.expectNew(PathChildrenCache.class,
-				EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyBoolean()).
-				andReturn(pathChildrenCacheMain).once();
-		PowerMock.expectNew(PathChildrenCache.class,
-				EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyBoolean()).
-				andReturn(pathChildrenCache1).once();
-		PowerMock.expectNew(PathChildrenCache.class,
-				EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyBoolean()).
-				andReturn(pathChildrenCache2).anyTimes();
-		PowerMock.replay(PathChildrenCache.class);
-		
-		// Mock ServiceCache
-		ServiceCache<ControllerService> serviceCache = EasyMock.createMock(ServiceCache.class);
-		serviceCache.start();
-		EasyMock.expectLastCall().once();
-		EasyMock.expect(serviceCache.getInstances()).andReturn(new ArrayList<ServiceInstance<ControllerService> > () {{
-			add(createServiceInstanceMock("controller1"));
-			add(createServiceInstanceMock("controller2"));
-		}}).anyTimes();
-		EasyMock.replay(serviceCache);
-		
-		// Mock ServiceCacheBuilder
-		ServiceCacheBuilder<ControllerService> serviceCacheBuilder = EasyMock.createMock(ServiceCacheBuilder.class);
-		EasyMock.expect(serviceCacheBuilder.name(EasyMock.anyObject(String.class))).andReturn(serviceCacheBuilder).once();
-		EasyMock.expect(serviceCacheBuilder.build()).andReturn(serviceCache).once();
-		EasyMock.replay(serviceCacheBuilder);
+        String controllerId = "controller2013";
+        registry.registerController(controllerId);
 
-		// Mock ServiceDiscovery
-		ServiceDiscovery<ControllerService> serviceDiscovery = EasyMock.createMock(ServiceDiscovery.class);
-		serviceDiscovery.start();
-		EasyMock.expectLastCall().once();
-		EasyMock.expect(serviceDiscovery.serviceCacheBuilder()).andReturn(serviceCacheBuilder).once();
-		serviceDiscovery.registerService(EasyMock.anyObject(ServiceInstance.class));
-		EasyMock.expectLastCall().once();
-		EasyMock.replay(serviceDiscovery);
-		
-		// Mock CuratorFramework
-		CuratorFramework client = EasyMock.createMock(CuratorFramework.class);
-		client.start();
-		EasyMock.expectLastCall().once();
-		EasyMock.expect(client.usingNamespace(EasyMock.anyObject(String.class))).andReturn(client);
-		EasyMock.replay(client);
+        LoggingCallback callback = new LoggingCallback(1);
+        long dpidToRequest = 2000L;
 
-		// Mock ServiceDiscoveryBuilder
-		ServiceDiscoveryBuilder<ControllerService> builder = EasyMock.createMock(ServiceDiscoveryBuilder.class);
-		EasyMock.expect(builder.client(client)).andReturn(builder).once();
-		EasyMock.expect(builder.basePath(EasyMock.anyObject(String.class))).andReturn(builder);
-		EasyMock.expect(builder.build()).andReturn(serviceDiscovery);
-		EasyMock.replay(builder);
-		
-		PowerMock.mockStatic(ServiceDiscoveryBuilder.class);
-		EasyMock.expect(ServiceDiscoveryBuilder.builder(ControllerService.class)).andReturn(builder).once();
-		PowerMock.replay(ServiceDiscoveryBuilder.class);
+        try {
+            registry.requestControl(dpidToRequest, callback);
+        } catch (RegistryException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
 
-		return client;
-	}
-	
-	/**
-	 * Create mock {@link ServiceInstance} object using given controller ID.
-	 * @param controllerId Controller ID to represent instance's payload (ControllerService).
-	 * @return Mock ServiceInstance object
-	 */
-	private ServiceInstance<ControllerService> createServiceInstanceMock(String controllerId) {
-		ControllerService controllerService = EasyMock.createMock(ControllerService.class);
-		EasyMock.expect(controllerService.getControllerId()).andReturn(controllerId).anyTimes();
-		EasyMock.replay(controllerService);
-		
-		@SuppressWarnings("unchecked")
-		ServiceInstance<ControllerService> serviceInstance = EasyMock.createMock(ServiceInstance.class);
-		EasyMock.expect(serviceInstance.getPayload()).andReturn(controllerService).anyTimes();
-		EasyMock.replay(serviceInstance);
+        EasyMock.verify(latch);
+    }
 
-		return serviceInstance;
-	}
-	
-	/**
-	 * Create mock {@link PathChildrenCache} using given controller ID and DPIDs.
-	 * @param controllerId Controller ID to represent current data.
-	 * @param paths List of HexString indicating switch's DPID.
-	 * @param listener Callback object to be set as Listenable.
-	 * @return Mock PathChildrenCache object
-	 * @throws Exception
-	 */
-	private PathChildrenCache createPathChildrenCacheMock(final String controllerId, final String [] paths,
-			ListenerContainer<PathChildrenCacheListener> listener) throws Exception {
-		PathChildrenCache pathChildrenCache = EasyMock.createMock(PathChildrenCache.class);
-		
-		EasyMock.expect(pathChildrenCache.getListenable()).andReturn(listener).anyTimes();
-		
-		pathChildrenCache.start(EasyMock.anyObject(StartMode.class));
-		EasyMock.expectLastCall().anyTimes();
-		
-		List<ChildData> childs = new ArrayList<ChildData>();
-		for(String path : paths) {
-			childs.add(createChildDataMockForCurrentData(controllerId,path));
-		}
-		EasyMock.expect(pathChildrenCache.getCurrentData()).andReturn(childs).anyTimes();
-		
-		pathChildrenCache.rebuild();
-		EasyMock.expectLastCall().anyTimes();
-		
-		EasyMock.replay(pathChildrenCache);
+    /**
+     * Test if {@link ZookeeperRegistry#releaseControl(long)} correctly release control of specific switch.
+     * Because {@link ZookeeperRegistry#releaseControl(long)} doesn't return values, inject mock
+     * {@link LeaderLatch} object and verify latch is correctly set up.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testReleaseControl() throws Exception {
+        // Mock of LeaderLatch
+        LeaderLatch latch = EasyMock.createMock(LeaderLatch.class);
+        latch.addListener(EasyMock.anyObject(SwitchLeaderListener.class));
+        EasyMock.expectLastCall().once();
+        latch.start();
+        EasyMock.expectLastCall().once();
+        latch.removeListener(EasyMock.anyObject(SwitchLeaderListener.class));
+        EasyMock.expectLastCall().once();
+        latch.close();
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(latch);
 
-		return pathChildrenCache;
-	}
-	
-	/**
-	 * Create mock {@link ChildData} for {@link PathChildrenCache#getCurrentData()} return value.
-	 * This object need to include 'sequence number' in tail of path string. ("-0" means 0th sequence)
-	 * @param controllerId Controller ID
-	 * @param path HexString indicating switch's DPID
-	 * @return Mock ChildData object
-	 */
-	private ChildData createChildDataMockForCurrentData(String controllerId, String path) {
-		ChildData data = EasyMock.createMock(ChildData.class);
-		EasyMock.expect(data.getPath()).andReturn(path + "-0").anyTimes();
-		EasyMock.expect(data.getData()).andReturn(controllerId.getBytes()).anyTimes();
-		EasyMock.replay(data);
-		
-		return data;
-	}
+        PowerMock.expectNew(LeaderLatch.class,
+                EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))
+                .andReturn(latch).once();
+        PowerMock.replay(LeaderLatch.class);
 
-	/**
-	 * Inject relations between controllers and switches using callback object.
-	 * @throws Exception
-	 */
-	private void setPathChildrenCache() throws Exception {
-		pathChildrenCacheListener.childEvent(client,
-				createChildrenCacheEventMock("controller1", HexString.toHexString(1000L), PathChildrenCacheEvent.Type.CHILD_ADDED));
-		pathChildrenCacheListener.childEvent(client,
-				createChildrenCacheEventMock("controller2", HexString.toHexString(1001L), PathChildrenCacheEvent.Type.CHILD_ADDED));
-		pathChildrenCacheListener.childEvent(client,
-				createChildrenCacheEventMock("controller2", HexString.toHexString(1002L), PathChildrenCacheEvent.Type.CHILD_ADDED));
-	}
+        String controllerId = "controller2013";
+        registry.registerController(controllerId);
 
-	/**
-	 * Create mock {@link PathChildrenCacheEvent} object using given controller ID and DPID.
-	 * @param controllerId Controller ID.
-	 * @param path HexString of DPID.
-	 * @param type Event type to be set to mock object.
-	 * @return Mock PathChildrenCacheEvent object
-	 */
-	private PathChildrenCacheEvent createChildrenCacheEventMock(String controllerId, String path,
-			PathChildrenCacheEvent.Type type) {
-		PathChildrenCacheEvent event = EasyMock.createMock(PathChildrenCacheEvent.class);
-		ChildData data = EasyMock.createMock(ChildData.class);
-		
-		EasyMock.expect(data.getPath()).andReturn(path).anyTimes();
-		EasyMock.expect(data.getData()).andReturn(controllerId.getBytes()).anyTimes();
-		EasyMock.replay(data);
-		
-		EasyMock.expect(event.getType()).andReturn(type).anyTimes();
-		EasyMock.expect(event.getData()).andReturn(data).anyTimes();
-		EasyMock.replay(event);
-		
-		return event;
-	}
+        long dpidToRequest = 2000L;
+        LoggingCallback callback = new LoggingCallback(1);
+
+        registry.requestControl(dpidToRequest, callback);
+        registry.releaseControl(dpidToRequest);
+
+        EasyMock.verify(latch);
+    }
+
+    /**
+     * Test if {@link ZookeeperRegistry#hasControl(long)} returns correct status whether controller has control of specific switch.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testHasControl() throws Exception {
+        // Mock of LeaderLatch
+        LeaderLatch latch = EasyMock.createMock(LeaderLatch.class);
+        latch.addListener(EasyMock.anyObject(SwitchLeaderListener.class));
+        EasyMock.expectLastCall().once();
+        latch.start();
+        EasyMock.expectLastCall().once();
+        EasyMock.expect(latch.hasLeadership()).andReturn(true).anyTimes();
+        latch.removeListener(EasyMock.anyObject(SwitchLeaderListener.class));
+        EasyMock.expectLastCall().once();
+        latch.close();
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(latch);
+
+        PowerMock.expectNew(LeaderLatch.class,
+                EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))
+                .andReturn(latch);
+        PowerMock.replay(LeaderLatch.class);
+
+        String controllerId = "controller2013";
+        registry.registerController(controllerId);
+
+        long dpidToRequest = 2000L;
+        LoggingCallback callback = new LoggingCallback(2);
+
+        // Test before request control
+        assertFalse(registry.hasControl(dpidToRequest));
+
+        registry.requestControl(dpidToRequest, callback);
+
+        // Test after request control
+        assertTrue(registry.hasControl(dpidToRequest));
+
+        registry.releaseControl(dpidToRequest);
+
+        // Test after release control
+        assertFalse(registry.hasControl(dpidToRequest));
+
+        EasyMock.verify(latch);
+    }
+
+    /**
+     * Test if {@link ZookeeperRegistry#getControllerForSwitch(long)} correctly returns controller ID of specific switch.
+     * Relation between controllers and switches are defined by {@link ZookeeperRegistryTest#setPathChildrenCache()} function.
+     *
+     * @throws Throwable
+     */
+    @Test
+    public void testGetControllerForSwitch() throws Throwable {
+        long dpidRegistered = 1000L;
+        long dpidNotRegistered = 2000L;
+
+        setPathChildrenCache();
+
+        String controllerForSw = registry.getControllerForSwitch(dpidRegistered);
+        assertEquals("controller1", controllerForSw);
+
+        controllerForSw = registry.getControllerForSwitch(dpidNotRegistered);
+        assertEquals(null, controllerForSw);
+    }
+
+    /**
+     * Test if {@link ZookeeperRegistry#getSwitchesControlledByController(String)} returns correct list of
+     * switches controlled by a controller.
+     *
+     * @throws Exception
+     */
+    // TODO: Test after getSwitchesControlledByController() is implemented.
+    @Ignore
+    @Test
+    public void testGetSwitchesControlledByController() throws Exception {
+        String controllerIdRegistered = "controller1";
+        String dpidRegistered = HexString.toHexString(1000L);
+        String controllerIdNotRegistered = CONTROLLER_ID;
+
+        Collection<Long> switches = registry.getSwitchesControlledByController(controllerIdRegistered);
+        assertNotNull(switches);
+        assertTrue(switches.contains(dpidRegistered));
+
+        switches = registry.getSwitchesControlledByController(controllerIdNotRegistered);
+        assertNotNull(switches);
+        assertEquals(0, switches.size());
+    }
+
+    /**
+     * Test if {@link ZookeeperRegistry#getAllSwitches()} returns correct list of all switches.
+     * Switches are injected in {@link ZookeeperRegistryTest#setPathChildrenCache()} function.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testGetAllSwitches() throws Exception {
+        String[] dpids = {
+                HexString.toHexString(1000L),
+                HexString.toHexString(1001L),
+                HexString.toHexString(1002L),
+        };
+
+        setPathChildrenCache();
+
+        Map<String, List<ControllerRegistryEntry>> switches = registry.getAllSwitches();
+        assertNotNull(switches);
+        assertEquals(dpids.length, switches.size());
+        for (String dpid : dpids) {
+            assertTrue(switches.keySet().contains(dpid));
+        }
+    }
+
+    /**
+     * Test if {@link ZookeeperRegistry#allocateUniqueIdBlock()} can assign IdBlock without duplication.
+     */
+    @Test
+    public void testAllocateUniqueIdBlock() {
+        // Number of blocks to be verified that any of them has unique block
+        final int NUM_BLOCKS = 100;
+        ArrayList<IdBlock> blocks = new ArrayList<IdBlock>(NUM_BLOCKS);
+
+        for (int i = 0; i < NUM_BLOCKS; ++i) {
+            IdBlock block = registry.allocateUniqueIdBlock();
+            assertNotNull(block);
+            blocks.add(block);
+        }
+
+        for (int i = 0; i < NUM_BLOCKS; ++i) {
+            IdBlock block1 = blocks.get(i);
+            for (int j = i + 1; j < NUM_BLOCKS; ++j) {
+                IdBlock block2 = blocks.get(j);
+                IdBlock lower, higher;
+
+                if (block1.getStart() < block2.getStart()) {
+                    lower = block1;
+                    higher = block2;
+                } else {
+                    lower = block2;
+                    higher = block1;
+                }
+
+                assertTrue(lower.getSize() > 0L);
+                assertTrue(higher.getSize() > 0L);
+                assertTrue(lower.getEnd() <= higher.getStart());
+            }
+        }
+    }
+
+
+    //-------------------------- Creation of mock objects --------------------------
+
+    /**
+     * Create mock {@link CuratorFramework} object with initial value below.<br>
+     * [Ctrl ID]    : [DPID]<br>
+     * controller1    :  1000<br>
+     * controller2    :  1001<br>
+     * controller2    :  1002<br>
+     * controller2013 : nothing
+     *
+     * @return Created mock object
+     * @throws Exception
+     */
+    @SuppressWarnings({"serial", "unchecked"})
+    private CuratorFramework createCuratorFrameworkMock() throws Exception {
+        // Mock of AtomicValue
+        AtomicValue<Long> atomicValue = EasyMock.createMock(AtomicValue.class);
+        EasyMock.expect(atomicValue.succeeded()).andReturn(true).anyTimes();
+        EasyMock.expect(atomicValue.preValue()).andAnswer(new IAnswer<Long>() {
+            private long value = 0;
+
+            @Override
+            public Long answer() throws Throwable {
+                value += ID_BLOCK_SIZE;
+                return value;
+            }
+        }).anyTimes();
+        EasyMock.expect(atomicValue.postValue()).andAnswer(new IAnswer<Long>() {
+            private long value = ID_BLOCK_SIZE;
+
+            @Override
+            public Long answer() throws Throwable {
+                value += ID_BLOCK_SIZE;
+                return value;
+            }
+        }).anyTimes();
+        EasyMock.replay(atomicValue);
+
+        // Mock DistributedAtomicLong
+        DistributedAtomicLong daLong = EasyMock.createMock(DistributedAtomicLong.class);
+        EasyMock.expect(daLong.add(EasyMock.anyLong())).andReturn(atomicValue).anyTimes();
+        EasyMock.replay(daLong);
+        PowerMock.expectNew(DistributedAtomicLong.class,
+                new Class<?>[]{CuratorFramework.class, String.class, RetryPolicy.class},
+                EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(RetryPolicy.class)).
+                andReturn(daLong).anyTimes();
+        PowerMock.replay(DistributedAtomicLong.class);
+
+        // Mock ListenerContainer
+        ListenerContainer<PathChildrenCacheListener> listenerContainer = EasyMock.createMock(ListenerContainer.class);
+        listenerContainer.addListener(EasyMock.anyObject(PathChildrenCacheListener.class));
+        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+            @Override
+            public Object answer() throws Throwable {
+                pathChildrenCacheListener = (PathChildrenCacheListener) EasyMock.getCurrentArguments()[0];
+                return null;
+            }
+        }).once();
+        EasyMock.replay(listenerContainer);
+
+        // Mock PathChildrenCache
+        PathChildrenCache pathChildrenCacheMain = createPathChildrenCacheMock(CONTROLLER_ID, new String[]{"/switches"}, listenerContainer);
+        PathChildrenCache pathChildrenCache1 = createPathChildrenCacheMock("controller1", new String[]{HexString.toHexString(1000L)}, listenerContainer);
+        PathChildrenCache pathChildrenCache2 = createPathChildrenCacheMock("controller2", new String[]{
+                HexString.toHexString(1001L), HexString.toHexString(1002L)}, listenerContainer);
+
+        // Mock PathChildrenCache constructor
+        PowerMock.expectNew(PathChildrenCache.class,
+                EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyBoolean()).
+                andReturn(pathChildrenCacheMain).once();
+        PowerMock.expectNew(PathChildrenCache.class,
+                EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyBoolean()).
+                andReturn(pathChildrenCache1).once();
+        PowerMock.expectNew(PathChildrenCache.class,
+                EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyBoolean()).
+                andReturn(pathChildrenCache2).anyTimes();
+        PowerMock.replay(PathChildrenCache.class);
+
+        // Mock ServiceCache
+        ServiceCache<ControllerService> serviceCache = EasyMock.createMock(ServiceCache.class);
+        serviceCache.start();
+        EasyMock.expectLastCall().once();
+        EasyMock.expect(serviceCache.getInstances()).andReturn(new ArrayList<ServiceInstance<ControllerService>>() {{
+            add(createServiceInstanceMock("controller1"));
+            add(createServiceInstanceMock("controller2"));
+        }}).anyTimes();
+        EasyMock.replay(serviceCache);
+
+        // Mock ServiceCacheBuilder
+        ServiceCacheBuilder<ControllerService> serviceCacheBuilder = EasyMock.createMock(ServiceCacheBuilder.class);
+        EasyMock.expect(serviceCacheBuilder.name(EasyMock.anyObject(String.class))).andReturn(serviceCacheBuilder).once();
+        EasyMock.expect(serviceCacheBuilder.build()).andReturn(serviceCache).once();
+        EasyMock.replay(serviceCacheBuilder);
+
+        // Mock ServiceDiscovery
+        ServiceDiscovery<ControllerService> serviceDiscovery = EasyMock.createMock(ServiceDiscovery.class);
+        serviceDiscovery.start();
+        EasyMock.expectLastCall().once();
+        EasyMock.expect(serviceDiscovery.serviceCacheBuilder()).andReturn(serviceCacheBuilder).once();
+        serviceDiscovery.registerService(EasyMock.anyObject(ServiceInstance.class));
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(serviceDiscovery);
+
+        // Mock CuratorFramework
+        CuratorFramework client = EasyMock.createMock(CuratorFramework.class);
+        client.start();
+        EasyMock.expectLastCall().once();
+        EasyMock.expect(client.usingNamespace(EasyMock.anyObject(String.class))).andReturn(client);
+        EasyMock.replay(client);
+
+        // Mock ServiceDiscoveryBuilder
+        ServiceDiscoveryBuilder<ControllerService> builder = EasyMock.createMock(ServiceDiscoveryBuilder.class);
+        EasyMock.expect(builder.client(client)).andReturn(builder).once();
+        EasyMock.expect(builder.basePath(EasyMock.anyObject(String.class))).andReturn(builder);
+        EasyMock.expect(builder.build()).andReturn(serviceDiscovery);
+        EasyMock.replay(builder);
+
+        PowerMock.mockStatic(ServiceDiscoveryBuilder.class);
+        EasyMock.expect(ServiceDiscoveryBuilder.builder(ControllerService.class)).andReturn(builder).once();
+        PowerMock.replay(ServiceDiscoveryBuilder.class);
+
+        return client;
+    }
+
+    /**
+     * Create mock {@link ServiceInstance} object using given controller ID.
+     *
+     * @param controllerId Controller ID to represent instance's payload (ControllerService).
+     * @return Mock ServiceInstance object
+     */
+    private ServiceInstance<ControllerService> createServiceInstanceMock(String controllerId) {
+        ControllerService controllerService = EasyMock.createMock(ControllerService.class);
+        EasyMock.expect(controllerService.getControllerId()).andReturn(controllerId).anyTimes();
+        EasyMock.replay(controllerService);
+
+        @SuppressWarnings("unchecked")
+        ServiceInstance<ControllerService> serviceInstance = EasyMock.createMock(ServiceInstance.class);
+        EasyMock.expect(serviceInstance.getPayload()).andReturn(controllerService).anyTimes();
+        EasyMock.replay(serviceInstance);
+
+        return serviceInstance;
+    }
+
+    /**
+     * Create mock {@link PathChildrenCache} using given controller ID and DPIDs.
+     *
+     * @param controllerId Controller ID to represent current data.
+     * @param paths        List of HexString indicating switch's DPID.
+     * @param listener     Callback object to be set as Listenable.
+     * @return Mock PathChildrenCache object
+     * @throws Exception
+     */
+    private PathChildrenCache createPathChildrenCacheMock(final String controllerId, final String[] paths,
+                                                          ListenerContainer<PathChildrenCacheListener> listener) throws Exception {
+        PathChildrenCache pathChildrenCache = EasyMock.createMock(PathChildrenCache.class);
+
+        EasyMock.expect(pathChildrenCache.getListenable()).andReturn(listener).anyTimes();
+
+        pathChildrenCache.start(EasyMock.anyObject(StartMode.class));
+        EasyMock.expectLastCall().anyTimes();
+
+        List<ChildData> childs = new ArrayList<ChildData>();
+        for (String path : paths) {
+            childs.add(createChildDataMockForCurrentData(controllerId, path));
+        }
+        EasyMock.expect(pathChildrenCache.getCurrentData()).andReturn(childs).anyTimes();
+
+        pathChildrenCache.rebuild();
+        EasyMock.expectLastCall().anyTimes();
+
+        EasyMock.replay(pathChildrenCache);
+
+        return pathChildrenCache;
+    }
+
+    /**
+     * Create mock {@link ChildData} for {@link PathChildrenCache#getCurrentData()} return value.
+     * This object need to include 'sequence number' in tail of path string. ("-0" means 0th sequence)
+     *
+     * @param controllerId Controller ID
+     * @param path         HexString indicating switch's DPID
+     * @return Mock ChildData object
+     */
+    private ChildData createChildDataMockForCurrentData(String controllerId, String path) {
+        ChildData data = EasyMock.createMock(ChildData.class);
+        EasyMock.expect(data.getPath()).andReturn(path + "-0").anyTimes();
+        EasyMock.expect(data.getData()).andReturn(controllerId.getBytes()).anyTimes();
+        EasyMock.replay(data);
+
+        return data;
+    }
+
+    /**
+     * Inject relations between controllers and switches using callback object.
+     *
+     * @throws Exception
+     */
+    private void setPathChildrenCache() throws Exception {
+        pathChildrenCacheListener.childEvent(client,
+                createChildrenCacheEventMock("controller1", HexString.toHexString(1000L), PathChildrenCacheEvent.Type.CHILD_ADDED));
+        pathChildrenCacheListener.childEvent(client,
+                createChildrenCacheEventMock("controller2", HexString.toHexString(1001L), PathChildrenCacheEvent.Type.CHILD_ADDED));
+        pathChildrenCacheListener.childEvent(client,
+                createChildrenCacheEventMock("controller2", HexString.toHexString(1002L), PathChildrenCacheEvent.Type.CHILD_ADDED));
+    }
+
+    /**
+     * Create mock {@link PathChildrenCacheEvent} object using given controller ID and DPID.
+     *
+     * @param controllerId Controller ID.
+     * @param path         HexString of DPID.
+     * @param type         Event type to be set to mock object.
+     * @return Mock PathChildrenCacheEvent object
+     */
+    private PathChildrenCacheEvent createChildrenCacheEventMock(String controllerId, String path,
+                                                                PathChildrenCacheEvent.Type type) {
+        PathChildrenCacheEvent event = EasyMock.createMock(PathChildrenCacheEvent.class);
+        ChildData data = EasyMock.createMock(ChildData.class);
+
+        EasyMock.expect(data.getPath()).andReturn(path).anyTimes();
+        EasyMock.expect(data.getData()).andReturn(controllerId.getBytes()).anyTimes();
+        EasyMock.replay(data);
+
+        EasyMock.expect(event.getType()).andReturn(type).anyTimes();
+        EasyMock.expect(event.getData()).andReturn(data).anyTimes();
+        EasyMock.replay(event);
+
+        return event;
+    }
 }
diff --git a/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java b/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java
index 1283bb0..4377c8c 100644
--- a/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java
+++ b/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java
@@ -1,6 +1,7 @@
 package net.onrc.onos.core.util;
 
 import static org.junit.Assert.assertEquals;
+
 import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.core.util.FlowEntryAction.ActionEnqueue;
 import net.onrc.onos.core.util.FlowEntryAction.ActionOutput;
@@ -16,412 +17,412 @@
 
 public class FlowEntryActionTest {
 
-	@Test
-	public void testSetActionOutputActionOutput(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionOutput actout = new FlowEntryAction.ActionOutput(new Port((short)42));
-		act.setActionOutput(actout);
+    @Test
+    public void testSetActionOutputActionOutput() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionOutput actout = new FlowEntryAction.ActionOutput(new Port((short) 42));
+        act.setActionOutput(actout);
 
-		assertEquals("action output",FlowEntryAction.ActionValues.ACTION_OUTPUT , act.actionType());
-		assertEquals("actionOutput port should be the same", actout.port(), act.actionOutput().port());
-		assertEquals("actionOutput maxlen should be the same", actout.maxLen(), act.actionOutput().maxLen());
+        assertEquals("action output", FlowEntryAction.ActionValues.ACTION_OUTPUT, act.actionType());
+        assertEquals("actionOutput port should be the same", actout.port(), act.actionOutput().port());
+        assertEquals("actionOutput maxlen should be the same", actout.maxLen(), act.actionOutput().maxLen());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionOutputPort(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionOutput(new Port((short)42));
+    @Test
+    public void testSetActionOutputPort() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionOutput(new Port((short) 42));
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionOutputToController(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionOutputToController((short)0);
+    @Test
+    public void testSetActionOutputToController() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionOutputToController((short) 0);
 
-		FlowEntryAction act_copy = new FlowEntryAction();
-		act_copy.setActionOutput(new Port(Port.PortValues.PORT_CONTROLLER));
-		;
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction();
+        act_copy.setActionOutput(new Port(Port.PortValues.PORT_CONTROLLER));
+        ;
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetVlanIdActionSetVlanId(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionSetVlanId actVlan = new FlowEntryAction.ActionSetVlanId((short)42);
-		act.setActionSetVlanId(actVlan);
+    @Test
+    public void testSetActionSetVlanIdActionSetVlanId() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionSetVlanId actVlan = new FlowEntryAction.ActionSetVlanId((short) 42);
+        act.setActionSetVlanId(actVlan);
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_VLAN_VID , act.actionType());
-		assertEquals("vlanid should be the same", actVlan.vlanId(), act.actionSetVlanId().vlanId());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_VLAN_VID, act.actionType());
+        assertEquals("vlanid should be the same", actVlan.vlanId(), act.actionSetVlanId().vlanId());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetVlanIdShort(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionSetVlanId((short)42);
+    @Test
+    public void testSetActionSetVlanIdShort() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionSetVlanId((short) 42);
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetVlanPriorityActionSetVlanPriority(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionSetVlanPriority actVlan = new FlowEntryAction.ActionSetVlanPriority((byte)42);
-		act.setActionSetVlanPriority(actVlan);
+    @Test
+    public void testSetActionSetVlanPriorityActionSetVlanPriority() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionSetVlanPriority actVlan = new FlowEntryAction.ActionSetVlanPriority((byte) 42);
+        act.setActionSetVlanPriority(actVlan);
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_VLAN_PCP , act.actionType());
-		assertEquals("vlan priority should be the same", actVlan.vlanPriority(), act.actionSetVlanPriority().vlanPriority());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_VLAN_PCP, act.actionType());
+        assertEquals("vlan priority should be the same", actVlan.vlanPriority(), act.actionSetVlanPriority().vlanPriority());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetVlanPriorityByte(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionSetVlanPriority((byte)42);
+    @Test
+    public void testSetActionSetVlanPriorityByte() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionSetVlanPriority((byte) 42);
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionStripVlanActionStripVlan(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionStripVlan actVlan = new FlowEntryAction.ActionStripVlan();
-		act.setActionStripVlan(actVlan);
+    @Test
+    public void testSetActionStripVlanActionStripVlan() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionStripVlan actVlan = new FlowEntryAction.ActionStripVlan();
+        act.setActionStripVlan(actVlan);
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_STRIP_VLAN , act.actionType());
-		assertEquals("vlanid should be the same", actVlan.stripVlan(), act.actionStripVlan().stripVlan());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_STRIP_VLAN, act.actionType());
+        assertEquals("vlanid should be the same", actVlan.stripVlan(), act.actionStripVlan().stripVlan());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionStripVlanBoolean(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionStripVlan(true);
+    @Test
+    public void testSetActionStripVlanBoolean() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionStripVlan(true);
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetEthernetSrcAddrActionSetEthernetAddr(){
-		FlowEntryAction act = new FlowEntryAction();
-		byte[] mac = { 1, 2, 3, 4, 5, 6 };
-		ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
-		act.setActionSetEthernetSrcAddr( setEth );
+    @Test
+    public void testSetActionSetEthernetSrcAddrActionSetEthernetAddr() {
+        FlowEntryAction act = new FlowEntryAction();
+        byte[] mac = {1, 2, 3, 4, 5, 6};
+        ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
+        act.setActionSetEthernetSrcAddr(setEth);
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_DL_SRC , act.actionType());
-		assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetSrcAddr().addr());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_DL_SRC, act.actionType());
+        assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetSrcAddr().addr());
 
-		
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-	@Test
-	public void testSetActionSetEthernetSrcAddrMACAddress(){
-		FlowEntryAction act = new FlowEntryAction();
-		byte[] mac = { 1, 2, 3, 4, 5, 6 };
-		act.setActionSetEthernetSrcAddr(new MACAddress(mac));
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+    @Test
+    public void testSetActionSetEthernetSrcAddrMACAddress() {
+        FlowEntryAction act = new FlowEntryAction();
+        byte[] mac = {1, 2, 3, 4, 5, 6};
+        act.setActionSetEthernetSrcAddr(new MACAddress(mac));
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-	@Test
-	public void testSetActionSetEthernetDstAddrActionSetEthernetAddr(){
-		FlowEntryAction act = new FlowEntryAction();
-		byte[] mac = { 1, 2, 3, 4, 5, 6 };
-		ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
-		act.setActionSetEthernetDstAddr( setEth );
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_DL_DST , act.actionType());
-		assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetDstAddr().addr());
+    @Test
+    public void testSetActionSetEthernetDstAddrActionSetEthernetAddr() {
+        FlowEntryAction act = new FlowEntryAction();
+        byte[] mac = {1, 2, 3, 4, 5, 6};
+        ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
+        act.setActionSetEthernetDstAddr(setEth);
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_DL_DST, act.actionType());
+        assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetDstAddr().addr());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-	@Test
-	public void testSetActionSetEthernetDstAddrMACAddress(){
-		FlowEntryAction act = new FlowEntryAction();
-		byte[] mac = { 1, 2, 3, 4, 5, 6 };
-		act.setActionSetEthernetDstAddr(new MACAddress(mac));
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
+
+    @Test
+    public void testSetActionSetEthernetDstAddrMACAddress() {
+        FlowEntryAction act = new FlowEntryAction();
+        byte[] mac = {1, 2, 3, 4, 5, 6};
+        act.setActionSetEthernetDstAddr(new MACAddress(mac));
+
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+    @Test
+    public void testSetActionSetIPv4SrcAddrActionSetIPv4Addr() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
+        act.setActionSetIPv4SrcAddr(setIp);
 
-	@Test
-	public void testSetActionSetIPv4SrcAddrActionSetIPv4Addr(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
-		act.setActionSetIPv4SrcAddr( setIp );
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_NW_SRC, act.actionType());
+        assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4SrcAddr().addr());
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_SRC , act.actionType());
-		assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4SrcAddr().addr());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetIPv4SrcAddrIPv4(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionSetIPv4SrcAddr(new IPv4("127.0.0.1"));
+    @Test
+    public void testSetActionSetIPv4SrcAddrIPv4() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionSetIPv4SrcAddr(new IPv4("127.0.0.1"));
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetIPv4DstAddrActionSetIPv4Addr(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
-		act.setActionSetIPv4DstAddr( setIp );
+    @Test
+    public void testSetActionSetIPv4DstAddrActionSetIPv4Addr() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
+        act.setActionSetIPv4DstAddr(setIp);
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_DST , act.actionType());
-		assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4DstAddr().addr());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_NW_DST, act.actionType());
+        assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4DstAddr().addr());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetIPv4DstAddrIPv4(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionSetIPv4DstAddr(new IPv4("127.0.0.1"));
+    @Test
+    public void testSetActionSetIPv4DstAddrIPv4() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionSetIPv4DstAddr(new IPv4("127.0.0.1"));
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetIpToSActionSetIpToS(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionSetIpToS setIpTos = new FlowEntryAction.ActionSetIpToS((byte)42);
-		act.setActionSetIpToS( setIpTos );
+    @Test
+    public void testSetActionSetIpToSActionSetIpToS() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionSetIpToS setIpTos = new FlowEntryAction.ActionSetIpToS((byte) 42);
+        act.setActionSetIpToS(setIpTos);
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_TOS , act.actionType());
-		assertEquals("tos should be the same", setIpTos.ipToS(), act.actionSetIpToS().ipToS());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_NW_TOS, act.actionType());
+        assertEquals("tos should be the same", setIpTos.ipToS(), act.actionSetIpToS().ipToS());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetIpToSByte(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionSetIpToS((byte)1);
+    @Test
+    public void testSetActionSetIpToSByte() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionSetIpToS((byte) 1);
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetTcpUdpSrcPortActionSetTcpUdpPort(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short)42);
-		act.setActionSetTcpUdpSrcPort( setPorts );
+    @Test
+    public void testSetActionSetTcpUdpSrcPortActionSetTcpUdpPort() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short) 42);
+        act.setActionSetTcpUdpSrcPort(setPorts);
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_TP_SRC , act.actionType());
-		assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpSrcPort().port());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_TP_SRC, act.actionType());
+        assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpSrcPort().port());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetTcpUdpSrcPortShort(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionSetTcpUdpSrcPort((short)1);
+    @Test
+    public void testSetActionSetTcpUdpSrcPortShort() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionSetTcpUdpSrcPort((short) 1);
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetTcpUdpDstPortActionSetTcpUdpPort(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short)42);
-		act.setActionSetTcpUdpDstPort( setPorts );
+    @Test
+    public void testSetActionSetTcpUdpDstPortActionSetTcpUdpPort() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short) 42);
+        act.setActionSetTcpUdpDstPort(setPorts);
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_TP_DST , act.actionType());
-		assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpDstPort().port());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_TP_DST, act.actionType());
+        assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpDstPort().port());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionSetTcpUdpDstPortShort(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionSetTcpUdpDstPort((short)1);
+    @Test
+    public void testSetActionSetTcpUdpDstPortShort() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionSetTcpUdpDstPort((short) 1);
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionEnqueueActionEnqueue(){
-		FlowEntryAction act = new FlowEntryAction();
-		ActionEnqueue enq = new FlowEntryAction.ActionEnqueue(new Port((short)42), 1);
-		act.setActionEnqueue( enq );
+    @Test
+    public void testSetActionEnqueueActionEnqueue() {
+        FlowEntryAction act = new FlowEntryAction();
+        ActionEnqueue enq = new FlowEntryAction.ActionEnqueue(new Port((short) 42), 1);
+        act.setActionEnqueue(enq);
 
-		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_ENQUEUE , act.actionType());
-		assertEquals("port should be the same", enq.port(), act.actionEnqueue().port());
-		assertEquals("queue id should be the same", enq.queueId(), act.actionEnqueue().queueId());
+        assertEquals("action type", FlowEntryAction.ActionValues.ACTION_ENQUEUE, act.actionType());
+        assertEquals("port should be the same", enq.port(), act.actionEnqueue().port());
+        assertEquals("queue id should be the same", enq.queueId(), act.actionEnqueue().queueId());
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
-	@Test
-	public void testSetActionEnqueuePortInt(){
-		FlowEntryAction act = new FlowEntryAction();
-		act.setActionEnqueue(new Port((short)42), 1);
+    @Test
+    public void testSetActionEnqueuePortInt() {
+        FlowEntryAction act = new FlowEntryAction();
+        act.setActionEnqueue(new Port((short) 42), 1);
 
-		FlowEntryAction act_copy = new FlowEntryAction(act);
-		FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+        FlowEntryAction act_copy = new FlowEntryAction(act);
+        FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
 
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy.toString());
-		assertEquals("toString must match between copies", act.toString(),
-				act_copy2.toString());
-	}
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy.toString());
+        assertEquals("toString must match between copies", act.toString(),
+                act_copy2.toString());
+    }
 
 }
diff --git a/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java b/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java
index 515a631..353b8ab 100644
--- a/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java
+++ b/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java
@@ -3,6 +3,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+
 import net.floodlightcontroller.util.MACAddress;
 
 import org.junit.Before;
@@ -10,303 +11,303 @@
 
 public class FlowEntryMatchTest {
 
-	FlowEntryMatch match;
-	
-	Port inport = new Port((short)1);
-	byte[] byte1 = { 1, 2, 3, 4, 5, 6 };
-	byte[] byte2 = { 6, 5, 4, 3, 2, 1 };
-	MACAddress mac1 = new MACAddress(byte1);
-	MACAddress mac2 = new MACAddress(byte2);
-	Short ether = Short.valueOf((short)2);
-	Short vlanid = Short.valueOf((short)3);
-	Byte vlanprio = Byte.valueOf((byte)4);
-	IPv4Net ip1 = new IPv4Net("127.0.0.1/32");
-	IPv4Net ip2 = new IPv4Net("127.0.0.2/32");
-	Byte ipproto = Byte.valueOf((byte)5);
-	Byte ipToS = Byte.valueOf((byte)6);
-	Short tport1 = Short.valueOf((short)7);
-	Short tport2 = Short.valueOf((short)8);
-	
-	@Before
-	public void setUp() throws Exception{
-		match = new FlowEntryMatch();
-		match.enableInPort( inport);
-		match.enableSrcMac( mac1 );
-		match.enableDstMac( mac2 );
-		match.enableEthernetFrameType( ether );
-		match.enableVlanId( vlanid );
-		match.enableVlanPriority( vlanprio );
-		match.enableSrcIPv4Net( ip1 );
-		match.enableDstIPv4Net( ip2 );
-		match.enableIpProto( ipproto );
-		match.enableIpToS( ipToS );
-		match.enableSrcTcpUdpPort( tport1 );
-		match.enableDstTcpUdpPort( tport2 );
-	}
+    FlowEntryMatch match;
 
-	@Test
-	public void testFlowEntryMatch(){
-		FlowEntryMatch def = new FlowEntryMatch();
-		
-		assertEquals("default null", null, def.inPort() );
-		assertEquals("default null", null, def.srcMac() );
-		assertEquals("default null", null, def.dstMac() );
-		assertEquals("default null", null, def.ethernetFrameType() );
-		assertEquals("default null", null, def.vlanId() );
-		assertEquals("default null", null, def.vlanPriority() );
-		assertEquals("default null", null, def.srcIPv4Net() );
-		assertEquals("default null", null, def.dstIPv4Net() );
-		assertEquals("default null", null, def.ipProto() );
-		assertEquals("default null", null, def.ipToS() );
-		assertEquals("default null", null, def.srcTcpUdpPort() );
-		assertEquals("default null", null, def.dstTcpUdpPort() );
-	}
+    Port inport = new Port((short) 1);
+    byte[] byte1 = {1, 2, 3, 4, 5, 6};
+    byte[] byte2 = {6, 5, 4, 3, 2, 1};
+    MACAddress mac1 = new MACAddress(byte1);
+    MACAddress mac2 = new MACAddress(byte2);
+    Short ether = Short.valueOf((short) 2);
+    Short vlanid = Short.valueOf((short) 3);
+    Byte vlanprio = Byte.valueOf((byte) 4);
+    IPv4Net ip1 = new IPv4Net("127.0.0.1/32");
+    IPv4Net ip2 = new IPv4Net("127.0.0.2/32");
+    Byte ipproto = Byte.valueOf((byte) 5);
+    Byte ipToS = Byte.valueOf((byte) 6);
+    Short tport1 = Short.valueOf((short) 7);
+    Short tport2 = Short.valueOf((short) 8);
 
-	@Test
-	public void testFlowEntryMatchFlowEntryMatch(){
-		FlowEntryMatch def_base = new FlowEntryMatch();
-		FlowEntryMatch def = new FlowEntryMatch(def_base);
+    @Before
+    public void setUp() throws Exception {
+        match = new FlowEntryMatch();
+        match.enableInPort(inport);
+        match.enableSrcMac(mac1);
+        match.enableDstMac(mac2);
+        match.enableEthernetFrameType(ether);
+        match.enableVlanId(vlanid);
+        match.enableVlanPriority(vlanprio);
+        match.enableSrcIPv4Net(ip1);
+        match.enableDstIPv4Net(ip2);
+        match.enableIpProto(ipproto);
+        match.enableIpToS(ipToS);
+        match.enableSrcTcpUdpPort(tport1);
+        match.enableDstTcpUdpPort(tport2);
+    }
 
-		assertEquals("default null", null, def.inPort() );
-		assertEquals("default null", null, def.srcMac() );
-		assertEquals("default null", null, def.dstMac() );
-		assertEquals("default null", null, def.ethernetFrameType() );
-		assertEquals("default null", null, def.vlanId() );
-		assertEquals("default null", null, def.vlanPriority() );
-		assertEquals("default null", null, def.srcIPv4Net() );
-		assertEquals("default null", null, def.dstIPv4Net() );
-		assertEquals("default null", null, def.ipProto() );
-		assertEquals("default null", null, def.ipToS() );
-		assertEquals("default null", null, def.srcTcpUdpPort() );
-		assertEquals("default null", null, def.dstTcpUdpPort() );
-		
-		FlowEntryMatch copy = new FlowEntryMatch( match );
-		
-		assertEquals("inport", inport, copy.inPort() );
-		assertEquals("mac1", mac1, copy.srcMac() );
-		assertEquals("mac2", mac2, copy.dstMac() );
-		assertEquals("ether", ether, copy.ethernetFrameType() );
-		assertEquals("vlan id", vlanid, copy.vlanId() );
-		assertEquals("vlan prio", vlanprio, copy.vlanPriority() );
-		assertEquals("ip1", ip1, copy.srcIPv4Net() );
-		assertEquals("ip2", ip2, copy.dstIPv4Net() );
-		assertEquals("ip proto", ipproto, copy.ipProto() );
-		assertEquals("tos", ipToS, copy.ipToS() );
-		assertEquals("src port", tport1, copy.srcTcpUdpPort() );
-		assertEquals("dst port", tport2, copy.dstTcpUdpPort() );
+    @Test
+    public void testFlowEntryMatch() {
+        FlowEntryMatch def = new FlowEntryMatch();
 
-	}
+        assertEquals("default null", null, def.inPort());
+        assertEquals("default null", null, def.srcMac());
+        assertEquals("default null", null, def.dstMac());
+        assertEquals("default null", null, def.ethernetFrameType());
+        assertEquals("default null", null, def.vlanId());
+        assertEquals("default null", null, def.vlanPriority());
+        assertEquals("default null", null, def.srcIPv4Net());
+        assertEquals("default null", null, def.dstIPv4Net());
+        assertEquals("default null", null, def.ipProto());
+        assertEquals("default null", null, def.ipToS());
+        assertEquals("default null", null, def.srcTcpUdpPort());
+        assertEquals("default null", null, def.dstTcpUdpPort());
+    }
 
-	@Test
-	public void testInPort(){
-		assertEquals("inport", inport, match.inPort() );
-	}
+    @Test
+    public void testFlowEntryMatchFlowEntryMatch() {
+        FlowEntryMatch def_base = new FlowEntryMatch();
+        FlowEntryMatch def = new FlowEntryMatch(def_base);
 
-	@Test
-	public void testDisableInPort(){
-		match.disableInPort();
-		assertEquals("inport", null, match.inPort() );
-		assertFalse( match.matchInPort() );
-	}
+        assertEquals("default null", null, def.inPort());
+        assertEquals("default null", null, def.srcMac());
+        assertEquals("default null", null, def.dstMac());
+        assertEquals("default null", null, def.ethernetFrameType());
+        assertEquals("default null", null, def.vlanId());
+        assertEquals("default null", null, def.vlanPriority());
+        assertEquals("default null", null, def.srcIPv4Net());
+        assertEquals("default null", null, def.dstIPv4Net());
+        assertEquals("default null", null, def.ipProto());
+        assertEquals("default null", null, def.ipToS());
+        assertEquals("default null", null, def.srcTcpUdpPort());
+        assertEquals("default null", null, def.dstTcpUdpPort());
 
-	@Test
-	public void testMatchInPort(){
-		assertTrue( match.matchInPort() );
-	}
+        FlowEntryMatch copy = new FlowEntryMatch(match);
 
-	@Test
-	public void testSrcMac(){
-		assertEquals("mac1", mac1, match.srcMac() );
-	}
+        assertEquals("inport", inport, copy.inPort());
+        assertEquals("mac1", mac1, copy.srcMac());
+        assertEquals("mac2", mac2, copy.dstMac());
+        assertEquals("ether", ether, copy.ethernetFrameType());
+        assertEquals("vlan id", vlanid, copy.vlanId());
+        assertEquals("vlan prio", vlanprio, copy.vlanPriority());
+        assertEquals("ip1", ip1, copy.srcIPv4Net());
+        assertEquals("ip2", ip2, copy.dstIPv4Net());
+        assertEquals("ip proto", ipproto, copy.ipProto());
+        assertEquals("tos", ipToS, copy.ipToS());
+        assertEquals("src port", tport1, copy.srcTcpUdpPort());
+        assertEquals("dst port", tport2, copy.dstTcpUdpPort());
 
-	@Test
-	public void testDisableSrcMac(){
-		match.disableSrcMac();
-		assertEquals("srcMac", null, match.srcMac() );
-		assertFalse( match.matchSrcMac() );
-	}
+    }
 
-	@Test
-	public void testMatchSrcMac(){
-		assertTrue( match.matchSrcMac() );
-	}
+    @Test
+    public void testInPort() {
+        assertEquals("inport", inport, match.inPort());
+    }
 
-	@Test
-	public void testDstMac(){
-		assertEquals("mac2", mac2, match.dstMac() );
-	}
+    @Test
+    public void testDisableInPort() {
+        match.disableInPort();
+        assertEquals("inport", null, match.inPort());
+        assertFalse(match.matchInPort());
+    }
 
-	@Test
-	public void testDisableDstMac(){
-		match.disableDstMac();
-		assertEquals("dstMac", null, match.dstMac() );
-		assertFalse( match.matchDstMac() );
-	}
+    @Test
+    public void testMatchInPort() {
+        assertTrue(match.matchInPort());
+    }
 
-	@Test
-	public void testMatchDstMac(){
-		assertTrue( match.matchDstMac() );
-	}
+    @Test
+    public void testSrcMac() {
+        assertEquals("mac1", mac1, match.srcMac());
+    }
 
-	@Test
-	public void testEthernetFrameType(){
-		assertEquals("ether", ether, match.ethernetFrameType() );
-	}
+    @Test
+    public void testDisableSrcMac() {
+        match.disableSrcMac();
+        assertEquals("srcMac", null, match.srcMac());
+        assertFalse(match.matchSrcMac());
+    }
 
-	@Test
-	public void testDisableEthernetFrameType(){
-		match.disableEthernetFrameType();
-		assertEquals("ethernetFrameType", null, match.ethernetFrameType() );
-		assertFalse( match.matchEthernetFrameType() );
-	}
+    @Test
+    public void testMatchSrcMac() {
+        assertTrue(match.matchSrcMac());
+    }
 
-	@Test
-	public void testMatchEthernetFrameType(){
-		assertTrue( match.matchEthernetFrameType() );
-	}
+    @Test
+    public void testDstMac() {
+        assertEquals("mac2", mac2, match.dstMac());
+    }
 
-	@Test
-	public void testVlanId(){
-		assertEquals("vlan id", vlanid, match.vlanId() );
-	}
+    @Test
+    public void testDisableDstMac() {
+        match.disableDstMac();
+        assertEquals("dstMac", null, match.dstMac());
+        assertFalse(match.matchDstMac());
+    }
 
-	@Test
-	public void testDisableVlanId(){
-		match.disableVlanId();
-		assertEquals("vlanId", null, match.vlanId() );
-		assertFalse( match.matchVlanId() );
-	}
+    @Test
+    public void testMatchDstMac() {
+        assertTrue(match.matchDstMac());
+    }
 
-	@Test
-	public void testMatchVlanId(){
-		assertTrue( match.matchVlanId() );
-	}
+    @Test
+    public void testEthernetFrameType() {
+        assertEquals("ether", ether, match.ethernetFrameType());
+    }
 
-	@Test
-	public void testVlanPriority(){
-		assertEquals("vlan prio", vlanprio, match.vlanPriority() );
-	}
+    @Test
+    public void testDisableEthernetFrameType() {
+        match.disableEthernetFrameType();
+        assertEquals("ethernetFrameType", null, match.ethernetFrameType());
+        assertFalse(match.matchEthernetFrameType());
+    }
 
-	@Test
-	public void testDisableVlanPriority(){
-		match.disableVlanPriority();
-		assertEquals("vlanPriority", null, match.vlanPriority() );
-		assertFalse( match.matchVlanPriority() );
-	}
+    @Test
+    public void testMatchEthernetFrameType() {
+        assertTrue(match.matchEthernetFrameType());
+    }
 
-	@Test
-	public void testMatchVlanPriority(){
-		assertTrue( match.matchVlanPriority() );
-	}
+    @Test
+    public void testVlanId() {
+        assertEquals("vlan id", vlanid, match.vlanId());
+    }
 
-	@Test
-	public void testSrcIPv4Net(){
-		assertEquals("ip1", ip1, match.srcIPv4Net() );
-	}
+    @Test
+    public void testDisableVlanId() {
+        match.disableVlanId();
+        assertEquals("vlanId", null, match.vlanId());
+        assertFalse(match.matchVlanId());
+    }
 
-	@Test
-	public void testDisableSrcIPv4Net(){
-		match.disableSrcIPv4Net();
-		assertEquals("srcIPv4Net", null, match.srcIPv4Net() );
-		assertFalse( match.matchSrcIPv4Net() );
-	}
+    @Test
+    public void testMatchVlanId() {
+        assertTrue(match.matchVlanId());
+    }
 
-	@Test
-	public void testMatchSrcIPv4Net(){
-		assertTrue( match.matchSrcIPv4Net() );
-	}
+    @Test
+    public void testVlanPriority() {
+        assertEquals("vlan prio", vlanprio, match.vlanPriority());
+    }
 
-	@Test
-	public void testDstIPv4Net(){
-		assertEquals("ip2", ip2, match.dstIPv4Net() );
-	}
+    @Test
+    public void testDisableVlanPriority() {
+        match.disableVlanPriority();
+        assertEquals("vlanPriority", null, match.vlanPriority());
+        assertFalse(match.matchVlanPriority());
+    }
 
-	@Test
-	public void testDisableDstIPv4Net(){
-		match.disableDstIPv4Net();
-		assertEquals("dstIPv4Net", null, match.dstIPv4Net() );
-		assertFalse( match.matchDstIPv4Net() );
-	}
+    @Test
+    public void testMatchVlanPriority() {
+        assertTrue(match.matchVlanPriority());
+    }
 
-	@Test
-	public void testMatchDstIPv4Net(){
-		assertTrue( match.matchDstIPv4Net() );
-	}
+    @Test
+    public void testSrcIPv4Net() {
+        assertEquals("ip1", ip1, match.srcIPv4Net());
+    }
 
-	@Test
-	public void testIpProto(){
-		assertEquals("ip proto", ipproto, match.ipProto() );
-	}
+    @Test
+    public void testDisableSrcIPv4Net() {
+        match.disableSrcIPv4Net();
+        assertEquals("srcIPv4Net", null, match.srcIPv4Net());
+        assertFalse(match.matchSrcIPv4Net());
+    }
 
-	@Test
-	public void testDisableIpProto(){
-		match.disableIpProto();
-		assertEquals("ipProto", null, match.ipProto() );
-		assertFalse( match.matchIpProto() );
-	}
+    @Test
+    public void testMatchSrcIPv4Net() {
+        assertTrue(match.matchSrcIPv4Net());
+    }
 
-	@Test
-	public void testMatchIpProto(){
-		assertTrue( match.matchIpProto() );
-	}
+    @Test
+    public void testDstIPv4Net() {
+        assertEquals("ip2", ip2, match.dstIPv4Net());
+    }
 
-	@Test
-	public void testIpToS(){
-		assertEquals("tos", ipToS, match.ipToS() );
-	}
+    @Test
+    public void testDisableDstIPv4Net() {
+        match.disableDstIPv4Net();
+        assertEquals("dstIPv4Net", null, match.dstIPv4Net());
+        assertFalse(match.matchDstIPv4Net());
+    }
 
-	@Test
-	public void testDisableIpToS(){
-		match.disableIpToS();
-		assertEquals("ipToS", null, match.ipToS() );
-		assertFalse( match.matchIpToS() );
-	}
+    @Test
+    public void testMatchDstIPv4Net() {
+        assertTrue(match.matchDstIPv4Net());
+    }
 
-	@Test
-	public void testMatchIpToS(){
-		assertTrue( match.matchIpToS() );
-	}
+    @Test
+    public void testIpProto() {
+        assertEquals("ip proto", ipproto, match.ipProto());
+    }
 
-	@Test
-	public void testSrcTcpUdpPort(){
-		assertEquals("src port", tport1, match.srcTcpUdpPort() );
-	}
+    @Test
+    public void testDisableIpProto() {
+        match.disableIpProto();
+        assertEquals("ipProto", null, match.ipProto());
+        assertFalse(match.matchIpProto());
+    }
 
-	@Test
-	public void testDisableSrcTcpUdpPort(){
-		match.disableSrcTcpUdpPort();
-		assertEquals("srcTcpUdpPort", null, match.srcTcpUdpPort() );
-		assertFalse( match.matchSrcTcpUdpPort() );
-	}
+    @Test
+    public void testMatchIpProto() {
+        assertTrue(match.matchIpProto());
+    }
 
-	@Test
-	public void testMatchSrcTcpUdpPort(){
-		assertTrue( match.matchSrcTcpUdpPort() );
-	}
+    @Test
+    public void testIpToS() {
+        assertEquals("tos", ipToS, match.ipToS());
+    }
 
-	@Test
-	public void testDstTcpUdpPort(){
-		assertEquals("dst port", tport2, match.dstTcpUdpPort() );
-	}
+    @Test
+    public void testDisableIpToS() {
+        match.disableIpToS();
+        assertEquals("ipToS", null, match.ipToS());
+        assertFalse(match.matchIpToS());
+    }
 
-	@Test
-	public void testDisableDstTcpUdpPort(){
-		match.disableDstTcpUdpPort();
-		assertEquals("dstTcpUdpPort", null, match.dstTcpUdpPort() );
-		assertFalse( match.matchDstTcpUdpPort() );
-	}
+    @Test
+    public void testMatchIpToS() {
+        assertTrue(match.matchIpToS());
+    }
 
-	@Test
-	public void testMatchDstTcpUdpPort(){
-		assertTrue( match.matchDstTcpUdpPort() );
-	}
+    @Test
+    public void testSrcTcpUdpPort() {
+        assertEquals("src port", tport1, match.srcTcpUdpPort());
+    }
 
-	@Test
-	public void testToString(){
-		FlowEntryMatch def = new FlowEntryMatch();
-		assertEquals("match default", def.toString(), "[]");
-		
-		assertEquals("match set", match.toString(), "[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01 ethernetFrameType=2 vlanId=3 vlanPriority=4 srcIPv4Net=127.0.0.1/32 dstIPv4Net=127.0.0.2/32 ipProto=5 ipToS=6 srcTcpUdpPort=7 dstTcpUdpPort=8]");
-	}
+    @Test
+    public void testDisableSrcTcpUdpPort() {
+        match.disableSrcTcpUdpPort();
+        assertEquals("srcTcpUdpPort", null, match.srcTcpUdpPort());
+        assertFalse(match.matchSrcTcpUdpPort());
+    }
+
+    @Test
+    public void testMatchSrcTcpUdpPort() {
+        assertTrue(match.matchSrcTcpUdpPort());
+    }
+
+    @Test
+    public void testDstTcpUdpPort() {
+        assertEquals("dst port", tport2, match.dstTcpUdpPort());
+    }
+
+    @Test
+    public void testDisableDstTcpUdpPort() {
+        match.disableDstTcpUdpPort();
+        assertEquals("dstTcpUdpPort", null, match.dstTcpUdpPort());
+        assertFalse(match.matchDstTcpUdpPort());
+    }
+
+    @Test
+    public void testMatchDstTcpUdpPort() {
+        assertTrue(match.matchDstTcpUdpPort());
+    }
+
+    @Test
+    public void testToString() {
+        FlowEntryMatch def = new FlowEntryMatch();
+        assertEquals("match default", def.toString(), "[]");
+
+        assertEquals("match set", match.toString(), "[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01 ethernetFrameType=2 vlanId=3 vlanPriority=4 srcIPv4Net=127.0.0.1/32 dstIPv4Net=127.0.0.2/32 ipProto=5 ipToS=6 srcTcpUdpPort=7 dstTcpUdpPort=8]");
+    }
 
 }
diff --git a/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java b/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java
index d877276..818abd5 100644
--- a/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java
+++ b/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java
@@ -2,6 +2,7 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+
 import net.floodlightcontroller.util.MACAddress;
 
 import org.junit.Before;
@@ -9,258 +10,258 @@
 
 public class FlowEntryTest {
 
-	FlowEntry entry;
-	
-	FlowId flowId = new FlowId(0x1234);
-	FlowEntryId flowEntryId = new FlowEntryId(0x5678);
-	int idleTimeout = 5;
-	int hardTimeout = 10;
-	int priority = 15;
-	FlowEntryMatch match;
-	FlowEntryActions actions;
-	
-	Dpid dpid = new Dpid(0xCAFE);
-	
-	Port inport = new Port((short)1);
-	byte[] byte1 = { 1, 2, 3, 4, 5, 6 };
-	byte[] byte2 = { 6, 5, 4, 3, 2, 1 };
-	MACAddress mac1 = new MACAddress(byte1);
-	MACAddress mac2 = new MACAddress(byte2);
-	Short ether = Short.valueOf((short)2);
-	Short vlanid = Short.valueOf((short)3);
-	Byte vlanprio = Byte.valueOf((byte)4);
-	IPv4Net ip1 = new IPv4Net("127.0.0.1/32");
-	IPv4Net ip2 = new IPv4Net( new IPv4("127.0.0.2"), (short)32);
-	IPv4 ipaddr1 = new IPv4("127.0.0.3");
-	IPv4 ipaddr2 = new IPv4("127.0.0.4");
-	Byte ipproto = Byte.valueOf((byte)5);
-	Byte ipToS = Byte.valueOf((byte)6);
-	Short tport1 = Short.valueOf((short)7);
-	Short tport2 = Short.valueOf((short)8);
-	Port outport = new Port((short)9);
-	Port queueport = new Port((short)10);
-	int queueId = 11;
-	
-	FlowEntryErrorState errorState = new FlowEntryErrorState( (short)12, (short)13);
+    FlowEntry entry;
 
-	
-	@Before
-	public void setUp() throws Exception{
-		entry = new FlowEntry();
+    FlowId flowId = new FlowId(0x1234);
+    FlowEntryId flowEntryId = new FlowEntryId(0x5678);
+    int idleTimeout = 5;
+    int hardTimeout = 10;
+    int priority = 15;
+    FlowEntryMatch match;
+    FlowEntryActions actions;
 
-		flowId = new FlowId("0x1234");
-		entry.setFlowId( flowId );
+    Dpid dpid = new Dpid(0xCAFE);
 
-		flowEntryId = new FlowEntryId("0x5678");
-		entry.setFlowEntryId(flowEntryId);
+    Port inport = new Port((short) 1);
+    byte[] byte1 = {1, 2, 3, 4, 5, 6};
+    byte[] byte2 = {6, 5, 4, 3, 2, 1};
+    MACAddress mac1 = new MACAddress(byte1);
+    MACAddress mac2 = new MACAddress(byte2);
+    Short ether = Short.valueOf((short) 2);
+    Short vlanid = Short.valueOf((short) 3);
+    Byte vlanprio = Byte.valueOf((byte) 4);
+    IPv4Net ip1 = new IPv4Net("127.0.0.1/32");
+    IPv4Net ip2 = new IPv4Net(new IPv4("127.0.0.2"), (short) 32);
+    IPv4 ipaddr1 = new IPv4("127.0.0.3");
+    IPv4 ipaddr2 = new IPv4("127.0.0.4");
+    Byte ipproto = Byte.valueOf((byte) 5);
+    Byte ipToS = Byte.valueOf((byte) 6);
+    Short tport1 = Short.valueOf((short) 7);
+    Short tport2 = Short.valueOf((short) 8);
+    Port outport = new Port((short) 9);
+    Port queueport = new Port((short) 10);
+    int queueId = 11;
 
-		entry.setIdleTimeout(5);
-		entry.setHardTimeout(10);
-		entry.setPriority(15);
-		
-		dpid = new Dpid("CA:FE");
-		entry.setDpid( dpid );
-		
-		entry.setInPort( inport );
-		entry.setOutPort( outport );
+    FlowEntryErrorState errorState = new FlowEntryErrorState((short) 12, (short) 13);
 
-		match = new FlowEntryMatch();
-		match.enableInPort( inport);
-		match.enableSrcMac( mac1 );
-		match.enableDstMac( mac2 );
-		match.enableEthernetFrameType( ether );
-		match.enableVlanId( vlanid );
-		match.enableVlanPriority( vlanprio );
-		match.enableSrcIPv4Net( ip1 );
-		match.enableDstIPv4Net( ip2 );
-		match.enableIpProto( ipproto );
-		match.enableIpToS( ipToS );
-		match.enableSrcTcpUdpPort( tport1 );
-		match.enableDstTcpUdpPort( tport2 );
-		
-		entry.setFlowEntryMatch( match );
-		
-		FlowEntryAction action = null;
-		actions = entry.flowEntryActions();
-		
-		action = new FlowEntryAction();
-		action.setActionOutput(outport);
-		actions.addAction(action);
 
-		action = new FlowEntryAction();
-		action.setActionOutputToController((short)0);
-		actions.addAction(action);
+    @Before
+    public void setUp() throws Exception {
+        entry = new FlowEntry();
 
-		action = new FlowEntryAction();
-		action.setActionSetVlanId(vlanid);
-		actions.addAction(action);
+        flowId = new FlowId("0x1234");
+        entry.setFlowId(flowId);
 
-		action = new FlowEntryAction();
-		action.setActionSetVlanPriority(vlanprio);
-		actions.addAction(action);
+        flowEntryId = new FlowEntryId("0x5678");
+        entry.setFlowEntryId(flowEntryId);
 
-		action = new FlowEntryAction();
-		action.setActionStripVlan(true);
-		actions.addAction(action);
+        entry.setIdleTimeout(5);
+        entry.setHardTimeout(10);
+        entry.setPriority(15);
 
-		action = new FlowEntryAction();
-		action.setActionSetEthernetSrcAddr(mac1);
-		actions.addAction(action);
+        dpid = new Dpid("CA:FE");
+        entry.setDpid(dpid);
 
-		action = new FlowEntryAction();
-		action.setActionSetEthernetDstAddr(mac2);
-		actions.addAction(action);
+        entry.setInPort(inport);
+        entry.setOutPort(outport);
 
-		action = new FlowEntryAction();
-		action.setActionSetIPv4SrcAddr(ipaddr1);
-		actions.addAction(action);
+        match = new FlowEntryMatch();
+        match.enableInPort(inport);
+        match.enableSrcMac(mac1);
+        match.enableDstMac(mac2);
+        match.enableEthernetFrameType(ether);
+        match.enableVlanId(vlanid);
+        match.enableVlanPriority(vlanprio);
+        match.enableSrcIPv4Net(ip1);
+        match.enableDstIPv4Net(ip2);
+        match.enableIpProto(ipproto);
+        match.enableIpToS(ipToS);
+        match.enableSrcTcpUdpPort(tport1);
+        match.enableDstTcpUdpPort(tport2);
 
-		action = new FlowEntryAction();
-		action.setActionSetIPv4DstAddr(ipaddr2);
-		actions.addAction(action);
+        entry.setFlowEntryMatch(match);
 
-		action = new FlowEntryAction();
-		action.setActionSetIpToS(ipToS);
-		actions.addAction(action);
+        FlowEntryAction action = null;
+        actions = entry.flowEntryActions();
 
-		action = new FlowEntryAction();
-		action.setActionSetTcpUdpSrcPort(tport1);
-		actions.addAction(action);
+        action = new FlowEntryAction();
+        action.setActionOutput(outport);
+        actions.addAction(action);
 
-		action = new FlowEntryAction();
-		action.setActionSetTcpUdpDstPort(tport2);
-		actions.addAction(action);
+        action = new FlowEntryAction();
+        action.setActionOutputToController((short) 0);
+        actions.addAction(action);
 
-		action = new FlowEntryAction();
-		action.setActionEnqueue(queueport, queueId);
-		actions.addAction(action);
-		
-		entry.setFlowEntryUserState( FlowEntryUserState.FE_USER_ADD );
-		entry.setFlowEntrySwitchState( FlowEntrySwitchState.FE_SWITCH_UPDATED );
-		entry.setFlowEntryErrorState( errorState );
+        action = new FlowEntryAction();
+        action.setActionSetVlanId(vlanid);
+        actions.addAction(action);
 
-	}
+        action = new FlowEntryAction();
+        action.setActionSetVlanPriority(vlanprio);
+        actions.addAction(action);
 
-	@Test
-	public void testFlowEntry(){
-		FlowEntry e = new FlowEntry();
-		
-		assertTrue( e.flowEntryActions().isEmpty() );
-		assertEquals("flowEntryUserState", FlowEntryUserState.FE_USER_UNKNOWN, e.flowEntryUserState() );
-		assertEquals("flowEntrySwitchState", FlowEntrySwitchState.FE_SWITCH_UNKNOWN, e.flowEntrySwitchState() );
-	}
+        action = new FlowEntryAction();
+        action.setActionStripVlan(true);
+        actions.addAction(action);
 
-	@Test
-	public void testFlowId(){
-		assertEquals("flowId", flowId, entry.flowId() );
-	}
+        action = new FlowEntryAction();
+        action.setActionSetEthernetSrcAddr(mac1);
+        actions.addAction(action);
 
-	@Test
-	public void testIsValidFlowId(){
-		FlowEntry e = new FlowEntry();
+        action = new FlowEntryAction();
+        action.setActionSetEthernetDstAddr(mac2);
+        actions.addAction(action);
 
-		// Test a Flow Entry with empty Flow ID
-		assertEquals("isValidFlowId", false, e.isValidFlowId() );
+        action = new FlowEntryAction();
+        action.setActionSetIPv4SrcAddr(ipaddr1);
+        actions.addAction(action);
 
-		// Test a Flow Entry with invalid Flow ID
-		e.setFlowId(new FlowId());
-		assertEquals("isValidFlowId", false, e.isValidFlowId() );
+        action = new FlowEntryAction();
+        action.setActionSetIPv4DstAddr(ipaddr2);
+        actions.addAction(action);
 
-		// Test a Flow Entry with valid Flow ID
-		e.setFlowId(new FlowId(0x1));
-		assertEquals("isValidFlowId", true, e.isValidFlowId() );
-		assertEquals("isValidFlowId", true, entry.isValidFlowId() );
-	}
+        action = new FlowEntryAction();
+        action.setActionSetIpToS(ipToS);
+        actions.addAction(action);
 
-	@Test
-	public void testFlowEntryId(){
-		assertEquals("flowEntryId", flowEntryId, entry.flowEntryId() );
-	}
+        action = new FlowEntryAction();
+        action.setActionSetTcpUdpSrcPort(tport1);
+        actions.addAction(action);
 
-	@Test
-	public void testIsValidFlowEntryId(){
-		FlowEntry e = new FlowEntry();
+        action = new FlowEntryAction();
+        action.setActionSetTcpUdpDstPort(tport2);
+        actions.addAction(action);
 
-		// Test a Flow Entry with empty Flow Entry ID
-		assertEquals("isValidFlowEntryId", false, e.isValidFlowEntryId() );
+        action = new FlowEntryAction();
+        action.setActionEnqueue(queueport, queueId);
+        actions.addAction(action);
 
-		// Test a Flow Entry with invalid Flow Entry ID
-		e.setFlowEntryId(new FlowEntryId());
-		assertEquals("isValidFlowEntryId", false, e.isValidFlowEntryId() );
+        entry.setFlowEntryUserState(FlowEntryUserState.FE_USER_ADD);
+        entry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_UPDATED);
+        entry.setFlowEntryErrorState(errorState);
 
-		// Test a Flow Entry with valid Flow Entry ID
-		e.setFlowEntryId(new FlowEntryId(0x1));
-		assertEquals("isValidFlowEntryId", true, e.isValidFlowEntryId() );
-		assertEquals("isValidFlowEntryId", true, entry.isValidFlowEntryId() );
-	}
+    }
 
-	@Test
-	public void testIdleTimeout(){
-		assertEquals("idleTimeout", idleTimeout, entry.idleTimeout() );
-	}
+    @Test
+    public void testFlowEntry() {
+        FlowEntry e = new FlowEntry();
 
-	@Test
-	public void testHardTimeout(){
-		assertEquals("hardTimeout", hardTimeout, entry.hardTimeout() );
-	}
+        assertTrue(e.flowEntryActions().isEmpty());
+        assertEquals("flowEntryUserState", FlowEntryUserState.FE_USER_UNKNOWN, e.flowEntryUserState());
+        assertEquals("flowEntrySwitchState", FlowEntrySwitchState.FE_SWITCH_UNKNOWN, e.flowEntrySwitchState());
+    }
 
-	@Test
-	public void testPriority(){
-		assertEquals("priority", priority, entry.priority() );
-	}
+    @Test
+    public void testFlowId() {
+        assertEquals("flowId", flowId, entry.flowId());
+    }
 
-	@Test
-	public void testFlowEntryMatch(){
-		assertEquals("flowEntryMatch", match, entry.flowEntryMatch() );
-	}
+    @Test
+    public void testIsValidFlowId() {
+        FlowEntry e = new FlowEntry();
 
-	@Test
-	public void testFlowEntryActions(){
-		assertEquals("flowEntryActions", actions, entry.flowEntryActions() );
-	}
+        // Test a Flow Entry with empty Flow ID
+        assertEquals("isValidFlowId", false, e.isValidFlowId());
 
-	@Test
-	public void testSetFlowEntryActions(){
-		FlowEntryActions actions = new FlowEntryActions();
-		entry.setFlowEntryActions( actions );
-		assertEquals("flowEntryActions", actions, entry.flowEntryActions() );
-	}
+        // Test a Flow Entry with invalid Flow ID
+        e.setFlowId(new FlowId());
+        assertEquals("isValidFlowId", false, e.isValidFlowId());
 
-	@Test
-	public void testDpid(){
-		assertEquals("dpid", dpid, entry.dpid() );
-	}
+        // Test a Flow Entry with valid Flow ID
+        e.setFlowId(new FlowId(0x1));
+        assertEquals("isValidFlowId", true, e.isValidFlowId());
+        assertEquals("isValidFlowId", true, entry.isValidFlowId());
+    }
 
-	@Test
-	public void testInPort(){
-		assertEquals("inPort", inport, entry.inPort() );
-	}
+    @Test
+    public void testFlowEntryId() {
+        assertEquals("flowEntryId", flowEntryId, entry.flowEntryId());
+    }
 
-	@Test
-	public void testOutPort(){
-		assertEquals("outPort", outport, entry.outPort() );
-	}
+    @Test
+    public void testIsValidFlowEntryId() {
+        FlowEntry e = new FlowEntry();
 
-	@Test
-	public void testFlowEntryUserState(){
-		assertEquals("flowEntryUserState", FlowEntryUserState.FE_USER_ADD, entry.flowEntryUserState() );
-	}
+        // Test a Flow Entry with empty Flow Entry ID
+        assertEquals("isValidFlowEntryId", false, e.isValidFlowEntryId());
 
-	@Test
-	public void testFlowEntrySwitchState(){
-		assertEquals("flowEntrySwitchState", FlowEntrySwitchState.FE_SWITCH_UPDATED, entry.flowEntrySwitchState() );
-	}
+        // Test a Flow Entry with invalid Flow Entry ID
+        e.setFlowEntryId(new FlowEntryId());
+        assertEquals("isValidFlowEntryId", false, e.isValidFlowEntryId());
 
-	@Test
-	public void testFlowEntryErrorState(){
-		assertEquals("flowEntryErrorState", errorState, entry.flowEntryErrorState() );
-	}
+        // Test a Flow Entry with valid Flow Entry ID
+        e.setFlowEntryId(new FlowEntryId(0x1));
+        assertEquals("isValidFlowEntryId", true, e.isValidFlowEntryId());
+        assertEquals("isValidFlowEntryId", true, entry.isValidFlowEntryId());
+    }
 
-	@Test
-	public void testToString(){
-		FlowEntry def = new FlowEntry();
-		assertEquals("toString", def.toString(), "[ idleTimeout=0 hardTimeout=0 priority=32768 flowEntryActions=[] flowEntryUserState=FE_USER_UNKNOWN flowEntrySwitchState=FE_SWITCH_UNKNOWN]" );
-		assertEquals("toString", entry.toString(), "[flowEntryId=0x5678 flowId=0x1234 idleTimeout=5 hardTimeout=10 priority=15 flowEntryMatch=[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01 ethernetFrameType=2 vlanId=3 vlanPriority=4 srcIPv4Net=127.0.0.1/32 dstIPv4Net=127.0.0.2/32 ipProto=5 ipToS=6 srcTcpUdpPort=7 dstTcpUdpPort=8] flowEntryActions=[[type=ACTION_OUTPUT action=[port=9 maxLen=0]];[type=ACTION_OUTPUT action=[port=-3 maxLen=0]];[type=ACTION_SET_VLAN_VID action=[vlanId=3]];[type=ACTION_SET_VLAN_PCP action=[vlanPriority=4]];[type=ACTION_STRIP_VLAN action=[stripVlan=true]];[type=ACTION_SET_DL_SRC action=[addr=01:02:03:04:05:06]];[type=ACTION_SET_DL_DST action=[addr=06:05:04:03:02:01]];[type=ACTION_SET_NW_SRC action=[addr=127.0.0.3]];[type=ACTION_SET_NW_DST action=[addr=127.0.0.4]];[type=ACTION_SET_NW_TOS action=[ipToS=6]];[type=ACTION_SET_TP_SRC action=[port=7]];[type=ACTION_SET_TP_DST action=[port=8]];[type=ACTION_ENQUEUE action=[port=10 queueId=11]];] dpid=00:00:00:00:00:00:ca:fe inPort=1 outPort=9 flowEntryUserState=FE_USER_ADD flowEntrySwitchState=FE_SWITCH_UPDATED flowEntryErrorState=[type=12 code=13]]" );
-	}
+    @Test
+    public void testIdleTimeout() {
+        assertEquals("idleTimeout", idleTimeout, entry.idleTimeout());
+    }
+
+    @Test
+    public void testHardTimeout() {
+        assertEquals("hardTimeout", hardTimeout, entry.hardTimeout());
+    }
+
+    @Test
+    public void testPriority() {
+        assertEquals("priority", priority, entry.priority());
+    }
+
+    @Test
+    public void testFlowEntryMatch() {
+        assertEquals("flowEntryMatch", match, entry.flowEntryMatch());
+    }
+
+    @Test
+    public void testFlowEntryActions() {
+        assertEquals("flowEntryActions", actions, entry.flowEntryActions());
+    }
+
+    @Test
+    public void testSetFlowEntryActions() {
+        FlowEntryActions actions = new FlowEntryActions();
+        entry.setFlowEntryActions(actions);
+        assertEquals("flowEntryActions", actions, entry.flowEntryActions());
+    }
+
+    @Test
+    public void testDpid() {
+        assertEquals("dpid", dpid, entry.dpid());
+    }
+
+    @Test
+    public void testInPort() {
+        assertEquals("inPort", inport, entry.inPort());
+    }
+
+    @Test
+    public void testOutPort() {
+        assertEquals("outPort", outport, entry.outPort());
+    }
+
+    @Test
+    public void testFlowEntryUserState() {
+        assertEquals("flowEntryUserState", FlowEntryUserState.FE_USER_ADD, entry.flowEntryUserState());
+    }
+
+    @Test
+    public void testFlowEntrySwitchState() {
+        assertEquals("flowEntrySwitchState", FlowEntrySwitchState.FE_SWITCH_UPDATED, entry.flowEntrySwitchState());
+    }
+
+    @Test
+    public void testFlowEntryErrorState() {
+        assertEquals("flowEntryErrorState", errorState, entry.flowEntryErrorState());
+    }
+
+    @Test
+    public void testToString() {
+        FlowEntry def = new FlowEntry();
+        assertEquals("toString", def.toString(), "[ idleTimeout=0 hardTimeout=0 priority=32768 flowEntryActions=[] flowEntryUserState=FE_USER_UNKNOWN flowEntrySwitchState=FE_SWITCH_UNKNOWN]");
+        assertEquals("toString", entry.toString(), "[flowEntryId=0x5678 flowId=0x1234 idleTimeout=5 hardTimeout=10 priority=15 flowEntryMatch=[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01 ethernetFrameType=2 vlanId=3 vlanPriority=4 srcIPv4Net=127.0.0.1/32 dstIPv4Net=127.0.0.2/32 ipProto=5 ipToS=6 srcTcpUdpPort=7 dstTcpUdpPort=8] flowEntryActions=[[type=ACTION_OUTPUT action=[port=9 maxLen=0]];[type=ACTION_OUTPUT action=[port=-3 maxLen=0]];[type=ACTION_SET_VLAN_VID action=[vlanId=3]];[type=ACTION_SET_VLAN_PCP action=[vlanPriority=4]];[type=ACTION_STRIP_VLAN action=[stripVlan=true]];[type=ACTION_SET_DL_SRC action=[addr=01:02:03:04:05:06]];[type=ACTION_SET_DL_DST action=[addr=06:05:04:03:02:01]];[type=ACTION_SET_NW_SRC action=[addr=127.0.0.3]];[type=ACTION_SET_NW_DST action=[addr=127.0.0.4]];[type=ACTION_SET_NW_TOS action=[ipToS=6]];[type=ACTION_SET_TP_SRC action=[port=7]];[type=ACTION_SET_TP_DST action=[port=8]];[type=ACTION_ENQUEUE action=[port=10 queueId=11]];] dpid=00:00:00:00:00:00:ca:fe inPort=1 outPort=9 flowEntryUserState=FE_USER_ADD flowEntrySwitchState=FE_SWITCH_UPDATED flowEntryErrorState=[type=12 code=13]]");
+    }
 
 }