7171import static org .junit .Assert .assertSame ;
7272import static org .junit .Assert .assertFalse ;
7373import static org .junit .Assert .assertNotNull ;
74- import static org .mockito .ArgumentMatchers .*;
74+ import static org .mockito .ArgumentMatchers .any ;
75+ import static org .mockito .ArgumentMatchers .anyLong ;
76+ import static org .mockito .ArgumentMatchers .nullable ;
7577import static org .mockito .Mockito .when ;
7678import static org .mockito .Mockito .verify ;
7779import static org .mockito .Mockito .mock ;
@@ -134,6 +136,7 @@ public void setUp() throws IllegalAccessException, NoSuchFieldException {
134136 ReflectionTestUtils .setField ((GuestNetworkGuru ) guru , "_ipAddrMgr" , ipAddressManager );
135137 ReflectionTestUtils .setField ((GuestNetworkGuru ) guru , "_networkModel" , networkModel );
136138 ReflectionTestUtils .setField ((GuestNetworkGuru ) guru , "networkOfferingDao" , networkOfferingDao );
139+ ReflectionTestUtils .setField ((GuestNetworkGuru ) guru , "_physicalNetworkDao" , physicalNetworkDao );
137140
138141 guru .networkOfferingServiceMapDao = networkOfferingServiceMapDao ;
139142 guru .nsxControllerUtils = nsxControllerUtils ;
@@ -246,10 +249,10 @@ public void testAllocateForUserVM() throws InsufficientVirtualNetworkCapacityExc
246249 when (network .getTrafficType ()).thenReturn (Networks .TrafficType .Guest );
247250 when (vmProfile .getVirtualMachine ()).thenReturn (virtualMachine );
248251 when (virtualMachine .getType ()).thenReturn (VirtualMachine .Type .User );
249- when (network .getId ()).thenReturn (2L );
250- when (offering .getId ()).thenReturn (11L );
252+ // when(network.getId()).thenReturn(2L);
253+ // when(offering.getId()).thenReturn(11L);
251254 when (networkModel .getNetworkIp4Dns (any (Network .class ), nullable (DataCenter .class ))).thenReturn (dns );
252- when (networkModel .getNextAvailableMacAddressInNetwork (anyLong ())).thenReturn (macAddress );
255+ // when(networkModel.getNextAvailableMacAddressInNetwork(anyLong())).thenReturn(macAddress);
253256 when (nicProfile .getMacAddress ()).thenReturn (macAddress );
254257 when (networkOfferingDao .isIpv6Supported (anyLong ())).thenReturn (false );
255258
@@ -271,15 +274,15 @@ public void testAllocateForDomainRouter() throws InsufficientVirtualNetworkCapac
271274 when (vmProfile .getVirtualMachine ()).thenReturn (virtualMachine );
272275 when (virtualMachine .getType ()).thenReturn (VirtualMachine .Type .DomainRouter );
273276 when (network .getId ()).thenReturn (2L );
274- when (offering .getId ()).thenReturn (11L );
275- when (networkModel .getNetworkIp4Dns (any (Network .class ), nullable (DataCenter .class ))).thenReturn (dns );
276- when (networkModel .getNextAvailableMacAddressInNetwork (anyLong ())).thenReturn (macAddress );
277+ // when(offering.getId()).thenReturn(11L);
278+ // when(networkModel.getNetworkIp4Dns(any(Network.class), nullable(DataCenter.class))).thenReturn(dns);
279+ // when(networkModel.getNextAvailableMacAddressInNetwork(anyLong())).thenReturn(macAddress);
277280 when (nicProfile .getMacAddress ()).thenReturn (macAddress );
278281 when (networkOfferingDao .isIpv6Supported (anyLong ())).thenReturn (false );
279282 when (network .getDataCenterId ()).thenReturn (1L );
280283 when (network .getAccountId ()).thenReturn (5L );
281284 when (network .getVpcId ()).thenReturn (51L );
282- when (account .getDomainId ()).thenReturn (2L );
285+ // when(account.getDomainId()).thenReturn(2L);
283286 when (dcDao .findById (anyLong ())).thenReturn (Mockito .mock (DataCenterVO .class ));
284287 when (accountDao .findById (anyLong ())).thenReturn (Mockito .mock (AccountVO .class ));
285288 when (vpcDao .findById (anyLong ())).thenReturn (Mockito .mock (VpcVO .class ));
0 commit comments