use of com.sequenceiq.cloudbreak.auth.altus.UmsRight in project cloudbreak by hortonworks.
the class BasicEnvironmentVirtualGroupTest method getEnvironmentVirtualGroups.
private Map<UmsRight, String> getEnvironmentVirtualGroups(TestContext testContext, UmsClient client) {
String accountId = testContext.getActingUserCrn().getAccountId();
String environmentCrn = testContext.given(EnvironmentTestDto.class).getCrn();
Map<UmsRight, String> virtualGroups = new HashMap<>();
String virtualGroup = null;
for (UmsRight right : UmsRight.values()) {
try {
virtualGroup = client.getDefaultClient().getWorkloadAdministrationGroupName(accountId, MDCUtils.getRequestId(), right.getRight(), environmentCrn);
} catch (StatusRuntimeException ex) {
if (Status.Code.NOT_FOUND != ex.getStatus().getCode()) {
LOGGER.info(String.format(" Virtual groups is missing for right: '%s' ", right.getRight()));
}
}
if (StringUtils.hasText(virtualGroup)) {
virtualGroups.put(right, virtualGroup);
}
}
if (MapUtils.isNotEmpty(virtualGroups)) {
Log.then(LOGGER, format(" Virtual groups are present [%s] for environment '%s' ", virtualGroups, environmentCrn));
LOGGER.info(String.format(" Virtual groups are present [%s] for environment '%s' ", virtualGroups, environmentCrn));
} else {
throw new TestFailException(String.format(" Cannot find virtual groups for environment '%s' ", environmentCrn));
}
return virtualGroups;
}
Aggregations