cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [2/6] Checkstyle adjustments in code and configuration
Date Mon, 18 Nov 2013 18:24:53 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/876b7e49/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
b/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
index 78465e4..eceec2a 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
@@ -84,68 +84,67 @@ import com.cloud.network.nicira.NiciraNvpList;
 import com.cloud.network.nicira.SourceNatRule;
 
 public class NiciraNvpResourceTest {
-    NiciraNvpApi _nvpApi = mock(NiciraNvpApi.class);
-    NiciraNvpResource _resource;
-    Map<String,Object> _parameters;
+    NiciraNvpApi nvpApi = mock(NiciraNvpApi.class);
+    NiciraNvpResource resource;
+    Map<String,Object> parameters;
 
     @Before
     public void setUp() throws ConfigurationException {
-        _resource = new NiciraNvpResource() {
+        resource = new NiciraNvpResource() {
             @Override
             protected NiciraNvpApi createNiciraNvpApi() {
-                return _nvpApi;
+                return nvpApi;
             }
         };
 
-        _parameters = new HashMap<String,Object>();
-        _parameters.put("name","nvptestdevice");
-        _parameters.put("ip","127.0.0.1");
-        _parameters.put("adminuser","adminuser");
-        _parameters.put("guid", "aaaaa-bbbbb-ccccc");
-        _parameters.put("zoneId", "blublub");
-        _parameters.put("adminpass","adminpass");
+        parameters = new HashMap<String,Object>();
+        parameters.put("name","nvptestdevice");
+        parameters.put("ip","127.0.0.1");
+        parameters.put("adminuser","adminuser");
+        parameters.put("guid", "aaaaa-bbbbb-ccccc");
+        parameters.put("zoneId", "blublub");
+        parameters.put("adminpass","adminpass");
     }
 
     @Test (expected=ConfigurationException.class)
     public void resourceConfigureFailure() throws ConfigurationException {
-        _resource.configure("NiciraNvpResource", Collections.<String,Object>emptyMap());
+        resource.configure("NiciraNvpResource", Collections.<String,Object>emptyMap());
     }
 
     @Test
     public void resourceConfigure() throws ConfigurationException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
-        verify(_nvpApi).setAdminCredentials("adminuser", "adminpass");
-        verify(_nvpApi).setControllerAddress("127.0.0.1");
-
-        assertTrue("nvptestdevice".equals(_resource.getName()));
+        verify(nvpApi).setAdminCredentials("adminuser", "adminpass");
+        verify(nvpApi).setControllerAddress("127.0.0.1");
+        assertTrue("Incorrect resource name", "nvptestdevice".equals(resource.getName()));
 
         /* Pretty lame test, but here to assure this plugin fails
          * if the type name ever changes from L2Networking
          */
-        assertTrue(_resource.getType() == Host.Type.L2Networking);
+        assertTrue("Incorrect resource type", resource.getType() == Host.Type.L2Networking);
     }
 
     @Test
     public void testInitialization() throws ConfigurationException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
-        StartupCommand[] sc = _resource.initialize();
+        StartupCommand[] sc = resource.initialize();
         assertTrue(sc.length ==1);
-        assertTrue("aaaaa-bbbbb-ccccc".equals(sc[0].getGuid()));
-        assertTrue("nvptestdevice".equals(sc[0].getName()));
-        assertTrue("blublub".equals(sc[0].getDataCenter()));
+        assertTrue("Incorrect startup command GUID", "aaaaa-bbbbb-ccccc".equals(sc[0].getGuid()));
+        assertTrue("Incorrect NVP device name", "nvptestdevice".equals(sc[0].getName()));
+        assertTrue("Incorrect Data Center", "blublub".equals(sc[0].getDataCenter()));
     }
 
     @Test
     public void testPingCommandStatusOk() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         ControlClusterStatus ccs = mock(ControlClusterStatus.class);
         when(ccs.getClusterStatus()).thenReturn("stable");
-        when(_nvpApi.getControlClusterStatus()).thenReturn(ccs);
+        when(nvpApi.getControlClusterStatus()).thenReturn(ccs);
 
