@Test void provideChoiceShouldThrowWhenConfigurationIsUnknown() { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.addProperty("blob.export.implementation", "unknown"); FakePropertiesProvider noConfigurationFile = FakePropertiesProvider.builder() .register(NAME, configuration) .build(); assertThatThrownBy(() -> module.provideChoice(noConfigurationFile)) .isInstanceOf(IllegalArgumentException.class); }
@VisibleForTesting @Provides @Singleton BlobExportImplChoice provideChoice(PropertiesProvider propertiesProvider) throws ConfigurationException { try { Configuration configuration = propertiesProvider.getConfigurations(ConfigurationComponent.NAMES); return BlobExportImplChoice.from(configuration) .orElseGet(() -> { LOGGER.warn("No blob export mechanism defined. Defaulting to " + BlobExportImplChoice.LOCAL_FILE.getImplName()); return BlobExportImplChoice.LOCAL_FILE; }); } catch (FileNotFoundException e) { LOGGER.warn("Could not find " + ConfigurationComponent.NAME + " configuration file, using localFile blob exporting as the default"); return BlobExportImplChoice.LOCAL_FILE; } }
BlobExportMechanismModule extends AbstractModule { @VisibleForTesting @Provides @Singleton BlobExportImplChoice provideChoice(PropertiesProvider propertiesProvider) throws ConfigurationException { try { Configuration configuration = propertiesProvider.getConfigurations(ConfigurationComponent.NAMES); return BlobExportImplChoice.from(configuration) .orElseGet(() -> { LOGGER.warn("No blob export mechanism defined. Defaulting to " + BlobExportImplChoice.LOCAL_FILE.getImplName()); return BlobExportImplChoice.LOCAL_FILE; }); } catch (FileNotFoundException e) { LOGGER.warn("Could not find " + ConfigurationComponent.NAME + " configuration file, using localFile blob exporting as the default"); return BlobExportImplChoice.LOCAL_FILE; } } }
BlobExportMechanismModule extends AbstractModule { @VisibleForTesting @Provides @Singleton BlobExportImplChoice provideChoice(PropertiesProvider propertiesProvider) throws ConfigurationException { try { Configuration configuration = propertiesProvider.getConfigurations(ConfigurationComponent.NAMES); return BlobExportImplChoice.from(configuration) .orElseGet(() -> { LOGGER.warn("No blob export mechanism defined. Defaulting to " + BlobExportImplChoice.LOCAL_FILE.getImplName()); return BlobExportImplChoice.LOCAL_FILE; }); } catch (FileNotFoundException e) { LOGGER.warn("Could not find " + ConfigurationComponent.NAME + " configuration file, using localFile blob exporting as the default"); return BlobExportImplChoice.LOCAL_FILE; } }  }
BlobExportMechanismModule extends AbstractModule { @VisibleForTesting @Provides @Singleton BlobExportImplChoice provideChoice(PropertiesProvider propertiesProvider) throws ConfigurationException { try { Configuration configuration = propertiesProvider.getConfigurations(ConfigurationComponent.NAMES); return BlobExportImplChoice.from(configuration) .orElseGet(() -> { LOGGER.warn("No blob export mechanism defined. Defaulting to " + BlobExportImplChoice.LOCAL_FILE.getImplName()); return BlobExportImplChoice.LOCAL_FILE; }); } catch (FileNotFoundException e) { LOGGER.warn("Could not find " + ConfigurationComponent.NAME + " configuration file, using localFile blob exporting as the default"); return BlobExportImplChoice.LOCAL_FILE; } }   }
BlobExportMechanismModule extends AbstractModule { @VisibleForTesting @Provides @Singleton BlobExportImplChoice provideChoice(PropertiesProvider propertiesProvider) throws ConfigurationException { try { Configuration configuration = propertiesProvider.getConfigurations(ConfigurationComponent.NAMES); return BlobExportImplChoice.from(configuration) .orElseGet(() -> { LOGGER.warn("No blob export mechanism defined. Defaulting to " + BlobExportImplChoice.LOCAL_FILE.getImplName()); return BlobExportImplChoice.LOCAL_FILE; }); } catch (FileNotFoundException e) { LOGGER.warn("Could not find " + ConfigurationComponent.NAME + " configuration file, using localFile blob exporting as the default"); return BlobExportImplChoice.LOCAL_FILE; } }    }