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);
}
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);
}
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;
}
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);
}
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());
}
Aggregations