Search in sources :

Example 1 with DescribeLdapConfigResponse

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;
}
Also used : DescribeLdapConfigResponse(com.sequenceiq.freeipa.api.v1.ldap.model.describe.DescribeLdapConfigResponse)

Example 2 with 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);
}
Also used : LdapConfig(com.sequenceiq.freeipa.ldap.LdapConfig) SecretResponse(com.sequenceiq.cloudbreak.service.secret.model.SecretResponse) DescribeLdapConfigResponse(com.sequenceiq.freeipa.api.v1.ldap.model.describe.DescribeLdapConfigResponse) CreateLdapConfigRequest(com.sequenceiq.freeipa.api.v1.ldap.model.create.CreateLdapConfigRequest) Test(org.junit.Test)

Example 3 with DescribeLdapConfigResponse

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);
}
Also used : LdapConfig(com.sequenceiq.freeipa.ldap.LdapConfig) SecretResponse(com.sequenceiq.cloudbreak.service.secret.model.SecretResponse) DescribeLdapConfigResponse(com.sequenceiq.freeipa.api.v1.ldap.model.describe.DescribeLdapConfigResponse) Test(org.junit.Test)

Aggregations

DescribeLdapConfigResponse (com.sequenceiq.freeipa.api.v1.ldap.model.describe.DescribeLdapConfigResponse)3 SecretResponse (com.sequenceiq.cloudbreak.service.secret.model.SecretResponse)2 LdapConfig (com.sequenceiq.freeipa.ldap.LdapConfig)2 Test (org.junit.Test)2 CreateLdapConfigRequest (com.sequenceiq.freeipa.api.v1.ldap.model.create.CreateLdapConfigRequest)1