-        PingCommand ping = _resource.getCurrentStatus(42);
+        PingCommand ping = resource.getCurrentStatus(42);
         assertTrue(ping != null);
         assertTrue(ping.getHostId() == 42);
         assertTrue(ping.getHostType() == Host.Type.L2Networking);
@@ -153,98 +152,98 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testPingCommandStatusFail() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         ControlClusterStatus ccs = mock(ControlClusterStatus.class);
         when(ccs.getClusterStatus()).thenReturn("unstable");
-        when(_nvpApi.getControlClusterStatus()).thenReturn(ccs);
+        when(nvpApi.getControlClusterStatus()).thenReturn(ccs);
 
-        PingCommand ping = _resource.getCurrentStatus(42);
+        PingCommand ping = resource.getCurrentStatus(42);
         assertTrue(ping == null);
     }
 
     @Test
     public void testPingCommandStatusApiException() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         ControlClusterStatus ccs = mock(ControlClusterStatus.class);
         when(ccs.getClusterStatus()).thenReturn("unstable");
-        when(_nvpApi.getControlClusterStatus()).thenThrow(new NiciraNvpApiException());
+        when(nvpApi.getControlClusterStatus()).thenThrow(new NiciraNvpApiException());
 
-        PingCommand ping = _resource.getCurrentStatus(42);
+        PingCommand ping = resource.getCurrentStatus(42);
         assertTrue(ping == null);
     }
 
     @Test
     public void testRetries() throws ConfigurationException, NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         LogicalSwitch ls = mock(LogicalSwitch.class);
         when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc");
-        when(_nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenThrow(new NiciraNvpApiException()).thenThrow(new
NiciraNvpApiException()).thenReturn(ls);
+        when(nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenThrow(new NiciraNvpApiException()).thenThrow(new
NiciraNvpApiException()).thenReturn(ls);
 
-        CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)_parameters.get("guid"),
"stt", "loigicalswitch","owner");
-        CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) _resource.executeRequest(clsc);
+        CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"),
"stt", "loigicalswitch","owner");
+        CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) resource.executeRequest(clsc);
         assertTrue(clsa.getResult());
     }
 
     @Test
     public void testCreateLogicalSwitch() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         LogicalSwitch ls = mock(LogicalSwitch.class);
         when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc");
-        when(_nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenReturn(ls);
+        when(nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenReturn(ls);
 
-        CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)_parameters.get("guid"),
"stt", "loigicalswitch","owner");
-        CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) _resource.executeRequest(clsc);
+        CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"),
"stt", "loigicalswitch","owner");
+        CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) resource.executeRequest(clsc);
         assertTrue(clsa.getResult());
         assertTrue("cccc".equals(clsa.getLogicalSwitchUuid()));
     }
 
     @Test
     public void testCreateLogicalSwitchApiException() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         LogicalSwitch ls = mock(LogicalSwitch.class);
         when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc");
-        when(_nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenThrow(new NiciraNvpApiException());
+        when(nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenThrow(new NiciraNvpApiException());
 
-        CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)_parameters.get("guid"),
"stt", "loigicalswitch","owner");
-        CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) _resource.executeRequest(clsc);
+        CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"),
"stt", "loigicalswitch","owner");
+        CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) resource.executeRequest(clsc);
         assertFalse(clsa.getResult());
     }
 
     @Test
     public void testDeleteLogicalSwitch() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
-        DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) _resource.executeRequest(dlsc);
+        DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) resource.executeRequest(dlsc);
         assertTrue(dlsa.getResult());
     }
 
     @Test
     public void testDeleteLogicalSwitchApiException() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
-        doThrow(new NiciraNvpApiException()).when(_nvpApi).deleteLogicalSwitch((String)any());
+        doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalSwitch((String)any());
 
         DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
-        DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) _resource.executeRequest(dlsc);
+        DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) resource.executeRequest(dlsc);
         assertFalse(dlsa.getResult());
     }
 
     @Test
     public void testCreateLogicalSwitchPort() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
         when(lsp.getUuid()).thenReturn("eeee");
