Search in sources :

Example 11 with IscsiBond

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

the class GetIscsiBondByIdQueryTest method mockIscsiBond.

private IscsiBond mockIscsiBond() {
    IscsiBond iscsiBond = new IscsiBond();
    iscsiBond.setId(iscsiBondId);
    return iscsiBond;
}
Also used : IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 12 with IscsiBond

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

the class GetIscsiBondsByStoragePoolIdQueryTest method testExecuteQueryCommand.

@Test
public void testExecuteQueryCommand() {
    Guid storagePoolId = Guid.newGuid();
    Guid networkId = Guid.newGuid();
    String connectionId = Guid.newGuid().toString();
    IscsiBond iscsiBond = new IscsiBond();
    iscsiBond.setId(Guid.newGuid());
    when(getQueryParameters().getId()).thenReturn(storagePoolId);
    when(iscsiBondDao.getAllByStoragePoolId(storagePoolId)).thenReturn(Collections.singletonList(iscsiBond));
    when(iscsiBondDao.getNetworkIdsByIscsiBondId(iscsiBond.getId())).thenReturn(Collections.singletonList(networkId));
    when(iscsiBondDao.getStorageConnectionIdsByIscsiBondId(iscsiBond.getId())).thenReturn(Collections.singletonList(connectionId));
    getQuery().executeQueryCommand();
    List<IscsiBond> result = getQuery().getQueryReturnValue().getReturnValue();
    assertNotNull(result);
    assertEquals(1, result.size());
    assertEquals(iscsiBond, result.get(0));
    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 : 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 13 with IscsiBond

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

the class IscsiBondDaoTest method generateNewEntity.

@Override
protected IscsiBond generateNewEntity() {
    IscsiBond newIscsiBond = new IscsiBond();
    newIscsiBond.setId(Guid.newGuid());
    newIscsiBond.setName("Multipath");
    newIscsiBond.setDescription("New iscsi bond for multipathing");
    newIscsiBond.setStoragePoolId(FixturesTool.STORAGE_POOL_RHEL6_ISCSI_OTHER);
    return newIscsiBond;
}
Also used : IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 14 with IscsiBond

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

the class BackendIscsiBondNetworkResource method remove.

@Override
public Response remove() {
    get();
    IscsiBond iscsiBond = parent.getIscsiBond();
    iscsiBond.getNetworkIds().remove(guid);
    return performAction(ActionType.EditIscsiBond, new EditIscsiBondParameters(iscsiBond));
}
Also used : EditIscsiBondParameters(org.ovirt.engine.core.common.action.EditIscsiBondParameters) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 15 with IscsiBond

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

the class BackendIscsiBondNetworkResource method get.

@Override
public Network get() {
    IscsiBond iscsiBond = parent.getIscsiBond();
    if (!iscsiBond.getNetworkIds().contains(guid)) {
        return notFound();
    }
    org.ovirt.engine.core.common.businessentities.network.Network entity = getNetwork();
    if (entity == null) {
        return notFound();
    }
    return addLinks(map(entity));
}
Also used : IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

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