use of com.sequenceiq.common.api.tag.response.MapToTaggedResponseAdapter in project cloudbreak by hortonworks.
the class CloudProviderSideTagAssertion method verifyTags.
private void verifyTags(List<String> instanceIds, Map<String, String> customTags, TestContext testContext, String resourceName) {
if ((instanceIds != null && !instanceIds.isEmpty()) || !instanceIds.contains(null)) {
CloudFunctionality cloudFunctionality = cloudProviderProxy.getCloudFunctionality();
Map<String, Map<String, String>> tagsByInstanceId = cloudFunctionality.listTagsByInstanceId(resourceName, instanceIds);
tagsByInstanceId.forEach((id, tags) -> {
LOGGER.info(" Verifying resource: {} instance ID: {} with tags: {}", resourceName, id, tags);
tagsUtil.verifyTags(new MapToTaggedResponseAdapter(tags), testContext);
customTags.forEach((key, value) -> assertThat(tags.get(cloudFunctionality.transformTagKeyOrValue(key))).isEqualTo(cloudFunctionality.transformTagKeyOrValue(value)));
});
} else {
LOGGER.error("Tag validation is not possible, because of {} instance ids: {} null or contains null!", resourceName, instanceIds);
throw new TestFailException(String.format(" Tag validation is not possible, because of %s instance ids: %s null or contains null ", resourceName, instanceIds));
}
}
Aggregations