RedshiftConnectionConfig extends AbstractJdbcConnectionConfig { @Override public Properties buildProperties() { Properties props = new Properties(); props.setProperty("user", user()); if (password().isPresent()) { props.setProperty("password", password().get()); } if (schema().isPresent()) { props.setProperty("currentSchema", schema().get()); } props.setProperty("loginTimeout", String.valueOf(connectTimeout().getDuration().getSeconds())); props.setProperty("connectTimeout", String.valueOf(connectTimeout().getDuration().getSeconds())); props.setProperty("socketTimeout", String.valueOf(socketTimeout().getDuration().getSeconds())); props.setProperty("tcpKeepAlive", "true"); if (ssl()) { props.setProperty("ssl", "true"); props.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); } props.setProperty("applicationName", "digdag"); return props; }  abstract Optional<String> schema(); @VisibleForTesting static RedshiftConnectionConfig configure(SecretProvider secrets, Config params); @Override String jdbcDriverName(); @Override String jdbcProtocolName(); @Override Properties buildProperties(); @Override String toString();  }
@Test public void buildProperties() { validateDefaultValueProperties(connConfigWithDefaultValue.buildProperties()); validateDefaultValueProperties(connConfigWithDefaultValueFromSecrets.buildProperties()); validateCustomValueProperties(connConfigWithCustomValue.buildProperties(), Optional.absent()); validateCustomValueProperties(connConfigWithCustomValueFromSecrets.buildProperties(), Optional.absent()); }
@Test public void configureWithOverriddenPassword() { validateCustomValueProperties(connConfigWithOverriddenPassword.buildProperties(), Optional.of("password2")); }