Search in sources :

Example 61 with NetworkCluster

use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.

the class AbstractBackendNetworksResourceTest method setUpEntityExpectations.

static org.ovirt.engine.core.common.businessentities.network.Network setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.network.Network entity, boolean isDisplay, boolean isMigration, boolean isRequired, boolean isDefaultRoute, int index) {
    NetworkCluster networkCluster = new NetworkCluster();
    networkCluster.setDisplay(isDisplay);
    networkCluster.setMigration(isMigration);
    networkCluster.setRequired(isRequired);
    networkCluster.setDefaultRoute(isDefaultRoute);
    when(entity.getCluster()).thenReturn(networkCluster);
    return setUpEntityExpectations(entity, index);
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Example 62 with NetworkCluster

use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.

the class SubTabNetworkClusterView method createNetRoleColumn.

private AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>> createNetRoleColumn() {
    return new AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>>() {

        @Override
        public SafeHtml getValue(PairQueryable<Cluster, NetworkCluster> object) {
            List<SafeHtml> images = new LinkedList<>();
            NetworkCluster networkCluster = object.getSecond();
            if (networkCluster != null) {
                images.add(thisOrEmptyImage(networkCluster.isManagement(), managementImage));
                images.add(thisOrEmptyImage(networkCluster.isDisplay(), displayImage));
                images.add(thisOrEmptyImage(networkCluster.isMigration(), migrationImage));
                images.add(thisOrEmptyImage(networkCluster.isGluster(), glusterNwImage));
                images.add(thisOrEmptyImage(networkCluster.isDefaultRoute(), defaultRouteImage));
            }
            return MultiImageColumnHelper.getValue(images);
        }

        @Override
        public SafeHtml getTooltip(PairQueryable<Cluster, NetworkCluster> object) {
            Map<SafeHtml, String> imagesToText = new LinkedHashMap<>();
            NetworkCluster networkCluster = object.getSecond();
            if (networkCluster != null) {
                if (networkCluster.isManagement()) {
                    imagesToText.put(managementImage, constants.managementItemInfo());
                }
                if (networkCluster.isDisplay()) {
                    imagesToText.put(displayImage, constants.displayItemInfo());
                }
                if (networkCluster.isMigration()) {
                    imagesToText.put(migrationImage, constants.migrationItemInfo());
                }
                if (networkCluster.isGluster()) {
                    imagesToText.put(glusterNwImage, constants.glusterNwItemInfo());
                }
                if (networkCluster.isDefaultRoute()) {
                    imagesToText.put(defaultRouteImage, constants.defaultRouteItemInfo());
                }
            }
            return MultiImageColumnHelper.getTooltip(imagesToText);
        }
    };
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) AbstractSafeHtmlColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)62 Test (org.junit.Test)19 Network (org.ovirt.engine.core.common.businessentities.network.Network)17 ArrayList (java.util.ArrayList)15 NetworkClusterId (org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)7 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)6 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 ManageNetworkClustersParameters (org.ovirt.engine.core.common.action.ManageNetworkClustersParameters)5 List (java.util.List)4 Map (java.util.Map)4 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)4 Guid (org.ovirt.engine.core.compat.Guid)4 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)3 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2