Fix checkstyle whitespace issues - WHITESPACE ONLY

Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index 8afe34a..672c63f 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.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.floodlightcontroller.core.internal;
 
@@ -92,11 +92,10 @@
 import org.openflow.vendor.nicira.OFRoleReplyVendorData;
 
 /**
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public class ControllerTest extends FloodlightTestCase {
-   
+
     private Controller controller;
     private MockThreadPoolService tp;
 
@@ -104,25 +103,25 @@
     public void setUp() throws Exception {
         super.setUp();
         FloodlightModuleContext fmc = new FloodlightModuleContext();
-        
+
         FloodlightProvider cm = new FloodlightProvider();
-        controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
+        controller = (Controller) cm.getServiceImpls().get(IFloodlightProviderService.class);
         fmc.addService(IFloodlightProviderService.class, controller);
-        
+
         RestApiServer restApi = new RestApiServer();
         fmc.addService(IRestApiService.class, restApi);
-   
+
         tp = new MockThreadPoolService();
         fmc.addService(IThreadPoolService.class, tp);
-        
+
         // Following added by ONOS
         // TODO replace with mock if further testing is needed.
         StandaloneRegistry sr = new StandaloneRegistry();
-        fmc.addService(IControllerRegistryService.class, sr );
+        fmc.addService(IControllerRegistryService.class, sr);
         LinkDiscoveryManager linkDiscovery = new LinkDiscoveryManager();
         fmc.addService(ILinkDiscoveryService.class, linkDiscovery);
 
-        
+
         restApi.init(fmc);
         cm.init(fmc);
         tp.init(fmc);
@@ -140,7 +139,7 @@
     }
 
     protected OFStatisticsReply getStatisticsReply(int transactionId,
-            int count, boolean moreReplies) {
+                                                   int count, boolean moreReplies) {
         OFStatisticsReply sr = new OFStatisticsReply();
         sr.setXid(transactionId);
         sr.setStatisticType(OFStatisticsType.FLOW);
@@ -153,14 +152,14 @@
             sr.setFlags((short) 1);
         return sr;
     }
-    
+
     /* Set the mock expectations for sw when sw is passed to addSwitch */
     protected void setupSwitchForAddSwitch(IOFSwitch sw, long dpid) {
         String dpidString = HexString.toHexString(dpid);
-                
+
         expect(sw.getId()).andReturn(dpid).anyTimes();
         expect(sw.getStringId()).andReturn(dpidString).anyTimes();
-        
+
         //Now we don't write to storage these methods aren't called
         //expect(sw.getConnectedSince()).andReturn(new Date());
         //Channel channel = createMock(Channel.class);
@@ -169,11 +168,11 @@
 
         expect(sw.getCapabilities()).andReturn(0).anyTimes();
         expect(sw.getBuffers()).andReturn(0).anyTimes();
-        expect(sw.getTables()).andReturn((byte)0).anyTimes();
+        expect(sw.getTables()).andReturn((byte) 0).anyTimes();
         expect(sw.getActions()).andReturn(0).anyTimes();
         expect(sw.getPorts()).andReturn(new ArrayList<OFPhysicalPort>()).anyTimes();
     }
-    
+
     /**
      * Run the controller's main loop so that updates are processed
      */
@@ -187,6 +186,7 @@
     /**
      * Verify that a listener that throws an exception halts further
      * execution, and verify that the Commands STOP and CONTINUE are honored.
+     *
      * @throws Exception
      */
     @Test
@@ -199,20 +199,20 @@
 
         // Build our test packet
         IPacket testPacket = new Ethernet()
-        .setSourceMACAddress("00:44:33:22:11:00")
-        .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:00"))
-                .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:00")
+                .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:00"))
+                                .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
+                                .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
+                                .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
         byte[] testPacketSerialized = testPacket.serialize();
 
         // Build the PacketIn        
@@ -225,13 +225,13 @@
 
         IOFMessageListener test1 = createMock(IOFMessageListener.class);
         expect(test1.getName()).andReturn("test1").anyTimes();
-        expect(test1.isCallbackOrderingPrereq((OFType)anyObject(), (String)anyObject())).andReturn(false).anyTimes();
-        expect(test1.isCallbackOrderingPostreq((OFType)anyObject(), (String)anyObject())).andReturn(false).anyTimes();
+        expect(test1.isCallbackOrderingPrereq((OFType) anyObject(), (String) anyObject())).andReturn(false).anyTimes();
+        expect(test1.isCallbackOrderingPostreq((OFType) anyObject(), (String) anyObject())).andReturn(false).anyTimes();
         expect(test1.receive(eq(sw), eq(pi), isA(FloodlightContext.class))).andThrow(new RuntimeException("This is NOT an error! We are testing exception catching."));
         IOFMessageListener test2 = createMock(IOFMessageListener.class);
         expect(test2.getName()).andReturn("test2").anyTimes();
-        expect(test2.isCallbackOrderingPrereq((OFType)anyObject(), (String)anyObject())).andReturn(false).anyTimes();
-        expect(test2.isCallbackOrderingPostreq((OFType)anyObject(), (String)anyObject())).andReturn(false).anyTimes();
+        expect(test2.isCallbackOrderingPrereq((OFType) anyObject(), (String) anyObject())).andReturn(false).anyTimes();
+        expect(test2.isCallbackOrderingPostreq((OFType) anyObject(), (String) anyObject())).andReturn(false).anyTimes();
         // expect no calls to test2.receive() since test1.receive() threw an exception
 
         replay(test1, test2, sw);
@@ -246,7 +246,7 @@
 
         // verify STOP works
         reset(test1, test2, sw);
-        expect(test1.receive(eq(sw), eq(pi), isA(FloodlightContext.class))).andReturn(Command.STOP);       
+        expect(test1.receive(eq(sw), eq(pi), isA(FloodlightContext.class))).andReturn(Command.STOP);
         //expect(test1.getId()).andReturn(0).anyTimes();
         expect(sw.getStringId()).andReturn("00:00:00:00:00:00:00").anyTimes();
         replay(test1, test2, sw);
@@ -287,7 +287,6 @@
     }
 
     /**
-     * 
      * @throws Exception
      */
     @Test
@@ -390,7 +389,7 @@
         expect(newsw.getPorts()).andReturn(new ArrayList<OFPhysicalPort>());
         expect(newsw.getCapabilities()).andReturn(0).anyTimes();
         expect(newsw.getBuffers()).andReturn(0).anyTimes();
-        expect(newsw.getTables()).andReturn((byte)0).anyTimes();
+        expect(newsw.getTables()).andReturn((byte) 0).anyTimes();
         expect(newsw.getActions()).andReturn(0).anyTimes();
         controller.activeSwitches.put(0L, oldsw);
         replay(newsw, channel);//, channel2);
@@ -399,44 +398,51 @@
 
         verify(newsw, channel);//, channel2);
     }
-    
+
     @Test
     public void testUpdateQueue() throws Exception {
         class DummySwitchListener implements IOFSwitchListener, IOFSwitchPortListener {
             public int nAdded;
             public int nRemoved;
             public int nPortChanged;
+
             public DummySwitchListener() {
                 nAdded = 0;
                 nRemoved = 0;
                 nPortChanged = 0;
             }
+
             public synchronized void addedSwitch(IOFSwitch sw) {
                 nAdded++;
                 notifyAll();
             }
+
             public synchronized void removedSwitch(IOFSwitch sw) {
                 nRemoved++;
                 notifyAll();
             }
+
             public String getName() {
                 return "dummy";
             }
+
             @Override
             public void switchPortChanged(Long switchId) {
                 nPortChanged++;
                 notifyAll();
             }
-			@Override
-			public void switchPortAdded(Long switchId, OFPhysicalPort port) {
-				// TODO Auto-generated method stub
-				
-			}
-			@Override
-			public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
-				// TODO Auto-generated method stub
-				
-			}
+
+            @Override
+            public void switchPortAdded(Long switchId, OFPhysicalPort port) {
+                // TODO Auto-generated method stub
+
+            }
+
+            @Override
+            public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
+                // TODO Auto-generated method stub
+
+            }
         }
         DummySwitchListener switchListener = new DummySwitchListener();
         IOFSwitch sw = createMock(IOFSwitch.class);
@@ -446,37 +452,37 @@
         replay(sw);
         ControllerRunThread t = new ControllerRunThread();
         t.start();
-        
+
         controller.addOFSwitchListener(switchListener);
-        synchronized(switchListener) {
+        synchronized (switchListener) {
             controller.updates.put(controller.new SwitchUpdate(sw,
-                                      Controller.SwitchUpdateType.ADDED));
+                    Controller.SwitchUpdateType.ADDED));
             switchListener.wait(500);
-            assertTrue("IOFSwitchListener.addedSwitch() was not called", 
+            assertTrue("IOFSwitchListener.addedSwitch() was not called",
                     switchListener.nAdded == 1);
-            controller.updates.put(controller.new SwitchUpdate(sw, 
-                                      Controller.SwitchUpdateType.REMOVED));
+            controller.updates.put(controller.new SwitchUpdate(sw,
+                    Controller.SwitchUpdateType.REMOVED));
             switchListener.wait(500);
-            assertTrue("IOFSwitchListener.removedSwitch() was not called", 
+            assertTrue("IOFSwitchListener.removedSwitch() was not called",
                     switchListener.nRemoved == 1);
-            controller.updates.put(controller.new SwitchUpdate(sw, 
-                                      Controller.SwitchUpdateType.PORTCHANGED));
+            controller.updates.put(controller.new SwitchUpdate(sw,
+                    Controller.SwitchUpdateType.PORTCHANGED));
             switchListener.wait(500);
-            assertTrue("IOFSwitchListener.switchPortChanged() was not called", 
+            assertTrue("IOFSwitchListener.switchPortChanged() was not called",
                     switchListener.nPortChanged == 1);
         }
     }
 
     /**
      * Test notifications for controller node IP changes. This requires
-     * synchronization between the main test thread and another thread 
+     * synchronization between the main test thread and another thread
      * that runs Controller's main loop and takes / handles updates. We
-     * synchronize with wait(timeout) / notifyAll(). We check for the 
+     * synchronize with wait(timeout) / notifyAll(). We check for the
      * expected condition after the wait returns. However, if wait returns
      * due to the timeout (or due to spurious awaking) and the check fails we
      * might just not have waited long enough. Using a long enough timeout
-     * mitigates this but we cannot get rid of the fundamental "issue". 
-     * 
+     * mitigates this but we cannot get rid of the fundamental "issue".
+     *
      * @throws Exception
      */
     /*
@@ -609,13 +615,12 @@
                 expectedCurMap, controller.getControllerNodeIPs());
     }
     */
-    
     @Test
     public void testCheckSwitchReady() {
         OFChannelState state = new OFChannelState();
         Controller.OFChannelHandler chdlr = controller.new OFChannelHandler(state);
         chdlr.sw = createMock(OFSwitchImpl.class);
-        
+
         // Wrong current state 
         // Should not go to READY
         state.hsState = OFChannelState.HandshakeState.HELLO;
@@ -626,31 +631,31 @@
         verify(chdlr.sw);
         assertSame(OFChannelState.HandshakeState.HELLO, state.hsState);
         reset(chdlr.sw);
-        
+
         // Have only config reply
         state.hsState = OFChannelState.HandshakeState.FEATURES_REPLY;
         state.hasDescription = false;
         state.hasGetConfigReply = true;
-        replay(chdlr.sw); 
+        replay(chdlr.sw);
         chdlr.checkSwitchReady();
         verify(chdlr.sw);
         assertSame(OFChannelState.HandshakeState.FEATURES_REPLY, state.hsState);
         assertTrue(controller.connectedSwitches.isEmpty());
         assertTrue(controller.activeSwitches.isEmpty());
         reset(chdlr.sw);
-        
+
         // Have only desc reply
         state.hsState = OFChannelState.HandshakeState.FEATURES_REPLY;
         state.hasDescription = true;
         state.hasGetConfigReply = false;
-        replay(chdlr.sw); 
+        replay(chdlr.sw);
         chdlr.checkSwitchReady();
         verify(chdlr.sw);
         assertSame(OFChannelState.HandshakeState.FEATURES_REPLY, state.hsState);
         assertTrue(controller.connectedSwitches.isEmpty());
         assertTrue(controller.activeSwitches.isEmpty());
         reset(chdlr.sw);
-        
+
         //////////////////////////////////////////
         // Finally, everything is right. Should advance to READY
         //////////////////////////////////////////
@@ -674,21 +679,21 @@
         reset(controller.roleChanger);
         controller.connectedSwitches.clear();
         controller.activeSwitches.clear();
-        
-        
+
+
         // Role support enabled. 
         state.hsState = OFChannelState.HandshakeState.FEATURES_REPLY;
         controller.role = Role.MASTER;
         expect(chdlr.sw.getStringId()).andReturn("SomeID").anyTimes();
         expect(chdlr.sw.getId()).andReturn(42L).anyTimes();
-        Capture<Collection<OFSwitchImpl>> swListCapture = 
-                    new Capture<Collection<OFSwitchImpl>>();
-        controller.roleChanger.submitRequest(capture(swListCapture), 
-                    same(Role.SLAVE));
-        Capture<Collection<OFSwitchImpl>> swListCapture2 = 
+        Capture<Collection<OFSwitchImpl>> swListCapture =
                 new Capture<Collection<OFSwitchImpl>>();
-        controller.roleChanger.submitRequest(capture(swListCapture2), 
-                    same(Role.MASTER));
+        controller.roleChanger.submitRequest(capture(swListCapture),
+                same(Role.SLAVE));
+        Capture<Collection<OFSwitchImpl>> swListCapture2 =
+                new Capture<Collection<OFSwitchImpl>>();
+        controller.roleChanger.submitRequest(capture(swListCapture2),
+                same(Role.MASTER));
         replay(controller.roleChanger, chdlr.sw);
         chdlr.checkSwitchReady();
         verify(controller.roleChanger, chdlr.sw);
@@ -701,29 +706,29 @@
         assertTrue("swList must contain this switch", swList.contains(chdlr.sw));
     }
 
-    
+
     @Test
     public void testChannelDisconnected() throws Exception {
         OFChannelState state = new OFChannelState();
         state.hsState = OFChannelState.HandshakeState.READY;
         Controller.OFChannelHandler chdlr = controller.new OFChannelHandler(state);
         chdlr.sw = createMock(OFSwitchImpl.class);
-        
+
         // Switch is active 
         expect(chdlr.sw.getId()).andReturn(0L).anyTimes();
         expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:00")
-                    .anyTimes();
+                .anyTimes();
         chdlr.sw.cancelAllStatisticsReplies();
         chdlr.sw.setConnected(false);
         expect(chdlr.sw.isConnected()).andReturn(true);
-        
+
         controller.connectedSwitches.add(chdlr.sw);
         controller.activeSwitches.put(0L, chdlr.sw);
-        
+
         replay(chdlr.sw);
         chdlr.channelDisconnected(null, null);
         verify(chdlr.sw);
-        
+
         // Switch is connected but not active
         reset(chdlr.sw);
         expect(chdlr.sw.getId()).andReturn(0L).anyTimes();
@@ -731,14 +736,14 @@
         replay(chdlr.sw);
         chdlr.channelDisconnected(null, null);
         verify(chdlr.sw);
-        
+
         // Not in ready state
         state.hsState = HandshakeState.START;
         reset(chdlr.sw);
         replay(chdlr.sw);
         chdlr.channelDisconnected(null, null);
         verify(chdlr.sw);
-        
+
         // Switch is null
         state.hsState = HandshakeState.READY;
         chdlr.sw = null;
@@ -778,14 +783,14 @@
         Controller.OFChannelHandler chdlr = controller.new OFChannelHandler(state);
         chdlr.sw = createMock(OFSwitchImpl.class);
         Channel ch = createMock(Channel.class);
-        
+
         // the error returned when role request message is not supported by sw
         OFError msg = new OFError();
         msg.setType(OFType.ERROR);
         msg.setXid(xid);
         msg.setErrorType(OFErrorType.OFPET_BAD_REQUEST);
         msg.setErrorCode(OFBadRequestCode.OFPBRC_BAD_VENDOR);
-        
+
         // the switch connection should get disconnected when the controller is
         // in SLAVE mode and the switch does not support role-request messages
         state.firstRoleReplyReceived = false;
@@ -794,17 +799,17 @@
         expect(chdlr.sw.deliverRoleRequestNotSupportedEx(xid)).andReturn(Role.SLAVE);
         expect(chdlr.sw.getChannel()).andReturn(ch).anyTimes();
         expect(ch.close()).andReturn(null);
-        
+
         replay(ch, chdlr.sw);
         chdlr.processOFMessage(msg);
         verify(ch, chdlr.sw);
-        assertTrue("state.firstRoleReplyReceived must be true", 
-                   state.firstRoleReplyReceived);
+        assertTrue("state.firstRoleReplyReceived must be true",
+                state.firstRoleReplyReceived);
         assertTrue("activeSwitches must be empty",
-                   controller.activeSwitches.isEmpty());
+                controller.activeSwitches.isEmpty());
         reset(ch, chdlr.sw);
-              
-        
+
+
         // a different error message - should also reject role request
         msg.setErrorType(OFErrorType.OFPET_BAD_REQUEST);
         msg.setErrorCode(OFBadRequestCode.OFPBRC_EPERM);
@@ -815,16 +820,16 @@
         expect(chdlr.sw.getChannel()).andReturn(ch).anyTimes();
         expect(ch.close()).andReturn(null);
         replay(ch, chdlr.sw);
-        
+
         chdlr.processOFMessage(msg);
         verify(ch, chdlr.sw);
         assertTrue("state.firstRoleReplyReceived must be True even with EPERM",
-                   state.firstRoleReplyReceived);
-        assertTrue("activeSwitches must be empty", 
-                   controller.activeSwitches.isEmpty());
+                state.firstRoleReplyReceived);
+        assertTrue("activeSwitches must be empty",
+                controller.activeSwitches.isEmpty());
         reset(ch, chdlr.sw);
