use of com.sequenceiq.freeipa.api.v1.ldap.model.describe.DescribeLdapConfigResponse in project cloudbreak by hortonworks.
the class LdapConfigV1Service method convertLdapConfigToDescribeLdapConfigResponse.
private DescribeLdapConfigResponse convertLdapConfigToDescribeLdapConfigResponse(LdapConfig config) {
DescribeLdapConfigResponse describeLdapConfigResponse = new DescribeLdapConfigResponse();
describeLdapConfigResponse.setName(config.getName());
describeLdapConfigResponse.setDescription(config.getDescription());
describeLdapConfigResponse.setCrn(config.getResourceCrn());
describeLdapConfigResponse.setHost(config.getServerHost());
describeLdapConfigResponse.setPort(config.getServerPort());
describeLdapConfigResponse.setProtocol(config.getProtocol());
describeLdapConfigResponse.setBindDn(stringToSecretResponseConverter.convert(config.getBindDnSecret()));
describeLdapConfigResponse.setBindPassword(stringToSecretResponseConverter.convert(config.getBindPasswordSecret()));
describeLdapConfigResponse.setGroupSearchBase(config.getGroupSearchBase());
describeLdapConfigResponse.setUserSearchBase(config.getUserSearchBase());
describeLdapConfigResponse.setUserDnPattern(config.getUserDnPattern());
describeLdapConfigResponse.setUserNameAttribute(config.getUserNameAttribute());
describeLdapConfigResponse.setDomain(config.getDomain());
describeLdapConfigResponse.setDirectoryType(config.getDirectoryType());
describeLdapConfigResponse.setUserObjectClass(config.getUserObjectClass());
describeLdapConfigResponse.setGroupObjectClass(config.getGroupObjectClass());
describeLdapConfigResponse.setGroupNameAttribute(config.getGroupNameAttribute());
describeLdapConfigResponse.setGroupMemberAttribute(config.getGroupMemberAttribute());
describeLdapConfigResponse.setAdminGroup(config.getAdminGroup());
describeLdapConfigResponse.setUserGroup(config.getUserGroup());
describeLdapConfigResponse.setCertificate(config.getCertificate());
describeLdapConfigResponse.setEnvironmentCrn(config.getEnvironmentCrn());
return describeLdapConfigResponse;
}
use of com.sequenceiq.freeipa.api.v1.ldap.model.describe.DescribeLdapConfigResponse 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.describe.DescribeLdapConfigResponse in project cloudbreak by hortonworks.
the class LdapConfigV1ServiceTest method testDescribe.
@Test
public void testDescribe() {
// GIVEN
LdapConfig ldapConfig = createLdapConfig();
Mockito.when(ldapConfigService.get(ENVID)).thenReturn(ldapConfig);
Mockito.when(stringToSecretResponseConverter.convert(SECRET_BINDDN)).thenReturn(new SecretResponse("enginepath", "binddn-secretpath"));
Mockito.when(stringToSecretResponseConverter.convert(SECRET_PWD)).thenReturn(new SecretResponse("enginepath", "pwd-secretpath"));
// WHEN
DescribeLdapConfigResponse actualResponse = underTest.describe(ENVID);
// THEN
checkResponse(actualResponse);
}
Aggregations