Search in sources :

Example 6 with SupportedAdditionalClusterFeature

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

the class ClusterFeatureDaoTest method testGetSupportedFeaturesByClusterId.

@Test
public void testGetSupportedFeaturesByClusterId() {
    Set<SupportedAdditionalClusterFeature> featuresSupportedInCluster = dao.getSupportedFeaturesByClusterId(EXISTING_CLUSTER);
    List<String> expectedFeatures = Arrays.asList("TEST_FEATURE_1", "TEST_FEATURE_2", "TEST_FEATURE_3");
    assertNotNull("Failed to retrive supported additional features for the cluster", featuresSupportedInCluster);
    assertThat("Failed to retrive correct set of features for the given version and category", featuresSupportedInCluster, hasSize(expectedFeatures.size()));
    for (SupportedAdditionalClusterFeature supportedFeatures : featuresSupportedInCluster) {
        assertThat("Wrong feature returned from DB", expectedFeatures, hasItem(supportedFeatures.getFeature().getName()));
    }
}
Also used : SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) Test(org.junit.Test)

Example 7 with SupportedAdditionalClusterFeature

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

the class ClusterFeatureDaoTest method buildSupportedFeature.

private SupportedAdditionalClusterFeature buildSupportedFeature(Guid featureId, Guid clusterId, boolean enabled) {
    SupportedAdditionalClusterFeature supportedAdditionalClusterFeature = new SupportedAdditionalClusterFeature();
    supportedAdditionalClusterFeature.setClusterId(clusterId);
    supportedAdditionalClusterFeature.setEnabled(enabled);
    supportedAdditionalClusterFeature.setFeature(new AdditionalFeature());
    supportedAdditionalClusterFeature.getFeature().setId(featureId);
    return supportedAdditionalClusterFeature;
}
Also used : SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature)

Example 8 with SupportedAdditionalClusterFeature

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

the class UpdateClusterCommandTest method createClusterWithAddtionalFeature.

private static Cluster createClusterWithAddtionalFeature() {
    Cluster group = createDefaultCluster();
    group.setCompatibilityVersion(VERSION_1_1);
    Set<SupportedAdditionalClusterFeature> addtionalFeaturesSupported = new HashSet<>();
    AdditionalFeature feature = new AdditionalFeature(DEFAULT_FEATURE_ID, "TEST_FEATURE", VERSION_1_1, "Test Feature", ApplicationMode.AllModes);
    addtionalFeaturesSupported.add(new SupportedAdditionalClusterFeature(group.getId(), true, feature));
    group.setAddtionalFeaturesSupported(addtionalFeaturesSupported);
    return group;
}
Also used : SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) HashSet(java.util.HashSet)

Example 9 with SupportedAdditionalClusterFeature

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

the class ClusterModel method refreshAdditionalClusterFeaturesList.

