You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2013/11/20 15:51:09 UTC

[39/50] [abbrv] Checkstyle adjustments in code and configuration

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
index 42e436f..bdcbfee 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
@@ -70,6 +70,7 @@ import com.cloud.user.Account;
 import com.cloud.vm.ReservationContext;
 
 public class NiciraNvpGuestNetworkGuruTest {
+    private static final long NETWORK_ID = 42L;
     PhysicalNetworkDao physnetdao = mock(PhysicalNetworkDao.class);
     NiciraNvpDao nvpdao = mock(NiciraNvpDao.class);
     DataCenterDao dcdao = mock(DataCenterDao.class);
@@ -87,14 +88,14 @@ public class NiciraNvpGuestNetworkGuruTest {
     public void setUp() {
         guru = new NiciraNvpGuestNetworkGuru();
         ((GuestNetworkGuru) guru)._physicalNetworkDao = physnetdao;
-        guru._physicalNetworkDao = physnetdao;
-        guru._niciraNvpDao = nvpdao;
+        guru.physicalNetworkDao = physnetdao;
+        guru.niciraNvpDao = nvpdao;
         guru._dcDao = dcdao;
-        guru._ntwkOfferingSrvcDao = nosd;
-        guru._networkModel = netmodel;
-        guru._hostDao = hostdao;
-        guru._agentMgr = agentmgr;
-        guru._networkDao = netdao;
+        guru.ntwkOfferingSrvcDao = nosd;
+        guru.networkModel = netmodel;
+        guru.hostDao = hostdao;
+        guru.agentMgr = agentmgr;
+        guru.networkDao = netdao;
 
         DataCenterVO dc = mock(DataCenterVO.class);
         when(dc.getNetworkType()).thenReturn(NetworkType.Advanced);
@@ -106,15 +107,15 @@ public class NiciraNvpGuestNetworkGuruTest {
     @Test
     public void testCanHandle() {
         NetworkOffering offering = mock(NetworkOffering.class);
-        when(offering.getId()).thenReturn(42L);
+        when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
         PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
-        when(physnet.getId()).thenReturn(42L);
+        when(physnet.getId()).thenReturn(NETWORK_ID);
 
-        when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(true);
+        when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(true);
 
         assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
 
@@ -142,18 +143,18 @@ public class NiciraNvpGuestNetworkGuruTest {
         PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnetdao.findById((Long) any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
-        when(physnet.getId()).thenReturn(42L);
+        when(physnet.getId()).thenReturn(NETWORK_ID);
 
         NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
         when(device.getId()).thenReturn(1L);
 
         NetworkOffering offering = mock(NetworkOffering.class);
-        when(offering.getId()).thenReturn(42L);
+        when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
-        when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(true);
+        when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(true);
 
         DeploymentPlan plan = mock(DeploymentPlan.class);
         Network network = mock(Network.class);
@@ -169,13 +170,13 @@ public class NiciraNvpGuestNetworkGuruTest {
         PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnetdao.findById((Long) any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
-        when(physnet.getId()).thenReturn(42L);
+        when(physnet.getId()).thenReturn(NETWORK_ID);
 
         mock(NiciraNvpDeviceVO.class);
-        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
+        when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
 
         NetworkOffering offering = mock(NetworkOffering.class);
-        when(offering.getId()).thenReturn(42L);
+        when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
@@ -192,13 +193,13 @@ public class NiciraNvpGuestNetworkGuruTest {
         PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnetdao.findById((Long) any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "VLAN" }));
-        when(physnet.getId()).thenReturn(42L);
+        when(physnet.getId()).thenReturn(NETWORK_ID);
 
         mock(NiciraNvpDeviceVO.class);
-        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
+        when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
 
         NetworkOffering offering = mock(NetworkOffering.class);
-        when(offering.getId()).thenReturn(42L);
+        when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
@@ -215,18 +216,18 @@ public class NiciraNvpGuestNetworkGuruTest {
         PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnetdao.findById((Long) any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
-        when(physnet.getId()).thenReturn(42L);
+        when(physnet.getId()).thenReturn(NETWORK_ID);
 
         NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
         when(device.getId()).thenReturn(1L);
 
         NetworkOffering offering = mock(NetworkOffering.class);
-        when(offering.getId()).thenReturn(42L);
+        when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
-        when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+        when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
 
         DeploymentPlan plan = mock(DeploymentPlan.class);
         Network network = mock(Network.class);
@@ -241,25 +242,25 @@ public class NiciraNvpGuestNetworkGuruTest {
         PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnetdao.findById((Long) any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
-        when(physnet.getId()).thenReturn(42L);
+        when(physnet.getId()).thenReturn(NETWORK_ID);
 
         NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
         when(device.getId()).thenReturn(1L);
 
         NetworkOffering offering = mock(NetworkOffering.class);
-        when(offering.getId()).thenReturn(42L);
+        when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
-        when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+        when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
 
         mock(DeploymentPlan.class);
 
         NetworkVO network = mock(NetworkVO.class);
         when(network.getName()).thenReturn("testnetwork");
         when(network.getState()).thenReturn(State.Implementing);
-        when(network.getPhysicalNetworkId()).thenReturn(42L);
+        when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
 
         DeployDestination dest = mock(DeployDestination.class);
 
@@ -270,9 +271,9 @@ public class NiciraNvpGuestNetworkGuruTest {
         when(hostdao.findById(anyLong())).thenReturn(niciraHost);
         when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
         when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
-        when(niciraHost.getId()).thenReturn(42L);
+        when(niciraHost.getId()).thenReturn(NETWORK_ID);
 
-        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(NETWORK_ID);
         Domain dom = mock(Domain.class);
         when(dom.getName()).thenReturn("domain");
         Account acc = mock(Account.class);
@@ -284,11 +285,11 @@ public class NiciraNvpGuestNetworkGuruTest {
         CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
         when(answer.getResult()).thenReturn(true);
         when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
-        when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+        when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);
 
         Network implementednetwork = guru.implement(network, offering, dest, res);
         assertTrue(implementednetwork != null);
-        verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+        verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any());
     }
 
     @Test
@@ -296,18 +297,18 @@ public class NiciraNvpGuestNetworkGuruTest {
         PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnetdao.findById((Long) any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
-        when(physnet.getId()).thenReturn(42L);
+        when(physnet.getId()).thenReturn(NETWORK_ID);
 
         NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
         when(device.getId()).thenReturn(1L);
 
         NetworkOffering offering = mock(NetworkOffering.class);
-        when(offering.getId()).thenReturn(42L);
+        when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
-        when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+        when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
 
         mock(DeploymentPlan.class);
 
@@ -316,7 +317,7 @@ public class NiciraNvpGuestNetworkGuruTest {
         when(network.getState()).thenReturn(State.Implementing);
         when(network.getGateway()).thenReturn("10.1.1.1");
         when(network.getCidr()).thenReturn("10.1.1.0/24");
-        when(network.getPhysicalNetworkId()).thenReturn(42L);
+        when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
 
         DeployDestination dest = mock(DeployDestination.class);
 
@@ -327,9 +328,9 @@ public class NiciraNvpGuestNetworkGuruTest {
         when(hostdao.findById(anyLong())).thenReturn(niciraHost);
         when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
         when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
-        when(niciraHost.getId()).thenReturn(42L);
+        when(niciraHost.getId()).thenReturn(NETWORK_ID);
 
-        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(NETWORK_ID);
         Domain dom = mock(Domain.class);
         when(dom.getName()).thenReturn("domain");
         Account acc = mock(Account.class);
@@ -341,13 +342,13 @@ public class NiciraNvpGuestNetworkGuruTest {
         CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
         when(answer.getResult()).thenReturn(true);
         when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
-        when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+        when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);
 
         Network implementednetwork = guru.implement(network, offering, dest, res);
         assertTrue(implementednetwork != null);
         assertTrue(implementednetwork.getCidr().equals("10.1.1.0/24"));
         assertTrue(implementednetwork.getGateway().equals("10.1.1.1"));
-        verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+        verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any());
     }
 
     @Test
@@ -355,25 +356,25 @@ public class NiciraNvpGuestNetworkGuruTest {
         PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnetdao.findById((Long) any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
-        when(physnet.getId()).thenReturn(42L);
+        when(physnet.getId()).thenReturn(NETWORK_ID);
 
         NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
         when(device.getId()).thenReturn(1L);
 
         NetworkOffering offering = mock(NetworkOffering.class);
-        when(offering.getId()).thenReturn(42L);
+        when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
-        when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+        when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
 
         mock(DeploymentPlan.class);
 
         NetworkVO network = mock(NetworkVO.class);
         when(network.getName()).thenReturn("testnetwork");
         when(network.getState()).thenReturn(State.Implementing);
-        when(network.getPhysicalNetworkId()).thenReturn(42L);
+        when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
 
         DeployDestination dest = mock(DeployDestination.class);
 
@@ -384,9 +385,9 @@ public class NiciraNvpGuestNetworkGuruTest {
         when(hostdao.findById(anyLong())).thenReturn(niciraHost);
         when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
         when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
-        when(niciraHost.getId()).thenReturn(42L);
+        when(niciraHost.getId()).thenReturn(NETWORK_ID);
 
-        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(NETWORK_ID);
         Domain dom = mock(Domain.class);
         when(dom.getName()).thenReturn("domain");
         Account acc = mock(Account.class);
@@ -398,11 +399,11 @@ public class NiciraNvpGuestNetworkGuruTest {
         CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
         when(answer.getResult()).thenReturn(true);
         //when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
-        when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+        when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);
 
         Network implementednetwork = guru.implement(network, offering, dest, res);
         assertTrue(implementednetwork == null);
-        verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+        verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any());
     }
 
     @Test
@@ -410,18 +411,18 @@ public class NiciraNvpGuestNetworkGuruTest {
         PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnetdao.findById((Long) any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
-        when(physnet.getId()).thenReturn(42L);
+        when(physnet.getId()).thenReturn(NETWORK_ID);
 
         NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(nvpdao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
         when(device.getId()).thenReturn(1L);
 
         NetworkOffering offering = mock(NetworkOffering.class);
-        when(offering.getId()).thenReturn(42L);
+        when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
-        when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+        when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(false);
 
         mock(DeploymentPlan.class);
 
@@ -430,8 +431,8 @@ public class NiciraNvpGuestNetworkGuruTest {
         when(network.getState()).thenReturn(State.Implementing);
         when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch);
         when(network.getBroadcastUri()).thenReturn(new URI("lswitch:aaaaa"));
-        when(network.getPhysicalNetworkId()).thenReturn(42L);
-        when(netdao.findById(42L)).thenReturn(network);
+        when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
+        when(netdao.findById(NETWORK_ID)).thenReturn(network);
 
         DeployDestination dest = mock(DeployDestination.class);
 
@@ -442,9 +443,9 @@ public class NiciraNvpGuestNetworkGuruTest {
         when(hostdao.findById(anyLong())).thenReturn(niciraHost);
         when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
         when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
-        when(niciraHost.getId()).thenReturn(42L);
+        when(niciraHost.getId()).thenReturn(NETWORK_ID);
 
-        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(NETWORK_ID);
         Domain dom = mock(Domain.class);
         when(dom.getName()).thenReturn("domain");
         Account acc = mock(Account.class);
@@ -455,15 +456,15 @@ public class NiciraNvpGuestNetworkGuruTest {
 
         DeleteLogicalSwitchAnswer answer = mock(DeleteLogicalSwitchAnswer.class);
         when(answer.getResult()).thenReturn(true);
-        when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+        when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);
 
         NetworkProfile implementednetwork = mock(NetworkProfile.class);
-        when(implementednetwork.getId()).thenReturn(42L);
+        when(implementednetwork.getId()).thenReturn(NETWORK_ID);
         when(implementednetwork.getBroadcastUri()).thenReturn(new URI("lswitch:aaaa"));
         when(offering.getSpecifyVlan()).thenReturn(false);
 
         guru.shutdown(implementednetwork, offering);
-        verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+        verify(agentmgr, times(1)).easySend(eq(NETWORK_ID), (Command)any());
         verify(implementednetwork, times(1)).setBroadcastUri(null);
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java
index 1467d47..21d2e7f 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraNvpApiTest.java
@@ -40,87 +40,87 @@ import org.junit.Before;
 import org.junit.Test;
 
 public class NiciraNvpApiTest {
-    NiciraNvpApi _api;
-    HttpClient _client = mock(HttpClient.class);
-    HttpMethod _method;
+    NiciraNvpApi api;
+    HttpClient client = mock(HttpClient.class);
+    HttpMethod method;
 
     @Before
     public void setUp() {
         HttpClientParams hmp = mock(HttpClientParams.class);
-        when (_client.getParams()).thenReturn(hmp);
-        _api = new NiciraNvpApi() {
+        when (client.getParams()).thenReturn(hmp);
+        api = new NiciraNvpApi() {
             @Override
             protected HttpClient createHttpClient() {
-                return _client;
+                return client;
             }
 
             @Override
             protected HttpMethod createMethod(String type, String uri) {
-                return _method;
+                return method;
             }
         };
-        _api.setAdminCredentials("admin", "adminpass");
-        _api.setControllerAddress("localhost");
+        api.setAdminCredentials("admin", "adminpass");
+        api.setControllerAddress("localhost");
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteLoginWithoutHostname() throws NiciraNvpApiException {
-        _api.setControllerAddress(null);
-        _api.login();
+        api.setControllerAddress(null);
+        api.login();
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteLoginWithoutCredentials() throws NiciraNvpApiException {
-        _api.setAdminCredentials(null, null);
-        _api.login();
+        api.setAdminCredentials(null, null);
+        api.login();
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteUpdateObjectWithoutHostname() throws NiciraNvpApiException {
-        _api.setControllerAddress(null);
-        _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+        api.setControllerAddress(null);
+        api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteUpdateObjectWithoutCredentials() throws NiciraNvpApiException {
-        _api.setAdminCredentials(null, null);
-        _api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
+        api.setAdminCredentials(null, null);
+        api.executeUpdateObject(new String(), "/", Collections.<String, String> emptyMap());
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteCreateObjectWithoutHostname() throws NiciraNvpApiException {
-        _api.setControllerAddress(null);
-        _api.executeCreateObject(new String(), String.class, "/", Collections.<String, String> emptyMap());
+        api.setControllerAddress(null);
+        api.executeCreateObject(new String(), String.class, "/", Collections.<String, String> emptyMap());
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteCreateObjectWithoutCredentials() throws NiciraNvpApiException {
-        _api.setAdminCredentials(null, null);
-        _api.executeCreateObject(new String(), String.class, "/", Collections.<String, String> emptyMap());
+        api.setAdminCredentials(null, null);
+        api.executeCreateObject(new String(), String.class, "/", Collections.<String, String> emptyMap());
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteDeleteObjectWithoutHostname() throws NiciraNvpApiException {
-        _api.setControllerAddress(null);
-        _api.executeDeleteObject("/");
+        api.setControllerAddress(null);
+        api.executeDeleteObject("/");
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteDeleteObjectWithoutCredentials() throws NiciraNvpApiException {
-        _api.setAdminCredentials(null, null);
-        _api.executeDeleteObject("/");
+        api.setAdminCredentials(null, null);
+        api.executeDeleteObject("/");
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteRetrieveObjectWithoutHostname() throws NiciraNvpApiException {
-        _api.setControllerAddress(null);
-        _api.executeRetrieveObject(String.class, "/", Collections.<String, String> emptyMap());
+        api.setControllerAddress(null);
+        api.executeRetrieveObject(String.class, "/", Collections.<String, String> emptyMap());
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteRetrieveObjectWithoutCredentials() throws NiciraNvpApiException {
-        _api.setAdminCredentials(null, null);
-        _api.executeDeleteObject("/");
+        api.setAdminCredentials(null, null);
+        api.executeDeleteObject("/");
     }
 
     @Test
@@ -128,7 +128,7 @@ public class NiciraNvpApiTest {
         GetMethod gm = mock(GetMethod.class);
 
         when(gm.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        _api.executeMethod(gm);
+        api.executeMethod(gm);
         verify(gm, times(1)).getStatusCode();
     }
 
@@ -138,172 +138,172 @@ public class NiciraNvpApiTest {
     @Test (expected=NiciraNvpApiException.class)
     public void executeMethodTestWithLogin() throws NiciraNvpApiException, HttpException, IOException {
         GetMethod gm = mock(GetMethod.class);
-        when(_client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
+        when(client.executeMethod((HttpMethod)any())).thenThrow(new HttpException());
         when(gm.getStatusCode()).thenReturn(HttpStatus.SC_UNAUTHORIZED).thenReturn(HttpStatus.SC_UNAUTHORIZED);
-        _api.executeMethod(gm);
+        api.executeMethod(gm);
         verify(gm, times(1)).getStatusCode();
     }
 
     @Test
     public void testExecuteCreateObject() throws NiciraNvpApiException, IOException {
         LogicalSwitch ls = new LogicalSwitch();
-        _method = mock(PostMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_CREATED);
-        when(_method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
-        ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+        method = mock(PostMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_CREATED);
+        when(method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
+        ls = api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
         assertTrue("aaaa".equals(ls.getUuid()));
-        verify(_method, times(1)).releaseConnection();
+        verify(method, times(1)).releaseConnection();
 
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteCreateObjectFailure() throws NiciraNvpApiException, IOException {
         LogicalSwitch ls = new LogicalSwitch();
-        _method = mock(PostMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        method = mock(PostMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
         Header header = mock(Header.class);
         when(header.getValue()).thenReturn("text/html");
-        when(_method.getResponseHeader("Content-Type")).thenReturn(header);
-        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
-        when(_method.isRequestSent()).thenReturn(true);
+        when(method.getResponseHeader("Content-Type")).thenReturn(header);
+        when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+        when(method.isRequestSent()).thenReturn(true);
         try {
-            ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+            ls = api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
         } finally {
-            verify(_method, times(1)).releaseConnection();
+            verify(method, times(1)).releaseConnection();
         }
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteCreateObjectException() throws NiciraNvpApiException, IOException {
         LogicalSwitch ls = new LogicalSwitch();
-        when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
-        _method = mock(PostMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        when(client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
+        method = mock(PostMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
         Header header = mock(Header.class);
         when(header.getValue()).thenReturn("text/html");
-        when(_method.getResponseHeader("Content-Type")).thenReturn(header);
-        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+        when(method.getResponseHeader("Content-Type")).thenReturn(header);
+        when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
         try {
-            ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+            ls = api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
         } finally {
-            verify(_method, times(1)).releaseConnection();
+            verify(method, times(1)).releaseConnection();
         }
     }
 
     @Test
     public void testExecuteUpdateObject() throws NiciraNvpApiException, IOException {
         LogicalSwitch ls = new LogicalSwitch();
-        _method = mock(PutMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        _api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
-        verify(_method, times(1)).releaseConnection();
-        verify(_client, times(1)).executeMethod(_method);
+        method = mock(PutMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
+        verify(method, times(1)).releaseConnection();
+        verify(client, times(1)).executeMethod(method);
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteUpdateObjectFailure() throws NiciraNvpApiException, IOException {
         LogicalSwitch ls = new LogicalSwitch();
-        _method = mock(PutMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        method = mock(PutMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
         Header header = mock(Header.class);
         when(header.getValue()).thenReturn("text/html");
-        when(_method.getResponseHeader("Content-Type")).thenReturn(header);
-        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
-        when(_method.isRequestSent()).thenReturn(true);
+        when(method.getResponseHeader("Content-Type")).thenReturn(header);
+        when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+        when(method.isRequestSent()).thenReturn(true);
         try {
-            _api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
+            api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
         } finally {
-            verify(_method, times(1)).releaseConnection();
+            verify(method, times(1)).releaseConnection();
         }
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteUpdateObjectException() throws NiciraNvpApiException, IOException {
         LogicalSwitch ls = new LogicalSwitch();
-        _method = mock(PutMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        when(_client.executeMethod((HttpMethod) any())).thenThrow(new IOException());
+        method = mock(PutMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        when(client.executeMethod((HttpMethod) any())).thenThrow(new IOException());
         try {
-            _api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
+            api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
         } finally {
-            verify(_method, times(1)).releaseConnection();
+            verify(method, times(1)).releaseConnection();
         }
     }
 
     @Test
     public void testExecuteDeleteObject() throws NiciraNvpApiException, IOException {
-        _method = mock(DeleteMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT);
-        _api.executeDeleteObject("/");
-        verify(_method, times(1)).releaseConnection();
-        verify(_client, times(1)).executeMethod(_method);
+        method = mock(DeleteMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT);
+        api.executeDeleteObject("/");
+        verify(method, times(1)).releaseConnection();
+        verify(client, times(1)).executeMethod(method);
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteDeleteObjectFailure() throws NiciraNvpApiException, IOException {
-        _method = mock(DeleteMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        method = mock(DeleteMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
         Header header = mock(Header.class);
         when(header.getValue()).thenReturn("text/html");
-        when(_method.getResponseHeader("Content-Type")).thenReturn(header);
-        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
-        when(_method.isRequestSent()).thenReturn(true);
+        when(method.getResponseHeader("Content-Type")).thenReturn(header);
+        when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+        when(method.isRequestSent()).thenReturn(true);
         try {
-            _api.executeDeleteObject("/");
+            api.executeDeleteObject("/");
         } finally {
-            verify(_method, times(1)).releaseConnection();
+            verify(method, times(1)).releaseConnection();
         }
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteDeleteObjectException() throws NiciraNvpApiException, IOException {
-        _method = mock(DeleteMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT);
-        when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
+        method = mock(DeleteMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_NO_CONTENT);
+        when(client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
         try {
-            _api.executeDeleteObject("/");
+            api.executeDeleteObject("/");
         } finally {
-            verify(_method, times(1)).releaseConnection();
+            verify(method, times(1)).releaseConnection();
         }
     }
 
     @Test
     public void testExecuteRetrieveObject() throws NiciraNvpApiException, IOException {
-        _method = mock(GetMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        when(_method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
-        _api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
-        verify(_method, times(1)).releaseConnection();
-        verify(_client, times(1)).executeMethod(_method);
+        method = mock(GetMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        when(method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
+        api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+        verify(method, times(1)).releaseConnection();
+        verify(client, times(1)).executeMethod(method);
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteRetrieveObjectFailure() throws NiciraNvpApiException, IOException {
-        _method = mock(GetMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
-        when(_method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
+        method = mock(GetMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        when(method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
         Header header = mock(Header.class);
         when(header.getValue()).thenReturn("text/html");
-        when(_method.getResponseHeader("Content-Type")).thenReturn(header);
-        when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
-        when(_method.isRequestSent()).thenReturn(true);
+        when(method.getResponseHeader("Content-Type")).thenReturn(header);
+        when(method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
+        when(method.isRequestSent()).thenReturn(true);
         try {
-            _api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+            api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
         } finally {
-            verify(_method, times(1)).releaseConnection();
+            verify(method, times(1)).releaseConnection();
         }
     }
 
     @Test (expected=NiciraNvpApiException.class)
     public void testExecuteRetrieveObjectException() throws NiciraNvpApiException, IOException {
-        _method = mock(GetMethod.class);
-        when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-        when(_method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
-        when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
+        method = mock(GetMethod.class);
+        when(method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        when(method.getResponseBodyAsString()).thenReturn("{ \"uuid\" : \"aaaa\" }");
+        when(client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
         try {
-            _api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+            api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
         } finally {
-            verify(_method, times(1)).releaseConnection();
+            verify(method, times(1)).releaseConnection();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java
index fd13e07..abf98d4 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NiciraTagTest.java
@@ -17,7 +17,7 @@
 package com.cloud.network.nicira;
 
 import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 public class NiciraTagTest {
     @Test