use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method successfullyAddedStorageConnections.
@Test
public void successfullyAddedStorageConnections() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<StorageServerConnections> conns = new ArrayList<>();
conns.add(createStorageConnection());
conns.add(createStorageConnection());
doReturn(conns).when(storageServerConnectionDao).getConnectableStorageConnectionsByStorageType(iscsiBond.getStoragePoolId(), StorageType.ISCSI);
iscsiBond.getStorageConnectionIds().add(conns.get(0).getId());
iscsiBond.getStorageConnectionIds().add(conns.get(1).getId());
assertEquals(ValidationResult.VALID, validator.validateAddedStorageConnections(iscsiBond));
}
use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method addedLogicalNetworkBelongToAnotherDatacenter.
@Test
public void addedLogicalNetworkBelongToAnotherDatacenter() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<Network> networks = new ArrayList<>();
networks.add(createNetwork(iscsiBond.getStoragePoolId()));
doReturn(networks).when(networkDao).getAllForDataCenter(iscsiBond.getStoragePoolId());
iscsiBond.getNetworkIds().add(networks.get(0).getId());
iscsiBond.getNetworkIds().add(Guid.newGuid());
ValidationResult res = validator.validateAddedLogicalNetworks(iscsiBond);
assertThat(res, failsWith(EngineMessage.NETWORKS_DONT_EXIST_IN_DATA_CENTER));
assertEquals(2, res.getVariableReplacements().size());
assertEquals("$networkIds " + iscsiBond.getNetworkIds().get(1).toString(), res.getVariableReplacements().get(0));
assertEquals("$dataCenterId " + iscsiBond.getStoragePoolId().toString(), res.getVariableReplacements().get(1));
}
use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method someAddedStorageConnectionsAreNotAnIscsi.
@Test
public void someAddedStorageConnectionsAreNotAnIscsi() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<StorageServerConnections> conns = new ArrayList<>();
conns.add(createStorageConnection());
doReturn(conns).when(storageServerConnectionDao).getConnectableStorageConnectionsByStorageType(iscsiBond.getStoragePoolId(), StorageType.ISCSI);
iscsiBond.getStorageConnectionIds().add(conns.get(0).getId());
iscsiBond.getStorageConnectionIds().add(Guid.newGuid().toString());
ValidationResult res = validator.validateAddedStorageConnections(iscsiBond);
assertThat(res, failsWith(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTIONS_CANNOT_BE_ADDED_TO_ISCSI_BOND));
assertEquals(1, res.getVariableReplacements().size());
assertEquals("$connectionIds " + iscsiBond.getStorageConnectionIds().get(1).toString(), res.getVariableReplacements().get(0));
}
use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method addedRequiredLogicalNetworks.
@Test
public void addedRequiredLogicalNetworks() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<Network> networks = new ArrayList<>();
networks.add(createNetwork(iscsiBond.getStoragePoolId()));
networks.add(createNetwork(iscsiBond.getStoragePoolId()));
doReturn(networks).when(networkDao).getAllForDataCenter(iscsiBond.getStoragePoolId());
for (Network network : networks) {
iscsiBond.getNetworkIds().add(network.getId());
}
List<NetworkCluster> networkClusters = new ArrayList<>();
networkClusters.add(createNetworkCluster(true));
doReturn(networkClusters).when(networkClusterDao).getAllForNetwork(any());
ValidationResult res = validator.validateAddedLogicalNetworks(iscsiBond);
assertThat(res, failsWith(EngineMessage.ACTION_TYPE_FAILED_ISCSI_BOND_NETWORK_CANNOT_BE_REQUIRED));
}
use of org.ovirt.engine.core.common.businessentities.IscsiBond in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method addedLogicalNetworkBelongToSameDatacenter.
@Test
public void addedLogicalNetworkBelongToSameDatacenter() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<Network> networks = new ArrayList<>();
networks.add(createNetwork(iscsiBond.getStoragePoolId()));
networks.add(createNetwork(iscsiBond.getStoragePoolId()));
doReturn(networks).when(networkDao).getAllForDataCenter(iscsiBond.getStoragePoolId());
for (Network network : networks) {
iscsiBond.getNetworkIds().add(network.getId());
}
List<NetworkCluster> networkClusters = new ArrayList<>();
networkClusters.add(createNetworkCluster(false));
doReturn(networkClusters).when(networkClusterDao).getAllForNetwork(any());
assertEquals(ValidationResult.VALID, validator.validateAddedLogicalNetworks(iscsiBond));
}
Aggregations