use of org.apache.cloudstack.api.command.user.vm.RemoveIpFromVmNicCmd in project cloudstack by apache.
the class AddIpToVmNicTest method testRemoveIpFromVmNicFailure.
@Test
public void testRemoveIpFromVmNicFailure() throws InsufficientAddressCapacityException {
NetworkService networkService = Mockito.mock(NetworkService.class);
RemoveIpFromVmNicCmd removeIpFromNic = Mockito.mock(RemoveIpFromVmNicCmd.class);
Mockito.when(networkService.releaseSecondaryIpFromNic(Matchers.anyInt())).thenReturn(false);
removeIpFromNic._networkService = networkService;
successResponseGenerator = Mockito.mock(SuccessResponse.class);
try {
removeIpFromNic.execute();
} catch (InvalidParameterValueException exception) {
Assert.assertEquals("Failed to remove secondary ip address for the nic", exception.getLocalizedMessage());
}
}
use of org.apache.cloudstack.api.command.user.vm.RemoveIpFromVmNicCmd 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();
}
Aggregations