Search in sources :

Example 1 with MITKerberosDescriptor

use of com.sequenceiq.freeipa.api.v1.kerberos.model.create.MITKerberosDescriptor in project cloudbreak by hortonworks.

the class CreateKerberosConfigRequestToKerberosConfigConverterTest method testInvalid.

@Test
public void testInvalid() {
    CreateKerberosConfigRequest request = new CreateKerberosConfigRequest();
    request.setActiveDirectory(new ActiveDirectoryKerberosDescriptor());
    request.setMit(new MITKerberosDescriptor());
    BadRequestException ex = Assertions.assertThrows(BadRequestException.class, () -> {
        underTest.convert(request);
    });
    assertEquals(IMPROPER_KERBEROS_MESSAGE, ex.getMessage());
}
Also used : BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) MITKerberosDescriptor(com.sequenceiq.freeipa.api.v1.kerberos.model.create.MITKerberosDescriptor) CreateKerberosConfigRequest(com.sequenceiq.freeipa.api.v1.kerberos.model.create.CreateKerberosConfigRequest) ActiveDirectoryKerberosDescriptor(com.sequenceiq.freeipa.api.v1.kerberos.model.create.ActiveDirectoryKerberosDescriptor) Test(org.junit.jupiter.api.Test)

Example 2 with MITKerberosDescriptor

use of com.sequenceiq.freeipa.api.v1.kerberos.model.create.MITKerberosDescriptor in project cloudbreak by hortonworks.

the class CreateKerberosConfigRequestToKerberosConfigConverterTest method testMitWithoutName.

@Test
public void testMitWithoutName() {
    CreateKerberosConfigRequest request = new CreateKerberosConfigRequest();
    request.setMit(new MITKerberosDescriptor());
    BadRequestException ex = Assertions.assertThrows(BadRequestException.class, () -> {
        underTest.convert(request);
    });
    assertEquals(IMPROPER_KERBEROS_MESSAGE, ex.getMessage());
}
Also used : BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) MITKerberosDescriptor(com.sequenceiq.freeipa.api.v1.kerberos.model.create.MITKerberosDescriptor) CreateKerberosConfigRequest(com.sequenceiq.freeipa.api.v1.kerberos.model.create.CreateKerberosConfigRequest) Test(org.junit.jupiter.api.Test)

Example 3 with MITKerberosDescriptor

use of com.sequenceiq.freeipa.api.v1.kerberos.model.create.MITKerberosDescriptor in project cloudbreak by hortonworks.

the class CreateKerberosConfigRequestToKerberosConfigConverterTest method createMitKerberosDescriptor.

private MITKerberosDescriptor createMitKerberosDescriptor() {
    MITKerberosDescriptor mitDescriptor = new MITKerberosDescriptor();
    setupCommonFields(mitDescriptor);
    mitDescriptor.setAdminUrl(ADMIN_URL);
    mitDescriptor.setRealm(REALM);
    mitDescriptor.setUrl(URL);
    mitDescriptor.setDomain(DOMAIN);
    return mitDescriptor;
}
Also used : MITKerberosDescriptor(com.sequenceiq.freeipa.api.v1.kerberos.model.create.MITKerberosDescriptor)

Example 4 with MITKerberosDescriptor

use of com.sequenceiq.freeipa.api.v1.kerberos.model.create.MITKerberosDescriptor in project cloudbreak by hortonworks.

the class KerberosConfigToCreateKerberosConfigRequestConverter method getMit.

private MITKerberosDescriptor getMit(KerberosConfig source) {
    MITKerberosDescriptor mit = new MITKerberosDescriptor();
    fillRequestWithCommonFields(mit, source);
    mit.setAdminUrl(source.getAdminUrl());
    mit.setPrincipal(getFakeSecretIfNotNull(source.getPrincipal(), FAKE_PRINCIPAL_POSTFIX));
    mit.setRealm(getFakeSecretIfNotNull(source.getRealm(), FAKE_REALM_POSTFIX));
    mit.setUrl(source.getUrl());
    return mit;
}
Also used : MITKerberosDescriptor(com.sequenceiq.freeipa.api.v1.kerberos.model.create.MITKerberosDescriptor)

Aggregations

MITKerberosDescriptor (com.sequenceiq.freeipa.api.v1.kerberos.model.create.MITKerberosDescriptor)4 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)2 CreateKerberosConfigRequest (com.sequenceiq.freeipa.api.v1.kerberos.model.create.CreateKerberosConfigRequest)2 Test (org.junit.jupiter.api.Test)2 ActiveDirectoryKerberosDescriptor (com.sequenceiq.freeipa.api.v1.kerberos.model.create.ActiveDirectoryKerberosDescriptor)1