use of com.cloud.api.command.user.vm.RemoveIpFromVmNicCmd in project cosmic by MissionCriticalCloud.
the class AddIpToVmNicTest method testRemoveIpFromVmNicSuccess.
@Test
public void testRemoveIpFromVmNicSuccess() throws ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
final NetworkService networkService = Mockito.mock(NetworkService.class);
final RemoveIpFromVmNicCmd removeIpFromNic = Mockito.mock(RemoveIpFromVmNicCmd.class);
Mockito.when(networkService.releaseSecondaryIpFromNic(Matchers.anyInt())).thenReturn(true);
removeIpFromNic._networkService = networkService;
removeIpFromNic.execute();
}
use of com.cloud.api.command.user.vm.RemoveIpFromVmNicCmd in project cosmic by MissionCriticalCloud.
the class AddIpToVmNicTest method testRemoveIpFromVmNicFailure.
@Test
public void testRemoveIpFromVmNicFailure() throws InsufficientAddressCapacityException {
final NetworkService networkService = Mockito.mock(NetworkService.class);
final 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 (final InvalidParameterValueException exception) {
Assert.assertEquals("Failed to remove secondary ip address for the nic", exception.getLocalizedMessage());
}
}
Aggregations