Search in sources :

Example 96 with StoragePool

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);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Before(org.junit.Before)

Example 97 with StoragePool

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);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 98 with StoragePool

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);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 99 with StoragePool

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();
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VDS(org.ovirt.engine.core.common.businessentities.VDS) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Guid(org.ovirt.engine.core.compat.Guid) Before(org.junit.Before)

Example 100 with StoragePool

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());
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) CompensationContext(org.ovirt.engine.core.bll.context.CompensationContext) Guid(org.ovirt.engine.core.compat.Guid) Pair(org.ovirt.engine.core.common.utils.Pair) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)239 Guid (org.ovirt.engine.core.compat.Guid)83 ArrayList (java.util.ArrayList)78 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)60 Test (org.junit.Test)59 List (java.util.List)46 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)35 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)34 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)33 VDS (org.ovirt.engine.core.common.businessentities.VDS)31 QueryType (org.ovirt.engine.core.common.queries.QueryType)31 Frontend (org.ovirt.engine.ui.frontend.Frontend)31 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)28 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)28 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)27 Linq (org.ovirt.engine.ui.uicommonweb.Linq)26 Arrays (java.util.Arrays)25 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)25