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