use of com.sequenceiq.freeipa.service.freeipa.user.model.WorkloadCredentialUpdate in project cloudbreak by hortonworks.
the class WorkloadCredentialServiceTest method testSetWorkloadCredentialWhenThereAreNoModifications.
@Test
void testSetWorkloadCredentialWhenThereAreNoModifications() throws Exception {
when(freeIpaClient.formatDate(any(Optional.class))).thenReturn(FreeIpaClient.MAX_PASSWORD_EXPIRATION_DATETIME);
when(freeIpaClient.invoke(any(), any(), any(), any())).thenThrow(new FreeIpaClientException("error", new JsonRpcClientException(4202, "", null)));
underTest.setWorkloadCredential(false, freeIpaClient, new WorkloadCredentialUpdate(USER, USER_CRN, createWorkloadCredential()));
verify(freeIpaClient).invoke(eq("user_mod"), eq(List.of(USER)), any(), any());
verifyNoInteractions(interruptChecker);
}
use of com.sequenceiq.freeipa.service.freeipa.user.model.WorkloadCredentialUpdate in project cloudbreak by hortonworks.
the class WorkloadCredentialServiceTest method testSetWorkloadCredential.
@Test
void testSetWorkloadCredential() throws Exception {
when(freeIpaClient.formatDate(any(Optional.class))).thenReturn(FreeIpaClient.MAX_PASSWORD_EXPIRATION_DATETIME);
when(freeIpaClient.invoke(any(), any(), any(), any())).thenReturn(getRpcResponse());
underTest.setWorkloadCredential(false, freeIpaClient, new WorkloadCredentialUpdate(USER, USER_CRN, createWorkloadCredential()));
verify(freeIpaClient).invoke(eq("user_mod"), eq(List.of(USER)), any(), any());
verifyNoInteractions(interruptChecker);
}
use of com.sequenceiq.freeipa.service.freeipa.user.model.WorkloadCredentialUpdate in project cloudbreak by hortonworks.
the class UserSyncStateApplier method getCredentialUpdate.
private WorkloadCredentialUpdate getCredentialUpdate(String username, UmsUsersState umsUsersState) {
UserMetadata userMetadata = requireNonNull(umsUsersState.getUsersState().getUserMetadataMap().get(username), "userMetadata must not be null");
WorkloadCredential workloadCredential = requireNonNull(umsUsersState.getUsersWorkloadCredentialMap().get(username), "workloadCredential must not be null");
return new WorkloadCredentialUpdate(username, userMetadata.getCrn(), workloadCredential);
}
Aggregations