use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class NetworkClusterHelperTest method setUp.
@Before
public void setUp() {
networkCluster = createNetworkCluster(CLUSTER_ID, NETWORK_ID1);
when(networkClusterDao.get(networkCluster.getId())).thenReturn(networkCluster);
managementNetworkCluster = createNetworkCluster(CLUSTER_ID, MANAGEMENT_NETWORK_ID);
managementNetwork = createNetwork(MANAGEMENT_NETWORK_ID, MANAGEMENT_NETWORK_NAME);
when(managementNetworkUtil.getManagementNetwork(CLUSTER_ID)).thenReturn(managementNetwork);
when(networkClusterDao.get(new NetworkClusterId(CLUSTER_ID, MANAGEMENT_NETWORK_ID))).thenReturn(managementNetworkCluster);
when(vdsDynamicDao.checkIfExistsHostWithStatusInCluster(CLUSTER_ID, VDSStatus.Up)).thenReturn(true);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class GetClustersAndNetworksByNetworkIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<PairQueryable<Cluster, NetworkCluster>> networkClusterPairs = new ArrayList<>();
Network network = networkDao.get(getParameters().getId());
if (network != null && network.getDataCenterId() != null) {
List<Cluster> clusters = clusterDao.getAllForStoragePool(network.getDataCenterId());
List<NetworkCluster> networkClusters = networkClusterDao.getAllForNetwork(getParameters().getId());
final Map<NetworkClusterId, NetworkCluster> networkClustersById = Entities.businessEntitiesById(networkClusters);
for (Cluster cluster : clusters) {
networkClusterPairs.add(new PairQueryable<>(cluster, networkClustersById.get(new NetworkClusterId(cluster.getId(), getParameters().getId()))));
}
}
getQueryReturnValue().setReturnValue(networkClusterPairs);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class MapVnicFlowTest method mock.
private void mock() {
when(mockVnicProfileDao.get(P1_ID)).thenReturn(profileOf(P1_ID, P1, N1_ID));
when(mockVnicProfileViewDao.getAllForCluster(CLUSTER)).thenReturn(singletonList(profileViewOf(P1_ID, P1, N1, N1_ID)));
when(mockNetworkClusterDao.get(new NetworkClusterId(CLUSTER, N1_ID))).thenReturn(networkClusterOf(N1_ID));
when(mockNetworkDao.get(N1_ID)).thenReturn(networkOf(N1_ID, N1));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class ClusterNetworkListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
super.syncSearch();
Guid clusterId = getEntity().getId();
IdQueryParameters tempVar = new IdQueryParameters(clusterId);
tempVar.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetAllNetworksByClusterId, tempVar, new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> {
final List<Network> newItems = returnValue.getReturnValue();
Collections.sort(newItems, Comparator.comparing((Network n) -> n.getCluster().isManagement()).reversed().thenComparing(Network::getName, new LexoNumericComparator()));
for (Network network : newItems) {
network.getCluster().setId(new NetworkClusterId(clusterId, network.getId()));
}
setItems(newItems);
}));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class NetworkClusterHelperTest method createNetworkCluster.
private NetworkCluster createNetworkCluster(Guid clusterId, Guid networkId) {
NetworkCluster result = new NetworkCluster();
result.setId(new NetworkClusterId(clusterId, networkId));
return result;
}
Aggregations