-    
-        
+
+
         // We are MASTER, the switch should be added to the list of active
         // switches.
         state.firstRoleReplyReceived = false;
@@ -834,19 +839,19 @@
         setupSwitchForAddSwitch(chdlr.sw, 0L);
         chdlr.sw.clearAllFlowMods();
         replay(ch, chdlr.sw);
-        
+
         chdlr.processOFMessage(msg);
         verify(ch, chdlr.sw);
-        assertTrue("state.firstRoleReplyReceived must be true", 
-                   state.firstRoleReplyReceived);
+        assertTrue("state.firstRoleReplyReceived must be true",
+                state.firstRoleReplyReceived);
         assertSame("activeSwitches must contain this switch",
-                   chdlr.sw, controller.activeSwitches.get(0L));
+                chdlr.sw, controller.activeSwitches.get(0L));
         reset(ch, chdlr.sw);
 
     }
-    
-    
-    @Test 
+
+
+    @Test
     public void testVendorMessageUnknown() throws Exception {
         // Check behavior with an unknown vendor id
         OFChannelState state = new OFChannelState();
@@ -856,8 +861,8 @@
         msg.setVendor(0);
         chdlr.processOFMessage(msg);
     }
-    
-    
+
+
     // Helper function.
     protected Controller.OFChannelHandler getChannelHandlerForRoleReplyTest() {
         OFChannelState state = new OFChannelState();
@@ -866,23 +871,25 @@
         chdlr.sw = createMock(OFSwitchImpl.class);
         return chdlr;
     }
-    
+
     // Helper function
     protected OFVendor getRoleReplyMsgForRoleReplyTest(int xid, int nicira_role) {
         OFVendor msg = new OFVendor();
         msg.setXid(xid);
         msg.setVendor(OFNiciraVendorData.NX_VENDOR_ID);
-        OFRoleReplyVendorData roleReplyVendorData = 
+        OFRoleReplyVendorData roleReplyVendorData =
                 new OFRoleReplyVendorData(OFRoleReplyVendorData.NXT_ROLE_REPLY);
         msg.setVendorData(roleReplyVendorData);
         roleReplyVendorData.setRole(nicira_role);
         return msg;
     }
-   
-    /** invalid role in role reply */
-    @Test 
-    public void testNiciraRoleReplyInvalidRole() 
-                    throws Exception {
+
+    /**
+     * invalid role in role reply
+     */
+    @Test
+    public void testNiciraRoleReplyInvalidRole()
+            throws Exception {
         int xid = 424242;
         Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
         Channel ch = createMock(Channel.class);
@@ -893,16 +900,18 @@
         chdlr.processOFMessage(msg);
         verify(chdlr.sw, ch);
     }
-    
-    /** First role reply message received: transition from slave to master */
-    @Test 
-    public void testNiciraRoleReplySlave2MasterFristTime() 
-                    throws Exception {
+
+    /**
+     * First role reply message received: transition from slave to master
+     */
+    @Test
+    public void testNiciraRoleReplySlave2MasterFristTime()
+            throws Exception {
         int xid = 424242;
         Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
         OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
-                                       OFRoleReplyVendorData.NX_ROLE_MASTER);
-        
+                OFRoleReplyVendorData.NX_ROLE_MASTER);
+
         chdlr.sw.deliverRoleReply(xid, Role.MASTER);
         expect(chdlr.sw.isActive()).andReturn(true);
         setupSwitchForAddSwitch(chdlr.sw, 1L);
@@ -911,22 +920,24 @@
         replay(chdlr.sw);
         chdlr.processOFMessage(msg);
         verify(chdlr.sw);
-        assertTrue("state.firstRoleReplyReceived must be true", 
-                   chdlr.state.firstRoleReplyReceived);
+        assertTrue("state.firstRoleReplyReceived must be true",
+                chdlr.state.firstRoleReplyReceived);
         assertSame("activeSwitches must contain this switch",
-                   chdlr.sw, controller.activeSwitches.get(1L));
+                chdlr.sw, controller.activeSwitches.get(1L));
     }
-    
-    
-    /** Not first role reply message received: transition from slave to master */
-    @Test 
-    public void testNiciraRoleReplySlave2MasterNotFristTime() 
-                    throws Exception {
+
+
+    /**
+     * Not first role reply message received: transition from slave to master
+     */
+    @Test
+    public void testNiciraRoleReplySlave2MasterNotFristTime()
+            throws Exception {
         int xid = 424242;
         Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
         OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
-                                       OFRoleReplyVendorData.NX_ROLE_MASTER);
-        
+                OFRoleReplyVendorData.NX_ROLE_MASTER);
+
         chdlr.sw.deliverRoleReply(xid, Role.MASTER);
         expect(chdlr.sw.isActive()).andReturn(true);
         setupSwitchForAddSwitch(chdlr.sw, 1L);
@@ -935,21 +946,23 @@
         replay(chdlr.sw);
         chdlr.processOFMessage(msg);
         verify(chdlr.sw);
-        assertTrue("state.firstRoleReplyReceived must be true", 
-                   chdlr.state.firstRoleReplyReceived);
+        assertTrue("state.firstRoleReplyReceived must be true",
+                chdlr.state.firstRoleReplyReceived);
         assertSame("activeSwitches must contain this switch",
-                   chdlr.sw, controller.activeSwitches.get(1L));
+                chdlr.sw, controller.activeSwitches.get(1L));
     }
-    
-    /** transition from slave to equal */
-    @Test 
-    public void testNiciraRoleReplySlave2Equal() 
-                    throws Exception {
+
+    /**
+     * transition from slave to equal
+     */
+    @Test
+    public void testNiciraRoleReplySlave2Equal()
+            throws Exception {
         int xid = 424242;
         Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
         OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
-                                       OFRoleReplyVendorData.NX_ROLE_OTHER);
-        
+                OFRoleReplyVendorData.NX_ROLE_OTHER);
+
         chdlr.sw.deliverRoleReply(xid, Role.EQUAL);
         expect(chdlr.sw.isActive()).andReturn(true);
         setupSwitchForAddSwitch(chdlr.sw, 1L);
@@ -958,72 +971,74 @@
         replay(chdlr.sw);
         chdlr.processOFMessage(msg);
         verify(chdlr.sw);
-        assertTrue("state.firstRoleReplyReceived must be true", 
-                   chdlr.state.firstRoleReplyReceived);
+        assertTrue("state.firstRoleReplyReceived must be true",
+                chdlr.state.firstRoleReplyReceived);
         assertSame("activeSwitches must contain this switch",
-                   chdlr.sw, controller.activeSwitches.get(1L));
-    };
-    
+                chdlr.sw, controller.activeSwitches.get(1L));
+    }
+
+    ;
+
     @Test
     /** Slave2Slave transition ==> no change */
-    public void testNiciraRoleReplySlave2Slave() throws Exception{
+    public void testNiciraRoleReplySlave2Slave() throws Exception {
         int xid = 424242;
         Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
-        OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid, 
-                                       OFRoleReplyVendorData.NX_ROLE_SLAVE);
-        
+        OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
+                OFRoleReplyVendorData.NX_ROLE_SLAVE);
+
         chdlr.sw.deliverRoleReply(xid, Role.SLAVE);
         expect(chdlr.sw.getId()).andReturn(1L).anyTimes();
         expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:01")
-                    .anyTimes();
+                .anyTimes();
         expect(chdlr.sw.isActive()).andReturn(false);
         // don't add switch to activeSwitches ==> slave2slave
         chdlr.state.firstRoleReplyReceived = false;
         replay(chdlr.sw);
         chdlr.processOFMessage(msg);
         verify(chdlr.sw);
-        assertTrue("state.firstRoleReplyReceived must be true", 
-                   chdlr.state.firstRoleReplyReceived);
-        assertTrue("activeSwitches must be empty", 
-                   controller.activeSwitches.isEmpty());
+        assertTrue("state.firstRoleReplyReceived must be true",
+                chdlr.state.firstRoleReplyReceived);
+        assertTrue("activeSwitches must be empty",
+                controller.activeSwitches.isEmpty());
     }
-    
+
     @Test
     /** Equal2Master transition ==> no change */
-    public void testNiciraRoleReplyEqual2Master() throws Exception{
+    public void testNiciraRoleReplyEqual2Master() throws Exception {
         int xid = 424242;
         Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
-        OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid, 
-                                       OFRoleReplyVendorData.NX_ROLE_MASTER);
-        
+        OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
+                OFRoleReplyVendorData.NX_ROLE_MASTER);
+
         chdlr.sw.deliverRoleReply(xid, Role.MASTER);
         expect(chdlr.sw.getId()).andReturn(1L).anyTimes();
         expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:01")
-                    .anyTimes();
+                .anyTimes();
         expect(chdlr.sw.isActive()).andReturn(true);
         controller.activeSwitches.put(1L, chdlr.sw);
         chdlr.state.firstRoleReplyReceived = false;
         replay(chdlr.sw);
         chdlr.processOFMessage(msg);
         verify(chdlr.sw);
-        assertTrue("state.firstRoleReplyReceived must be true", 
-                   chdlr.state.firstRoleReplyReceived);
+        assertTrue("state.firstRoleReplyReceived must be true",
+                chdlr.state.firstRoleReplyReceived);
         assertSame("activeSwitches must contain this switch",
-                   chdlr.sw, controller.activeSwitches.get(1L));
+                chdlr.sw, controller.activeSwitches.get(1L));
     }
-    
-    @Test 
-    public void testNiciraRoleReplyMaster2Slave() 
-                    throws Exception {
+
+    @Test
+    public void testNiciraRoleReplyMaster2Slave()
+            throws Exception {
         int xid = 424242;
         Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
-        OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid, 
-                                       OFRoleReplyVendorData.NX_ROLE_SLAVE);
-        
+        OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
+                OFRoleReplyVendorData.NX_ROLE_SLAVE);
+
         chdlr.sw.deliverRoleReply(xid, Role.SLAVE);
         expect(chdlr.sw.getId()).andReturn(1L).anyTimes();
         expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:01")
-                    .anyTimes();
+                .anyTimes();
         controller.activeSwitches.put(1L, chdlr.sw);
         expect(chdlr.sw.isActive()).andReturn(false);
         expect(chdlr.sw.isConnected()).andReturn(true);
@@ -1032,15 +1047,16 @@
         replay(chdlr.sw);
         chdlr.processOFMessage(msg);
         verify(chdlr.sw);
-        assertTrue("state.firstRoleReplyReceived must be true", 
-                   chdlr.state.firstRoleReplyReceived);
-        assertTrue("activeSwitches must be empty", 
-                   controller.activeSwitches.isEmpty());
+        assertTrue("state.firstRoleReplyReceived must be true",
+                chdlr.state.firstRoleReplyReceived);
+        assertTrue("activeSwitches must be empty",
+                controller.activeSwitches.isEmpty());
     }
-    
+
     /**
      * Tests that you can't remove a switch from the active
      * switch list.
+     *
      * @throws Exception
      */
     @Test
@@ -1058,52 +1074,52 @@
         assertTrue(exceptionThrown);
         verify(sw);
     }
-    
+
     public void verifyPortChangedUpdateInQueue(IOFSwitch sw) throws Exception {
         assertEquals(1, controller.updates.size());
         IUpdate update = controller.updates.take();
         assertEquals(true, update instanceof SwitchUpdate);
-        SwitchUpdate swUpdate = (SwitchUpdate)update;
+        SwitchUpdate swUpdate = (SwitchUpdate) update;
         assertEquals(sw, swUpdate.sw);
         assertEquals(SwitchUpdateType.PORTCHANGED, swUpdate.switchUpdateType);
     }
-    
+
     public void verifyPortAddedUpdateInQueue(IOFSwitch sw) throws Exception {
         assertEquals(2, controller.updates.size());
         IUpdate update = controller.updates.take();
         assertEquals(true, update instanceof SwitchUpdate);
-        SwitchUpdate swUpdate = (SwitchUpdate)update;
+        SwitchUpdate swUpdate = (SwitchUpdate) update;
         assertEquals(sw, swUpdate.sw);
         assertEquals(SwitchUpdateType.PORTADDED, swUpdate.switchUpdateType);
         verifyPortChangedUpdateInQueue(sw);
     }
-    
+
     public void verifyPortRemovedUpdateInQueue(IOFSwitch sw) throws Exception {
         assertEquals(2, controller.updates.size());
         IUpdate update = controller.updates.take();
         assertEquals(true, update instanceof SwitchUpdate);
-        SwitchUpdate swUpdate = (SwitchUpdate)update;
+        SwitchUpdate swUpdate = (SwitchUpdate) update;
         assertEquals(sw, swUpdate.sw);
         assertEquals(SwitchUpdateType.PORTREMOVED, swUpdate.switchUpdateType);
         verifyPortChangedUpdateInQueue(sw);
     }
-    
+
     /*
      * Test handlePortStatus()
      * TODO: test correct updateStorage behavior!
      */
