use of com.cloud.network.NetworkService in project cloudstack by apache.
the class AddIpToVmNicTest method testRemoveIpFromVmNicSuccess.
@Test
public void testRemoveIpFromVmNicSuccess() throws ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
NetworkService networkService = Mockito.mock(NetworkService.class);
RemoveIpFromVmNicCmd removeIpFromNic = Mockito.mock(RemoveIpFromVmNicCmd.class);
Mockito.when(networkService.releaseSecondaryIpFromNic(Matchers.anyInt())).thenReturn(true);
removeIpFromNic._networkService = networkService;
removeIpFromNic.execute();
}
use of com.cloud.network.NetworkService in project cloudstack by apache.
the class AddIpToVmNicTest method testCreateSuccess.
@Test
public void testCreateSuccess() throws ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
NetworkService networkService = Mockito.mock(NetworkService.class);
AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class);
NicSecondaryIp secIp = Mockito.mock(NicSecondaryIp.class);
Mockito.when(networkService.allocateSecondaryGuestIP(Matchers.anyLong(), Matchers.any())).thenReturn(secIp);
ipTonicCmd._networkService = networkService;
responseGenerator = Mockito.mock(ResponseGenerator.class);
NicSecondaryIpResponse ipres = Mockito.mock(NicSecondaryIpResponse.class);
Mockito.when(responseGenerator.createSecondaryIPToNicResponse(secIp)).thenReturn(ipres);
ipTonicCmd._responseGenerator = responseGenerator;
ipTonicCmd.execute();
}
Aggregations