-        when(_nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);
+        when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);
 
         CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc",
"dddd", "owner", "nicname");
-        CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) _resource.executeRequest(clspc);
+        CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) resource.executeRequest(clspc);
         assertTrue(clspa.getResult());
         assertTrue("eeee".equals(clspa.getLogicalSwitchPortUuid()));
 
@@ -252,91 +251,91 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testCreateLogicalSwitchPortApiExceptionInCreate() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
         when(lsp.getUuid()).thenReturn("eeee");
-        when(_nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenThrow(new
NiciraNvpApiException());
+        when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenThrow(new
NiciraNvpApiException());
 
         CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc",
"dddd", "owner", "nicname");
-        CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) _resource.executeRequest(clspc);
+        CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) resource.executeRequest(clspc);
         assertFalse(clspa.getResult());
     }
 
     @Test
     public void testCreateLogicalSwitchPortApiExceptionInModify() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
         when(lsp.getUuid()).thenReturn("eeee");
-        when(_nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);
-        doThrow(new NiciraNvpApiException()).when(_nvpApi).modifyLogicalSwitchPortAttachment((String)any(),
(String)any(), (Attachment)any());
+        when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);
+        doThrow(new NiciraNvpApiException()).when(nvpApi).modifyLogicalSwitchPortAttachment((String)any(),
(String)any(), (Attachment)any());
 
 
         CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc",
"dddd", "owner", "nicname");
-        CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) _resource.executeRequest(clspc);
+        CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) resource.executeRequest(clspc);
         assertFalse(clspa.getResult());
-        verify(_nvpApi, atLeastOnce()).deleteLogicalSwitchPort((String) any(),  (String)
any());
+        verify(nvpApi, atLeastOnce()).deleteLogicalSwitchPort((String) any(),  (String) any());
     }
 
     @Test
     public void testDeleteLogicalSwitchPortException() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
-        doThrow(new NiciraNvpApiException()).when(_nvpApi).deleteLogicalSwitchPort((String)
any(), (String) any());
-        DeleteLogicalSwitchPortAnswer dlspa = (DeleteLogicalSwitchPortAnswer) _resource.executeRequest(new
DeleteLogicalSwitchPortCommand("aaaa","bbbb"));
+        doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalSwitchPort((String)
any(), (String) any());
+        DeleteLogicalSwitchPortAnswer dlspa = (DeleteLogicalSwitchPortAnswer) resource.executeRequest(new
DeleteLogicalSwitchPortCommand("aaaa","bbbb"));
         assertFalse(dlspa.getResult());
     }
 
     @Test
     public void testUpdateLogicalSwitchPortException() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
-        doThrow(new NiciraNvpApiException()).when(_nvpApi).modifyLogicalSwitchPortAttachment((String)
any(), (String) any(), (Attachment) any());
-        UpdateLogicalSwitchPortAnswer dlspa = (UpdateLogicalSwitchPortAnswer) _resource.executeRequest(
+        doThrow(new NiciraNvpApiException()).when(nvpApi).modifyLogicalSwitchPortAttachment((String)
any(), (String) any(), (Attachment) any());
+        UpdateLogicalSwitchPortAnswer dlspa = (UpdateLogicalSwitchPortAnswer) resource.executeRequest(
                 new UpdateLogicalSwitchPortCommand("aaaa","bbbb","cccc","owner","nicname"));
         assertFalse(dlspa.getResult());
     }
 
     @Test
     public void testFindLogicalSwitchPort() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         @SuppressWarnings("unchecked")
         NiciraNvpList<LogicalSwitchPort> lspl = mock(NiciraNvpList.class);
         when(lspl.getResultCount()).thenReturn(1);
-        when(_nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
+        when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
 
-        FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) _resource.executeRequest(new
FindLogicalSwitchPortCommand("aaaa", "bbbb"));
+        FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) resource.executeRequest(new
FindLogicalSwitchPortCommand("aaaa", "bbbb"));
         assertTrue(flspa.getResult());
     }
 
     @Test
     public void testFindLogicalSwitchPortNotFound() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         @SuppressWarnings("unchecked")
         NiciraNvpList<LogicalSwitchPort> lspl = mock(NiciraNvpList.class);
         when(lspl.getResultCount()).thenReturn(0);
