public static ConfigStorage create(final InputStream inputStream) throws IOException { final Properties props = new Properties(); props.load(inputStream); return new ConfigStorage(props); }
private String getSender() { return config.read(target, "from", "noreply@robozonky.cz"); }
private boolean isAuthenticationRequired() { // for backwards compatibility reasons, defaults to true return config.readBoolean(target, "smtp.requiresAuthentication", true); }
public static ConfigStorage create(final File file) throws IOException { return create(Files.newInputStream(file.toPath())); }
private int getHourlyLimit() { final int val = config.readInt(target, HOURLY_LIMIT, Integer.MAX_VALUE); return (val < 0) ? Integer.MAX_VALUE : val; }
public static ConfigStorage create(final File file) throws IOException { return create(Files.newInputStream(file.toPath())); }
private int getHourlyLimit() { final int val = config.readInt(target, HOURLY_LIMIT, Integer.MAX_VALUE); return (val < 0) ? Integer.MAX_VALUE : val; }
@Override protected Optional<ConfigStorage> transform(final String source) { return Try.withResources(() -> new ByteArrayInputStream(source.getBytes(Defaults.CHARSET))) .of(baos -> Optional.of(ConfigStorage.create(baos))) .getOrElseGet(ex -> { LOGGER.warn("Failed transforming source.", ex); return Optional.empty(); }); }
private String getSmtpPassword() { return config.read(target, "smtp.password", ""); }
private boolean isStartTlsRequired() { return config.readBoolean(target, "smtp.requiresStartTLS", false); }
private int getSmtpPort() { return config.readInt(target, "smtp.port", 25); }
public static ConfigStorage create(final InputStream inputStream) throws IOException { final Properties props = new Properties(); props.load(inputStream); return new ConfigStorage(props); }
@Override protected Optional<ConfigStorage> transform(final String source) { return Try.withResources(() -> new ByteArrayInputStream(source.getBytes(Defaults.CHARSET))) .of(baos -> Optional.of(ConfigStorage.create(baos))) .getOrElseGet(ex -> { logger.warn("Failed transforming source.", ex); return Optional.empty(); }); }
private String getSender() { return config.read(target, "from", "noreply@robozonky.cz"); }
boolean isEnabledInSettings() { return config.readBoolean(target, "enabled", false); }
private int getSmtpPort() { return config.readInt(target, "smtp.port", 25); }
private static ConfigStorage mockProperties(final InputStream is) throws IOException { return spy(ConfigStorage.create(is)); }
private String getRecipient() { return config.read(target, "to", ""); }
private boolean isSslOnConnectRequired() { return config.readBoolean(target, "smtp.requiresSslOnConnect", false); }
public int readInt(final Target target, final String propertyName, final int defaultValue) { return this.readInt(target, propertyName).orElse(defaultValue); }