-    @Test 
+    @Test
     public void testHandlePortStatus() throws Exception {
         IOFSwitch sw = createMock(IOFSwitch.class);
         expect(sw.getId()).andReturn(1L).anyTimes();
         OFPhysicalPort port = new OFPhysicalPort();
         port.setName("myPortName1");
-        port.setPortNumber((short)42);
-        
+        port.setPortNumber((short) 42);
+
         OFPortStatus ofps = new OFPortStatus();
         ofps.setDesc(port);
-        
-        ofps.setReason((byte)OFPortReason.OFPPR_ADD.ordinal());
+
+        ofps.setReason((byte) OFPortReason.OFPPR_ADD.ordinal());
         sw.setPort(port);
         expectLastCall().once();
         replay(sw);
@@ -1111,9 +1127,9 @@
         verify(sw);
         verifyPortAddedUpdateInQueue(sw);
         reset(sw);
-        
+
         // ONOS:Port is considered added if Link state is not down and not configured to be down
-        ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
+        ofps.setReason((byte) OFPortReason.OFPPR_MODIFY.ordinal());
         sw.setPort(port);
         expectLastCall().once();
         replay(sw);
@@ -1121,9 +1137,9 @@
         verify(sw);
         verifyPortAddedUpdateInQueue(sw);
         reset(sw);
-        
+
         // ONOS:Port is considered removed if Link state is down
-        ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
+        ofps.setReason((byte) OFPortReason.OFPPR_MODIFY.ordinal());
         port.setState(OFPortState.OFPPS_LINK_DOWN.getValue());
         sw.setPort(port);
         expectLastCall().once();
@@ -1133,9 +1149,9 @@
         verifyPortRemovedUpdateInQueue(sw);
         reset(sw);
         port.setState(0);// reset
-        
+
         // ONOS: .. or is configured to be down
-        ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
+        ofps.setReason((byte) OFPortReason.OFPPR_MODIFY.ordinal());
         port.setConfig(OFPortConfig.OFPPC_PORT_DOWN.getValue());
         sw.setPort(port);
         expectLastCall().once();
@@ -1145,9 +1161,9 @@
         verifyPortRemovedUpdateInQueue(sw);
         reset(sw);
         port.setConfig(0);// reset
-        
-        
-        ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
+
+
+        ofps.setReason((byte) OFPortReason.OFPPR_DELETE.ordinal());
         sw.deletePort(port.getPortNumber());
         expectLastCall().once();
         replay(sw);
diff --git a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java
index 152d2f0..cf03551 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java
@@ -31,8 +31,8 @@
 
 public class OFSwitchImplTest extends FloodlightTestCase {
     protected OFSwitchImpl sw;
-    
-    
+
+
     @Before
     public void setUp() throws Exception {
         sw = new OFSwitchImpl();
@@ -44,10 +44,10 @@
         sw.setFloodlightProvider(floodlightProvider);
     }
 
-    
+
     public void doSendNxRoleRequest(Role role, int nx_role) throws Exception {
         long cookie = System.nanoTime();
-        
+
         // verify that the correct OFMessage is sent
         Capture<List<OFMessage>> msgCapture = new Capture<List<OFMessage>>();
         expect(sw.channel.write(capture(msgCapture))).andReturn(null);
@@ -57,18 +57,18 @@
         List<OFMessage> msgList = msgCapture.getValue();
         assertEquals(1, msgList.size());
         OFMessage msg = msgList.get(0);
-        assertEquals("Transaction Ids must match", xid, msg.getXid()); 
+        assertEquals("Transaction Ids must match", xid, msg.getXid());
         assertTrue("Message must be an OFVendor type", msg instanceof OFVendor);
         assertEquals(OFType.VENDOR, msg.getType());
-        OFVendor vendorMsg = (OFVendor)msg;
+        OFVendor vendorMsg = (OFVendor) msg;
         assertEquals("Vendor message must be vendor Nicira",
-                     OFNiciraVendorData.NX_VENDOR_ID, vendorMsg.getVendor());
+                OFNiciraVendorData.NX_VENDOR_ID, vendorMsg.getVendor());
         OFVendorData vendorData = vendorMsg.getVendorData();
         assertTrue("Vendor Data must be an OFRoleRequestVendorData",
-                     vendorData instanceof OFRoleRequestVendorData);
-        OFRoleRequestVendorData roleRequest = (OFRoleRequestVendorData)vendorData;
+                vendorData instanceof OFRoleRequestVendorData);
+        OFRoleRequestVendorData roleRequest = (OFRoleRequestVendorData) vendorData;
         assertEquals(nx_role, roleRequest.getRole());
-        
+
         // Now verify that we've added the pending request correctly
         // to the pending queue
         assertEquals(1, sw.pendingRoleRequests.size());
@@ -78,23 +78,23 @@
         assertEquals(cookie, pendingRoleRequest.cookie);
         reset(sw.channel);
     }
-    
+
     @Test
     public void testSendNxRoleRequest() throws Exception {
         doSendNxRoleRequest(Role.MASTER, OFRoleVendorData.NX_ROLE_MASTER);
         doSendNxRoleRequest(Role.SLAVE, OFRoleVendorData.NX_ROLE_SLAVE);
         doSendNxRoleRequest(Role.EQUAL, OFRoleVendorData.NX_ROLE_OTHER);
     }
-    
-    
+
+
     @Test
     public void testDeliverRoleReplyOk() {
         // test normal case
         PendingRoleRequestEntry pending = new PendingRoleRequestEntry(
-                            (int)System.currentTimeMillis(),  // arbitrary xid
-                            Role.MASTER,
-                            System.nanoTime() // arbitrary cookie
-                            );
+                (int) System.currentTimeMillis(),  // arbitrary xid
+                Role.MASTER,
+                System.nanoTime() // arbitrary cookie
+        );
         sw.pendingRoleRequests.add(pending);
         replay(sw.channel);
         sw.deliverRoleReply(pending.xid, pending.role);
@@ -103,15 +103,15 @@
         assertEquals(pending.role, sw.role);
         assertEquals(0, sw.pendingRoleRequests.size());
     }
-    
+
     @Test
     public void testDeliverRoleReplyOkRepeated() {
         // test normal case. Not the first role reply
         PendingRoleRequestEntry pending = new PendingRoleRequestEntry(
-                            (int)System.currentTimeMillis(),  // arbitrary xid
-                            Role.MASTER,
-                            System.nanoTime() // arbitrary cookie
-                            );
+                (int) System.currentTimeMillis(),  // arbitrary xid
+                Role.MASTER,
+                System.nanoTime() // arbitrary cookie
+        );
         sw.setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true);
         sw.pendingRoleRequests.add(pending);
         replay(sw.channel);
@@ -121,7 +121,7 @@
         assertEquals(pending.role, sw.role);
         assertEquals(0, sw.pendingRoleRequests.size());
     }
-    
+
     @Test
     public void testDeliverRoleReplyNonePending() {
         // nothing pending 
@@ -131,32 +131,32 @@
         verify(sw.channel);
         assertEquals(0, sw.pendingRoleRequests.size());
     }
-    
+
     @Test
     public void testDeliverRoleReplyWrongXid() {
         // wrong xid received 
         PendingRoleRequestEntry pending = new PendingRoleRequestEntry(
-                            (int)System.currentTimeMillis(),  // arbitrary xid
-                            Role.MASTER,
-                            System.nanoTime() // arbitrary cookie
-                            );
+                (int) System.currentTimeMillis(),  // arbitrary xid
+                Role.MASTER,
+                System.nanoTime() // arbitrary cookie
+        );
         sw.pendingRoleRequests.add(pending);
         expect(sw.channel.close()).andReturn(null);
         replay(sw.channel);
-        sw.deliverRoleReply(pending.xid+1, pending.role);
+        sw.deliverRoleReply(pending.xid + 1, pending.role);
         verify(sw.channel);
         assertEquals(null, sw.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE));
         assertEquals(0, sw.pendingRoleRequests.size());
     }
-    
+
     @Test
     public void testDeliverRoleReplyWrongRole() {
         // correct xid but incorrect role received
         PendingRoleRequestEntry pending = new PendingRoleRequestEntry(
-                            (int)System.currentTimeMillis(),  // arbitrary xid
-                            Role.MASTER,
-                            System.nanoTime() // arbitrary cookie
-                            );
+                (int) System.currentTimeMillis(),  // arbitrary xid
+                Role.MASTER,
+                System.nanoTime() // arbitrary cookie
+        );
         sw.pendingRoleRequests.add(pending);
         expect(sw.channel.close()).andReturn(null);
         replay(sw.channel);
@@ -165,11 +165,11 @@
         assertEquals(null, sw.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE));
         assertEquals(0, sw.pendingRoleRequests.size());
     }
-    
+
     @Test
     public void testCheckFirstPendingRoleRequestXid() {
         PendingRoleRequestEntry pending = new PendingRoleRequestEntry(
-                            54321, Role.MASTER, 232323);
+                54321, Role.MASTER, 232323);
         replay(sw.channel); // we don't expect any invocations 
         sw.pendingRoleRequests.add(pending);
         assertEquals(true, sw.checkFirstPendingRoleRequestXid(54321));
@@ -178,11 +178,11 @@
         assertEquals(false, sw.checkFirstPendingRoleRequestXid(54321));
         verify(sw.channel);
     }
-    
+
     @Test
     public void testCheckFirstPendingRoleRequestCookie() {
         PendingRoleRequestEntry pending = new PendingRoleRequestEntry(
-                            54321, Role.MASTER, 232323);
+                54321, Role.MASTER, 232323);
         replay(sw.channel); // we don't expect any invocations 
         sw.pendingRoleRequests.add(pending);
         assertEquals(true, sw.checkFirstPendingRoleRequestCookie(232323));
@@ -191,15 +191,15 @@
         assertEquals(false, sw.checkFirstPendingRoleRequestCookie(232323));
         verify(sw.channel);
     }
-    
+
     @Test
-    public void testDeliverRoleRequestNotSupported () {
+    public void testDeliverRoleRequestNotSupported() {
         // normal case. xid is pending 
         PendingRoleRequestEntry pending = new PendingRoleRequestEntry(
-                            (int)System.currentTimeMillis(),  // arbitrary xid
-                            Role.MASTER,
-                            System.nanoTime() // arbitrary cookie
-                            );
+                (int) System.currentTimeMillis(),  // arbitrary xid
+                Role.MASTER,
+                System.nanoTime() // arbitrary cookie
+        );
         sw.role = Role.SLAVE;
         sw.pendingRoleRequests.add(pending);
         replay(sw.channel);
@@ -209,7 +209,7 @@
         assertEquals(null, sw.role);
         assertEquals(0, sw.pendingRoleRequests.size());
     }
-    
+
     @Test
     public void testDeliverRoleRequestNotSupportedNonePending() {
         // nothing pending 
@@ -221,20 +221,20 @@
         assertEquals(null, sw.role);
         assertEquals(0, sw.pendingRoleRequests.size());
     }
-    
+
     @Test
     public void testDeliverRoleRequestNotSupportedWrongXid() {
         // wrong xid received 
         PendingRoleRequestEntry pending = new PendingRoleRequestEntry(
-                            (int)System.currentTimeMillis(),  // arbitrary xid
-                            Role.MASTER,
-                            System.nanoTime() // arbitrary cookie
-                            );
+                (int) System.currentTimeMillis(),  // arbitrary xid
+                Role.MASTER,
+                System.nanoTime() // arbitrary cookie
+        );
         sw.role = Role.SLAVE;
         sw.pendingRoleRequests.add(pending);
         expect(sw.channel.close()).andReturn(null);
         replay(sw.channel);
-        sw.deliverRoleRequestNotSupportedEx(pending.xid+1);
+        sw.deliverRoleRequestNotSupportedEx(pending.xid + 1);
         verify(sw.channel);
         assertEquals(null, sw.role);
         assertEquals(0, sw.pendingRoleRequests.size());
