Package org.apache.cloudstack.api.command.user.vm

Examples of org.apache.cloudstack.api.command.user.vm.AddIpToVmNicCmd


    @Rule
    public ExpectedException expectedException = ExpectedException.none();

    @Before
    public void setUp() {
        addIpToVmNicCmd = new AddIpToVmNicCmd() {
        };
        removeIpFromVmNicCmd = new RemoveIpFromVmNicCmd();
    }
View Full Code Here


    @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(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.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();
    }
View Full Code Here

    @Test
    public void testCreateFailure() throws ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {

        NetworkService networkService = Mockito.mock(NetworkService.class);
        AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class);

        Mockito.when(
                networkService.allocateSecondaryGuestIP(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString())).thenReturn(null);

        ipTonicCmd._networkService = networkService;

        try {
            ipTonicCmd.execute();
        } catch (InsufficientAddressCapacityException e) {
            throw new InvalidParameterValueException("Allocating guest ip for nic failed");
        }
    }
View Full Code Here

    public ExpectedException expectedException = ExpectedException.none();

    @Override
    @Before
    public void setUp() {
        addIpToVmNicCmd = new AddIpToVmNicCmd() {
        };
        removeIpFromVmNicCmd = new RemoveIpFromVmNicCmd();
    }
View Full Code Here

    @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();
    }
View Full Code Here

    @Test
    public void testCreateFailure() throws ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {

        NetworkService networkService = Mockito.mock(NetworkService.class);
        AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class);

        Mockito.when(
            networkService.allocateSecondaryGuestIP(Matchers.anyLong(), Matchers.anyString()))
            .thenReturn(null);

        ipTonicCmd._networkService = networkService;

        try {
            ipTonicCmd.execute();
        } catch (InsufficientAddressCapacityException e) {
            throw new InvalidParameterValueException("Allocating guest ip for nic failed");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.api.command.user.vm.AddIpToVmNicCmd

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.