@Test @ExtendWith(TemporaryFolderExtension.class) void testEnvironmentFromConfigFolderMissingValues(TemporaryFolder temporaryFolder) throws URISyntaxException, IOException { File testTemplatizedBundlesFolder = new File(temporaryFolder.getRoot(), "templatized-bundles"); File testDetemplatizedBundlesFolder = new File(temporaryFolder.getRoot(), "detemplatized-bundles"); File keyStoreFolder = new File(temporaryFolder.getRoot(), "keystore"); File envFolder = new File(temporaryFolder.getRoot(), "config"); File privateKeyFolder = new File(envFolder, "privateKeys"); assertTrue(testDetemplatizedBundlesFolder.mkdirs()); copyDirectory(new File(Objects.requireNonNull(getClass().getClassLoader().getResource("templatized-bundles")).toURI()), testTemplatizedBundlesFolder); writeStringToFile( new File(envFolder, "service-env.properties"), "my-gateway-api.myEnvironmentVariable=my-service-property-value", defaultCharset() ); writeStringToFile(new File( envFolder, "context-env.properties"), "anotherEnvVar=context-variable-value", defaultCharset()); new EnvironmentCreatorApplication( System.getenv(), testTemplatizedBundlesFolder.getPath(), testDetemplatizedBundlesFolder.getPath(), keyStoreFolder.getPath(), privateKeyFolder.getPath(), temporaryFolder.getRoot().getPath() ).run(); }
@VisibleForTesting void run() { EnvironmentBundleCreator bundleCreator = InjectionRegistry.getInjector().getInstance(EnvironmentBundleCreator.class); Bundle environmentBundle = bundleCreator.createEnvironmentBundle( environmentProperties, bootstrapBundleFolderPath, templatizedBundleFolderPath, environmentConfigurationFolderPath, APPLICATION, "_0_env.req.install.bundle", new ProjectInfo("environment", "", "") ); createKeyStoreIfNecessary(keystoreFolderPath, privateKeyFolderPath, environmentBundle.getPrivateKeys().values(), FileUtils.INSTANCE, SYSTEM_PROPERTIES_PATH); }
EnvironmentCreatorApplication { @VisibleForTesting void run() { EnvironmentBundleCreator bundleCreator = InjectionRegistry.getInjector().getInstance(EnvironmentBundleCreator.class); Bundle environmentBundle = bundleCreator.createEnvironmentBundle( environmentProperties, bootstrapBundleFolderPath, templatizedBundleFolderPath, environmentConfigurationFolderPath, APPLICATION, "_0_env.req.install.bundle", new ProjectInfo("environment", "", "") ); createKeyStoreIfNecessary(keystoreFolderPath, privateKeyFolderPath, environmentBundle.getPrivateKeys().values(), FileUtils.INSTANCE, SYSTEM_PROPERTIES_PATH); } }
EnvironmentCreatorApplication { @VisibleForTesting void run() { EnvironmentBundleCreator bundleCreator = InjectionRegistry.getInjector().getInstance(EnvironmentBundleCreator.class); Bundle environmentBundle = bundleCreator.createEnvironmentBundle( environmentProperties, bootstrapBundleFolderPath, templatizedBundleFolderPath, environmentConfigurationFolderPath, APPLICATION, "_0_env.req.install.bundle", new ProjectInfo("environment", "", "") ); createKeyStoreIfNecessary(keystoreFolderPath, privateKeyFolderPath, environmentBundle.getPrivateKeys().values(), FileUtils.INSTANCE, SYSTEM_PROPERTIES_PATH); } EnvironmentCreatorApplication(Map<String, String> environmentProperties,
                                  String templatizedBundleFolderPath,
                                  String bootstrapBundleFolderPath,
                                  String keystoreFolderPath,
                                  String privateKeyFolderPath,
                                  String environmentConfigurationFolderPath); }
EnvironmentCreatorApplication { @VisibleForTesting void run() { EnvironmentBundleCreator bundleCreator = InjectionRegistry.getInjector().getInstance(EnvironmentBundleCreator.class); Bundle environmentBundle = bundleCreator.createEnvironmentBundle( environmentProperties, bootstrapBundleFolderPath, templatizedBundleFolderPath, environmentConfigurationFolderPath, APPLICATION, "_0_env.req.install.bundle", new ProjectInfo("environment", "", "") ); createKeyStoreIfNecessary(keystoreFolderPath, privateKeyFolderPath, environmentBundle.getPrivateKeys().values(), FileUtils.INSTANCE, SYSTEM_PROPERTIES_PATH); } EnvironmentCreatorApplication(Map<String, String> environmentProperties,
                                  String templatizedBundleFolderPath,
                                  String bootstrapBundleFolderPath,
                                  String keystoreFolderPath,
                                  String privateKeyFolderPath,
                                  String environmentConfigurationFolderPath); static void main(String[] args); }
EnvironmentCreatorApplication { @VisibleForTesting void run() { EnvironmentBundleCreator bundleCreator = InjectionRegistry.getInjector().getInstance(EnvironmentBundleCreator.class); Bundle environmentBundle = bundleCreator.createEnvironmentBundle( environmentProperties, bootstrapBundleFolderPath, templatizedBundleFolderPath, environmentConfigurationFolderPath, APPLICATION, "_0_env.req.install.bundle", new ProjectInfo("environment", "", "") ); createKeyStoreIfNecessary(keystoreFolderPath, privateKeyFolderPath, environmentBundle.getPrivateKeys().values(), FileUtils.INSTANCE, SYSTEM_PROPERTIES_PATH); } EnvironmentCreatorApplication(Map<String, String> environmentProperties,
                                  String templatizedBundleFolderPath,
                                  String bootstrapBundleFolderPath,
                                  String keystoreFolderPath,
                                  String privateKeyFolderPath,
                                  String environmentConfigurationFolderPath); static void main(String[] args);  }