Search in sources :

Example 31 with IscsiBond

use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.

the class DataCenterIscsiBondListModel method onRemove.

private void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    ArrayList<ActionParametersBase> params = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        params.add(new RemoveIscsiBondParameters(((IscsiBond) item).getId()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveIscsiBond, params, result -> {
        DataCenterIscsiBondListModel localModel = (DataCenterIscsiBondListModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, this);
}
Also used : ArrayList(java.util.ArrayList) RemoveIscsiBondParameters(org.ovirt.engine.core.common.action.RemoveIscsiBondParameters) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 32 with IscsiBond

use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.

the class IscsiBondModel method updateBond.

private void updateBond() {
    IscsiBond newIscsiBond = createIscsiBond();
    newIscsiBond.setId(getIscsiBond().getId());
    EditIscsiBondParameters params = new EditIscsiBondParameters(newIscsiBond);
    startProgress();
    Frontend.getInstance().runAction(ActionType.EditIscsiBond, params, result -> {
        IscsiBondModel model = (IscsiBondModel) result.getState();
        model.stopProgress();
        model.cancel();
    }, this);
}
Also used : EditIscsiBondParameters(org.ovirt.engine.core.common.action.EditIscsiBondParameters) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 33 with IscsiBond

use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.

the class IscsiBondModel method createIscsiBond.

private IscsiBond createIscsiBond() {
    IscsiBond newIscsiBond = new IscsiBond();
    newIscsiBond.setStoragePoolId(getStoragePool().getId());
    newIscsiBond.setName(getName().getEntity());
    newIscsiBond.setDescription(getDescription().getEntity());
    newIscsiBond.setNetworkIds(getSelectedNetworks());
    newIscsiBond.setStorageConnectionIds(getSelectedConnections());
    return newIscsiBond;
}
Also used : IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 34 with IscsiBond

use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.

the class GetIscsiBondByIdQueryTest method testExecuteQueryWithStoragesAndNetworksCommand.

@Test
public void testExecuteQueryWithStoragesAndNetworksCommand() {
    IscsiBond iscsiBond = mockIscsiBond();
    when(getQueryParameters().getId()).thenReturn(iscsiBondId);
    when(iscsiBondDao.get(iscsiBondId)).thenReturn(iscsiBond);
    // Mock Networks and Storage Server Connections
    List<Guid> networks = new ArrayList<>();
    Guid networkId = Guid.newGuid();
    networks.add(networkId);
    List<String> storageServerConnections = new ArrayList<>();
    String connectionId = Guid.newGuid().toString();
    storageServerConnections.add(connectionId);
    mockNetworksAndStorages(iscsiBondId, networks, storageServerConnections);
    getQuery().executeQueryCommand();
    IscsiBond result = getQuery().getQueryReturnValue().getReturnValue();
    assertNotNull(result);
    assertNotNull(iscsiBond.getNetworkIds());
    assertEquals(1, iscsiBond.getNetworkIds().size());
    assertEquals(iscsiBond.getNetworkIds().get(0), networkId);
    assertNotNull(iscsiBond.getStorageConnectionIds());
    assertEquals(1, iscsiBond.getStorageConnectionIds().size());
    assertEquals(iscsiBond.getStorageConnectionIds().get(0), connectionId);
}
Also used : ArrayList(java.util.ArrayList) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Example 35 with IscsiBond

use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.

the class GetIscsiBondByIdQueryTest method testExecuteQueryCommand.

@Test
public void testExecuteQueryCommand() {
    IscsiBond iscsiBond = mockIscsiBond();
    when(getQueryParameters().getId()).thenReturn(iscsiBondId);
    when(iscsiBondDao.get(iscsiBondId)).thenReturn(iscsiBond);
    // Mock Networks and Storage Server Connections
    List<Guid> networks = new ArrayList<>();
    List<String> storageServerConnections = new ArrayList<>();
    mockNetworksAndStorages(iscsiBondId, networks, storageServerConnections);
    getQuery().executeQueryCommand();
    IscsiBond result = getQuery().getQueryReturnValue().getReturnValue();
    assertNotNull(result);
    assertNotNull(iscsiBond.getNetworkIds());
    assertEquals(0, iscsiBond.getNetworkIds().size());
    assertNotNull(iscsiBond.getStorageConnectionIds());
    assertEquals(0, iscsiBond.getStorageConnectionIds().size());
}
Also used : ArrayList(java.util.ArrayList) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Aggregations

IscsiBond (org.ovirt.engine.core.common.businessentities.IscsiBond)36 ArrayList (java.util.ArrayList)13 Test (org.junit.Test)12 Guid (org.ovirt.engine.core.compat.Guid)9 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)5 EditIscsiBondParameters (org.ovirt.engine.core.common.action.EditIscsiBondParameters)5 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)4 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)4 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 RemoveIscsiBondParameters (org.ovirt.engine.core.common.action.RemoveIscsiBondParameters)1 StorageServerConnectionQueryParametersBase (org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1