use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class AddExistingBlockStorageDomainCommandTest method getStorageDomain.
private static StorageDomainStatic getStorageDomain() {
StorageDomainStatic storageDomain = new StorageDomainStatic();
storageDomain.setStorage(Guid.newGuid().toString());
return storageDomain;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class AddExistingFileStorageDomainCommandTest method getStorageDomain.
private static StorageDomainStatic getStorageDomain() {
StorageDomainStatic storageDomain = new StorageDomainStatic();
storageDomain.setStorage(Guid.newGuid().toString());
storageDomain.setStorageDomainType(StorageDomainType.Data);
storageDomain.setStorageFormat(StorageFormatType.V3);
return storageDomain;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class AddExistingFileStorageDomainCommandTest method testAddExistingSuccessfully.
@Test
public void testAddExistingSuccessfully() {
StorageDomainStatic sdStatic = command.getStorageDomain().getStorageStaticData();
doReturn(new Pair<>(sdStatic, sdStatic.getId())).when(command).executeHSMGetStorageDomainInfo(any());
ValidateTestUtils.runAndAssertValidateSuccess(command);
command.executeCommand();
assertTrue(command.getReturnValue().getSucceeded());
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic 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.StorageDomainStatic 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