use of com.sequenceiq.freeipa.api.v1.freeipa.test.model.CheckUsersInGroupV1Request in project cloudbreak by hortonworks.
the class FreeIpaFindUsersInGroupAction method action.
public FreeIpaTestDto action(TestContext testContext, FreeIpaTestDto testDto, FreeIpaClient client) throws Exception {
CheckUsersInGroupV1Request checkUsersInGroupRequest = new CheckUsersInGroupV1Request();
checkUsersInGroupRequest.setEnvironmentCrn(testDto.getResponse().getEnvironmentCrn());
checkUsersInGroupRequest.setGroup(group);
checkUsersInGroupRequest.setUsers(users);
Log.when(LOGGER, format(" Checking users [%s] are present in group '%s' at environment '%s'", users, group, testDto.getResponse().getEnvironmentCrn()));
Log.whenJson(LOGGER, format(" FreeIpa '%s' find users in group request:%n ", testDto.getResponse().getCrn()), checkUsersInGroupRequest);
if (expectedPresence) {
if (!client.getDefaultClient().getClientTestV1Endpoint().checkUsersInGroup(checkUsersInGroupRequest).getResult()) {
throw new TestFailException("Given freeipa users cannot be found in the given group, please check FMS logs for details");
}
LOGGER.info(format(" Users [%s] are present in group '%s' at environment '%s'", users, group, testDto.getResponse().getEnvironmentCrn()));
Log.when(LOGGER, format(" Users [%s] are present in group '%s' at environment '%s'", users, group, testDto.getResponse().getEnvironmentCrn()));
} else {
if (client.getDefaultClient().getClientTestV1Endpoint().checkUsersInGroup(checkUsersInGroupRequest).getResult()) {
throw new TestFailException("Given freeipa users have been found in the given group, please check FMS logs for details");
}
LOGGER.info(format(" Users [%s] have been removed successfully from group '%s' at environment '%s'", users, group, testDto.getResponse().getEnvironmentCrn()));
Log.when(LOGGER, format(" Users [%s] have been removed successfully from group '%s' at environment '%s'", users, group, testDto.getResponse().getEnvironmentCrn()));
}
return testDto;
}
Aggregations