Search in sources :

Example 1 with VDSCommandType

use of org.ovirt.engine.core.common.vdscommands.VDSCommandType in project ovirt-engine by oVirt.

the class VmSlaPolicyCommandTest method setUp.

@Before
public void setUp() {
    doAnswer(invocation -> {
        VDSCommandType commandType = (VDSCommandType) invocation.getArguments()[0];
        assertEquals(VDSCommandType.UpdateVmPolicy, commandType);
        UpdateVmPolicyVDSParams params = (UpdateVmPolicyVDSParams) invocation.getArguments()[1];
        VDSReturnValue retVal = new VDSReturnValue();
        retVal.setSucceeded(vdsFunction.apply(params));
        return retVal;
    }).when(command).runVdsCommand(any(), any());
    vm = new VM();
    vm.setId(VM_ID);
    vm.setStatus(VMStatus.Up);
    when(vmDao.get(VM_ID)).thenReturn(vm);
    diskImage = new DiskImage();
    diskImage.setStorageIds(new ArrayList<>());
    diskImage.getStorageIds().add(DISK_DOMAIN_ID);
    diskImage.setStoragePoolId(DISK_POOL_ID);
    diskImage.setId(DISK_IMAGE_ID);
    diskImage.setImageId(DISK_VOLUME_ID);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) VDSCommandType(org.ovirt.engine.core.common.vdscommands.VDSCommandType) UpdateVmPolicyVDSParams(org.ovirt.engine.core.common.vdscommands.UpdateVmPolicyVDSParams) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)1 UpdateVmPolicyVDSParams (org.ovirt.engine.core.common.vdscommands.UpdateVmPolicyVDSParams)1 VDSCommandType (org.ovirt.engine.core.common.vdscommands.VDSCommandType)1 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)1