diff --git a/src/test/java/net/floodlightcontroller/core/internal/RoleChangeCallbackTest.java b/src/test/java/net/floodlightcontroller/core/internal/RoleChangeCallbackTest.java
index 90eb68d..6e707ca 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/RoleChangeCallbackTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/RoleChangeCallbackTest.java
@@ -16,129 +16,133 @@
 
 // Extends Controller class to access protected inner class
 public class RoleChangeCallbackTest extends Controller {
-	@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 if {@link RoleChangeCallback#controlChanged(long, boolean)} correctly calls {@link RoleChanger#submitRequest(Collection, net.floodlightcontroller.core.IFloodlightProviderService.Role)}
-	 * when connectedSwitch is not empty.
-	 * @throws Exception
-	 */
-	@SuppressWarnings("unchecked")
-	@Test
-	public void testNormalSwitches() throws Exception {
-		Long [] dpids = new Long [] { 1000L, 1001L, 1002L, 1003L };
-		final long dpidExist = 1000L;
-		final long dpidNotExist = 2000L;
-		
-		roleChanger = EasyMock.createMock(RoleChanger.class);
-		
-		// First call will be called with (dpidExist,true)
-		roleChanger.submitRequest(EasyMock.anyObject(Collection.class), EasyMock.anyObject(Role.class));
-		EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-			@Override
-			public Object answer() throws Throwable {
-				Collection<OFSwitchImpl> switches = (Collection<OFSwitchImpl>)EasyMock.getCurrentArguments()[0];
-				Role role = (Role)EasyMock.getCurrentArguments()[1];
+    /**
+     * Test if {@link RoleChangeCallback#controlChanged(long, boolean)} correctly calls {@link RoleChanger#submitRequest(Collection, net.floodlightcontroller.core.IFloodlightProviderService.Role)}
+     * when connectedSwitch is not empty.
+     *
+     * @throws Exception
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testNormalSwitches() throws Exception {
+        Long[] dpids = new Long[]{1000L, 1001L, 1002L, 1003L};
+        final long dpidExist = 1000L;
+        final long dpidNotExist = 2000L;
 
-				List<Long> dpids = new ArrayList<Long>();
-				
-				for(OFSwitchImpl sw : switches) {
-					dpids.add(sw.getId());
-				}
-				assertTrue(dpids.contains(dpidExist));
-				assertEquals(role, Role.MASTER);
-				
-				return null;
-			}
-		}).once();
+        roleChanger = EasyMock.createMock(RoleChanger.class);
 
-		// Second call will be called with (dpidExist,false)
-		roleChanger.submitRequest(EasyMock.anyObject(Collection.class), EasyMock.anyObject(Role.class));
-		EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-			@Override
-			public Object answer() throws Throwable {
-				Collection<OFSwitchImpl> switches = (Collection<OFSwitchImpl>)EasyMock.getCurrentArguments()[0];
-				Role role = (Role)EasyMock.getCurrentArguments()[1];
+        // First call will be called with (dpidExist,true)
+        roleChanger.submitRequest(EasyMock.anyObject(Collection.class), EasyMock.anyObject(Role.class));
+        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+            @Override
+            public Object answer() throws Throwable {
+                Collection<OFSwitchImpl> switches = (Collection<OFSwitchImpl>) EasyMock.getCurrentArguments()[0];
+                Role role = (Role) EasyMock.getCurrentArguments()[1];
 
-				List<Long> dpids = new ArrayList<Long>();
-				
-				for(OFSwitchImpl sw : switches) {
-					dpids.add(sw.getId());
-				}
-				assertTrue(dpids.contains(dpidExist));
-				assertEquals(role, Role.SLAVE);
-				
-				return null;
-			}
-		}).once();
+                List<Long> dpids = new ArrayList<Long>();
 
-		EasyMock.replay(roleChanger);
-		
-		initNetwork(roleChanger, dpids);
-		
-		RoleChangeCallback callback = new RoleChangeCallback();
-		callback.controlChanged(dpidExist, true);
-		callback.controlChanged(dpidExist, false);
-		callback.controlChanged(dpidNotExist, true);
-		callback.controlChanged(dpidNotExist, false);
-		
-		EasyMock.verify(roleChanger);
-	}
+                for (OFSwitchImpl sw : switches) {
+                    dpids.add(sw.getId());
+                }
+                assertTrue(dpids.contains(dpidExist));
+                assertEquals(role, Role.MASTER);
 
-	/**
-	 * Test if {@link RoleChangeCallback#controlChanged(long, boolean)} doesn't call RoleChanger methods
-	 * when connectedSwitch is empty.
-	 * @throws Exception
-	 */
-	@Test
-	public void testEmptySwitches() throws Exception {
-		Long [] dpids = new Long [] {};
-		final long dpidToTest = 1000L;
-		
-		roleChanger = EasyMock.createMock(RoleChanger.class);
-		// roleChanger methods must not be used
-		EasyMock.replay(roleChanger);
-		
-		initNetwork(roleChanger, dpids);
-		
-		RoleChangeCallback callback = new RoleChangeCallback();
-		callback.controlChanged(dpidToTest, true);
-		callback.controlChanged(dpidToTest, false);
-		
-		EasyMock.verify(roleChanger);
-	}
-	
-	/**
-	 * Create mock OFSwitchImpl object.
-	 * @param id
-	 * @return
-	 */
-	private OFSwitchImpl createOFSwitchImplMock(Long id) {
-		OFSwitchImpl sw = EasyMock.createMock(OFSwitchImpl.class);
+                return null;
+            }
+        }).once();
 
-		EasyMock.expect(sw.getId()).andReturn(id).anyTimes();
-		EasyMock.replay(sw);
-		
-		return sw;
-	}
-	
-	/**
-	 * Setup connectedSwitches
-	 * @param changer
-	 * @param ids
-	 * @throws Exception
-	 */
-	private void initNetwork(RoleChanger changer, Long [] ids) throws Exception {
-		connectedSwitches = new HashSet<OFSwitchImpl>();
-		
-		for(Long id : ids) {
-			connectedSwitches.add(createOFSwitchImplMock(id));
-		}
-	}
+        // Second call will be called with (dpidExist,false)
+        roleChanger.submitRequest(EasyMock.anyObject(Collection.class), EasyMock.anyObject(Role.class));
+        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+            @Override
+            public Object answer() throws Throwable {
+                Collection<OFSwitchImpl> switches = (Collection<OFSwitchImpl>) EasyMock.getCurrentArguments()[0];
+                Role role = (Role) EasyMock.getCurrentArguments()[1];
+
+                List<Long> dpids = new ArrayList<Long>();
+
+                for (OFSwitchImpl sw : switches) {
+                    dpids.add(sw.getId());
+                }
+                assertTrue(dpids.contains(dpidExist));
+                assertEquals(role, Role.SLAVE);
+
+                return null;
+            }
+        }).once();
+
+        EasyMock.replay(roleChanger);
+
+        initNetwork(roleChanger, dpids);
+
+        RoleChangeCallback callback = new RoleChangeCallback();
+        callback.controlChanged(dpidExist, true);
+        callback.controlChanged(dpidExist, false);
+        callback.controlChanged(dpidNotExist, true);
+        callback.controlChanged(dpidNotExist, false);
+
+        EasyMock.verify(roleChanger);
+    }
+
+    /**
+     * Test if {@link RoleChangeCallback#controlChanged(long, boolean)} doesn't call RoleChanger methods
+     * when connectedSwitch is empty.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testEmptySwitches() throws Exception {
+        Long[] dpids = new Long[]{};
+        final long dpidToTest = 1000L;
+
+        roleChanger = EasyMock.createMock(RoleChanger.class);
+        // roleChanger methods must not be used
+        EasyMock.replay(roleChanger);
+
+        initNetwork(roleChanger, dpids);
+
+        RoleChangeCallback callback = new RoleChangeCallback();
+        callback.controlChanged(dpidToTest, true);
+        callback.controlChanged(dpidToTest, false);
+
+        EasyMock.verify(roleChanger);
+    }
+
+    /**
+     * Create mock OFSwitchImpl object.
+     *
+     * @param id
+     * @return
+     */
+    private OFSwitchImpl createOFSwitchImplMock(Long id) {
+        OFSwitchImpl sw = EasyMock.createMock(OFSwitchImpl.class);
+
+        EasyMock.expect(sw.getId()).andReturn(id).anyTimes();
+        EasyMock.replay(sw);
+
+        return sw;
+    }
+
+    /**
+     * Setup connectedSwitches
+     *
+     * @param changer
+     * @param ids
+     * @throws Exception
+     */
+    private void initNetwork(RoleChanger changer, Long[] ids) throws Exception {
+        connectedSwitches = new HashSet<OFSwitchImpl>();
+
+        for (Long id : ids) {
+            connectedSwitches.add(createOFSwitchImplMock(id));
+        }
+    }
 }
diff --git a/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java b/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java
index 2b85221..9078665 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java
@@ -25,195 +25,196 @@
 
 public class RoleChangerTest {
     public RoleChanger roleChanger;
-    
+
     @Before
     public void setUp() throws Exception {
         roleChanger = new RoleChanger();
     }
-    
+
     /**
-     * Send a role request for SLAVE to a switch that doesn't support it. 
+     * Send a role request for SLAVE to a switch that doesn't support it.
      * The connection should be closed.
      */
     @Test
     public void testSendRoleRequestSlaveNotSupported() {
         LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>();
-        
+
         // a switch that doesn't support role requests
         OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class);
         Channel channel1 = createMock(Channel.class);
         expect(sw1.getChannel()).andReturn(channel1);
         // No support for NX_ROLE
         expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE))
-                        .andReturn(false); 
+                .andReturn(false);
         expect(channel1.close()).andReturn(null);
         switches.add(sw1);
-        
+
         replay(sw1, channel1);
         roleChanger.sendRoleRequest(switches, Role.SLAVE, 123456);
         verify(sw1, channel1);
-        
+
         // sendRoleRequest needs to remove the switch from the list since
         // it closed its connection
         assertTrue(switches.isEmpty());
     }
-    
+
     /**
-     * Send a role request for MASTER to a switch that doesn't support it. 
+     * Send a role request for MASTER to a switch that doesn't support it.
      * The connection should be closed.
      */
     @Test
-    @Ignore // FIXME: ONOS modified the behavior here to intentionally trigger OFS error.
+    @Ignore
+    // FIXME: ONOS modified the behavior here to intentionally trigger OFS error.
     public void testSendRoleRequestMasterNotSupported() {
         LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>();
-        
+
         // a switch that doesn't support role requests
         OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class);
         // No support for NX_ROLE
         expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE))
-                        .andReturn(false); 
+                .andReturn(false);
         switches.add(sw1);
-        
+
         replay(sw1);
         roleChanger.sendRoleRequest(switches, Role.MASTER, 123456);
         verify(sw1);
-        
+
         assertEquals(1, switches.size());
     }
-    
+
     /**
-     * Send a role request a switch that supports it and one that 
+     * Send a role request a switch that supports it and one that
      * hasn't had a role request send to it yet
      */
     @Test
-    public void testSendRoleRequestErrorHandling () throws Exception {
+    public void testSendRoleRequestErrorHandling() throws Exception {
         LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>();
-        
+
         // a switch that supports role requests
         OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class);
         // No support for NX_ROLE
         expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE))
-                        .andReturn(true); 
+                .andReturn(true);
         expect(sw1.sendNxRoleRequest(Role.MASTER, 123456))
-                    .andThrow(new IOException()).once();
+                .andThrow(new IOException()).once();
         Channel channel1 = createMock(Channel.class);
         expect(sw1.getChannel()).andReturn(channel1);
         expect(channel1.close()).andReturn(null);
         switches.add(sw1);
-        
+
         replay(sw1);
         roleChanger.sendRoleRequest(switches, Role.MASTER, 123456);
         verify(sw1);
-        
+
         assertTrue(switches.isEmpty());
     }
-    
+
     /**
-     * Check error handling 
+     * Check error handling
      * hasn't had a role request send to it yet
      */
     @Test
     public void testSendRoleRequestSupported() throws Exception {
         LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>();
-        
+
         // a switch that supports role requests
         OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class);
         // No support for NX_ROLE
         expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE))
-                        .andReturn(true); 
+                .andReturn(true);
         expect(sw1.sendNxRoleRequest(Role.MASTER, 123456)).andReturn(1).once();
         switches.add(sw1);
-        
+
         // a switch for which we don't have SUPPORTS_NX_ROLE yet
         OFSwitchImpl sw2 = EasyMock.createMock(OFSwitchImpl.class);
         // No support for NX_ROLE
         expect(sw2.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE))
-                        .andReturn(null); 
+                .andReturn(null);
         expect(sw2.sendNxRoleRequest(Role.MASTER, 123456)).andReturn(1).once();
         switches.add(sw2);
-        
-        
+
+
         replay(sw1, sw2);
         roleChanger.sendRoleRequest(switches, Role.MASTER, 123456);
         verify(sw1, sw2);
-        
+
         assertEquals(2, switches.size());
     }
-    
+
     @Test
     public void testVerifyRoleReplyReceived() {
         LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>();
-        
+
         // Add a switch that has received a role reply
         OFSwitchImpl sw1 = EasyMock.createMock(OFSwitchImpl.class);
         expect(sw1.checkFirstPendingRoleRequestCookie(123456))
-                        .andReturn(false).once();
+                .andReturn(false).once();
         switches.add(sw1);
-        
+
         // Add a switch that has not yet received a role reply
         OFSwitchImpl sw2 = EasyMock.createMock(OFSwitchImpl.class);
         expect(sw2.checkFirstPendingRoleRequestCookie(123456))
-                        .andReturn(true).once();
+                .andReturn(true).once();
         Channel channel2 = createMock(Channel.class);
         expect(sw2.getChannel()).andReturn(channel2);
         expect(channel2.close()).andReturn(null);
         switches.add(sw2);
-        
-        
+
+
         replay(sw1, sw2);
         roleChanger.verifyRoleReplyReceived(switches, 123456);
         verify(sw1, sw2);
-        
+
         assertEquals(2, switches.size());
     }
-    
+
     @Test
     public void testRoleChangeTask() {
         @SuppressWarnings("unchecked")
-        Collection<OFSwitchImpl> switches = 
+        Collection<OFSwitchImpl> switches =
                 EasyMock.createMock(Collection.class);
         long now = System.nanoTime();
-        long dt1 = 10 * 1000*1000*1000L;
-        long dt2 = 20 * 1000*1000*1000L;
-        long dt3 = 15 * 1000*1000*1000L;
-        RoleChangeTask t1 = new RoleChangeTask(switches, null, now+dt1);
-        RoleChangeTask t2 = new RoleChangeTask(switches, null, now+dt2);
-        RoleChangeTask t3 = new RoleChangeTask(switches, null, now+dt3);
-        
+        long dt1 = 10 * 1000 * 1000 * 1000L;
+        long dt2 = 20 * 1000 * 1000 * 1000L;
+        long dt3 = 15 * 1000 * 1000 * 1000L;
+        RoleChangeTask t1 = new RoleChangeTask(switches, null, now + dt1);
+        RoleChangeTask t2 = new RoleChangeTask(switches, null, now + dt2);
+        RoleChangeTask t3 = new RoleChangeTask(switches, null, now + dt3);
+
         // FIXME: cannot test comparison against self. grrr
         //assertTrue( t1.compareTo(t1) <= 0 );
-        assertTrue( t1.compareTo(t2) < 0 );
-        assertTrue( t1.compareTo(t3) < 0 );
-        
-        assertTrue( t2.compareTo(t1) > 0 );
+        assertTrue(t1.compareTo(t2) < 0);
+        assertTrue(t1.compareTo(t3) < 0);
+
+        assertTrue(t2.compareTo(t1) > 0);
         //assertTrue( t2.compareTo(t2) <= 0 );
-        assertTrue( t2.compareTo(t3) > 0 );
+        assertTrue(t2.compareTo(t3) > 0);
     }
-    
+
     @Test
     public void testSubmitRequest() throws Exception {
         LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>();
-        roleChanger.timeout = 500*1000*1000; // 500 ms
-        
+        roleChanger.timeout = 500 * 1000 * 1000; // 500 ms
+
         // a switch that supports role requests
         OFSwitchImpl sw1 = EasyMock.createStrictMock(OFSwitchImpl.class);
         // No support for NX_ROLE
         expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE))
-                        .andReturn(true); 
+                .andReturn(true);
         expect(sw1.sendNxRoleRequest(EasyMock.same(Role.MASTER), EasyMock.anyLong()))
-                       .andReturn(1);
+                .andReturn(1);
         expect(sw1.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE))
-                        .andReturn(true); 
+                .andReturn(true);
         expect(sw1.sendNxRoleRequest(EasyMock.same(Role.SLAVE), EasyMock.anyLong()))
-                       .andReturn(1);
+                .andReturn(1);
         // The following calls happen for timeout handling:
         expect(sw1.checkFirstPendingRoleRequestCookie(EasyMock.anyLong()))
-                        .andReturn(false);
+                .andReturn(false);
         expect(sw1.checkFirstPendingRoleRequestCookie(EasyMock.anyLong()))
-                        .andReturn(false);
+                .andReturn(false);
         switches.add(sw1);
-        
-        
+
+
         replay(sw1);
         roleChanger.submitRequest(switches, Role.MASTER);
         roleChanger.submitRequest(switches, Role.SLAVE);
@@ -223,17 +224,17 @@
         // Now there should be exactly one timeout task pending
         assertEquals(2, roleChanger.pendingTasks.size());
         // Make sure it's indeed a timeout task
-        assertSame(RoleChanger.RoleChangeTask.Type.TIMEOUT, 
-                     roleChanger.pendingTasks.peek().type);
+        assertSame(RoleChanger.RoleChangeTask.Type.TIMEOUT,
+                roleChanger.pendingTasks.peek().type);
         // Check that RoleChanger indeed made a copy of switches collection
         assertNotSame(switches, roleChanger.pendingTasks.peek().switches);
-        
+
         // Wait until the timeout triggers 
         // TODO: get rid of this sleep too.
         Thread.sleep(500);
         assertEquals(0, roleChanger.pendingTasks.size());
         verify(sw1);
-        
+
     }
-    
+
 }
