Search in sources :

Example 1 with CreateLdapConfigRequest

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);
}
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 2 with CreateLdapConfigRequest

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);
}
Also used : LdapConfig(com.sequenceiq.freeipa.ldap.LdapConfig) CreateLdapConfigRequest(com.sequenceiq.freeipa.api.v1.ldap.model.create.CreateLdapConfigRequest) Test(org.junit.Test)

Example 3 with CreateLdapConfigRequest

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

Example 4 with 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;
}
Also used : CreateLdapConfigRequest(com.sequenceiq.freeipa.api.v1.ldap.model.create.CreateLdapConfigRequest)

Aggregations

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