Search in sources :

Example 6 with IscsiBond

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

the class IscsiBondValidatorTest method addedLogicalNetworkBelongToAnotherDatacenter2.

@Test
public void addedLogicalNetworkBelongToAnotherDatacenter2() {
    Guid dataCenterId = Guid.newGuid();
    IscsiBond before = createIscsiBond("Before", dataCenterId);
    IscsiBond after = createIscsiBond("After", dataCenterId);
    List<Network> networks = new ArrayList<>();
    networks.add(createNetwork(dataCenterId));
    doReturn(networks).when(networkDao).getAllForDataCenter(dataCenterId);
    before.getNetworkIds().add(networks.get(0).getId());
    after.getNetworkIds().add(networks.get(0).getId());
    after.getNetworkIds().add(Guid.newGuid());
    ValidationResult res = validator.validateAddedLogicalNetworks(after, before);
    assertThat(res, failsWith(EngineMessage.NETWORKS_DONT_EXIST_IN_DATA_CENTER));
    assertEquals(2, res.getVariableReplacements().size());
    assertEquals("$networkIds " + after.getNetworkIds().get(1).toString(), res.getVariableReplacements().get(0));
    assertEquals("$dataCenterId " + after.getStoragePoolId().toString(), res.getVariableReplacements().get(1));
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) Guid(org.ovirt.engine.core.compat.Guid) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 7 with IscsiBond

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

the class NetworkValidatorTest method getIscsiBondList.

private static List<IscsiBond> getIscsiBondList() {
    List<IscsiBond> iscsiBondList = new ArrayList<>();
    IscsiBond iscsiBond = new IscsiBond();
    iscsiBond.setId(Guid.newGuid());
    iscsiBond.setName("IscsiBond name");
    iscsiBondList.add(iscsiBond);
    return iscsiBondList;
}
Also used : ArrayList(java.util.ArrayList) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 8 with IscsiBond

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

the class BackendIscsiBondNetworkResourceTest method getIscsiBondWithNoMatchingNetworks.

private org.ovirt.engine.core.common.businessentities.IscsiBond getIscsiBondWithNoMatchingNetworks() {
    org.ovirt.engine.core.common.businessentities.IscsiBond iscsiBond = new org.ovirt.engine.core.common.businessentities.IscsiBond();
    iscsiBond.setId(ISCSI_BOND_ID);
    iscsiBond.getNetworkIds().add(GUIDS[0]);
    return iscsiBond;
}
Also used : IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 9 with IscsiBond

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

the class DataCenterIscsiBondListModel method remove.

public void remove() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    model.setTitle(ConstantsManager.getInstance().getConstants().removeIscsiBondTitle());
    model.setHelpTag(HelpTag.remove_iscsi_bundle);
    // $NON-NLS-1$
    model.setHashName("remove_iscsi_bundle");
    setWindow(model);
    model.getLatch().setEntity(false);
    ArrayList<String> items = new ArrayList<>();
    for (IscsiBond selected : getSelectedItems()) {
        items.add(selected.getName());
    }
    model.setItems(items);
    // $NON-NLS-1$
    UICommand removeCommand = UICommand.createDefaultOkUiCommand("OnRemove", this);
    model.getCommands().add(removeCommand);
    model.getCommands().add(createCancelCommand());
}
Also used : ArrayList(java.util.ArrayList) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 10 with IscsiBond

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

the class GetIscsiBondByIdQueryTest method testExecuteQueryWithNotExistingIscsiBond.

@Test
public void testExecuteQueryWithNotExistingIscsiBond() {
    when(getQueryParameters().getId()).thenReturn(iscsiBondId);
    getQuery().executeQueryCommand();
    IscsiBond result = getQuery().getQueryReturnValue().getReturnValue();
    assertNull(result);
}
Also used : IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) 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