use of com.sequenceiq.freeipa.api.v1.ldap.model.create.CreateLdapConfigRequest in project cloudbreak by hortonworks.
the class LdapConfigV1ServiceTest method testPost.
@Test
public void testPost() {
// GIVEN
CreateLdapConfigRequest createLdapConfigRequest = createCreateLdapConfigRequest();
LdapConfig ldapConfig = createLdapConfig();
ArgumentCaptor<LdapConfig> ldapConfigParam = ArgumentCaptor.forClass(LdapConfig.class);
Mockito.when(stringToSecretResponseConverter.convert(SECRET_BINDDN)).thenReturn(new SecretResponse("enginepath", "binddn-secretpath"));
Mockito.when(stringToSecretResponseConverter.convert(SECRET_PWD)).thenReturn(new SecretResponse("enginepath", "pwd-secretpath"));
Mockito.when(ldapConfigService.createLdapConfig(ldapConfigParam.capture())).thenReturn(ldapConfig);
// WHEN
DescribeLdapConfigResponse actualResponse = underTest.post(createLdapConfigRequest);
// THEN
checkInnerLdapConfig(ldapConfigParam.getValue());
checkResponse(actualResponse);
}
use of com.sequenceiq.freeipa.api.v1.ldap.model.create.CreateLdapConfigRequest in project cloudbreak by hortonworks.
the class LdapConfigV1ServiceTest method testGetCreateRequest.
@Test
public void testGetCreateRequest() {
// GIVEN
LdapConfig ldapConfig = createLdapConfig();
Mockito.when(ldapConfigService.get(ENVID)).thenReturn(ldapConfig);
// WHEN
CreateLdapConfigRequest actualRequest = underTest.getCreateLdapConfigRequest(ENVID);
// THEN
checkCreateRequest(actualRequest);
}
use of com.sequenceiq.freeipa.api.v1.ldap.model.create.CreateLdapConfigRequest in project cloudbreak by hortonworks.
the class LdapConfigV1ServiceTest method createCreateLdapConfigRequest.
private CreateLdapConfigRequest createCreateLdapConfigRequest() {
CreateLdapConfigRequest createLdapConfigRequest = new CreateLdapConfigRequest();
createLdapConfigRequest.setName(LDAPNAME);
createLdapConfigRequest.setDescription(LDAPDESC);
createLdapConfigRequest.setEnvironmentCrn(ENVID);
createLdapConfigRequest.setProtocol(LDAP_PROTOCOL);
createLdapConfigRequest.setHost(HOST);
createLdapConfigRequest.setPort(PORT);
createLdapConfigRequest.setBindDn(BINDDN);
createLdapConfigRequest.setBindPassword(PWD);
createLdapConfigRequest.setAdminGroup(ADMIN);
createLdapConfigRequest.setCertificate(CERT);
createLdapConfigRequest.setDirectoryType(DirectoryType.LDAP);
createLdapConfigRequest.setDomain(DOMAIN);
createLdapConfigRequest.setGroupMemberAttribute(MEMBER);
createLdapConfigRequest.setGroupObjectClass(GROUPOBJCLASS);
createLdapConfigRequest.setGroupSearchBase(GROUPSEARCHBASE);
createLdapConfigRequest.setGroupNameAttribute(GROUPNAMEATTR);
createLdapConfigRequest.setUserDnPattern(USERDNPATTERN);
createLdapConfigRequest.setUserNameAttribute(USERNAMEATTR);
createLdapConfigRequest.setUserObjectClass(USEROBJCLASS);
createLdapConfigRequest.setUserSearchBase(USERSEARCHBASE);
return createLdapConfigRequest;
}
use of com.sequenceiq.freeipa.api.v1.ldap.model.create.CreateLdapConfigRequest in project cloudbreak by hortonworks.
the class LdapConfigV1Service method convertLdapConfigToCreateLdapConfigRequest.
private CreateLdapConfigRequest convertLdapConfigToCreateLdapConfigRequest(LdapConfig source) {
CreateLdapConfigRequest createLdapConfigRequest = new CreateLdapConfigRequest();
createLdapConfigRequest.setName(source.getName());
createLdapConfigRequest.setEnvironmentCrn(source.getEnvironmentCrn());
createLdapConfigRequest.setBindDn("fake-user");
createLdapConfigRequest.setBindPassword("fake-password");
createLdapConfigRequest.setAdminGroup(source.getAdminGroup());
createLdapConfigRequest.setDescription(source.getDescription());
createLdapConfigRequest.setDirectoryType(source.getDirectoryType());
createLdapConfigRequest.setDomain(source.getDomain());
createLdapConfigRequest.setGroupMemberAttribute(source.getGroupMemberAttribute());
createLdapConfigRequest.setGroupNameAttribute(source.getGroupNameAttribute());
createLdapConfigRequest.setGroupObjectClass(source.getGroupObjectClass());
createLdapConfigRequest.setGroupSearchBase(source.getGroupSearchBase());
createLdapConfigRequest.setProtocol(source.getProtocol());
createLdapConfigRequest.setHost(source.getServerHost());
createLdapConfigRequest.setPort(source.getServerPort());
createLdapConfigRequest.setUserDnPattern(source.getUserDnPattern());
createLdapConfigRequest.setUserNameAttribute(source.getUserNameAttribute());
createLdapConfigRequest.setUserObjectClass(source.getUserObjectClass());
createLdapConfigRequest.setUserSearchBase(source.getUserSearchBase());
createLdapConfigRequest.setCertificate(source.getCertificate());
return createLdapConfigRequest;
}
Aggregations