Search in sources :

Example 6 with NicSecondaryIpResponse

use of org.apache.cloudstack.api.response.NicSecondaryIpResponse 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.anyString())).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();
}
Also used : NicSecondaryIpResponse(org.apache.cloudstack.api.response.NicSecondaryIpResponse) AddIpToVmNicCmd(org.apache.cloudstack.api.command.user.vm.AddIpToVmNicCmd) ResponseGenerator(org.apache.cloudstack.api.ResponseGenerator) NicSecondaryIp(com.cloud.vm.NicSecondaryIp) NetworkService(com.cloud.network.NetworkService) Test(org.junit.Test)

Aggregations

NicSecondaryIpResponse (org.apache.cloudstack.api.response.NicSecondaryIpResponse)6 NicSecondaryIpVO (com.cloud.vm.dao.NicSecondaryIpVO)3 ArrayList (java.util.ArrayList)3 NicResponse (org.apache.cloudstack.api.response.NicResponse)3 NetworkVO (com.cloud.network.dao.NetworkVO)2 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)2 NicSecondaryIp (com.cloud.vm.NicSecondaryIp)2 NicVO (com.cloud.vm.NicVO)2 AffinityGroupResponse (org.apache.cloudstack.affinity.AffinityGroupResponse)2 SecurityGroupResponse (org.apache.cloudstack.api.response.SecurityGroupResponse)2 UserVmJoinVO (com.cloud.api.query.vo.UserVmJoinVO)1 NetworkService (com.cloud.network.NetworkService)1 ServiceOfferingDetailsVO (com.cloud.service.ServiceOfferingDetailsVO)1 User (com.cloud.user.User)1 UserVmDetailVO (com.cloud.vm.UserVmDetailVO)1 VMInstanceVO (com.cloud.vm.VMInstanceVO)1 VmStats (com.cloud.vm.VmStats)1 DecimalFormat (java.text.DecimalFormat)1 HashMap (java.util.HashMap)1 ResponseGenerator (org.apache.cloudstack.api.ResponseGenerator)1