use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class OvfDataUpdaterTest method setUp.
@Before
public void setUp() {
map = new HashMap<>();
mockAnswers();
StoragePool pool1 = new StoragePool();
pool1.setId(Guid.newGuid());
StoragePool pool2 = new StoragePool();
pool2.setId(Guid.newGuid());
doReturn(Arrays.asList(pool1, pool2)).when(storagePoolDao).getAllByStatus(StoragePoolStatus.Up);
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class ProcessOvfUpdateForStoragePoolCommandTest method initMembers.
private void initMembers() {
executedUpdatedOvfGenerationIdsInDb = new HashMap<>();
poolDomainsOvfInfo = new HashMap<>();
vms = new HashMap<>();
templates = new HashMap<>();
pool1 = new StoragePool();
pool1.setId(Guid.newGuid());
pool1.setStatus(StoragePoolStatus.Maintenance);
performStoragePoolInitOps(pool1);
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class ActivateStorageDomainCommandTest method createUpStoragePool.
private void createUpStoragePool() {
StoragePool pool = new StoragePool();
pool.setId(Guid.newGuid());
pool.setStatus(StoragePoolStatus.Up);
when(storagePoolDao.get(any())).thenReturn(pool);
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class AddStorageDomainCommonTest method setUp.
@Before
public void setUp() {
Guid vdsId = Guid.newGuid();
spId = Guid.newGuid();
connId = Guid.newGuid();
sd = new StorageDomainStatic();
sd.setId(Guid.newGuid());
sd.setStorageType(StorageType.NFS);
sd.setStorageDomainType(StorageDomainType.Data);
sd.setStorageName("newStorage");
sd.setStorageFormat(StorageFormatType.V3);
sd.setStorage(connId.toString());
VDS vds = new VDS();
vds.setId(vdsId);
vds.setStatus(VDSStatus.Up);
vds.setStoragePoolId(spId);
when(vdsDao.get(vdsId)).thenReturn(vds);
sp = new StoragePool();
sp.setId(spId);
sp.setCompatibilityVersion(Version.getLast());
when(spDao.get(spId)).thenReturn(sp);
StorageServerConnections conn = new StorageServerConnections();
conn.setId(connId.toString());
conn.setStorageType(StorageType.NFS);
when(sscDao.get(connId.toString())).thenReturn(conn);
cmd.getParameters().setStorageDomainId(sd.getId());
cmd.getParameters().setStorageDomain(sd);
cmd.getParameters().setVdsId(vdsId);
cmd.setVdsId(vdsId);
cmd.init();
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class AttachStorageDomainToPoolCommandTest method statusSetInMap.
@Test
public void statusSetInMap() {
cmd.init();
Guid storageDomainId = cmd.getStorageDomainId();
Guid poolId = cmd.getStoragePoolId();
doNothing().when(cmd).attemptToActivateDomain();
doReturn(Collections.singletonList(new Pair<>(Guid.newGuid(), true))).when(cmd).connectHostsInUpToDomainStorageServer();
StoragePool pool = new StoragePool();
pool.setId(poolId);
pool.setStatus(StoragePoolStatus.Up);
when(storagePoolDao.get(any())).thenReturn(pool);
when(isoMapDao.get(any())).thenReturn(map);
when(storageDomainDao.getForStoragePool(any(), any())).thenReturn(new StorageDomain());
when(storageDomainStaticDao.get(any())).thenReturn(new StorageDomainStatic());
doReturn(pool.getId()).when(cmd).getStoragePoolIdFromVds();
ActionReturnValue actionReturnValue = new ActionReturnValue();
actionReturnValue.setSucceeded(true);
when(backendInternal.runInternalAction(any(), any(), any())).thenReturn(actionReturnValue);
StorageDomainStatic storageDomain = new StorageDomainStatic();
storageDomain.setId(Guid.newGuid());
storageDomain.setStorageDomainType(StorageDomainType.ImportExport);
mockGetStorageDomainInfoVdsCommand(storageDomain);
mockAttachStorageDomainVdsCommand();
when(vdsDao.get(any())).thenReturn(vds);
doReturn(Collections.emptyList()).when(cmd).getEntitiesFromStorageOvfDisk(storageDomainId, pool.getId());
doReturn(Collections.emptyList()).when(cmd).getAllOVFDisks(storageDomainId, pool.getId());
doAnswer(invocation -> {
map = (StoragePoolIsoMap) invocation.getArguments()[0];
return null;
}).when(isoMapDao).save(any());
cmd.setCompensationContext(mock(CompensationContext.class));
cmd.executeCommand();
assertNotNull(map);
assertEquals(StorageDomainStatus.Maintenance, map.getStatus());
}
Aggregations