use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class ClusterNetworkManageModel method createNetworkCluster.
private NetworkCluster createNetworkCluster(ClusterNetworkModel manageModel) {
final NetworkCluster networkCluster = new NetworkCluster();
networkCluster.setClusterId(manageModel.getCluster().getId());
networkCluster.setNetworkId(manageModel.getEntity().getId());
copyRoles(manageModel, networkCluster);
return networkCluster;
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster 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.network.NetworkCluster in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method createNetworkCluster.
private NetworkCluster createNetworkCluster(boolean isRequired) {
NetworkCluster networkCluster = new NetworkCluster();
networkCluster.setRequired(isRequired);
return networkCluster;
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster 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));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class JsonImmutableSerializeDeserializeTest method serializeCollectionsSingletonList.
@Test
public void serializeCollectionsSingletonList() {
ManageNetworkClustersParameters params = new ManageNetworkClustersParameters(Collections.singletonList(new NetworkCluster(Guid.newGuid(), Guid.newGuid(), NetworkStatus.NON_OPERATIONAL, false, false, false, false, false, false)));
JsonObjectSerializer serializer = new JsonObjectSerializer();
String json = serializer.serialize(params);
assertTrue(json.length() > 0);
ManageNetworkClustersParameters deserializedParams = new JsonObjectDeserializer().deserialize(json, ManageNetworkClustersParameters.class);
assertEquals(params.getExecutionReason(), deserializedParams.getExecutionReason());
}
Aggregations