use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class RunVmCommandTest method testValidate.
@Test
public void testValidate() {
final VM vm = new VM();
vm.setStatus(VMStatus.Down);
command.setVm(vm);
command.setStoragePool(new StoragePool());
doReturn(true).when(command).checkRngDeviceClusterCompatibility();
doReturn(true).when(command).checkPayload(any());
doReturn(ValidationResult.VALID).when(command).checkDisksInBackupStorage();
command.setCluster(new Cluster());
ValidateTestUtils.runAndAssertValidateSuccess(command);
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class CommonVmPoolCommandTestAbstract method mockStoragePool.
/**
* Mock Storage Pool
*/
private StoragePool mockStoragePool() {
StoragePool storagePool = new StoragePool();
storagePool.setStatus(StoragePoolStatus.Up);
return storagePool;
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class ClusterValidatorTest method dataCenterVersionMismatches.
@Test
public void dataCenterVersionMismatches() {
when(cluster.getStoragePoolId()).thenReturn(mock(Guid.class));
when(cluster.getCompatibilityVersion()).thenReturn(mock(Version.class));
StoragePool dataCenter = mock(StoragePool.class);
when(dataCenter.getCompatibilityVersion()).thenReturn(SUPPORTED_VERSION);
when(dataCenterDao.get(any())).thenReturn(dataCenter);
when(dbFacade.getStoragePoolDao()).thenReturn(dataCenterDao);
when(cluster.supportsVirtService()).thenReturn(true);
validator = new ClusterValidator(dbFacade, cluster, cpuFlagsManagerHandler);
assertThat(validator.dataCenterVersionMismatch(), failsWith(EngineMessage.CLUSTER_CANNOT_ADD_COMPATIBILITY_VERSION_WITH_LOWER_STORAGE_POOL));
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class ClusterValidatorTest method localStoragePoolAttachedToMultipleClusters.
@Test
public void localStoragePoolAttachedToMultipleClusters() {
when(cluster.getStoragePoolId()).thenReturn(mock(Guid.class));
StoragePool dataCenter = mock(StoragePool.class);
when(dataCenter.isLocal()).thenReturn(true);
when(dataCenterDao.get(any())).thenReturn(dataCenter);
when(dbFacade.getStoragePoolDao()).thenReturn(dataCenterDao);
when(clusterDao.getAllForStoragePool(any())).thenReturn(Collections.singletonList(mock(Cluster.class)));
when(dbFacade.getClusterDao()).thenReturn(clusterDao);
validator = new ClusterValidator(dbFacade, cluster, cpuFlagsManagerHandler);
assertThat(validator.localStoragePoolAttachedToSingleCluster(), failsWith(EngineMessage.CLUSTER_CANNOT_ADD_MORE_THEN_ONE_HOST_TO_LOCAL_STORAGE));
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class ClusterValidatorTest method localStoragePoolAttachedToSingleCluster.
@Test
public void localStoragePoolAttachedToSingleCluster() {
when(cluster.getStoragePoolId()).thenReturn(mock(Guid.class));
StoragePool dataCenter = mock(StoragePool.class);
when(dataCenter.isLocal()).thenReturn(true);
when(dataCenterDao.get(any())).thenReturn(dataCenter);
when(dbFacade.getStoragePoolDao()).thenReturn(dataCenterDao);
when(dbFacade.getClusterDao()).thenReturn(clusterDao);
validator = new ClusterValidator(dbFacade, cluster, cpuFlagsManagerHandler);
assertThat(validator.localStoragePoolAttachedToSingleCluster(), isValid());
}
Aggregations