use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class GetIscsiBondByIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
IscsiBond iscsiBond = iscsiBondDao.get(getParameters().getId());
if (iscsiBond != null) {
iscsiBond.getNetworkIds().addAll(iscsiBondDao.getNetworkIdsByIscsiBondId(iscsiBond.getId()));
iscsiBond.getStorageConnectionIds().addAll(iscsiBondDao.getStorageConnectionIdsByIscsiBondId(iscsiBond.getId()));
getQueryReturnValue().setReturnValue(iscsiBond);
}
}
use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class GetIscsiBondsByStoragePoolIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<IscsiBond> iscsiBonds = iscsiBondDao.getAllByStoragePoolId(getParameters().getId());
for (IscsiBond iscsiBond : iscsiBonds) {
List<Guid> networkIds = iscsiBondDao.getNetworkIdsByIscsiBondId(iscsiBond.getId());
iscsiBond.setNetworkIds(networkIds);
List<String> connectionIds = iscsiBondDao.getStorageConnectionIdsByIscsiBondId(iscsiBond.getId());
iscsiBond.setStorageConnectionIds(connectionIds);
}
getQueryReturnValue().setReturnValue(iscsiBonds);
}
use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method createIscsiBond.
private IscsiBond createIscsiBond(String name, Guid dataCenterId) {
IscsiBond iscsiBond = new IscsiBond();
iscsiBond.setId(Guid.newGuid());
iscsiBond.setStoragePoolId(dataCenterId);
iscsiBond.setName(name);
return iscsiBond;
}
use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method iscsiBondWithTheSameNameExistsInDataCenter.
@Test
public void iscsiBondWithTheSameNameExistsInDataCenter() {
List<IscsiBond> iscsiBonds = new ArrayList<>();
Guid dataCenterId = Guid.newGuid();
iscsiBonds.add(createIscsiBond("First", dataCenterId));
iscsiBonds.add(createIscsiBond("Second", dataCenterId));
doReturn(iscsiBonds).when(iscsiBondDao).getAllByStoragePoolId(any());
ValidationResult res = validator.iscsiBondWithTheSameNameExistInDataCenter(createIscsiBond("Second", dataCenterId));
assertThat(res, failsWith(EngineMessage.ISCSI_BOND_WITH_SAME_NAME_EXIST_IN_DATA_CENTER));
}
use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method iscsiBondWithTheSameNameDoesNotExistInDataCenter.
@Test
public void iscsiBondWithTheSameNameDoesNotExistInDataCenter() {
List<IscsiBond> iscsiBonds = new ArrayList<>();
Guid dataCenterId = Guid.newGuid();
iscsiBonds.add(createIscsiBond("First", dataCenterId));
iscsiBonds.add(createIscsiBond("Second", dataCenterId));
doReturn(iscsiBonds).when(iscsiBondDao).getAllByStoragePoolId(any());
assertEquals(ValidationResult.VALID, validator.iscsiBondWithTheSameNameExistInDataCenter(createIscsiBond("Third", dataCenterId)));
}
Aggregations