use of com.sequenceiq.freeipa.client.model.Config in project cloudbreak by hortonworks.
the class UserSyncStateApplierTest method testApplyDifferenceWithPasswordHashSupport.
@Test
public void testApplyDifferenceWithPasswordHashSupport() throws FreeIpaClientException, TimeoutException {
UsersState usersState = UsersState.newBuilder().addUserMetadata("userToUpdate1", new UserMetadata("userToUpdate1Crn", 1L)).addUserMetadata("userToUpdate2", new UserMetadata("userToUpdate2Crn", 2L)).build();
WorkloadCredential workloadCredential1 = mock(WorkloadCredential.class);
WorkloadCredential workloadCredential2 = mock(WorkloadCredential.class);
UmsUsersState umsUsersState = UmsUsersState.newBuilder().setUsersState(usersState).addWorkloadCredentials("userToUpdate1", workloadCredential1).addWorkloadCredentials("userToUpdate2", workloadCredential2).build();
UserSyncOptions userSyncOptions = mock(UserSyncOptions.class);
UsersStateDifference usersStateDifference = createStateDiff();
Multimap<String, String> warnings = ArrayListMultimap.create();
when(userSyncOptions.isFmsToFreeIpaBatchCallEnabled()).thenReturn(Boolean.TRUE);
Config config = new Config();
config.setIpauserobjectclasses(Set.of("cdpUserAttr"));
when(freeIpaClient.getConfig()).thenReturn(config);
underTest.applyDifference(umsUsersState, ENV_CRN, warnings, usersStateDifference, userSyncOptions, freeIpaClient);
ArgumentCaptor<Set<WorkloadCredentialUpdate>> credentialUpdateCaptor = ArgumentCaptor.forClass(Set.class);
verify(workloadCredentialService).setWorkloadCredentials(eq(userSyncOptions), eq(freeIpaClient), credentialUpdateCaptor.capture(), any());
Set<WorkloadCredentialUpdate> workloadCredentialUpdates = credentialUpdateCaptor.getValue();
assertThat(workloadCredentialUpdates, allOf(hasItem(allOf(hasProperty("username", is("userToUpdate1")), hasProperty("userCrn", is("userToUpdate1Crn")), hasProperty("workloadCredential", is(workloadCredential1)))), hasItem(allOf(hasProperty("username", is("userToUpdate2")), hasProperty("userCrn", is("userToUpdate2Crn")), hasProperty("workloadCredential", is(workloadCredential2))))));
}
use of com.sequenceiq.freeipa.client.model.Config in project cloudbreak by hortonworks.
the class SetPasswordHandlerTest method newfreeIpaClient.
private FreeIpaClient newfreeIpaClient(boolean hasPasswordHashSuppport) throws FreeIpaClientException {
FreeIpaClient mockFreeIpaClient = mock(FreeIpaClient.class);
Config config = mock(Config.class);
if (hasPasswordHashSuppport) {
when(config.getIpauserobjectclasses()).thenReturn(Set.of("cdpUserAttr"));
} else {
when(config.getIpauserobjectclasses()).thenReturn(Set.of());
}
when(mockFreeIpaClient.getConfig()).thenReturn(config);
return mockFreeIpaClient;
}
use of com.sequenceiq.freeipa.client.model.Config in project cloudbreak by hortonworks.
the class UserSyncStateApplierTest method testApplyDifferenceNoPasswordHashSupport.
@Test
public void testApplyDifferenceNoPasswordHashSupport() throws FreeIpaClientException, TimeoutException {
UmsUsersState umsUsersState = mock(UmsUsersState.class);
UserSyncOptions userSyncOptions = mock(UserSyncOptions.class);
UsersStateDifference usersStateDifference = createStateDiff();
Multimap<String, String> warnings = ArrayListMultimap.create();
when(userSyncOptions.isFmsToFreeIpaBatchCallEnabled()).thenReturn(Boolean.TRUE);
when(freeIpaClient.getConfig()).thenReturn(new Config());
underTest.applyDifference(umsUsersState, ENV_CRN, warnings, usersStateDifference, userSyncOptions, freeIpaClient);
verifyNoInteractions(workloadCredentialService);
}
use of com.sequenceiq.freeipa.client.model.Config in project cloudbreak by hortonworks.
the class UserKeytabServiceTest method newfreeIpaClient.
private FreeIpaClient newfreeIpaClient(boolean hasPasswordHashSuppport) throws FreeIpaClientException {
FreeIpaClient mockFreeIpaClient = mock(FreeIpaClient.class);
Config config = mock(Config.class);
if (hasPasswordHashSuppport) {
when(config.getIpauserobjectclasses()).thenReturn(Set.of("cdpUserAttr"));
} else {
when(config.getIpauserobjectclasses()).thenReturn(Set.of());
}
when(mockFreeIpaClient.getConfig()).thenReturn(config);
return mockFreeIpaClient;
}
use of com.sequenceiq.freeipa.client.model.Config in project cloudbreak by hortonworks.
the class ConfigShowResponse method handleInternal.
@Override
protected Config handleInternal(List<CloudVmMetaDataStatus> metadatas, String body) {
Config config = new Config();
config.setIpamaxusernamelength(IPA_MAX_USERNAME_LENGTH);
return config;
}
Aggregations