private void refreshAdditionalClusterFeaturesList() {
    if (getVersion() == null || getVersion().getSelectedItem() == null) {
        return;
    }
    Version version = getVersion().getSelectedItem();
    ApplicationMode category = null;
    if (getEnableGlusterService().getEntity() && getEnableOvirtService().getEntity()) {
        category = ApplicationMode.AllModes;
    } else if (getEnableGlusterService().getEntity()) {
        category = ApplicationMode.GlusterOnly;
    } else if (getEnableOvirtService().getEntity()) {
        category = ApplicationMode.VirtOnly;
    }
    // Get all the addtional features avaivalble for the cluster
    startProgress();
    AsyncDataProvider.getInstance().getClusterFeaturesByVersionAndCategory(new AsyncQuery<>(features -> {
        stopProgress();
        // cluster
        if (getIsEdit() && !features.isEmpty()) {
            startProgress();
            AsyncDataProvider.getInstance().getClusterFeaturesByClusterId(new AsyncQuery<>(clusterFeatures -> {
                stopProgress();
                Set<AdditionalFeature> featuresEnabled = new HashSet<>();
                for (SupportedAdditionalClusterFeature feature : clusterFeatures) {
                    if (feature.isEnabled()) {
                        featuresEnabled.add(feature.getFeature());
                    }
                }
                updateAddtionClusterFeatureList(features, featuresEnabled);
            }), getEntity().getId());
        } else {
            updateAddtionClusterFeatureList(features, Collections.emptySet());
        }
    }), version, category);
}
Also used : MacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.MacPoolModel) Arrays(java.util.Arrays) Provider(org.ovirt.engine.core.common.businessentities.Provider) Event(org.ovirt.engine.ui.uicompat.Event) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) SwitchType(org.ovirt.engine.core.common.network.SwitchType) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) Version(org.ovirt.engine.core.compat.Version) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) SortedListModel(org.ovirt.engine.ui.uicommonweb.models.SortedListModel) ClusterPolicy(org.ovirt.engine.core.common.scheduling.ClusterPolicy) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) MigrationBandwidthLimitType(org.ovirt.engine.core.common.businessentities.MigrationBandwidthLimitType) HasValidatedTabs(org.ovirt.engine.ui.uicommonweb.models.HasValidatedTabs) I18NNameValidation(org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation) StringHelper(org.ovirt.engine.core.compat.StringHelper) SerialNumberPolicyModel(org.ovirt.engine.ui.uicommonweb.models.vms.SerialNumberPolicyModel) Objects(java.util.Objects) ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) List(java.util.List) MigrateOnErrorOptions(org.ovirt.engine.core.common.businessentities.MigrateOnErrorOptions) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) ValidationCompleteEvent(org.ovirt.engine.ui.uicommonweb.models.ValidationCompleteEvent) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ProviderType(org.ovirt.engine.core.common.businessentities.ProviderType) FilteredListModel(org.ovirt.engine.ui.uicommonweb.models.FilteredListModel) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) HostWithProtocolAndPortAddressValidation(org.ovirt.engine.ui.uicommonweb.validation.HostWithProtocolAndPortAddressValidation) Guid(org.ovirt.engine.core.compat.Guid) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) HashSet(java.util.HashSet) LinkedHashMap(java.util.LinkedHashMap) NoMigrationPolicy(org.ovirt.engine.core.common.migration.NoMigrationPolicy) Frontend(org.ovirt.engine.ui.frontend.Frontend) NotNullIntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.NotNullIntegerValidation) Network(org.ovirt.engine.core.common.businessentities.network.Network) MigrationPolicy(org.ovirt.engine.core.common.migration.MigrationPolicy) Pair(org.ovirt.engine.core.common.utils.Pair) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) SerialNumberPolicy(org.ovirt.engine.core.common.businessentities.SerialNumberPolicy) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) MacPool(org.ovirt.engine.core.common.businessentities.MacPool) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) PolicyUnit(org.ovirt.engine.core.common.scheduling.PolicyUnit) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) FirewallType(org.ovirt.engine.core.common.network.FirewallType) Comparator(java.util.Comparator) Collections(java.util.Collections) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) IdAndNameQueryParameters(org.ovirt.engine.core.common.queries.IdAndNameQueryParameters) Version(org.ovirt.engine.core.compat.Version) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) HashSet(java.util.HashSet)

Example 10 with SupportedAdditionalClusterFeature

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

the class BackendClusterEnabledFeaturesResource method list.

@Override
public ClusterFeatures list() {
    ClusterFeatures features = new ClusterFeatures();
    Set<SupportedAdditionalClusterFeature> addlFeatures = getOptionalEntity(Set.class, QueryType.GetClusterFeaturesByClusterId, new IdQueryParameters(clusterId), clusterId.toString(), false);
    if (addlFeatures != null) {
        for (SupportedAdditionalClusterFeature entity : addlFeatures) {
            if (entity.isEnabled()) {
                features.getClusterFeatures().add(addLinks(map(entity.getFeature(), null)));
            }
        }
    }
    return features;
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) ClusterFeatures(org.ovirt.engine.api.model.ClusterFeatures)

Aggregations

SupportedAdditionalClusterFeature (org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature)14 AdditionalFeature (org.ovirt.engine.core.common.businessentities.AdditionalFeature)6 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)4 HashMap (java.util.HashMap)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 Guid (org.ovirt.engine.core.compat.Guid)2 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Test (org.junit.Test)1 ClusterFeatures (org.ovirt.engine.api.model.ClusterFeatures)1