@Test void testCreateWithDomainReturnedFromUms() { UserManagementProto.Account account = UserManagementProto.Account.newBuilder().setWorkloadSubdomain("checkme").build(); when(grpcUmsClient.getAccountDetails(USER_CRN, ACCOUNT_ID, Optional.empty())).thenReturn(account); when(environmentBasedDomainNameProvider.getDomainName(ENV_NAME, "checkme")).thenReturn("checkme.mydomain"); EnvironmentDto environmentDto = new EnvironmentDto(); environmentDto.setName(ENV_NAME); FreeIpaServerRequest freeIpaServerRequest = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.create(environmentDto)); assertEquals("checkme.mydomain", freeIpaServerRequest.getDomain()); }
FreeIpaServerRequest create(EnvironmentDto environment) { String environmentName = environment.getName(); String accountSubDomain = getAccountSubdomain(); String domain = environmentBasedDomainNameProvider.getDomainName(environmentName, accountSubDomain); LOGGER.info("Generate domain: environmentName: {}, accountSubdomain {}, domain: {}", environment.getName(), accountSubDomain, domain); String adminGroupName = environment.getAdminGroupName(); FreeIpaServerRequest freeIpaServerRequest = new FreeIpaServerRequest(); freeIpaServerRequest.setAdminPassword(FreeIpaPasswordUtil.generatePassword()); freeIpaServerRequest.setDomain(domain); freeIpaServerRequest.setHostname(FREEIPA_HOSTNAME); freeIpaServerRequest.setAdminGroupName(adminGroupName); LOGGER.info("FreeIpaServerRequest created for environment: {}, request {}", environment.getName(), freeIpaServerRequest); return freeIpaServerRequest; }
FreeIpaServerRequestProvider { FreeIpaServerRequest create(EnvironmentDto environment) { String environmentName = environment.getName(); String accountSubDomain = getAccountSubdomain(); String domain = environmentBasedDomainNameProvider.getDomainName(environmentName, accountSubDomain); LOGGER.info("Generate domain: environmentName: {}, accountSubdomain {}, domain: {}", environment.getName(), accountSubDomain, domain); String adminGroupName = environment.getAdminGroupName(); FreeIpaServerRequest freeIpaServerRequest = new FreeIpaServerRequest(); freeIpaServerRequest.setAdminPassword(FreeIpaPasswordUtil.generatePassword()); freeIpaServerRequest.setDomain(domain); freeIpaServerRequest.setHostname(FREEIPA_HOSTNAME); freeIpaServerRequest.setAdminGroupName(adminGroupName); LOGGER.info("FreeIpaServerRequest created for environment: {}, request {}", environment.getName(), freeIpaServerRequest); return freeIpaServerRequest; } }
FreeIpaServerRequestProvider { FreeIpaServerRequest create(EnvironmentDto environment) { String environmentName = environment.getName(); String accountSubDomain = getAccountSubdomain(); String domain = environmentBasedDomainNameProvider.getDomainName(environmentName, accountSubDomain); LOGGER.info("Generate domain: environmentName: {}, accountSubdomain {}, domain: {}", environment.getName(), accountSubDomain, domain); String adminGroupName = environment.getAdminGroupName(); FreeIpaServerRequest freeIpaServerRequest = new FreeIpaServerRequest(); freeIpaServerRequest.setAdminPassword(FreeIpaPasswordUtil.generatePassword()); freeIpaServerRequest.setDomain(domain); freeIpaServerRequest.setHostname(FREEIPA_HOSTNAME); freeIpaServerRequest.setAdminGroupName(adminGroupName); LOGGER.info("FreeIpaServerRequest created for environment: {}, request {}", environment.getName(), freeIpaServerRequest); return freeIpaServerRequest; }  }
FreeIpaServerRequestProvider { FreeIpaServerRequest create(EnvironmentDto environment) { String environmentName = environment.getName(); String accountSubDomain = getAccountSubdomain(); String domain = environmentBasedDomainNameProvider.getDomainName(environmentName, accountSubDomain); LOGGER.info("Generate domain: environmentName: {}, accountSubdomain {}, domain: {}", environment.getName(), accountSubDomain, domain); String adminGroupName = environment.getAdminGroupName(); FreeIpaServerRequest freeIpaServerRequest = new FreeIpaServerRequest(); freeIpaServerRequest.setAdminPassword(FreeIpaPasswordUtil.generatePassword()); freeIpaServerRequest.setDomain(domain); freeIpaServerRequest.setHostname(FREEIPA_HOSTNAME); freeIpaServerRequest.setAdminGroupName(adminGroupName); LOGGER.info("FreeIpaServerRequest created for environment: {}, request {}", environment.getName(), freeIpaServerRequest); return freeIpaServerRequest; }   }
FreeIpaServerRequestProvider { FreeIpaServerRequest create(EnvironmentDto environment) { String environmentName = environment.getName(); String accountSubDomain = getAccountSubdomain(); String domain = environmentBasedDomainNameProvider.getDomainName(environmentName, accountSubDomain); LOGGER.info("Generate domain: environmentName: {}, accountSubdomain {}, domain: {}", environment.getName(), accountSubDomain, domain); String adminGroupName = environment.getAdminGroupName(); FreeIpaServerRequest freeIpaServerRequest = new FreeIpaServerRequest(); freeIpaServerRequest.setAdminPassword(FreeIpaPasswordUtil.generatePassword()); freeIpaServerRequest.setDomain(domain); freeIpaServerRequest.setHostname(FREEIPA_HOSTNAME); freeIpaServerRequest.setAdminGroupName(adminGroupName); LOGGER.info("FreeIpaServerRequest created for environment: {}, request {}", environment.getName(), freeIpaServerRequest); return freeIpaServerRequest; }    }