@Test public void testFreeIpaWithoutName() { CreateKerberosConfigRequest request = new CreateKerberosConfigRequest(); request.setFreeIpa(new FreeIpaKerberosDescriptor()); BadRequestException ex = Assertions.assertThrows(BadRequestException.class, () -> { underTest.convert(request); }); assertEquals(IMPROPER_KERBEROS_MESSAGE, ex.getMessage()); }
public KerberosConfig convert(CreateKerberosConfigRequest request) { if (request == null || !KerberosRequestValidator.isValid(request)) { throw new BadRequestException("Improper CreateKerberosConfigRequest!"); } KerberosConfig kerberos; if (request.getFreeIpa() != null) { kerberos = convertFreeIpa(request.getFreeIpa()); } else if (request.getActiveDirectory() != null) { kerberos = convertActiveDirectory(request.getActiveDirectory()); } else if (request.getMit() != null) { kerberos = convertMit(request.getMit()); } else { throw new BadRequestException("Unable to determine Kerberos Configuration since none of them are provided in the request!"); } kerberos.setName(request.getName()); kerberos.setDescription(request.getDescription()); kerberos.setEnvironmentCrn(request.getEnvironmentCrn()); return kerberos; }
CreateKerberosConfigRequestToKerberosConfigConverter { public KerberosConfig convert(CreateKerberosConfigRequest request) { if (request == null || !KerberosRequestValidator.isValid(request)) { throw new BadRequestException("Improper CreateKerberosConfigRequest!"); } KerberosConfig kerberos; if (request.getFreeIpa() != null) { kerberos = convertFreeIpa(request.getFreeIpa()); } else if (request.getActiveDirectory() != null) { kerberos = convertActiveDirectory(request.getActiveDirectory()); } else if (request.getMit() != null) { kerberos = convertMit(request.getMit()); } else { throw new BadRequestException("Unable to determine Kerberos Configuration since none of them are provided in the request!"); } kerberos.setName(request.getName()); kerberos.setDescription(request.getDescription()); kerberos.setEnvironmentCrn(request.getEnvironmentCrn()); return kerberos; } }
CreateKerberosConfigRequestToKerberosConfigConverter { public KerberosConfig convert(CreateKerberosConfigRequest request) { if (request == null || !KerberosRequestValidator.isValid(request)) { throw new BadRequestException("Improper CreateKerberosConfigRequest!"); } KerberosConfig kerberos; if (request.getFreeIpa() != null) { kerberos = convertFreeIpa(request.getFreeIpa()); } else if (request.getActiveDirectory() != null) { kerberos = convertActiveDirectory(request.getActiveDirectory()); } else if (request.getMit() != null) { kerberos = convertMit(request.getMit()); } else { throw new BadRequestException("Unable to determine Kerberos Configuration since none of them are provided in the request!"); } kerberos.setName(request.getName()); kerberos.setDescription(request.getDescription()); kerberos.setEnvironmentCrn(request.getEnvironmentCrn()); return kerberos; }  }
CreateKerberosConfigRequestToKerberosConfigConverter { public KerberosConfig convert(CreateKerberosConfigRequest request) { if (request == null || !KerberosRequestValidator.isValid(request)) { throw new BadRequestException("Improper CreateKerberosConfigRequest!"); } KerberosConfig kerberos; if (request.getFreeIpa() != null) { kerberos = convertFreeIpa(request.getFreeIpa()); } else if (request.getActiveDirectory() != null) { kerberos = convertActiveDirectory(request.getActiveDirectory()); } else if (request.getMit() != null) { kerberos = convertMit(request.getMit()); } else { throw new BadRequestException("Unable to determine Kerberos Configuration since none of them are provided in the request!"); } kerberos.setName(request.getName()); kerberos.setDescription(request.getDescription()); kerberos.setEnvironmentCrn(request.getEnvironmentCrn()); return kerberos; }  KerberosConfig convert(CreateKerberosConfigRequest request); }
CreateKerberosConfigRequestToKerberosConfigConverter { public KerberosConfig convert(CreateKerberosConfigRequest request) { if (request == null || !KerberosRequestValidator.isValid(request)) { throw new BadRequestException("Improper CreateKerberosConfigRequest!"); } KerberosConfig kerberos; if (request.getFreeIpa() != null) { kerberos = convertFreeIpa(request.getFreeIpa()); } else if (request.getActiveDirectory() != null) { kerberos = convertActiveDirectory(request.getActiveDirectory()); } else if (request.getMit() != null) { kerberos = convertMit(request.getMit()); } else { throw new BadRequestException("Unable to determine Kerberos Configuration since none of them are provided in the request!"); } kerberos.setName(request.getName()); kerberos.setDescription(request.getDescription()); kerberos.setEnvironmentCrn(request.getEnvironmentCrn()); return kerberos; }  KerberosConfig convert(CreateKerberosConfigRequest request);  }