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

[2/6] Fix checkstyle errors in Nicira NVP plugin

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/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 58c0333..42e436f 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
@@ -16,8 +16,19 @@
 // under the License.
 package com.cloud.network.guru;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Arrays;
 import java.util.Collections;
 
 import org.junit.Before;
@@ -25,16 +36,13 @@ import org.junit.Test;
 
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.CreateLogicalSwitchAnswer;
 import com.cloud.agent.api.DeleteLogicalSwitchAnswer;
 import com.cloud.dc.DataCenter;
-import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.deploy.DeploymentPlan;
@@ -61,404 +69,401 @@ import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
 import com.cloud.user.Account;
 import com.cloud.vm.ReservationContext;
 
-import java.util.Arrays;
-
 public class NiciraNvpGuestNetworkGuruTest {
-	PhysicalNetworkDao physnetdao = mock (PhysicalNetworkDao.class);
-	NiciraNvpDao nvpdao = mock(NiciraNvpDao.class);
-	DataCenterDao dcdao = mock(DataCenterDao.class);
-	NetworkOfferingServiceMapDao nosd = mock(NetworkOfferingServiceMapDao.class);
-	AgentManager agentmgr = mock (AgentManager.class);
-	NetworkOrchestrationService netmgr = mock (NetworkOrchestrationService.class);
-	NetworkModel netmodel = mock (NetworkModel.class);
-
-	HostDao hostdao = mock (HostDao.class);
-	NetworkDao netdao = mock(NetworkDao.class);
-	NiciraNvpGuestNetworkGuru guru;
-	
-	
-	@Before
-	public void setUp() {
-		guru = new NiciraNvpGuestNetworkGuru();
-		((GuestNetworkGuru) guru)._physicalNetworkDao = physnetdao;
-		guru._physicalNetworkDao = physnetdao;
-		guru._niciraNvpDao = nvpdao;
-		guru._dcDao = dcdao;
-		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);
-		when(dc.getGuestNetworkCidr()).thenReturn("10.1.1.1/24");
-		
-		when(dcdao.findById((Long) any())).thenReturn((DataCenterVO) dc);
-	}
-	
-	@Test
-	public void testCanHandle() {
-		NetworkOffering offering = mock(NetworkOffering.class);
-		when(offering.getId()).thenReturn(42L);
-		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(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(true);
-		
-		assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
-		
-		// Not supported TrafficType != Guest
-		when(offering.getTrafficType()).thenReturn(TrafficType.Management);
-		assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
-		
-		// Not supported: GuestType Shared
-		when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-		when(offering.getGuestType()).thenReturn(GuestType.Shared);
-		assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
-		
-		// Not supported: Basic networking
-		when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-		assertFalse(guru.canHandle(offering, NetworkType.Basic, physnet) == true);
-		
-		// Not supported: IsolationMethod != STT
-		when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "VLAN" }));
-		assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
-		
-	}
-	
-	
-	@Test
-	public void testDesign() {
-		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);
-		
-		NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-		when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
-		when(device.getId()).thenReturn(1L);
-		
-		NetworkOffering offering = mock(NetworkOffering.class);
-		when(offering.getId()).thenReturn(42L);
-		when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-		when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-		
-		when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(true);
-		
-		DeploymentPlan plan = mock(DeploymentPlan.class);
-		Network network = mock(Network.class);
-		Account account = mock(Account.class);
-		
-		Network designednetwork = guru.design(offering, plan, network, account);
-		assertTrue(designednetwork != null);
-		assertTrue(designednetwork.getBroadcastDomainType() == BroadcastDomainType.Lswitch);		
-	}
-	
-	@Test
-	public void testDesignNoElementOnPhysicalNetwork() {
-		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);
-		
-		NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-		when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
-		
-		NetworkOffering offering = mock(NetworkOffering.class);
-		when(offering.getId()).thenReturn(42L);
-		when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-		when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-		
-		DeploymentPlan plan = mock(DeploymentPlan.class);
-		Network network = mock(Network.class);
-		Account account = mock(Account.class);
-		
-		Network designednetwork = guru.design(offering, plan, network, account);
-		assertTrue(designednetwork == null);	
-	}
-	
-	@Test
-	public void testDesignNoIsolationMethodSTT() {
-		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);
-		
-		NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-		when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
-		
-		NetworkOffering offering = mock(NetworkOffering.class);
-		when(offering.getId()).thenReturn(42L);
-		when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-		when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-		
-		DeploymentPlan plan = mock(DeploymentPlan.class);
-		Network network = mock(Network.class);
-		Account account = mock(Account.class);
-		
-		Network designednetwork = guru.design(offering, plan, network, account);
-		assertTrue(designednetwork == null);			
-	}
-	
-	@Test
-	public void testDesignNoConnectivityInOffering() {
-		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);
-		
-		NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-		when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
-		when(device.getId()).thenReturn(1L);
-		
-		NetworkOffering offering = mock(NetworkOffering.class);
-		when(offering.getId()).thenReturn(42L);
-		when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-		when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-		
-		when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
-		
-		DeploymentPlan plan = mock(DeploymentPlan.class);
-		Network network = mock(Network.class);
-		Account account = mock(Account.class);
-		
-		Network designednetwork = guru.design(offering, plan, network, account);
-		assertTrue(designednetwork == null);		
-	}
-	
-	@Test
-	public void testImplement() throws InsufficientVirtualNetworkCapcityException {
-		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);
-		
-		NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-		when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
-		when(device.getId()).thenReturn(1L);
-		
-		NetworkOffering offering = mock(NetworkOffering.class);
-		when(offering.getId()).thenReturn(42L);
-		when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-		when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-		
-		when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
-		
-		DeploymentPlan plan = mock(DeploymentPlan.class);
-		
-		NetworkVO network = mock(NetworkVO.class);
-		when(network.getName()).thenReturn("testnetwork");
-		when(network.getState()).thenReturn(State.Implementing);
-		when(network.getPhysicalNetworkId()).thenReturn(42L);
-		
-		DeployDestination dest = mock(DeployDestination.class);
-		
-		DataCenter dc = mock(DataCenter.class);
-		when(dest.getDataCenter()).thenReturn(dc);
-		
-		HostVO niciraHost = mock(HostVO.class);
-		when(hostdao.findById(anyLong())).thenReturn(niciraHost);
-		when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
-		when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
-		when(niciraHost.getId()).thenReturn(42L);
-		
-		when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
-		Domain dom = mock(Domain.class);
-		when(dom.getName()).thenReturn("domain");
-		Account acc = mock(Account.class);
-		when(acc.getAccountName()).thenReturn("accountname");
-		ReservationContext res = mock(ReservationContext.class);
-		when(res.getDomain()).thenReturn(dom);
-		when(res.getAccount()).thenReturn(acc);
-		
-		CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
-		when(answer.getResult()).thenReturn(true);
-		when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
- 		when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);		
-
- 		Network implementednetwork = guru.implement(network, offering, dest, res);
-		assertTrue(implementednetwork != null);		
-		verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
-	}
-
-	@Test
-	public void testImplementWithCidr() throws InsufficientVirtualNetworkCapcityException {
-		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);
-		
-		NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-		when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
-		when(device.getId()).thenReturn(1L);
-		
-		NetworkOffering offering = mock(NetworkOffering.class);
-		when(offering.getId()).thenReturn(42L);
-		when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-		when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-		
-		when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
-		
-		DeploymentPlan plan = mock(DeploymentPlan.class);
-		
-		NetworkVO network = mock(NetworkVO.class);
-		when(network.getName()).thenReturn("testnetwork");
-		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);
-		
-		DeployDestination dest = mock(DeployDestination.class);
-		
-		DataCenter dc = mock(DataCenter.class);
-		when(dest.getDataCenter()).thenReturn(dc);
-		
-		HostVO niciraHost = mock(HostVO.class);
-		when(hostdao.findById(anyLong())).thenReturn(niciraHost);
-		when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
-		when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
-		when(niciraHost.getId()).thenReturn(42L);
-		
-		when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
-		Domain dom = mock(Domain.class);
-		when(dom.getName()).thenReturn("domain");
-		Account acc = mock(Account.class);
-		when(acc.getAccountName()).thenReturn("accountname");
-		ReservationContext res = mock(ReservationContext.class);
-		when(res.getDomain()).thenReturn(dom);
-		when(res.getAccount()).thenReturn(acc);
-		
-		CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
-		when(answer.getResult()).thenReturn(true);
-		when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
- 		when(agentmgr.easySend(eq(42L), (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());
-	}
-	
-	@Test
-	public void testImplementURIException() throws InsufficientVirtualNetworkCapcityException {
-		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);
-		
-		NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-		when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
-		when(device.getId()).thenReturn(1L);
-		
-		NetworkOffering offering = mock(NetworkOffering.class);
-		when(offering.getId()).thenReturn(42L);
-		when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-		when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-		
-		when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
-		
-		DeploymentPlan plan = mock(DeploymentPlan.class);
-		
-		NetworkVO network = mock(NetworkVO.class);
-		when(network.getName()).thenReturn("testnetwork");
-		when(network.getState()).thenReturn(State.Implementing);
-		when(network.getPhysicalNetworkId()).thenReturn(42L);
-		
-		DeployDestination dest = mock(DeployDestination.class);
-		
-		DataCenter dc = mock(DataCenter.class);
-		when(dest.getDataCenter()).thenReturn(dc);
-		
-		HostVO niciraHost = mock(HostVO.class);
-		when(hostdao.findById(anyLong())).thenReturn(niciraHost);
-		when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
-		when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
-		when(niciraHost.getId()).thenReturn(42L);
-		
-		when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
-		Domain dom = mock(Domain.class);
-		when(dom.getName()).thenReturn("domain");
-		Account acc = mock(Account.class);
-		when(acc.getAccountName()).thenReturn("accountname");
-		ReservationContext res = mock(ReservationContext.class);
-		when(res.getDomain()).thenReturn(dom);
-		when(res.getAccount()).thenReturn(acc);
-		
-		CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
-		when(answer.getResult()).thenReturn(true);
-		//when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
- 		when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);		
-
- 		Network implementednetwork = guru.implement(network, offering, dest, res);
-		assertTrue(implementednetwork == null);		
-		verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
-	}
-	
-	@Test
-	public void testShutdown() throws InsufficientVirtualNetworkCapcityException, URISyntaxException {
-		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);
-		
-		NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
-		when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
-		when(device.getId()).thenReturn(1L);
-		
-		NetworkOffering offering = mock(NetworkOffering.class);
-		when(offering.getId()).thenReturn(42L);
-		when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-		when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-		
-		when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
-		
-		DeploymentPlan plan = mock(DeploymentPlan.class);
-		
-		NetworkVO network = mock(NetworkVO.class);
-		when(network.getName()).thenReturn("testnetwork");
-		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);
-		
-		DeployDestination dest = mock(DeployDestination.class);
-		
-		DataCenter dc = mock(DataCenter.class);
-		when(dest.getDataCenter()).thenReturn(dc);
-		
-		HostVO niciraHost = mock(HostVO.class);
-		when(hostdao.findById(anyLong())).thenReturn(niciraHost);
-		when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
-		when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
-		when(niciraHost.getId()).thenReturn(42L);
-		
-		when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
-		Domain dom = mock(Domain.class);
-		when(dom.getName()).thenReturn("domain");
-		Account acc = mock(Account.class);
-		when(acc.getAccountName()).thenReturn("accountname");
-		ReservationContext res = mock(ReservationContext.class);
-		when(res.getDomain()).thenReturn(dom);
-		when(res.getAccount()).thenReturn(acc);
-		
-		DeleteLogicalSwitchAnswer answer = mock(DeleteLogicalSwitchAnswer.class);
-		when(answer.getResult()).thenReturn(true);
- 		when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);		
-
- 		NetworkProfile implementednetwork = mock(NetworkProfile.class);
- 		when(implementednetwork.getId()).thenReturn(42L);
- 		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(implementednetwork, times(1)).setBroadcastUri(null);
-	}
+    PhysicalNetworkDao physnetdao = mock(PhysicalNetworkDao.class);
+    NiciraNvpDao nvpdao = mock(NiciraNvpDao.class);
+    DataCenterDao dcdao = mock(DataCenterDao.class);
+    NetworkOfferingServiceMapDao nosd = mock(NetworkOfferingServiceMapDao.class);
+    AgentManager agentmgr = mock (AgentManager.class);
+    NetworkOrchestrationService netmgr = mock (NetworkOrchestrationService.class);
+    NetworkModel netmodel = mock (NetworkModel.class);
+
+    HostDao hostdao = mock (HostDao.class);
+    NetworkDao netdao = mock(NetworkDao.class);
+    NiciraNvpGuestNetworkGuru guru;
+
+
+    @Before
+    public void setUp() {
+        guru = new NiciraNvpGuestNetworkGuru();
+        ((GuestNetworkGuru) guru)._physicalNetworkDao = physnetdao;
+        guru._physicalNetworkDao = physnetdao;
+        guru._niciraNvpDao = nvpdao;
+        guru._dcDao = dcdao;
+        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);
+        when(dc.getGuestNetworkCidr()).thenReturn("10.1.1.1/24");
+
+        when(dcdao.findById((Long) any())).thenReturn(dc);
+    }
+
+    @Test
+    public void testCanHandle() {
+        NetworkOffering offering = mock(NetworkOffering.class);
+        when(offering.getId()).thenReturn(42L);
+        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(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(true);
+
+        assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
+
+        // Not supported TrafficType != Guest
+        when(offering.getTrafficType()).thenReturn(TrafficType.Management);
+        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
+
+        // Not supported: GuestType Shared
+        when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
+        when(offering.getGuestType()).thenReturn(GuestType.Shared);
+        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
+
+        // Not supported: Basic networking
+        when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+        assertFalse(guru.canHandle(offering, NetworkType.Basic, physnet) == true);
+
+        // Not supported: IsolationMethod != STT
+        when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "VLAN" }));
+        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
+
+    }
+
+    @Test
+    public void testDesign() {
+        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);
+
+        NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
+        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(device.getId()).thenReturn(1L);
+
+        NetworkOffering offering = mock(NetworkOffering.class);
+        when(offering.getId()).thenReturn(42L);
+        when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
+        when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+
+        when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(true);
+
+        DeploymentPlan plan = mock(DeploymentPlan.class);
+        Network network = mock(Network.class);
+        Account account = mock(Account.class);
+
+        Network designednetwork = guru.design(offering, plan, network, account);
+        assertTrue(designednetwork != null);
+        assertTrue(designednetwork.getBroadcastDomainType() == BroadcastDomainType.Lswitch);
+    }
+
+    @Test
+    public void testDesignNoElementOnPhysicalNetwork() {
+        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);
+
+        mock(NiciraNvpDeviceVO.class);
+        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
+
+        NetworkOffering offering = mock(NetworkOffering.class);
+        when(offering.getId()).thenReturn(42L);
+        when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
+        when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+
+        DeploymentPlan plan = mock(DeploymentPlan.class);
+        Network network = mock(Network.class);
+        Account account = mock(Account.class);
+
+        Network designednetwork = guru.design(offering, plan, network, account);
+        assertTrue(designednetwork == null);
+    }
+
+    @Test
+    public void testDesignNoIsolationMethodSTT() {
+        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);
+
+        mock(NiciraNvpDeviceVO.class);
+        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
+
+        NetworkOffering offering = mock(NetworkOffering.class);
+        when(offering.getId()).thenReturn(42L);
+        when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
+        when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+
+        DeploymentPlan plan = mock(DeploymentPlan.class);
+        Network network = mock(Network.class);
+        Account account = mock(Account.class);
+
+        Network designednetwork = guru.design(offering, plan, network, account);
+        assertTrue(designednetwork == null);
+    }
+
+    @Test
+    public void testDesignNoConnectivityInOffering() {
+        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);
+
+        NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
+        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(device.getId()).thenReturn(1L);
+
+        NetworkOffering offering = mock(NetworkOffering.class);
+        when(offering.getId()).thenReturn(42L);
+        when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
+        when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+
+        when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false);
+
+        DeploymentPlan plan = mock(DeploymentPlan.class);
+        Network network = mock(Network.class);
+        Account account = mock(Account.class);
+
+        Network designednetwork = guru.design(offering, plan, network, account);
+        assertTrue(designednetwork == null);
+    }
+
+    @Test
+    public void testImplement() throws InsufficientVirtualNetworkCapcityException {
+        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);
+
+        NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
+        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(device.getId()).thenReturn(1L);
+
+        NetworkOffering offering = mock(NetworkOffering.class);
+        when(offering.getId()).thenReturn(42L);
+        when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
+        when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+
+        when(nosd.areServicesSupportedByNetworkOffering(42L, 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);
+
+        DeployDestination dest = mock(DeployDestination.class);
+
+        DataCenter dc = mock(DataCenter.class);
+        when(dest.getDataCenter()).thenReturn(dc);
+
+        HostVO niciraHost = mock(HostVO.class);
+        when(hostdao.findById(anyLong())).thenReturn(niciraHost);
+        when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
+        when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
+        when(niciraHost.getId()).thenReturn(42L);
+
+        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+        Domain dom = mock(Domain.class);
+        when(dom.getName()).thenReturn("domain");
+        Account acc = mock(Account.class);
+        when(acc.getAccountName()).thenReturn("accountname");
+        ReservationContext res = mock(ReservationContext.class);
+        when(res.getDomain()).thenReturn(dom);
+        when(res.getAccount()).thenReturn(acc);
+
+        CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
+        when(answer.getResult()).thenReturn(true);
+        when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
+        when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+
+        Network implementednetwork = guru.implement(network, offering, dest, res);
+        assertTrue(implementednetwork != null);
+        verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+    }
+
+    @Test
+    public void testImplementWithCidr() throws InsufficientVirtualNetworkCapcityException {
+        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);
+
+        NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
+        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(device.getId()).thenReturn(1L);
+
+        NetworkOffering offering = mock(NetworkOffering.class);
+        when(offering.getId()).thenReturn(42L);
+        when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
+        when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+
+        when(nosd.areServicesSupportedByNetworkOffering(42L, 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.getGateway()).thenReturn("10.1.1.1");
+        when(network.getCidr()).thenReturn("10.1.1.0/24");
+        when(network.getPhysicalNetworkId()).thenReturn(42L);
+
+        DeployDestination dest = mock(DeployDestination.class);
+
+        DataCenter dc = mock(DataCenter.class);
+        when(dest.getDataCenter()).thenReturn(dc);
+
+        HostVO niciraHost = mock(HostVO.class);
+        when(hostdao.findById(anyLong())).thenReturn(niciraHost);
+        when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
+        when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
+        when(niciraHost.getId()).thenReturn(42L);
+
+        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+        Domain dom = mock(Domain.class);
+        when(dom.getName()).thenReturn("domain");
+        Account acc = mock(Account.class);
+        when(acc.getAccountName()).thenReturn("accountname");
+        ReservationContext res = mock(ReservationContext.class);
+        when(res.getDomain()).thenReturn(dom);
+        when(res.getAccount()).thenReturn(acc);
+
+        CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
+        when(answer.getResult()).thenReturn(true);
+        when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
+        when(agentmgr.easySend(eq(42L), (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());
+    }
+
+    @Test
+    public void testImplementURIException() throws InsufficientVirtualNetworkCapcityException {
+        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);
+
+        NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
+        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(device.getId()).thenReturn(1L);
+
+        NetworkOffering offering = mock(NetworkOffering.class);
+        when(offering.getId()).thenReturn(42L);
+        when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
+        when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+
+        when(nosd.areServicesSupportedByNetworkOffering(42L, 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);
+
+        DeployDestination dest = mock(DeployDestination.class);
+
+        DataCenter dc = mock(DataCenter.class);
+        when(dest.getDataCenter()).thenReturn(dc);
+
+        HostVO niciraHost = mock(HostVO.class);
+        when(hostdao.findById(anyLong())).thenReturn(niciraHost);
+        when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
+        when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
+        when(niciraHost.getId()).thenReturn(42L);
+
+        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+        Domain dom = mock(Domain.class);
+        when(dom.getName()).thenReturn("domain");
+        Account acc = mock(Account.class);
+        when(acc.getAccountName()).thenReturn("accountname");
+        ReservationContext res = mock(ReservationContext.class);
+        when(res.getDomain()).thenReturn(dom);
+        when(res.getAccount()).thenReturn(acc);
+
+        CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
+        when(answer.getResult()).thenReturn(true);
+        //when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
+        when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+
+        Network implementednetwork = guru.implement(network, offering, dest, res);
+        assertTrue(implementednetwork == null);
+        verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
+    }
+
+    @Test
+    public void testShutdown() throws InsufficientVirtualNetworkCapcityException, URISyntaxException {
+        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);
+
+        NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
+        when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
+        when(device.getId()).thenReturn(1L);
+
+        NetworkOffering offering = mock(NetworkOffering.class);
+        when(offering.getId()).thenReturn(42L);
+        when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
+        when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+
+        when(nosd.areServicesSupportedByNetworkOffering(42L, 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.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch);
+        when(network.getBroadcastUri()).thenReturn(new URI("lswitch:aaaaa"));
+        when(network.getPhysicalNetworkId()).thenReturn(42L);
+        when(netdao.findById(42L)).thenReturn(network);
+
+        DeployDestination dest = mock(DeployDestination.class);
+
+        DataCenter dc = mock(DataCenter.class);
+        when(dest.getDataCenter()).thenReturn(dc);
+
+        HostVO niciraHost = mock(HostVO.class);
+        when(hostdao.findById(anyLong())).thenReturn(niciraHost);
+        when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa");
+        when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt");
+        when(niciraHost.getId()).thenReturn(42L);
+
+        when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L);
+        Domain dom = mock(Domain.class);
+        when(dom.getName()).thenReturn("domain");
+        Account acc = mock(Account.class);
+        when(acc.getAccountName()).thenReturn("accountname");
+        ReservationContext res = mock(ReservationContext.class);
+        when(res.getDomain()).thenReturn(dom);
+        when(res.getAccount()).thenReturn(acc);
+
+        DeleteLogicalSwitchAnswer answer = mock(DeleteLogicalSwitchAnswer.class);
+        when(answer.getResult()).thenReturn(true);
+        when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);
+
+        NetworkProfile implementednetwork = mock(NetworkProfile.class);
+        when(implementednetwork.getId()).thenReturn(42L);
+        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(implementednetwork, times(1)).setBroadcastUri(null);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java
index 8e7245e..9c6f85e 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java
@@ -16,7 +16,7 @@
 // under the License.
 package com.cloud.network.nicira;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
 
@@ -25,14 +25,14 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 
 public class NatRuleTest {
-	
+
     @Test
     public void testNatRuleEncoding() {
         Gson gson = new GsonBuilder()
-            .registerTypeAdapter(NatRule.class, new com.cloud.network.nicira.NiciraNvpApi.NatRuleAdapter())
-            .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
-            .create();
-        
+        .registerTypeAdapter(NatRule.class, new com.cloud.network.nicira.NiciraNvpApi.NatRuleAdapter())
+        .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
+        .create();
+
         DestinationNatRule rn1 = new DestinationNatRule();
         rn1.setToDestinationIpAddress("10.10.10.10");
         rn1.setToDestinationPort(80);
@@ -41,12 +41,12 @@ public class NatRuleTest {
         mr1.setEthertype("IPv4");
         mr1.setProtocol(6);
         rn1.setMatch(mr1);
-        
+
         String jsonString = gson.toJson(rn1);
         NatRule dnr = gson.fromJson(jsonString, NatRule.class);
 
         assertTrue(dnr instanceof DestinationNatRule);
         assertTrue(rn1.equals(dnr));
     }
-	
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/256763cf/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 42eb96e..1467d47 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
@@ -16,8 +16,12 @@
 // under the License.
 package com.cloud.network.nicira;
 
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import java.io.IOException;
 import java.util.Collections;
@@ -36,271 +40,271 @@ import org.junit.Before;
 import org.junit.Test;
 
 public class NiciraNvpApiTest {
-	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() {
-			@Override
-			protected HttpClient createHttpClient() {
-				return _client;
-			}
-			
-			@Override
-			protected HttpMethod createMethod(String type, String uri) {
-				return _method;
-			}
-		};
-		_api.setAdminCredentials("admin", "adminpass");
-		_api.setControllerAddress("localhost");
-	}
-	
-	@Test (expected=NiciraNvpApiException.class)
-	public void testExecuteLoginWithoutHostname() throws NiciraNvpApiException {
-		_api.setControllerAddress(null);
-		_api.login();
-	}
-
-	@Test (expected=NiciraNvpApiException.class)
-	public void testExecuteLoginWithoutCredentials() throws NiciraNvpApiException {
-		_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());
-	}
-
-	@Test (expected=NiciraNvpApiException.class)
-	public void testExecuteUpdateObjectWithoutCredentials() throws NiciraNvpApiException {
-		_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());
-	}
-
-	@Test (expected=NiciraNvpApiException.class)
-	public void testExecuteCreateObjectWithoutCredentials() throws NiciraNvpApiException {
-		_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("/");
-	}
-
-	@Test (expected=NiciraNvpApiException.class)
-	public void testExecuteDeleteObjectWithoutCredentials() throws NiciraNvpApiException {
-		_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());
-	}
-
-	@Test (expected=NiciraNvpApiException.class)
-	public void testExecuteRetrieveObjectWithoutCredentials() throws NiciraNvpApiException {
-		_api.setAdminCredentials(null, null);
-		_api.executeDeleteObject("/");
-	}
-
-	@Test
-	public void executeMethodTest() throws NiciraNvpApiException {
-		GetMethod gm = mock(GetMethod.class);
-		
-		when(gm.getStatusCode()).thenReturn(HttpStatus.SC_OK);
-		_api.executeMethod(gm);
-		verify(gm, times(1)).getStatusCode();
-	}
-
-	/* Bit of a roundabout way to ensure that login is called after an un authorized result
-	 * It not possible to properly mock login()
-	 */
-	@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(gm.getStatusCode()).thenReturn(HttpStatus.SC_UNAUTHORIZED).thenReturn(HttpStatus.SC_UNAUTHORIZED);
-		_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());
-		assertTrue("aaaa".equals(ls.getUuid()));
-		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);
-		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);
-		try {
-			ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
-		} finally {
-			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);
-		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.");
-		try {
-			ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
-		} finally {
-			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);
-	}
-
-	@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);
-		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);
-		try {
-			_api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
-		} finally {
-			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());
-		try {
-			_api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
-		} finally {
-			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);
-	}
-
-	@Test (expected=NiciraNvpApiException.class)
-	public void testExecuteDeleteObjectFailure() throws NiciraNvpApiException, IOException {
-		_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);
-		try {
-			_api.executeDeleteObject("/");
-		} finally {
-			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());
-		try {
-			_api.executeDeleteObject("/");
-		} finally {
-			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);
-	}
-
-	@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\" }");
-		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);
-		try {
-			_api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
-		} finally {
-			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());
-		try {
-			_api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
-		} finally {
-			verify(_method, times(1)).releaseConnection();
-		}
-	}
-	
+    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() {
+            @Override
+            protected HttpClient createHttpClient() {
+                return _client;
+            }
+
+            @Override
+            protected HttpMethod createMethod(String type, String uri) {
+                return _method;
+            }
+        };
+        _api.setAdminCredentials("admin", "adminpass");
+        _api.setControllerAddress("localhost");
+    }
+
+    @Test (expected=NiciraNvpApiException.class)
+    public void testExecuteLoginWithoutHostname() throws NiciraNvpApiException {
+        _api.setControllerAddress(null);
+        _api.login();
+    }
+
+    @Test (expected=NiciraNvpApiException.class)
+    public void testExecuteLoginWithoutCredentials() throws NiciraNvpApiException {
+        _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());
+    }
+
+    @Test (expected=NiciraNvpApiException.class)
+    public void testExecuteUpdateObjectWithoutCredentials() throws NiciraNvpApiException {
+        _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());
+    }
+
+    @Test (expected=NiciraNvpApiException.class)
+    public void testExecuteCreateObjectWithoutCredentials() throws NiciraNvpApiException {
+        _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("/");
+    }
+
+    @Test (expected=NiciraNvpApiException.class)
+    public void testExecuteDeleteObjectWithoutCredentials() throws NiciraNvpApiException {
+        _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());
+    }
+
+    @Test (expected=NiciraNvpApiException.class)
+    public void testExecuteRetrieveObjectWithoutCredentials() throws NiciraNvpApiException {
+        _api.setAdminCredentials(null, null);
+        _api.executeDeleteObject("/");
+    }
+
+    @Test
+    public void executeMethodTest() throws NiciraNvpApiException {
+        GetMethod gm = mock(GetMethod.class);
+
+        when(gm.getStatusCode()).thenReturn(HttpStatus.SC_OK);
+        _api.executeMethod(gm);
+        verify(gm, times(1)).getStatusCode();
+    }
+
+    /* Bit of a roundabout way to ensure that login is called after an un authorized result
+     * It not possible to properly mock login()
+     */
+    @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(gm.getStatusCode()).thenReturn(HttpStatus.SC_UNAUTHORIZED).thenReturn(HttpStatus.SC_UNAUTHORIZED);
+        _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());
+        assertTrue("aaaa".equals(ls.getUuid()));
+        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);
+        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);
+        try {
+            ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+        } finally {
+            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);
+        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.");
+        try {
+            ls = _api.executeCreateObject(ls, LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+        } finally {
+            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);
+    }
+
+    @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);
+        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);
+        try {
+            _api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
+        } finally {
+            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());
+        try {
+            _api.executeUpdateObject(ls, "/", Collections.<String, String> emptyMap());
+        } finally {
+            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);
+    }
+
+    @Test (expected=NiciraNvpApiException.class)
+    public void testExecuteDeleteObjectFailure() throws NiciraNvpApiException, IOException {
+        _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);
+        try {
+            _api.executeDeleteObject("/");
+        } finally {
+            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());
+        try {
+            _api.executeDeleteObject("/");
+        } finally {
+            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);
+    }
+
+    @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\" }");
+        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);
+        try {
+            _api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+        } finally {
+            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());
+        try {
+            _api.executeRetrieveObject(LogicalSwitch.class, "/", Collections.<String, String> emptyMap());
+        } finally {
+            verify(_method, times(1)).releaseConnection();
+        }
+    }
+
 }