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()));
}
}
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;
}
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;
}
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);
}
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;
}
Aggregations