EnterLicenseKeyConfiguration extends AbstractCamundaConfiguration { protected Optional<String> readLicenseKeyFromUrl(URL licenseFileUrl) { if (licenseFileUrl == null) { return Optional.empty(); } try { return Optional.of(new Scanner(licenseFileUrl.openStream(), "UTF-8").useDelimiter("\\A")) .filter(Scanner::hasNext).map(Scanner::next) .map(s -> s.replaceAll(LICENSE_HEADER_FOOTER_REGEX, "")) .map(s -> s.replaceAll("\\n", "")) .map(String::trim); } catch (IOException e) { LOG.enterLicenseKeyFailed(licenseFileUrl, e); return Optional.empty(); } }  @Override void postProcessEngineBuild(ProcessEngine processEngine);  }
@Test public void shouldLoadStringFromUrl() throws Exception { EnterLicenseKeyConfiguration licenseKeyConfiguration = new EnterLicenseKeyConfiguration(); final String licenseKey = licenseKeyConfiguration .readLicenseKeyFromUrl(LICENSE_FILE_URL) .orElse(null); assertValidLicenseKeyFormat(licenseKey); }