diff --git a/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java b/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
index beb6d4f..b70405e 100644
--- a/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
+++ b/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
@@ -11,148 +11,152 @@
 import org.slf4j.LoggerFactory;
 
 public class FloodlightTestModuleLoader extends FloodlightModuleLoader {
-	protected final static Logger log = LoggerFactory.getLogger(FloodlightTestModuleLoader.class);
-	
-	// List of default modules to use unless specified otherwise
-	public static final Class<? extends IFloodlightModule> DEFAULT_FLOODLIGHT_PRPOVIDER =
-			MockFloodlightProvider.class;
-	public static final Class<? extends IFloodlightModule> DEFAULT_THREADPOOL =
-			MockThreadPoolService.class;
-	
-	
-	protected static final Collection<Class<? extends IFloodlightModule>> DEFAULT_MODULE_LIST;
-	
-	static {
-		DEFAULT_MODULE_LIST = new ArrayList<Class<? extends IFloodlightModule>>();
-		DEFAULT_MODULE_LIST.add(DEFAULT_FLOODLIGHT_PRPOVIDER);
-		DEFAULT_MODULE_LIST.add(DEFAULT_THREADPOOL);
+    protected final static Logger log = LoggerFactory.getLogger(FloodlightTestModuleLoader.class);
 
-	}
-	
-	protected IFloodlightModuleContext fmc;
-	
-	/**
-	 * Adds default modules to the list of modules to load. This is done
-	 * in order to avoid the module loader throwing errors about duplicate
-	 * modules and neither one is specified by the user.
-	 * @param userModules The list of user specified modules to add to.
-	 */
-	protected void addDefaultModules(Collection<Class<? extends IFloodlightModule>> userModules) {
-		Collection<Class<? extends IFloodlightModule>> defaultModules =
-				new ArrayList<Class<? extends IFloodlightModule>>(DEFAULT_MODULE_LIST.size());
-		defaultModules.addAll(DEFAULT_MODULE_LIST);
-		
-		Iterator<Class<? extends IFloodlightModule>> modIter = userModules.iterator();
-		while (modIter.hasNext()) {
-			Class<? extends IFloodlightModule> userMod = modIter.next();
-			Iterator<Class<? extends IFloodlightModule>> dmIter = defaultModules.iterator();
-			while (dmIter.hasNext()) {
-				Class<? extends IFloodlightModule> dmMod = dmIter.next();
-				Collection<Class<? extends IFloodlightService>> userModServs;
-				Collection<Class<? extends IFloodlightService>> dmModServs;
-				try {
-					dmModServs = dmMod.newInstance().getModuleServices();
-					userModServs = userMod.newInstance().getModuleServices();
-				} catch (InstantiationException e) {
-					log.error(e.getMessage());
-					break;
-				} catch (IllegalAccessException e) {
-					log.error(e.getMessage());
-					break;
-				}
-				
-				// If either of these are null continue as they have no services
-				if (dmModServs == null || userModServs == null) continue;
-				
-				// If the user supplied modules has a service
-				// that is in the default module list we remove
-				// the default module from the list.
-				boolean shouldBreak = false;
-				Iterator<Class<? extends IFloodlightService>> userModServsIter 
-					= userModServs.iterator();
-				while (userModServsIter.hasNext()) {
-					Class<? extends IFloodlightService> userModServIntf = userModServsIter.next();
-					Iterator<Class<? extends IFloodlightService>> dmModsServsIter 
-						= dmModServs.iterator();
-					while (dmModsServsIter.hasNext()) {
-						Class<? extends IFloodlightService> dmModServIntf 
-							= dmModsServsIter.next();
-						
-						if (dmModServIntf.getCanonicalName().equals(
-								userModServIntf.getCanonicalName())) {
-							logger.debug("Removing default module {} because it was " +
-									"overriden by an explicitly specified module",
-									dmModServIntf.getCanonicalName());
-							dmIter.remove();
-							shouldBreak = true;
-							break;
-						}
-					}
-					if (shouldBreak) break;
-				}
-				if (shouldBreak) break;
-			}
-		}
-		
-		// Append the remaining default modules to the user specified ones.
-		// This avoids the module loader throwing duplicate module errors.
-		userModules.addAll(defaultModules);
-		log.debug("Using module set " + userModules.toString());
-	}
-	
-	/**
-	 * Sets up all modules and their dependencies.
-	 * @param modules The list of modules that the user wants to load.
-	 * @param mockedServices The list of services that will be mocked. Any
-	 * module that provides this service will not be loaded.
-	 */
-	public void setupModules(Collection<Class<? extends IFloodlightModule>> modules,
-			Collection<IFloodlightService> mockedServices) {
-		addDefaultModules(modules);
-		Collection<String> modulesAsString = new ArrayList<String>();
-		for (Class<? extends IFloodlightModule> m : modules) {
-			modulesAsString.add(m.getCanonicalName());
-		}
-		
-		try {
-			fmc = loadModulesFromList(modulesAsString, null, mockedServices);
-		} catch (FloodlightModuleException e) {
-			log.error(e.getMessage());
-		}
-	}
-	
-	/**
-	 * Gets the inited/started instance of a module from the context.
-	 * @param ifl The name if the module to get, i.e. "LearningSwitch.class".
-	 * @return The inited/started instance of the module.
-	 */
-	public IFloodlightModule getModuleByName(Class<? extends IFloodlightModule> ifl) {
-		Collection<IFloodlightModule> modules = fmc.getAllModules();
-		for (IFloodlightModule m : modules) {
-			if (ifl.getCanonicalName().equals(m.getClass().getCanonicalName())) {
-				return m;
-			}
-		}
-		return null;
-	}
-	
-	/**
-	 * Gets an inited/started instance of a service from the context.
-	 * @param ifs The name of the service to get, i.e. "ITopologyService.class".
-	 * @return The inited/started instance of the service from teh context.
-	 */
-	public IFloodlightService getModuleByService(Class<? extends IFloodlightService> ifs) {
-		Collection<IFloodlightModule> modules = fmc.getAllModules();
-		for (IFloodlightModule m : modules) {
-			Collection<Class<? extends IFloodlightService>> mServs = m.getModuleServices();
-			if (mServs == null) continue;
-			for (Class<? extends IFloodlightService> mServClass : mServs) {
-				if (mServClass.getCanonicalName().equals(ifs.getCanonicalName())) {
-					assert(m instanceof IFloodlightService);
-					return (IFloodlightService)m;
-				}
-			}
-		}
-		return null;
-	}
+    // List of default modules to use unless specified otherwise
+    public static final Class<? extends IFloodlightModule> DEFAULT_FLOODLIGHT_PRPOVIDER =
+            MockFloodlightProvider.class;
+    public static final Class<? extends IFloodlightModule> DEFAULT_THREADPOOL =
+            MockThreadPoolService.class;
+
+
+    protected static final Collection<Class<? extends IFloodlightModule>> DEFAULT_MODULE_LIST;
+
+    static {
+        DEFAULT_MODULE_LIST = new ArrayList<Class<? extends IFloodlightModule>>();
+        DEFAULT_MODULE_LIST.add(DEFAULT_FLOODLIGHT_PRPOVIDER);
+        DEFAULT_MODULE_LIST.add(DEFAULT_THREADPOOL);
+
+    }
+
+    protected IFloodlightModuleContext fmc;
+
+    /**
+     * Adds default modules to the list of modules to load. This is done
+     * in order to avoid the module loader throwing errors about duplicate
+     * modules and neither one is specified by the user.
+     *
+     * @param userModules The list of user specified modules to add to.
+     */
+    protected void addDefaultModules(Collection<Class<? extends IFloodlightModule>> userModules) {
+        Collection<Class<? extends IFloodlightModule>> defaultModules =
+                new ArrayList<Class<? extends IFloodlightModule>>(DEFAULT_MODULE_LIST.size());
+        defaultModules.addAll(DEFAULT_MODULE_LIST);
+
+        Iterator<Class<? extends IFloodlightModule>> modIter = userModules.iterator();
+        while (modIter.hasNext()) {
+            Class<? extends IFloodlightModule> userMod = modIter.next();
+            Iterator<Class<? extends IFloodlightModule>> dmIter = defaultModules.iterator();
+            while (dmIter.hasNext()) {
+                Class<? extends IFloodlightModule> dmMod = dmIter.next();
+                Collection<Class<? extends IFloodlightService>> userModServs;
+                Collection<Class<? extends IFloodlightService>> dmModServs;
+                try {
+                    dmModServs = dmMod.newInstance().getModuleServices();
+                    userModServs = userMod.newInstance().getModuleServices();
+                } catch (InstantiationException e) {
+                    log.error(e.getMessage());
+                    break;
+                } catch (IllegalAccessException e) {
+                    log.error(e.getMessage());
+                    break;
+                }
+
+                // If either of these are null continue as they have no services
+                if (dmModServs == null || userModServs == null) continue;
+
+                // If the user supplied modules has a service
+                // that is in the default module list we remove
+                // the default module from the list.
+                boolean shouldBreak = false;
+                Iterator<Class<? extends IFloodlightService>> userModServsIter
+                        = userModServs.iterator();
+                while (userModServsIter.hasNext()) {
+                    Class<? extends IFloodlightService> userModServIntf = userModServsIter.next();
+                    Iterator<Class<? extends IFloodlightService>> dmModsServsIter
+                            = dmModServs.iterator();
+                    while (dmModsServsIter.hasNext()) {
+                        Class<? extends IFloodlightService> dmModServIntf
+                                = dmModsServsIter.next();
+
+                        if (dmModServIntf.getCanonicalName().equals(
+                                userModServIntf.getCanonicalName())) {
+                            logger.debug("Removing default module {} because it was " +
+                                    "overriden by an explicitly specified module",
+                                    dmModServIntf.getCanonicalName());
+                            dmIter.remove();
+                            shouldBreak = true;
+                            break;
+                        }
+                    }
+                    if (shouldBreak) break;
+                }
+                if (shouldBreak) break;
+            }
+        }
+
+        // Append the remaining default modules to the user specified ones.
+        // This avoids the module loader throwing duplicate module errors.
+        userModules.addAll(defaultModules);
+        log.debug("Using module set " + userModules.toString());
+    }
+
+    /**
+     * Sets up all modules and their dependencies.
+     *
+     * @param modules        The list of modules that the user wants to load.
+     * @param mockedServices The list of services that will be mocked. Any
+     *                       module that provides this service will not be loaded.
+     */
+    public void setupModules(Collection<Class<? extends IFloodlightModule>> modules,
+                             Collection<IFloodlightService> mockedServices) {
+        addDefaultModules(modules);
+        Collection<String> modulesAsString = new ArrayList<String>();
+        for (Class<? extends IFloodlightModule> m : modules) {
+            modulesAsString.add(m.getCanonicalName());
+        }
+
+        try {
+            fmc = loadModulesFromList(modulesAsString, null, mockedServices);
+        } catch (FloodlightModuleException e) {
+            log.error(e.getMessage());
+        }
+    }
+
+    /**
+     * Gets the inited/started instance of a module from the context.
+     *
+     * @param ifl The name if the module to get, i.e. "LearningSwitch.class".
+     * @return The inited/started instance of the module.
+     */
+    public IFloodlightModule getModuleByName(Class<? extends IFloodlightModule> ifl) {
+        Collection<IFloodlightModule> modules = fmc.getAllModules();
+        for (IFloodlightModule m : modules) {
+            if (ifl.getCanonicalName().equals(m.getClass().getCanonicalName())) {
+                return m;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Gets an inited/started instance of a service from the context.
+     *
+     * @param ifs The name of the service to get, i.e. "ITopologyService.class".
+     * @return The inited/started instance of the service from teh context.
+     */
+    public IFloodlightService getModuleByService(Class<? extends IFloodlightService> ifs) {
+        Collection<IFloodlightModule> modules = fmc.getAllModules();
+        for (IFloodlightModule m : modules) {
+            Collection<Class<? extends IFloodlightService>> mServs = m.getModuleServices();
+            if (mServs == null) continue;
+            for (Class<? extends IFloodlightService> mServClass : mServs) {
+                if (mServClass.getCanonicalName().equals(ifs.getCanonicalName())) {
+                    assert (m instanceof IFloodlightService);
+                    return (IFloodlightService) m;
+                }
+            }
+        }
+        return null;
+    }
 }
diff --git a/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java b/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java
index 30ade50..5961037 100644
--- a/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java
+++ b/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.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.floodlightcontroller.core.test;
 
@@ -52,31 +52,30 @@
 import org.slf4j.LoggerFactory;
 
 /**
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public class MockFloodlightProvider implements IFloodlightModule, IFloodlightProviderService {
     protected final static Logger log = LoggerFactory.getLogger(MockFloodlightProvider.class);
-    protected ConcurrentMap<OFType, ListenerDispatcher<OFType,IOFMessageListener>> listeners;
+    protected ConcurrentMap<OFType, ListenerDispatcher<OFType, IOFMessageListener>> listeners;
     protected List<IOFSwitchListener> switchListeners;
     protected Map<Long, IOFSwitch> switches;
     protected BasicFactory factory;
 
     /**
-     * 
+     *
      */
     public MockFloodlightProvider() {
-        listeners = new ConcurrentHashMap<OFType, ListenerDispatcher<OFType, 
-                                   IOFMessageListener>>();
+        listeners = new ConcurrentHashMap<OFType, ListenerDispatcher<OFType,
+                IOFMessageListener>>();
         switches = new ConcurrentHashMap<Long, IOFSwitch>();
         switchListeners = new CopyOnWriteArrayList<IOFSwitchListener>();
         factory = new BasicFactory();
     }
 
     @Override
-    public synchronized void addOFMessageListener(OFType type, 
+    public synchronized void addOFMessageListener(OFType type,
                                                   IOFMessageListener listener) {
-        ListenerDispatcher<OFType, IOFMessageListener> ldd = 
+        ListenerDispatcher<OFType, IOFMessageListener> ldd =
                 listeners.get(type);
         if (ldd == null) {
             ldd = new ListenerDispatcher<OFType, IOFMessageListener>();
@@ -88,7 +87,7 @@
     @Override
     public synchronized void removeOFMessageListener(OFType type,
                                                      IOFMessageListener listener) {
-        ListenerDispatcher<OFType, IOFMessageListener> ldd = 
+        ListenerDispatcher<OFType, IOFMessageListener> ldd =
                 listeners.get(type);
         if (ldd != null) {
             ldd.removeListener(listener);
@@ -99,19 +98,19 @@
      * @return the listeners
      */
     public Map<OFType, List<IOFMessageListener>> getListeners() {
-        Map<OFType, List<IOFMessageListener>> lers = 
+        Map<OFType, List<IOFMessageListener>> lers =
                 new HashMap<OFType, List<IOFMessageListener>>();
-            for(Entry<OFType, ListenerDispatcher<OFType, IOFMessageListener>> e : 
+        for (Entry<OFType, ListenerDispatcher<OFType, IOFMessageListener>> e :
                 listeners.entrySet()) {
-                lers.put(e.getKey(), e.getValue().getOrderedListeners());
-            }
-            return Collections.unmodifiableMap(lers);
+            lers.put(e.getKey(), e.getValue().getOrderedListeners());
+        }
+        return Collections.unmodifiableMap(lers);
     }
 
     public void clearListeners() {
         this.listeners.clear();
     }
-    
+
     @Override
     public Map<Long, IOFSwitch> getSwitches() {
         return this.switches;
@@ -134,18 +133,18 @@
     public void dispatchMessage(IOFSwitch sw, OFMessage msg) {
         dispatchMessage(sw, msg, new FloodlightContext());
     }
-    
+
     public void dispatchMessage(IOFSwitch sw, OFMessage msg, FloodlightContext bc) {
         List<IOFMessageListener> theListeners = listeners.get(msg.getType()).getOrderedListeners();
         if (theListeners != null) {
             Command result = Command.CONTINUE;
             Iterator<IOFMessageListener> it = theListeners.iterator();
             if (OFType.PACKET_IN.equals(msg.getType())) {
-                OFPacketIn pi = (OFPacketIn)msg;
+                OFPacketIn pi = (OFPacketIn) msg;
                 Ethernet eth = new Ethernet();
                 eth.deserialize(pi.getPacketData(), 0, pi.getPacketData().length);
-                IFloodlightProviderService.bcStore.put(bc, 
-                        IFloodlightProviderService.CONTEXT_PI_PAYLOAD, 
+                IFloodlightProviderService.bcStore.put(bc,
+                        IFloodlightProviderService.CONTEXT_PI_PAYLOAD,
                         eth);
             }
             while (it.hasNext() && !Command.STOP.equals(result)) {
@@ -153,17 +152,17 @@
             }
         }
     }
-    
+
     public void handleOutgoingMessage(IOFSwitch sw, OFMessage m, FloodlightContext bc) {
         List<IOFMessageListener> msgListeners = null;
         if (listeners.containsKey(m.getType())) {
             msgListeners = listeners.get(m.getType()).getOrderedListeners();
         }
-            
-        if (msgListeners != null) {                
+
+        if (msgListeners != null) {
             for (IOFMessageListener listener : msgListeners) {
                 if (listener instanceof IOFSwitchFilter) {
-                    if (!((IOFSwitchFilter)listener).isInterested(sw)) {
+                    if (!((IOFSwitchFilter) listener).isInterested(sw)) {
                         continue;
                     }
                 }
@@ -173,9 +172,9 @@
             }
         }
     }
-    
+
     public void handleOutgoingMessages(IOFSwitch sw, List<OFMessage> msglist, FloodlightContext bc) {
-        for (OFMessage m:msglist) {
+        for (OFMessage m : msglist) {
             handleOutgoingMessage(sw, m, bc);
         }
     }
@@ -186,7 +185,7 @@
     public List<IOFSwitchListener> getSwitchListeners() {
         return switchListeners;
     }
-    
+
     public void terminate() {
     }
 
@@ -195,14 +194,14 @@
         dispatchMessage(sw, msg);
         return true;
     }
-    
+
     @Override
-    public boolean injectOfMessage(IOFSwitch sw, OFMessage msg, 
-                                   FloodlightContext bContext) {        
-        dispatchMessage(sw, msg, bContext);     
+    public boolean injectOfMessage(IOFSwitch sw, OFMessage msg,
+                                   FloodlightContext bContext) {
+        dispatchMessage(sw, msg, bContext);
         return true;
     }
-    
+
     @Override
     public BasicFactory getOFMessageFactory() {
         return factory;
@@ -223,9 +222,9 @@
 
     @Override
     public Map<Class<? extends IFloodlightService>, IFloodlightService>
-            getServiceImpls() {
+    getServiceImpls() {
         Map<Class<? extends IFloodlightService>,
-            IFloodlightService> m = 
+                IFloodlightService> m =
                 new HashMap<Class<? extends IFloodlightService>,
                         IFloodlightService>();
         m.put(IFloodlightProviderService.class, this);
@@ -234,21 +233,21 @@
 
     @Override
     public Collection<Class<? extends IFloodlightService>>
-            getModuleDependencies() {
+    getModuleDependencies() {
         return null;
     }
-    
+
     @Override
     public void init(FloodlightModuleContext context)
-                                                 throws FloodlightModuleException {
+            throws FloodlightModuleException {
         // TODO Auto-generated method stub
-        
+
     }
 
     @Override
     public void startUp(FloodlightModuleContext context) {
         // TODO Auto-generated method stub
-        
+
     }
 
     @Override
@@ -270,14 +269,14 @@
 
     private void logListeners() {
         for (Map.Entry<OFType,
-                       ListenerDispatcher<OFType, 
-                                          IOFMessageListener>> entry
-             : listeners.entrySet()) {
-            
+                ListenerDispatcher<OFType,
+                        IOFMessageListener>> entry
+                : listeners.entrySet()) {
+
             OFType type = entry.getKey();
-            ListenerDispatcher<OFType, IOFMessageListener> ldd = 
+            ListenerDispatcher<OFType, IOFMessageListener> ldd =
                     entry.getValue();
-            
+
             StringBuffer sb = new StringBuffer();
             sb.append("OFListeners for ");
             sb.append(type);
@@ -286,19 +285,19 @@
                 sb.append(l.getName());
                 sb.append(",");
             }
-            log.debug(sb.toString());            
+            log.debug(sb.toString());
         }
     }
 
     @Override
     public void setAlwaysClearFlowsOnSwAdd(boolean value) {
         // TODO Auto-generated method stub
-        
+
     }
 
-	@Override
-	public void publishUpdate(IUpdate update) {
-		// TODO Auto-generated method stub
-		
-	}
+    @Override
+    public void publishUpdate(IUpdate update) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/test/java/net/floodlightcontroller/core/test/MockScheduledExecutor.java b/src/test/java/net/floodlightcontroller/core/test/MockScheduledExecutor.java
index 733ff1a..0a09863 100644
--- a/src/test/java/net/floodlightcontroller/core/test/MockScheduledExecutor.java
+++ b/src/test/java/net/floodlightcontroller/core/test/MockScheduledExecutor.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.floodlightcontroller.core.test;
 
@@ -33,10 +33,10 @@
 public class MockScheduledExecutor implements ScheduledExecutorService {
     ScheduledExecutorService ses = null;
 
-    public static class MockFuture<T> implements Future<T>,ScheduledFuture<T>{
+    public static class MockFuture<T> implements Future<T>, ScheduledFuture<T> {
         T result;
         ExecutionException e;
-        
+
         /**
          * @param result
          */
@@ -44,7 +44,7 @@
             super();
             this.result = result;
         }
-        
+
         /**
          * @param result
          */
@@ -91,7 +91,7 @@
             return 0;
         }
     }
-    
+
     @Override
     public boolean awaitTermination(long arg0, TimeUnit arg1)
             throws InterruptedException {
@@ -134,7 +134,7 @@
 
     @Override
     public <T> T invokeAny(Collection<? extends Callable<T>> arg0, long arg1,
-            TimeUnit arg2) throws InterruptedException, ExecutionException,
+                           TimeUnit arg2) throws InterruptedException, ExecutionException,
             TimeoutException {
         return invokeAny(arg0);
     }
@@ -151,7 +151,7 @@
     public boolean isTerminated() {
         if (ses != null)
             return ses.isTerminated();
-        
+
         return false;
     }
 
@@ -191,7 +191,7 @@
     public <T> Future<T> submit(Runnable arg0, T arg1) {
         try {
             arg0.run();
-            return new MockFuture<T>((T)null);
+            return new MockFuture<T>((T) null);
         } catch (Exception e) {
             return new MockFuture<T>(new ExecutionException(e));
         }
@@ -215,7 +215,7 @@
 
     @Override
     public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay,
-            TimeUnit unit) {
+                                           TimeUnit unit) {
         if (ses == null)
             ses = Executors.newScheduledThreadPool(1);
         try {
diff --git a/src/test/java/net/floodlightcontroller/core/test/MockThreadPoolService.java b/src/test/java/net/floodlightcontroller/core/test/MockThreadPoolService.java
index 67bee30..5b1823e 100644
--- a/src/test/java/net/floodlightcontroller/core/test/MockThreadPoolService.java
+++ b/src/test/java/net/floodlightcontroller/core/test/MockThreadPoolService.java
@@ -13,11 +13,11 @@
 import net.floodlightcontroller.threadpool.IThreadPoolService;
 
 public class MockThreadPoolService implements IFloodlightModule, IThreadPoolService {
-    
+
     protected ScheduledExecutorService mockExecutor = new MockScheduledExecutor();
 
     /**
-     * Return a mock executor that will simply execute each task 
+     * Return a mock executor that will simply execute each task
      * synchronously once.
      */
     @Override
@@ -26,10 +26,10 @@
     }
 
     // IFloodlightModule
-    
+
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleServices() {
-        Collection<Class<? extends IFloodlightService>> l = 
+        Collection<Class<? extends IFloodlightService>> l =
                 new ArrayList<Class<? extends IFloodlightService>>();
         l.add(IThreadPoolService.class);
         return l;
@@ -37,11 +37,11 @@
 
     @Override
     public Map<Class<? extends IFloodlightService>, IFloodlightService>
-            getServiceImpls() {
+    getServiceImpls() {
         Map<Class<? extends IFloodlightService>,
-            IFloodlightService> m = 
+                IFloodlightService> m =
                 new HashMap<Class<? extends IFloodlightService>,
-                    IFloodlightService>();
+                        IFloodlightService>();
         m.put(IThreadPoolService.class, this);
         // We are the class that implements the service
         return m;
@@ -49,14 +49,14 @@
 
     @Override
     public Collection<Class<? extends IFloodlightService>>
-            getModuleDependencies() {
+    getModuleDependencies() {
         // No dependencies
         return null;
     }
 
     @Override
     public void init(FloodlightModuleContext context)
-                                 throws FloodlightModuleException {
+            throws FloodlightModuleException {
     }
 
     @Override
diff --git a/src/test/java/net/floodlightcontroller/core/test/PacketFactory.java b/src/test/java/net/floodlightcontroller/core/test/PacketFactory.java
index 1f7c3d7..77d6fa0 100644
--- a/src/test/java/net/floodlightcontroller/core/test/PacketFactory.java
+++ b/src/test/java/net/floodlightcontroller/core/test/PacketFactory.java
@@ -19,129 +19,131 @@
 /**
  * A class to that creates many types of L2/L3/L4 or OpenFlow packets.
  * This is used in testing.
- * @author alexreimers
  *
+ * @author alexreimers
  */
 public class PacketFactory {
     public static String broadcastMac = "ff:ff:ff:ff:ff:ff";
     public static String broadcastIp = "255.255.255.255";
     protected static BasicFactory OFMessageFactory = new BasicFactory();
-    
+
     /**
      * Generates a DHCP request OFPacketIn.
+     *
      * @param hostMac The host MAC address of for the request.
      * @return An OFPacketIn that contains a DHCP request packet.
      */
     public static OFPacketIn DhcpDiscoveryRequestOFPacketIn(MACAddress hostMac) {
         byte[] serializedPacket = DhcpDiscoveryRequestEthernet(hostMac).serialize();
-        return (((OFPacketIn)OFMessageFactory
+        return (((OFPacketIn) OFMessageFactory
                 .getMessage(OFType.PACKET_IN))
                 .setBufferId(OFPacketOut.BUFFER_ID_NONE)
                 .setInPort((short) 1)
                 .setPacketData(serializedPacket)
                 .setReason(OFPacketInReason.NO_MATCH)
-                .setTotalLength((short)serializedPacket.length));
+                .setTotalLength((short) serializedPacket.length));
     }
-    
+
     /**
      * Generates a DHCP request Ethernet frame.
+     *
      * @param hostMac The host MAC address of for the request.
      * @returnAn An Ethernet frame that contains a DHCP request packet.
      */
     public static Ethernet DhcpDiscoveryRequestEthernet(MACAddress hostMac) {
         List<DHCPOption> optionList = new ArrayList<DHCPOption>();
-        
+
         byte[] requestValue = new byte[4];
         requestValue[0] = requestValue[1] = requestValue[2] = requestValue[3] = 0;
-        DHCPOption requestOption = 
+        DHCPOption requestOption =
                 new DHCPOption()
-                    .setCode(DHCP.DHCPOptionCode.OptionCode_RequestedIP.
-                             getValue())
-                    .setLength((byte)4)
-                    .setData(requestValue);
-        
+                        .setCode(DHCP.DHCPOptionCode.OptionCode_RequestedIP.
+                                getValue())
+                        .setLength((byte) 4)
+                        .setData(requestValue);
+
         byte[] msgTypeValue = new byte[1];
         msgTypeValue[0] = 1;    // DHCP request
-        DHCPOption msgTypeOption = 
+        DHCPOption msgTypeOption =
                 new DHCPOption()
-                    .setCode(DHCP.DHCPOptionCode.OptionCode_MessageType.
-                             getValue())
-                    .setLength((byte)1)
-                    .setData(msgTypeValue);
-        
+                        .setCode(DHCP.DHCPOptionCode.OptionCode_MessageType.
+                                getValue())
+                        .setLength((byte) 1)
+                        .setData(msgTypeValue);
+
         byte[] reqParamValue = new byte[4];
         reqParamValue[0] = 1;   // subnet mask
         reqParamValue[1] = 3;   // Router
         reqParamValue[2] = 6;   // Domain Name Server
         reqParamValue[3] = 42;  // NTP Server
-        DHCPOption reqParamOption = 
+        DHCPOption reqParamOption =
                 new DHCPOption()
-                    .setCode(DHCP.DHCPOptionCode.OptionCode_RequestedParameters.
-                             getValue())
-                    .setLength((byte)4)
-                    .setData(reqParamValue);
-        
+                        .setCode(DHCP.DHCPOptionCode.OptionCode_RequestedParameters.
+                                getValue())
+                        .setLength((byte) 4)
+                        .setData(reqParamValue);
+
         byte[] clientIdValue = new byte[7];
         clientIdValue[0] = 1;   // Ethernet
-        System.arraycopy(hostMac.toBytes(), 0, 
-                         clientIdValue, 1, 6);
-        DHCPOption clientIdOption = 
+        System.arraycopy(hostMac.toBytes(), 0,
+                clientIdValue, 1, 6);
+        DHCPOption clientIdOption =
                 new DHCPOption()
-                    .setCode(DHCP.DHCPOptionCode.OptionCode_ClientID.
-                             getValue())
-                             .setLength((byte)7)
-                             .setData(clientIdValue);
-        
-        DHCPOption endOption = 
+                        .setCode(DHCP.DHCPOptionCode.OptionCode_ClientID.
+                                getValue())
+                        .setLength((byte) 7)
+                        .setData(clientIdValue);
+
+        DHCPOption endOption =
                 new DHCPOption()
-                    .setCode(DHCP.DHCPOptionCode.OptionCode_END.
-                             getValue())
-                             .setLength((byte)0)
-                             .setData(null);
-                                    
+                        .setCode(DHCP.DHCPOptionCode.OptionCode_END.
+                                getValue())
+                        .setLength((byte) 0)
+                        .setData(null);
+
         optionList.add(requestOption);
         optionList.add(msgTypeOption);
         optionList.add(reqParamOption);
         optionList.add(clientIdOption);
         optionList.add(endOption);
-        
+
         Ethernet requestPacket = new Ethernet();
         requestPacket.setSourceMACAddress(hostMac.toBytes())
-        .setDestinationMACAddress(broadcastMac)
-        .setEtherType(Ethernet.TYPE_IPv4)
-        .setPayload(
-                new IPv4()
-                .setVersion((byte)4)
-                .setDiffServ((byte)0)
-                .setIdentification((short)100)
-                .setFlags((byte)0)
-                .setFragmentOffset((short)0)
-                .setTtl((byte)250)
-                .setProtocol(IPv4.PROTOCOL_UDP)
-                .setChecksum((short)0)
-                .setSourceAddress(0)
-                .setDestinationAddress(broadcastIp)
+                .setDestinationMACAddress(broadcastMac)
+                .setEtherType(Ethernet.TYPE_IPv4)
                 .setPayload(
-                        new UDP()
-                        .setSourcePort(UDP.DHCP_CLIENT_PORT)
-                        .setDestinationPort(UDP.DHCP_SERVER_PORT)
-                        .setChecksum((short)0)
-                        .setPayload(
-                                new DHCP()
-                                .setOpCode(DHCP.OPCODE_REQUEST)
-                                .setHardwareType(DHCP.HWTYPE_ETHERNET)
-                                .setHardwareAddressLength((byte)6)
-                                .setHops((byte)0)
-                                .setTransactionId(0x00003d1d)
-                                .setSeconds((short)0)
-                                .setFlags((short)0)
-                                .setClientIPAddress(0)
-                                .setYourIPAddress(0)
-                                .setServerIPAddress(0)
-                                .setGatewayIPAddress(0)
-                                .setClientHardwareAddress(hostMac.toBytes())
-                                .setOptions(optionList))));
-                
+                        new IPv4()
+                                .setVersion((byte) 4)
+                                .setDiffServ((byte) 0)
+                                .setIdentification((short) 100)
+                                .setFlags((byte) 0)
+                                .setFragmentOffset((short) 0)
+                                .setTtl((byte) 250)
+                                .setProtocol(IPv4.PROTOCOL_UDP)
+                                .setChecksum((short) 0)
+                                .setSourceAddress(0)
+                                .setDestinationAddress(broadcastIp)
+                                .setPayload(
+                                        new UDP()
+                                                .setSourcePort(UDP.DHCP_CLIENT_PORT)
+                                                .setDestinationPort(UDP.DHCP_SERVER_PORT)
+                                                .setChecksum((short) 0)
+                                                .setPayload(
+                                                        new DHCP()
+                                                                .setOpCode(DHCP.OPCODE_REQUEST)
+                                                                .setHardwareType(DHCP.HWTYPE_ETHERNET)
+                                                                .setHardwareAddressLength((byte) 6)
+                                                                .setHops((byte) 0)
+                                                                .setTransactionId(0x00003d1d)
+                                                                .setSeconds((short) 0)
+                                                                .setFlags((short) 0)
+                                                                .setClientIPAddress(0)
+                                                                .setYourIPAddress(0)
+                                                                .setServerIPAddress(0)
+                                                                .setGatewayIPAddress(0)
+                                                                .setClientHardwareAddress(hostMac.toBytes())
+                                                                .setOptions(optionList))));
+
         return requestPacket;
     }
 }
diff --git a/src/test/java/net/floodlightcontroller/core/util/AppCookieTest.java b/src/test/java/net/floodlightcontroller/core/util/AppCookieTest.java
index 2c77d6a..e967107 100644
--- a/src/test/java/net/floodlightcontroller/core/util/AppCookieTest.java
+++ b/src/test/java/net/floodlightcontroller/core/util/AppCookieTest.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.floodlightcontroller.core.util;
 
@@ -22,13 +22,13 @@
 
 
 public class AppCookieTest extends FloodlightTestCase {
-    public void testAppCookie(){
+    public void testAppCookie() {
         int appID = 12;
         int user = 12345;
         long cookie = AppCookie.makeCookie(appID, user);
         TestCase.assertEquals(appID, AppCookie.extractApp(cookie));
         TestCase.assertEquals(user, AppCookie.extractUser(cookie));
-        
+
         // now ensure that we don't exceed our size
         cookie = AppCookie.makeCookie(appID + 0x10000, user);
         TestCase.assertEquals(appID, AppCookie.extractApp(cookie));
diff --git a/src/test/java/net/floodlightcontroller/core/util/MessageDispatcherTest.java b/src/test/java/net/floodlightcontroller/core/util/MessageDispatcherTest.java
index 3a1501a..21e5c4a 100644
--- a/src/test/java/net/floodlightcontroller/core/util/MessageDispatcherTest.java
+++ b/src/test/java/net/floodlightcontroller/core/util/MessageDispatcherTest.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.floodlightcontroller.core.util;
 
@@ -39,24 +39,24 @@
         expect(mock.getName()).andReturn(name).anyTimes();
         return mock;
     }
-    
+
     void addPrereqs(IOFMessageListener mock, String... deps) {
         for (String dep : deps) {
             expect(mock.isCallbackOrderingPrereq(OFType.PACKET_IN, dep)).andReturn(true).anyTimes();
         }
     }
-    
+
     void testOrdering(ArrayList<IOFMessageListener> inputListeners) {
-        ListenerDispatcher<OFType, IOFMessageListener> ld = 
+        ListenerDispatcher<OFType, IOFMessageListener> ld =
                 new ListenerDispatcher<OFType, IOFMessageListener>();
-        
+
         for (IOFMessageListener l : inputListeners) {
             ld.addListener(OFType.PACKET_IN, l);
         }
         for (IOFMessageListener l : inputListeners) {
             verify(l);
         }
-        
+
         List<IOFMessageListener> result = ld.getOrderedListeners();
         System.out.print("Ordering: ");
         for (IOFMessageListener l : result) {
@@ -67,27 +67,27 @@
 
         for (int ind_i = 0; ind_i < result.size(); ind_i++) {
             IOFMessageListener i = result.get(ind_i);
-            for (int ind_j = ind_i+1; ind_j < result.size(); ind_j++) {
+            for (int ind_j = ind_i + 1; ind_j < result.size(); ind_j++) {
                 IOFMessageListener j = result.get(ind_j);
-                
-                boolean orderwrong = 
+
+                boolean orderwrong =
                         (i.isCallbackOrderingPrereq(OFType.PACKET_IN, j.getName()) ||
-                         j.isCallbackOrderingPostreq(OFType.PACKET_IN, i.getName()));
-                assertFalse("Invalid order: " + 
-                            ind_i + " (" + i.getName() + ") " + 
-                            ind_j + " (" + j.getName() + ") ", orderwrong);
+                                j.isCallbackOrderingPostreq(OFType.PACKET_IN, i.getName()));
+                assertFalse("Invalid order: " +
+                        ind_i + " (" + i.getName() + ") " +
+                        ind_j + " (" + j.getName() + ") ", orderwrong);
             }
         }
     }
-    
+
     void randomTestOrdering(ArrayList<IOFMessageListener> mocks) {
         Random rand = new Random(0);
-        ArrayList<IOFMessageListener> random = 
+        ArrayList<IOFMessageListener> random =
                 new ArrayList<IOFMessageListener>();
         random.addAll(mocks);
         for (int i = 0; i < 20; i++) {
             for (int j = 0; j < random.size(); j++) {
-                int ind = rand.nextInt(mocks.size()-1);
+                int ind = rand.nextInt(mocks.size() - 1);
                 IOFMessageListener tmp = random.get(j);
                 random.set(j, random.get(ind));
                 random.set(ind, tmp);
@@ -95,16 +95,16 @@
             testOrdering(random);
         }
     }
-    
+
     @Test
     public void testCallbackOrderingSimple() throws Exception {
-        ArrayList<IOFMessageListener> mocks = 
+        ArrayList<IOFMessageListener> mocks =
                 new ArrayList<IOFMessageListener>();
         for (int i = 0; i < 10; i++) {
-            mocks.add(createLMock(""+i));
+            mocks.add(createLMock("" + i));
         }
         for (int i = 1; i < 10; i++) {
-            addPrereqs(mocks.get(i), ""+(i-1));
+            addPrereqs(mocks.get(i), "" + (i - 1));
         }
         for (IOFMessageListener l : mocks) {
             replay(l);
@@ -114,36 +114,36 @@
 
     @Test
     public void testCallbackOrderingPartial() throws Exception {
-        ArrayList<IOFMessageListener> mocks = 
+        ArrayList<IOFMessageListener> mocks =
                 new ArrayList<IOFMessageListener>();
         for (int i = 0; i < 10; i++) {
-            mocks.add(createLMock(""+i));
+            mocks.add(createLMock("" + i));
         }
         for (int i = 1; i < 5; i++) {
-            addPrereqs(mocks.get(i), ""+(i-1));
+            addPrereqs(mocks.get(i), "" + (i - 1));
         }
         for (int i = 6; i < 10; i++) {
-            addPrereqs(mocks.get(i), ""+(i-1));
+            addPrereqs(mocks.get(i), "" + (i - 1));
         }
         for (IOFMessageListener l : mocks) {
             replay(l);
         }
         randomTestOrdering(mocks);
     }
-    
+
 
     @Test
     public void testCallbackOrderingPartial2() throws Exception {
-        ArrayList<IOFMessageListener> mocks = 
+        ArrayList<IOFMessageListener> mocks =
                 new ArrayList<IOFMessageListener>();
         for (int i = 0; i < 10; i++) {
-            mocks.add(createLMock(""+i));
+            mocks.add(createLMock("" + i));
         }
         for (int i = 2; i < 5; i++) {
-            addPrereqs(mocks.get(i), ""+(i-1));
+            addPrereqs(mocks.get(i), "" + (i - 1));
         }
         for (int i = 6; i < 9; i++) {
-            addPrereqs(mocks.get(i), ""+(i-1));
+            addPrereqs(mocks.get(i), "" + (i - 1));
         }
         for (IOFMessageListener l : mocks) {
             replay(l);
diff --git a/src/test/java/net/floodlightcontroller/core/util/SingletonTaskTest.java b/src/test/java/net/floodlightcontroller/core/util/SingletonTaskTest.java
index 9a29852..51a5260 100644
--- a/src/test/java/net/floodlightcontroller/core/util/SingletonTaskTest.java
+++ b/src/test/java/net/floodlightcontroller/core/util/SingletonTaskTest.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.floodlightcontroller.core.util;
 
@@ -27,23 +27,23 @@
 import org.junit.Test;
 
 public class SingletonTaskTest extends FloodlightTestCase {
-    
+
     public int ran = 0;
     public int finished = 0;
     public long time = 0;
-    
+
     @Before
     public void setup() {
         ran = 0;
         finished = 0;
         time = 0;
     }
-    
+
     @Test
     public void testBasic() throws InterruptedException {
-        ScheduledExecutorService ses = 
-            Executors.newSingleThreadScheduledExecutor();
-        
+        ScheduledExecutorService ses =
+                Executors.newSingleThreadScheduledExecutor();
+
         SingletonTask st1 = new SingletonTask(ses, new Runnable() {
             @Override
             public void run() {
@@ -53,14 +53,14 @@
         st1.reschedule(0, null);
         ses.shutdown();
         ses.awaitTermination(5, TimeUnit.SECONDS);
-        
+
         assertEquals("Check that task ran", 1, ran);
     }
 
     @Test
     public void testDelay() throws InterruptedException {
-        ScheduledExecutorService ses = 
-            Executors.newSingleThreadScheduledExecutor();
+        ScheduledExecutorService ses =
+                Executors.newSingleThreadScheduledExecutor();
 
         SingletonTask st1 = new SingletonTask(ses, new Runnable() {
             @Override
@@ -72,19 +72,19 @@
         long start = System.nanoTime();
         st1.reschedule(10, TimeUnit.MILLISECONDS);
         assertFalse("Check that task hasn't run yet", ran > 0);
-        
+
         ses.shutdown();
         ses.awaitTermination(5, TimeUnit.SECONDS);
-        
+
         assertEquals("Check that task ran", 1, ran);
         assertTrue("Check that time passed appropriately",
-                   (time - start) >= TimeUnit.NANOSECONDS.convert(10, TimeUnit.MILLISECONDS));
+                (time - start) >= TimeUnit.NANOSECONDS.convert(10, TimeUnit.MILLISECONDS));
     }
 
     @Test
     public void testReschedule() throws InterruptedException {
-        ScheduledExecutorService ses = 
-            Executors.newSingleThreadScheduledExecutor();
+        ScheduledExecutorService ses =
+                Executors.newSingleThreadScheduledExecutor();
 
         final Object tc = this;
         SingletonTask st1 = new SingletonTask(ses, new Runnable() {
@@ -121,10 +121,10 @@
         st1.reschedule(20, TimeUnit.MILLISECONDS);
         Thread.sleep(5);
         assertFalse("Check that task hasn't run yet", ran > 0);
-        
+
         ses.shutdown();
         ses.awaitTermination(5, TimeUnit.SECONDS);
-        
+
         assertEquals("Check that task ran only once", 1, ran);
         assertTrue("Check that time passed appropriately: " + (time - start),
                 (time - start) >= TimeUnit.NANOSECONDS.convert(55, TimeUnit.MILLISECONDS));
@@ -132,8 +132,8 @@
 
     @Test
     public void testConcurrentAddDelay() throws InterruptedException {
-        ScheduledExecutorService ses = 
-            Executors.newSingleThreadScheduledExecutor();
+        ScheduledExecutorService ses =
+                Executors.newSingleThreadScheduledExecutor();
 
         final Object tc = this;
         SingletonTask st1 = new SingletonTask(ses, new Runnable() {
@@ -153,7 +153,7 @@
                 }
             }
         });
-        
+
         long start = System.nanoTime();
         st1.reschedule(5, TimeUnit.MILLISECONDS);
         Thread.sleep(20);
@@ -171,20 +171,20 @@
         assertTrue("Check task should run state false", !st1.context.taskShouldRun);
         assertEquals("Check that task ran exactly twice", 2, ran);
         assertEquals("Check that task finished exactly twice", 2, finished);
-        
+
         assertTrue("Check that time passed appropriately: " + (time - start),
                 (time - start) >= TimeUnit.NANOSECONDS.convert(130, TimeUnit.MILLISECONDS));
         assertTrue("Check that time passed appropriately: " + (time - start),
                 (time - start) <= TimeUnit.NANOSECONDS.convert(160, TimeUnit.MILLISECONDS));
-        
+
         ses.shutdown();
         ses.awaitTermination(5, TimeUnit.SECONDS);
     }
 
     @Test
     public void testConcurrentAddDelay2() throws InterruptedException {
-        ScheduledExecutorService ses = 
-            Executors.newSingleThreadScheduledExecutor();
+        ScheduledExecutorService ses =
+                Executors.newSingleThreadScheduledExecutor();
 
         final Object tc = this;
         SingletonTask st1 = new SingletonTask(ses, new Runnable() {
@@ -223,12 +223,12 @@
         assertTrue("Check task should run state false", !st1.context.taskShouldRun);
         assertEquals("Check that task ran exactly twice", 2, ran);
         assertEquals("Check that task finished exactly twice", 2, finished);
-        
+
         assertTrue("Check that time passed appropriately: " + (time - start),
                 (time - start) >= TimeUnit.NANOSECONDS.convert(100, TimeUnit.MILLISECONDS));
         assertTrue("Check that time passed appropriately: " + (time - start),
                 (time - start) <= TimeUnit.NANOSECONDS.convert(125, TimeUnit.MILLISECONDS));
-        
+
         ses.shutdown();
         ses.awaitTermination(5, TimeUnit.SECONDS);
     }
@@ -236,8 +236,8 @@
 
     @Test
     public void testConcurrentAddNoDelay() throws InterruptedException {
-        ScheduledExecutorService ses = 
-            Executors.newSingleThreadScheduledExecutor();
+        ScheduledExecutorService ses =
+                Executors.newSingleThreadScheduledExecutor();
 
         final Object tc = this;
         SingletonTask st1 = new SingletonTask(ses, new Runnable() {
@@ -258,7 +258,7 @@
                 }
             }
         });
-        
+
         long start = System.nanoTime();
         st1.reschedule(0, null);
         Thread.sleep(20);
@@ -276,12 +276,12 @@
         assertTrue("Check task should run state false", !st1.context.taskShouldRun);
         assertEquals("Check that task ran exactly twice", 2, ran);
         assertEquals("Check that task finished exactly twice", 2, finished);
-        
+
         assertTrue("Check that time passed appropriately: " + (time - start),
                 (time - start) >= TimeUnit.NANOSECONDS.convert(90, TimeUnit.MILLISECONDS));
         assertTrue("Check that time passed appropriately: " + (time - start),
                 (time - start) <= TimeUnit.NANOSECONDS.convert(130, TimeUnit.MILLISECONDS));
-        
+
         ses.shutdown();
         ses.awaitTermination(5, TimeUnit.SECONDS);
     }
diff --git a/src/test/java/net/floodlightcontroller/test/FloodlightTestCase.java b/src/test/java/net/floodlightcontroller/test/FloodlightTestCase.java
index f96d374..523cb7e 100644
--- a/src/test/java/net/floodlightcontroller/test/FloodlightTestCase.java
+++ b/src/test/java/net/floodlightcontroller/test/FloodlightTestCase.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.floodlightcontroller.test;
 
@@ -38,14 +38,14 @@
     public void setMockFloodlightProvider(MockFloodlightProvider mockFloodlightProvider) {
         this.mockFloodlightProvider = mockFloodlightProvider;
     }
-    
+
     @Override
     public void setUp() throws Exception {
         mockFloodlightProvider = new MockFloodlightProvider();
     }
-    
+
     @Test
     public void testSanity() throws Exception {
-    	assertTrue(true);
+        assertTrue(true);
     }
 }
diff --git a/src/test/java/net/floodlightcontroller/util/MACAddressTest.java b/src/test/java/net/floodlightcontroller/util/MACAddressTest.java
index 2e8a793..6b81135 100644
--- a/src/test/java/net/floodlightcontroller/util/MACAddressTest.java
+++ b/src/test/java/net/floodlightcontroller/util/MACAddressTest.java
@@ -21,33 +21,33 @@
         assertEquals(address,
                 MACAddress.valueOf(new byte[]{(byte) 0xFF, (byte) 0xFE, (byte) 0xFD, 0x10, 0x20, 0x30}));
         assertEquals("ff:fe:fd:10:20:30", address.toString());
-        
+
         address = MACAddress.valueOf("00:11:22:aa:bb:cc");
         assertEquals(address,
-                MACAddress.valueOf(new byte[]{0x00, 0x11, 0x22, (byte)0xaa, (byte)0xbb, (byte)0xcc}));
+                MACAddress.valueOf(new byte[]{0x00, 0x11, 0x22, (byte) 0xaa, (byte) 0xbb, (byte) 0xcc}));
     }
 
-    @Test(expected=NumberFormatException.class)
+    @Test(expected = NumberFormatException.class)
     public void testIllegalFormat() {
         MACAddress.valueOf("0T:00:01:02:03:04");
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testLongStringFields() {
         MACAddress.valueOf("00:01:02:03:04:05:06");
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testShortStringFields() {
         MACAddress.valueOf("00:01:02:03:04");
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testLongByteFields() {
         MACAddress.valueOf(new byte[]{0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06});
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testShortByteField() {
         MACAddress.valueOf(new byte[]{0x01, 0x01, 0x02, 0x03, 0x04});
     }
@@ -62,16 +62,16 @@
 
         assertEquals(
                 1103823438081L,
-                MACAddress.valueOf(new byte[] { (byte) 0x01, (byte) 0x01,
-                        (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01 }).toLong());
+                MACAddress.valueOf(new byte[]{(byte) 0x01, (byte) 0x01,
+                        (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01}).toLong());
 
         assertEquals(
                 141289400074368L,
-                MACAddress.valueOf(new byte[] { (byte) 0x80, (byte) 0x80,
-                        (byte) 0x80, (byte) 0x80, (byte) 0x80, (byte) 0x80 }).toLong());
+                MACAddress.valueOf(new byte[]{(byte) 0x80, (byte) 0x80,
+                        (byte) 0x80, (byte) 0x80, (byte) 0x80, (byte) 0x80}).toLong());
 
     }
-    
+
     @Test
     public void testIsBroadcast() {
         assertTrue(MACAddress.valueOf("FF:FF:FF:FF:FF:FF").isBroadcast());
diff --git a/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java b/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java
index e3ded96..574dc23 100644
--- a/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java
+++ b/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java
@@ -28,54 +28,54 @@
 
 /**
  * A mock implementation of IFOSwitch we use for {@link OFMessageDamper}
- * 
+ * <p/>
  * We need to mock equals() and hashCode() but alas, EasyMock doesn't support
  * this. Sigh. And of course this happens to be the interface with the most
- * methods. 
- * @author gregor
+ * methods.
  *
+ * @author gregor
  */
 public class OFMessageDamperMockSwitch implements IOFSwitch {
     OFMessage writtenMessage;
     FloodlightContext writtenContext;
-    
+
     public OFMessageDamperMockSwitch() {
         reset();
     }
-    
+
     /* reset this mock. I.e., clear the stored message previously written */
     public void reset() {
         writtenMessage = null;
         writtenContext = null;
     }
-    
+
     /* assert that a message was written to this switch and that the 
      * written message and context matches the expected values 
      * @param expected
      * @param expectedContext
      */
-    public void assertMessageWasWritten(OFMessage expected, 
+    public void assertMessageWasWritten(OFMessage expected,
                                         FloodlightContext expectedContext) {
         assertNotNull("No OFMessage was written", writtenMessage);
         assertEquals(expected, writtenMessage);
         assertEquals(expectedContext, writtenContext);
     }
-    
+
     /*
      * assert that no message was written 
      */
     public void assertNoMessageWritten() {
-        assertNull("OFMessage was written but didn't expect one", 
-                      writtenMessage);
-        assertNull("There was a context but didn't expect one", 
-                      writtenContext);
+        assertNull("OFMessage was written but didn't expect one",
+                writtenMessage);
+        assertNull("There was a context but didn't expect one",
+                writtenContext);
     }
     
     /*
      * use hashCode() and equals() from Object
      */
-    
-    
+
+
     //-------------------------------------------------------
     // IOFSwitch: mocked methods
     @Override
@@ -85,222 +85,222 @@
         writtenContext = bc;
         writtenMessage = m;
     }
-    
+
     //-------------------------------------------------------
     // IOFSwitch: not-implemented methods
     @Override
-    public void write(List<OFMessage> msglist, FloodlightContext bc) 
+    public void write(List<OFMessage> msglist, FloodlightContext bc)
             throws IOException {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public void disconnectOutputStream() {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public Channel getChannel() {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public void setFeaturesReply(OFFeaturesReply featuresReply) {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public void setSwitchProperties(OFDescriptionStatistics description) {
         assertTrue("Unexpected method call", false);
         // TODO Auto-generated method stub
     }
-    
+
     @Override
     public Collection<OFPhysicalPort> getEnabledPorts() {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public Collection<Short> getEnabledPortNumbers() {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public OFPhysicalPort getPort(short portNumber) {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public OFPhysicalPort getPort(String portName) {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public void setPort(OFPhysicalPort port) {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public void deletePort(short portNumber) {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public void deletePort(String portName) {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public Collection<OFPhysicalPort> getPorts() {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public boolean portEnabled(short portName) {
         assertTrue("Unexpected method call", false);
         return false;
     }
-    
+
     @Override
     public boolean portEnabled(String portName) {
         assertTrue("Unexpected method call", false);
         return false;
     }
-    
+
     @Override
     public boolean portEnabled(OFPhysicalPort port) {
         assertTrue("Unexpected method call", false);
         return false;
     }
-    
+
     @Override
     public long getId() {
         assertTrue("Unexpected method call", false);
         return 0;
     }
-    
+
     @Override
     public String getStringId() {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public Map<Object, Object> getAttributes() {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public Date getConnectedSince() {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public int getNextTransactionId() {
         assertTrue("Unexpected method call", false);
         return 0;
     }
-    
+
     @Override
     public Future<List<OFStatistics>>
-            getStatistics(OFStatisticsRequest request) throws IOException {
+    getStatistics(OFStatisticsRequest request) throws IOException {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public boolean isConnected() {
         assertTrue("Unexpected method call", false);
         return false;
     }
-    
+
     @Override
     public void setConnected(boolean connected) {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public Role getRole() {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public boolean isActive() {
         assertTrue("Unexpected method call", false);
         return false;
     }
-    
+
     @Override
     public void deliverStatisticsReply(OFMessage reply) {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public void cancelStatisticsReply(int transactionId) {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public void cancelAllStatisticsReplies() {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public boolean hasAttribute(String name) {
         assertTrue("Unexpected method call", false);
         return false;
     }
-    
+
     @Override
     public Object getAttribute(String name) {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public void setAttribute(String name, Object value) {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public Object removeAttribute(String name) {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public void clearAllFlowMods() {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public boolean updateBroadcastCache(Long entry, Short port) {
         assertTrue("Unexpected method call", false);
         return false;
     }
-    
+
     @Override
     public Map<Short, Long> getPortBroadcastHits() {
         assertTrue("Unexpected method call", false);
         return null;
     }
-    
+
     @Override
     public void sendStatsQuery(OFStatisticsRequest request, int xid,
                                IOFMessageListener caller)
-                                                         throws IOException {
+            throws IOException {
         assertTrue("Unexpected method call", false);
     }
-    
+
     @Override
     public void flush() {
         assertTrue("Unexpected method call", false);
diff --git a/src/test/java/net/floodlightcontroller/util/OFMessageDamperTest.java b/src/test/java/net/floodlightcontroller/util/OFMessageDamperTest.java
index 1f39761..02cc535 100644
--- a/src/test/java/net/floodlightcontroller/util/OFMessageDamperTest.java
+++ b/src/test/java/net/floodlightcontroller/util/OFMessageDamperTest.java
@@ -20,50 +20,49 @@
     OFMessageFactory factory;
     OFMessageDamper damper;
     FloodlightContext cntx;
-    
+
     OFMessageDamperMockSwitch sw1;
     OFMessageDamperMockSwitch sw2;
-    
+
     OFEchoRequest echoRequst1;
     OFEchoRequest echoRequst1Clone;
     OFEchoRequest echoRequst2;
     OFHello hello1;
     OFHello hello2;
-    
-    
-    
+
+
     @Before
     public void setUp() throws IOException {
         factory = new BasicFactory();
         cntx = new FloodlightContext();
-        
+
         sw1 = new OFMessageDamperMockSwitch();
         sw2 = new OFMessageDamperMockSwitch();
-        
-        echoRequst1 = (OFEchoRequest)factory.getMessage(OFType.ECHO_REQUEST);
-        echoRequst1.setPayload(new byte[] { 1 });
+
+        echoRequst1 = (OFEchoRequest) factory.getMessage(OFType.ECHO_REQUEST);
+        echoRequst1.setPayload(new byte[]{1});
         echoRequst1Clone = (OFEchoRequest)
                 factory.getMessage(OFType.ECHO_REQUEST);
-        echoRequst1Clone.setPayload(new byte[] { 1 });
-        echoRequst2 = (OFEchoRequest)factory.getMessage(OFType.ECHO_REQUEST);
-        echoRequst2.setPayload(new byte[] { 2 });
-        
-        hello1 = (OFHello)factory.getMessage(OFType.HELLO);
+        echoRequst1Clone.setPayload(new byte[]{1});
+        echoRequst2 = (OFEchoRequest) factory.getMessage(OFType.ECHO_REQUEST);
+        echoRequst2.setPayload(new byte[]{2});
+
+        hello1 = (OFHello) factory.getMessage(OFType.HELLO);
         hello1.setXid(1);
-        hello2 = (OFHello)factory.getMessage(OFType.HELLO);
+        hello2 = (OFHello) factory.getMessage(OFType.HELLO);
         hello2.setXid(2);
-        
+
     }
-    
-    protected void doWrite(boolean expectWrite, 
-                           OFMessageDamperMockSwitch sw, 
+
+    protected void doWrite(boolean expectWrite,
+                           OFMessageDamperMockSwitch sw,
                            OFMessage msg,
                            FloodlightContext cntx) throws IOException {
-        
+
         boolean result;
         sw.reset();
         result = damper.write(sw, msg, cntx);
-        
+
         if (expectWrite) {
             assertEquals(true, result);
             sw.assertMessageWasWritten(msg, cntx);
@@ -72,79 +71,77 @@
             sw.assertNoMessageWritten();
         }
     }
-    
-    
+
+
     @Test
     public void testOneMessageType() throws IOException, InterruptedException {
         int timeout = 50;
-        int sleepTime = 60; 
-        damper = new OFMessageDamper(100, 
-                                     EnumSet.of(OFType.ECHO_REQUEST),
-                                     timeout);
-        
-        
-        
+        int sleepTime = 60;
+        damper = new OFMessageDamper(100,
+                EnumSet.of(OFType.ECHO_REQUEST),
+                timeout);
+
+
         // echo requests should be dampened 
         doWrite(true, sw1, echoRequst1, cntx);
         doWrite(false, sw1, echoRequst1, cntx);
         doWrite(false, sw1, echoRequst1Clone, cntx);
         doWrite(true, sw1, echoRequst2, cntx);
         doWrite(false, sw1, echoRequst2, cntx);
-        
+
         // we don't dampen hellos. All should succeed 
         doWrite(true, sw1, hello1, cntx);
         doWrite(true, sw1, hello1, cntx);
         doWrite(true, sw1, hello1, cntx);
-        
+
         // echo request should also be dampened on sw2
         doWrite(true, sw2, echoRequst1, cntx);
         doWrite(false, sw2, echoRequst1, cntx);
         doWrite(true, sw2, echoRequst2, cntx);
-        
-        
+
+
         Thread.sleep(sleepTime);
         doWrite(true, sw1, echoRequst1, cntx);
         doWrite(true, sw2, echoRequst1, cntx);
-        
+
     }
-    
+
     @Test
     public void testTwoMessageTypes() throws IOException, InterruptedException {
         int timeout = 50;
-        int sleepTime = 60; 
-        damper = new OFMessageDamper(100, 
-                                     EnumSet.of(OFType.ECHO_REQUEST, 
-                                                OFType.HELLO),
-                                     timeout);
-        
-        
-        
+        int sleepTime = 60;
+        damper = new OFMessageDamper(100,
+                EnumSet.of(OFType.ECHO_REQUEST,
+                        OFType.HELLO),
+                timeout);
+
+
         // echo requests should be dampened 
         doWrite(true, sw1, echoRequst1, cntx);
         doWrite(false, sw1, echoRequst1, cntx);
         doWrite(false, sw1, echoRequst1Clone, cntx);
         doWrite(true, sw1, echoRequst2, cntx);
         doWrite(false, sw1, echoRequst2, cntx);
-        
+
         // hello should be dampened as well
         doWrite(true, sw1, hello1, cntx);
         doWrite(false, sw1, hello1, cntx);
         doWrite(false, sw1, hello1, cntx);
-        
+
         doWrite(true, sw1, hello2, cntx);
         doWrite(false, sw1, hello2, cntx);
         doWrite(false, sw1, hello2, cntx);
-        
+
         // echo request should also be dampened on sw2
         doWrite(true, sw2, echoRequst1, cntx);
         doWrite(false, sw2, echoRequst1, cntx);
         doWrite(true, sw2, echoRequst2, cntx);
-        
+
         Thread.sleep(sleepTime);
         doWrite(true, sw1, echoRequst1, cntx);
         doWrite(true, sw2, echoRequst1, cntx);
         doWrite(true, sw1, hello1, cntx);
         doWrite(true, sw1, hello2, cntx);
     }
-    
+
 }
diff --git a/src/test/java/net/floodlightcontroller/util/TimedCacheTest.java b/src/test/java/net/floodlightcontroller/util/TimedCacheTest.java
index 7f06c0d..331e0e6 100644
--- a/src/test/java/net/floodlightcontroller/util/TimedCacheTest.java
+++ b/src/test/java/net/floodlightcontroller/util/TimedCacheTest.java
@@ -8,7 +8,7 @@
 public class TimedCacheTest {
     public static class CacheEntry {
         public int key;
-        
+
         public CacheEntry(int key) {
             this.key = key;
         }
@@ -35,56 +35,55 @@
             return true;
         }
     }
-    
+
     protected TimedCache<CacheEntry> cache;
-    
+
     @Before
     public void setUp() {
         // 
     }
-    
-    
+
+
     @Test
     public void testCaching() throws InterruptedException {
         int timeout = 50;
         int timeToSleep = 60;
         cache = new TimedCache<TimedCacheTest.CacheEntry>(100, timeout);
-        
+
         CacheEntry e1a = new CacheEntry(1);
         CacheEntry e1b = new CacheEntry(1);
         CacheEntry e1c = new CacheEntry(1);
         CacheEntry e2 = new CacheEntry(2);
-        
+
         assertEquals(false, cache.update(e1a));
         assertEquals(true, cache.update(e1a));
         assertEquals(true, cache.update(e1b));
         assertEquals(true, cache.update(e1c));
         assertEquals(false, cache.update(e2));
         assertEquals(true, cache.update(e2));
-        
+
         Thread.sleep(timeToSleep);
         assertEquals(false, cache.update(e1a));
         assertEquals(false, cache.update(e2));
     }
-    
+
     @Test
     public void testCapacity() throws InterruptedException {
         int timeout = 5000;
         cache = new TimedCache<TimedCacheTest.CacheEntry>(2, timeout);
-        
+
         // Testing the capacity is tricky since the capacity can be 
         // exceeded for short amounts of time, so we try to flood the cache
         // to make sure the first entry is expired
         CacheEntry e1 = new CacheEntry(1);
-        for (int i=0; i < 100; i++) {
+        for (int i = 0; i < 100; i++) {
             CacheEntry e = new CacheEntry(i);
             cache.update(e);
         }
-        
+
         // entry 1 should have been expired due to capacity limits 
         assertEquals(false, cache.update(e1));
     }
-    
-    
-    
+
+
 }