Search in sources :

Example 6 with WorkloadCredentialUpdate

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);
}
Also used : JsonRpcClientException(com.googlecode.jsonrpc4j.JsonRpcClientException) Optional(java.util.Optional) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) WorkloadCredentialUpdate(com.sequenceiq.freeipa.service.freeipa.user.model.WorkloadCredentialUpdate) Test(org.junit.jupiter.api.Test)

Example 7 with WorkloadCredentialUpdate

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);
}
Also used : Optional(java.util.Optional) WorkloadCredentialUpdate(com.sequenceiq.freeipa.service.freeipa.user.model.WorkloadCredentialUpdate) Test(org.junit.jupiter.api.Test)

Example 8 with WorkloadCredentialUpdate

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);
}
Also used : UserMetadata(com.sequenceiq.freeipa.service.freeipa.user.model.UserMetadata) WorkloadCredentialUpdate(com.sequenceiq.freeipa.service.freeipa.user.model.WorkloadCredentialUpdate) WorkloadCredential(com.sequenceiq.freeipa.service.freeipa.user.model.WorkloadCredential)

Aggregations

WorkloadCredentialUpdate (com.sequenceiq.freeipa.service.freeipa.user.model.WorkloadCredentialUpdate)8 Test (org.junit.jupiter.api.Test)5 WorkloadCredential (com.sequenceiq.freeipa.service.freeipa.user.model.WorkloadCredential)4 UserMetadata (com.sequenceiq.freeipa.service.freeipa.user.model.UserMetadata)3 Optional (java.util.Optional)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 JsonRpcClientException (com.googlecode.jsonrpc4j.JsonRpcClientException)2 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)2 UserSyncOptions (com.sequenceiq.freeipa.service.freeipa.user.model.UserSyncOptions)2 Set (java.util.Set)2 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)1 Multimap (com.google.common.collect.Multimap)1 CrnTestUtil (com.sequenceiq.cloudbreak.auth.crn.CrnTestUtil)1 RPCResponse (com.sequenceiq.cloudbreak.client.RPCResponse)1 WorkloadCredentialsUpdateType (com.sequenceiq.freeipa.api.v1.freeipa.user.model.WorkloadCredentialsUpdateType)1 FreeIpaClient (com.sequenceiq.freeipa.client.FreeIpaClient)1 Config (com.sequenceiq.freeipa.client.model.Config)1 User (com.sequenceiq.freeipa.client.model.User)1 BatchPartitionSizeProperties (com.sequenceiq.freeipa.configuration.BatchPartitionSizeProperties)1 UserSyncTestUtils (com.sequenceiq.freeipa.service.freeipa.user.UserSyncTestUtils)1