private void verifyFeaturesReturned(Set<AdditionalFeature> featuresFromDb, List<String> featuresExpdected) { assertNotNull(featuresFromDb, "Failed to retrive additional features for the version and category"); assertEquals(featuresFromDb.size(), featuresExpdected.size(), "Failed to retrive correct set of features for the given version and category"); for (AdditionalFeature feature : featuresFromDb) { assertThat("Wrong feature returned from DB", featuresExpdected, hasItem(feature.getName())); } }
@Test public void testGetAllByClusterId() { Set<SupportedAdditionalClusterFeature> featuresSupportedInCluster = dao.getAllByClusterId(EXISTING_CLUSTER); List<String> expectedFeatures = Arrays.asList("TEST_FEATURE_1", "TEST_FEATURE_2", "TEST_FEATURE_3"); assertNotNull(featuresSupportedInCluster, "Failed to retrive supported additional features for the cluster"); 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())); } }
@Mapping(from = AdditionalFeature.class, to = org.ovirt.engine.api.model.ClusterFeature.class) public static org.ovirt.engine.api.model.ClusterFeature map(AdditionalFeature entity, org.ovirt.engine.api.model.ClusterFeature template) { org.ovirt.engine.api.model.ClusterFeature model = template != null ? template : new org.ovirt.engine.api.model.ClusterFeature(); model.setName(entity.getName()); model.setId(entity.getId().toString()); return model; }
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("id", getId()) .append("name", getName()) .append("version", getVersion()) .append("description", getDescription()) .append("category", getCategory()) .build(); } }