-        when(_nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
+        when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
 
-        FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) _resource.executeRequest(new
FindLogicalSwitchPortCommand("aaaa", "bbbb"));
+        FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) resource.executeRequest(new
FindLogicalSwitchPortCommand("aaaa", "bbbb"));
         assertFalse(flspa.getResult());
     }
 
     @Test
     public void testFindLogicalSwitchPortApiException() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
-        when(_nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenThrow(new NiciraNvpApiException());
+        when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenThrow(new NiciraNvpApiException());
 
-        FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) _resource.executeRequest(new
FindLogicalSwitchPortCommand("aaaa", "bbbb"));
+        FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) resource.executeRequest(new
FindLogicalSwitchPortCommand("aaaa", "bbbb"));
         assertFalse(flspa.getResult());
     }
 
     @Test
     public void testCreateLogicalRouter() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         LogicalRouterConfig lrc = mock(LogicalRouterConfig.class);
         LogicalRouterPort lrp = mock(LogicalRouterPort.class);
@@ -344,46 +343,46 @@ public class NiciraNvpResourceTest {
         when(lrc.getUuid()).thenReturn("ccccc");
         when(lrp.getUuid()).thenReturn("ddddd").thenReturn("eeeee");
         when(lsp.getUuid()).thenReturn("fffff");
-        when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
-        when(_nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
-        when(_nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
+        when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
+        when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
+        when(nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
         CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb",
"lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
-        CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
+        CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
 
         assertTrue(clra.getResult());
         assertTrue("ccccc".equals(clra.getLogicalRouterUuid()));
-        verify(_nvpApi, atLeast(1)).createLogicalRouterNatRule((String) any(), (NatRule)
any());
+        verify(nvpApi, atLeast(1)).createLogicalRouterNatRule((String) any(), (NatRule) any());
     }
 
     @Test
     public void testCreateLogicalRouterApiException() throws ConfigurationException, NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
-        when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenThrow(new NiciraNvpApiException());
+        when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenThrow(new NiciraNvpApiException());
         CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb",
"lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
-        CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
+        CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
 
         assertFalse(clra.getResult());
     }
 
     @Test
     public void testCreateLogicalRouterApiExceptionRollbackRouter() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         LogicalRouterConfig lrc = mock(LogicalRouterConfig.class);
         when(lrc.getUuid()).thenReturn("ccccc");
-        when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
-        when(_nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenThrow(new
NiciraNvpApiException());
+        when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
+        when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenThrow(new
NiciraNvpApiException());
         CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb",
"lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
-        CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
+        CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
 
         assertFalse(clra.getResult());
-        verify(_nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
+        verify(nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
     }
 
     @Test
     public void testCreateLogicalRouterApiExceptionRollbackRouterAndSwitchPort() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         LogicalRouterConfig lrc = mock(LogicalRouterConfig.class);
         LogicalRouterPort lrp = mock(LogicalRouterPort.class);
@@ -391,30 +390,30 @@ public class NiciraNvpResourceTest {
         when(lrc.getUuid()).thenReturn("ccccc");
         when(lrp.getUuid()).thenReturn("ddddd").thenReturn("eeeee");
         when(lsp.getUuid()).thenReturn("fffff");
-        when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
-        when(_nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
-        when(_nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
-        when(_nvpApi.createLogicalRouterNatRule((String) any(), (NatRule)any())).thenThrow(new
NiciraNvpApiException());
+        when(nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
+        when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
+        when(nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
+        when(nvpApi.createLogicalRouterNatRule((String) any(), (NatRule)any())).thenThrow(new
NiciraNvpApiException());
         CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb",
"lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
-        CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
+        CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
 
         assertFalse(clra.getResult());
-        verify(_nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
-        verify(_nvpApi, atLeast(1)).deleteLogicalSwitchPort(eq("bbbbb"), eq("fffff"));
+        verify(nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
+        verify(nvpApi, atLeast(1)).deleteLogicalSwitchPort(eq("bbbbb"), eq("fffff"));
     }
 
     @Test
     public void testDeleteLogicalRouterApiException() throws ConfigurationException,NiciraNvpApiException
{
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
-        doThrow(new NiciraNvpApiException()).when(_nvpApi).deleteLogicalRouter(eq("aaaaa"));
-        DeleteLogicalRouterAnswer dlspa = (DeleteLogicalRouterAnswer) _resource.executeRequest(new
DeleteLogicalRouterCommand("aaaaa"));
+        doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalRouter(eq("aaaaa"));
+        DeleteLogicalRouterAnswer dlspa = (DeleteLogicalRouterAnswer) resource.executeRequest(new
DeleteLogicalRouterCommand("aaaaa"));
         assertFalse(dlspa.getResult());
     }
 
     @Test
     public void testConfigurePublicIpsOnLogicalRouterApiException() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
 
         ConfigurePublicIpsOnLogicalRouterCommand cmd = mock(ConfigurePublicIpsOnLogicalRouterCommand.class);
         @SuppressWarnings("unchecked")
@@ -422,18 +421,18 @@ public class NiciraNvpResourceTest {
 
         when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
         when(cmd.getL3GatewayServiceUuid()).thenReturn("bbbbb");
-        doThrow(new NiciraNvpApiException()).when(_nvpApi).modifyLogicalRouterPort((String)
any(), (LogicalRouterPort) any());
-        when(_nvpApi.findLogicalRouterPortByGatewayServiceUuid("aaaaa","bbbbb")).thenReturn(list);
+        doThrow(new NiciraNvpApiException()).when(nvpApi).modifyLogicalRouterPort((String)
any(), (LogicalRouterPort) any());
+        when(nvpApi.findLogicalRouterPortByGatewayServiceUuid("aaaaa","bbbbb")).thenReturn(list);
 
         ConfigurePublicIpsOnLogicalRouterAnswer answer =
-                (ConfigurePublicIpsOnLogicalRouterAnswer) _resource.executeRequest(cmd);
+                (ConfigurePublicIpsOnLogicalRouterAnswer) resource.executeRequest(cmd);
         assertFalse(answer.getResult());
 
     }
 
     @Test
     public void testConfigureStaticNatRulesOnLogicalRouter() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
         /* StaticNat
          * Outside IP: 11.11.11.11
          * Inside IP:  10.10.10.10
@@ -450,18 +449,18 @@ public class NiciraNvpResourceTest {
         // Mock the api find call
         @SuppressWarnings("unchecked")
         NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
-        when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
 
         // Mock the api create calls
-        NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+        NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
         rulepair[0].setUuid(UUID.randomUUID());
         rulepair[1].setUuid(UUID.randomUUID());
-        when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
 
-        ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)
_resource.executeRequest(cmd);
+        ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)
resource.executeRequest(cmd);
 
         assertTrue(a.getResult());
-        verify(_nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>()
{
+        verify(nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>()
{
             @Override
             public boolean matches(Object argument) {
                 NatRule rule = (NatRule) argument;
@@ -479,7 +478,7 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testConfigureStaticNatRulesOnLogicalRouterExistingRules() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
         /* StaticNat
          * Outside IP: 11.11.11.11
          * Inside IP:  10.10.10.10
@@ -494,22 +493,22 @@ public class NiciraNvpResourceTest {
         when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
 
         // Mock the api create calls
-        NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+        NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
         rulepair[0].setUuid(UUID.randomUUID());
         rulepair[1].setUuid(UUID.randomUUID());
-        when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
 
         // Mock the api find call
         @SuppressWarnings("unchecked")
         NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
         when(storedRules.getResultCount()).thenReturn(2);
         when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
-        when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
 
-        ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)
_resource.executeRequest(cmd);
+        ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)
resource.executeRequest(cmd);
 
         assertTrue(a.getResult());
-        verify(_nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>()
{
+        verify(nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>()
{
             @Override
             public boolean matches(Object argument) {
                 NatRule rule = (NatRule) argument;
@@ -527,7 +526,7 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testConfigureStaticNatRulesOnLogicalRouterRemoveRules() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
         /* StaticNat
          * Outside IP: 11.11.11.11
          * Inside IP:  10.10.10.10
@@ -542,24 +541,24 @@ public class NiciraNvpResourceTest {
         when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
 
         // Mock the api create calls
-        NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+        NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
         final UUID rule0Uuid = UUID.randomUUID();
         final UUID rule1Uuid = UUID.randomUUID();
         rulepair[0].setUuid(rule0Uuid);
         rulepair[1].setUuid(rule1Uuid);
-        when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
 
         // Mock the api find call
         @SuppressWarnings("unchecked")
         NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
         when(storedRules.getResultCount()).thenReturn(2);
         when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
-        when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
 
-        ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)
_resource.executeRequest(cmd);
+        ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)
resource.executeRequest(cmd);
 
         assertTrue(a.getResult());
-        verify(_nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>()
{
+        verify(nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>()
{
             @Override
             public boolean matches(Object argument) {
                 UUID uuid = (UUID) argument;
@@ -572,7 +571,7 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testConfigureStaticNatRulesOnLogicalRouterRollback() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
         /* StaticNat
          * Outside IP: 11.11.11.11
          * Inside IP:  10.10.10.10
@@ -587,26 +586,26 @@ public class NiciraNvpResourceTest {
         when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
 
         // Mock the api create calls
-        NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+        NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
         rulepair[0].setUuid(UUID.randomUUID());
         rulepair[1].setUuid(UUID.randomUUID());
-        when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new
NiciraNvpApiException());
+        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new
NiciraNvpApiException());
 
         // Mock the api find call
         @SuppressWarnings("unchecked")
         NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
         when(storedRules.getResultCount()).thenReturn(0);
-        when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
 
-        ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)
_resource.executeRequest(cmd);
+        ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)
resource.executeRequest(cmd);
 
         assertFalse(a.getResult());
-        verify(_nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
+        verify(nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
     }
 
     @Test
     public void testConfigurePortForwardingRulesOnLogicalRouter() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
         /* StaticNat
          * Outside IP: 11.11.11.11
          * Inside IP:  10.10.10.10
@@ -623,18 +622,18 @@ public class NiciraNvpResourceTest {
         // Mock the api find call
         @SuppressWarnings("unchecked")
         NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
-        when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
 
         // Mock the api create calls
-        NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new
int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
+        NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[]
{ 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
         rulepair[0].setUuid(UUID.randomUUID());
         rulepair[1].setUuid(UUID.randomUUID());
-        when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
 
-        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
_resource.executeRequest(cmd);
+        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
resource.executeRequest(cmd);
 
         assertTrue(a.getResult());
-        verify(_nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>()
{
+        verify(nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>()
{
             @Override
             public boolean matches(Object argument) {
                 NatRule rule = (NatRule) argument;
@@ -652,7 +651,7 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testConfigurePortForwardingRulesOnLogicalRouterExistingRules() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
         /* StaticNat
          * Outside IP: 11.11.11.11
          * Inside IP:  10.10.10.10
@@ -667,22 +666,22 @@ public class NiciraNvpResourceTest {
         when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
 
         // Mock the api create calls
-        NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new
int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
+        NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[]
{ 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
         rulepair[0].setUuid(UUID.randomUUID());
         rulepair[1].setUuid(UUID.randomUUID());
-        when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
 
         // Mock the api find call
         @SuppressWarnings("unchecked")
         NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
         when(storedRules.getResultCount()).thenReturn(2);
         when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
-        when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
 
-        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
_resource.executeRequest(cmd);
+        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
resource.executeRequest(cmd);
 
         assertTrue(a.getResult());
-        verify(_nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>()
{
+        verify(nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>()
{
             @Override
             public boolean matches(Object argument) {
                 NatRule rule = (NatRule) argument;
@@ -700,7 +699,7 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testConfigurePortForwardingRulesOnLogicalRouterRemoveRules() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
         /* StaticNat
          * Outside IP: 11.11.11.11
          * Inside IP:  10.10.10.10
@@ -715,24 +714,24 @@ public class NiciraNvpResourceTest {
         when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
 
         // Mock the api create calls
-        NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new
int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
+        NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[]
{ 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
         final UUID rule0Uuid = UUID.randomUUID();
         final UUID rule1Uuid = UUID.randomUUID();
         rulepair[0].setUuid(rule0Uuid);
         rulepair[1].setUuid(rule1Uuid);
-        when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
 
         // Mock the api find call
         @SuppressWarnings("unchecked")
         NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
         when(storedRules.getResultCount()).thenReturn(2);
         when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
-        when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
 
-        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
_resource.executeRequest(cmd);
+        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
resource.executeRequest(cmd);
 
         assertTrue(a.getResult());
-        verify(_nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>()
{
+        verify(nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>()
{
             @Override
             public boolean matches(Object argument) {
                 UUID uuid = (UUID) argument;
@@ -745,7 +744,7 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testConfigurePortForwardingRulesOnLogicalRouterRollback() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
         /* StaticNat
          * Outside IP: 11.11.11.11
          * Inside IP:  10.10.10.10
@@ -760,26 +759,26 @@ public class NiciraNvpResourceTest {
         when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
 
         // Mock the api create calls
-        NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new
int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
+        NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[]
{ 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
         rulepair[0].setUuid(UUID.randomUUID());
         rulepair[1].setUuid(UUID.randomUUID());
-        when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new
NiciraNvpApiException());
+        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new
NiciraNvpApiException());
 
         // Mock the api find call
         @SuppressWarnings("unchecked")
         NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
         when(storedRules.getResultCount()).thenReturn(0);
-        when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
 
-        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
_resource.executeRequest(cmd);
+        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
resource.executeRequest(cmd);
 
         assertFalse(a.getResult());
-        verify(_nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
+        verify(nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
     }
 
     @Test
     public void testConfigurePortForwardingRulesOnLogicalRouterPortRange() throws ConfigurationException,
NiciraNvpApiException {
-        _resource.configure("NiciraNvpResource", _parameters);
+        resource.configure("NiciraNvpResource", parameters);
         /* StaticNat
          * Outside IP: 11.11.11.11
          * Inside IP:  10.10.10.10
@@ -796,15 +795,15 @@ public class NiciraNvpResourceTest {
         // Mock the api find call
         @SuppressWarnings("unchecked")
         NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
-        when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
+        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
 
         // Mock the api create calls
-        NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new
int[] { 80, 85 }, "11.11.11.11", new int[] { 80, 85}, "tcp");
+        NatRule[] rulepair = resource.generatePortForwardingRulePair("10.10.10.10", new int[]
{ 80, 85 }, "11.11.11.11", new int[] { 80, 85}, "tcp");
         rulepair[0].setUuid(UUID.randomUUID());
         rulepair[1].setUuid(UUID.randomUUID());
-        when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
+        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
 
-        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
_resource.executeRequest(cmd);
+        ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer)
resource.executeRequest(cmd);
 
         // The expected result is false, Nicira does not support port ranges in DNAT
         assertFalse(a.getResult());
@@ -813,7 +812,7 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testGenerateStaticNatRulePair() {
-        NatRule[] rules = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
+        NatRule[] rules = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
         assertTrue("DestinationNatRule".equals(rules[0].getType()));
         assertTrue("SourceNatRule".equals(rules[1].getType()));
 
@@ -830,7 +829,7 @@ public class NiciraNvpResourceTest {
 
     @Test
     public void testGeneratePortForwardingRulePair() {
-        NatRule[] rules = _resource.generatePortForwardingRulePair("10.10.10.10", new int[]
{ 8080,  8080 }, "11.11.11.11", new int[] { 80, 80 }, "tcp" );
+        NatRule[] rules = resource.generatePortForwardingRulePair("10.10.10.10", new int[]
{ 8080,  8080 }, "11.11.11.11", new int[] { 80, 80 }, "tcp" );
         assertTrue("DestinationNatRule".equals(rules[0].getType()));
         assertTrue("SourceNatRule".equals(rules[1].getType()));
 


Mime
View raw message