Search in sources :

Example 1 with StoragePoolParametersBase

use of org.ovirt.engine.core.common.action.StoragePoolParametersBase in project ovirt-engine by oVirt.

the class DataCenterListModel method onRemove.

public void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (StoragePool a : getSelectedItems()) {
        parameters.add(new StoragePoolParametersBase(a.getId()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveStoragePool, parameters, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) StoragePoolParametersBase(org.ovirt.engine.core.common.action.StoragePoolParametersBase)

Example 2 with StoragePoolParametersBase

use of org.ovirt.engine.core.common.action.StoragePoolParametersBase in project ovirt-engine by oVirt.

the class DataCenterListModel method onForceRemove.

public void onForceRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (!model.validate()) {
        return;
    }
    StoragePoolParametersBase tempVar = new StoragePoolParametersBase(getSelectedItem().getId());
    tempVar.setForceDelete(true);
    ActionParametersBase parametersBase = tempVar;
    Frontend.getInstance().runAction(ActionType.RemoveStoragePool, parametersBase);
    cancel();
}
Also used : ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) StoragePoolParametersBase(org.ovirt.engine.core.common.action.StoragePoolParametersBase) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with StoragePoolParametersBase

use of org.ovirt.engine.core.common.action.StoragePoolParametersBase in project ovirt-engine by oVirt.

the class RemoveStoragePoolCommandTest method allButMaintenance.

@Test
public void allButMaintenance() {
    Arrays.stream(StorageDomainStatus.values()).filter(s -> s != StorageDomainStatus.Maintenance).forEach(s -> {
        StoragePoolParametersBase param = new StoragePoolParametersBase();
        RemoveStoragePoolCommand<StoragePoolParametersBase> cmd = createCommand(param);
        List<StorageDomain> domainsList = createSingleDomainList(s);
        domainsList.add(createDomain(StorageDomainStatus.Maintenance));
        assertFalse(cmd.validateDomainsInMaintenance(domainsList));
    });
}
Also used : StoragePoolParametersBase(org.ovirt.engine.core.common.action.StoragePoolParametersBase) Arrays(java.util.Arrays) List(java.util.List) Assert.assertFalse(org.junit.Assert.assertFalse) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) LinkedList(java.util.LinkedList) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest) ArrayList(java.util.ArrayList) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePoolParametersBase(org.ovirt.engine.core.common.action.StoragePoolParametersBase) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 4 with StoragePoolParametersBase

use of org.ovirt.engine.core.common.action.StoragePoolParametersBase in project ovirt-engine by oVirt.

the class RemoveStoragePoolCommandTest method emptyDomainList.

@Test
public void emptyDomainList() {
    StoragePoolParametersBase param = new StoragePoolParametersBase();
    RemoveStoragePoolCommand<StoragePoolParametersBase> cmd = createCommand(param);
    List<StorageDomain> domainsList = new ArrayList<>();
    assertTrue(cmd.validateDomainsInMaintenance(domainsList));
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList) StoragePoolParametersBase(org.ovirt.engine.core.common.action.StoragePoolParametersBase) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 5 with StoragePoolParametersBase

use of org.ovirt.engine.core.common.action.StoragePoolParametersBase in project ovirt-engine by oVirt.

the class RemoveStoragePoolCommandTest method onlyMaintenanceDomainInList.

@Test
public void onlyMaintenanceDomainInList() {
    StoragePoolParametersBase param = new StoragePoolParametersBase();
    RemoveStoragePoolCommand<StoragePoolParametersBase> cmd = createCommand(param);
    assertTrue(cmd.validateDomainsInMaintenance(createSingleDomainList(StorageDomainStatus.Maintenance)));
}
Also used : StoragePoolParametersBase(org.ovirt.engine.core.common.action.StoragePoolParametersBase) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

StoragePoolParametersBase (org.ovirt.engine.core.common.action.StoragePoolParametersBase)7 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)3 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2 Arrays (java.util.Arrays)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Assert.assertFalse (org.junit.Assert.assertFalse)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 Enlistment (org.ovirt.engine.ui.uicompat.Enlistment)1 PreparingEnlistment (org.ovirt.engine.ui.uicompat.PreparingEnlistment)1