@Test public void settingsProxy() { AwsClientFactory factory = new AwsClientFactory(config); ClientConfiguration settings = factory.createClientConfig("proxy"); Assert.assertEquals(12345, settings.getProxyPort()); Assert.assertEquals("host", settings.getProxyHost()); Assert.assertEquals("domain", settings.getProxyDomain()); Assert.assertEquals("workstation", settings.getProxyWorkstation()); Assert.assertEquals("username", settings.getProxyUsername()); Assert.assertEquals("password", settings.getProxyPassword()); }
ClientConfiguration createClientConfig(String name) { final Config cfg = getConfig(name, "client"); final ClientConfiguration settings = new ClientConfiguration(); settings.setProtocol(Protocol.HTTPS); Function<String, Long> getMillis = k -> cfg.getDuration(k, TimeUnit.MILLISECONDS); Function<String, Integer> getTimeout = k -> getMillis.apply(k).intValue(); setIfPresent(cfg, "use-gzip", cfg::getBoolean, settings::setUseGzip); setIfPresent(cfg, "use-reaper", cfg::getBoolean, settings::setUseReaper); setIfPresent(cfg, "use-tcp-keep-alive", cfg::getBoolean, settings::setUseTcpKeepAlive); setIfPresent(cfg, "use-throttle-retries", cfg::getBoolean, settings::setUseThrottleRetries); setIfPresent(cfg, "max-connections", cfg::getInt, settings::setMaxConnections); setIfPresent(cfg, "max-error-retry", cfg::getInt, settings::setMaxErrorRetry); setIfPresent(cfg, "connection-ttl", getMillis, settings::setConnectionTTL); setIfPresent(cfg, "connection-max-idle", getMillis, settings::setConnectionMaxIdleMillis); setIfPresent(cfg, "connection-timeout", getTimeout, settings::setConnectionTimeout); setIfPresent(cfg, "socket-timeout", getTimeout, settings::setSocketTimeout); setIfPresent(cfg, "client-execution-timeout", getTimeout, settings::setClientExecutionTimeout); setIfPresent(cfg, "user-agent-prefix", cfg::getString, settings::setUserAgentPrefix); setIfPresent(cfg, "user-agent-suffix", cfg::getString, settings::setUserAgentSuffix); setIfPresent(cfg, "proxy-port", cfg::getInt, settings::setProxyPort); setIfPresent(cfg, "proxy-host", cfg::getString, settings::setProxyHost); setIfPresent(cfg, "proxy-domain", cfg::getString, settings::setProxyDomain); setIfPresent(cfg, "proxy-workstation", cfg::getString, settings::setProxyWorkstation); setIfPresent(cfg, "proxy-username", cfg::getString, settings::setProxyUsername); setIfPresent(cfg, "proxy-password", cfg::getString, settings::setProxyPassword); return settings; }
AwsClientFactory implements AutoCloseable { ClientConfiguration createClientConfig(String name) { final Config cfg = getConfig(name, "client"); final ClientConfiguration settings = new ClientConfiguration(); settings.setProtocol(Protocol.HTTPS); Function<String, Long> getMillis = k -> cfg.getDuration(k, TimeUnit.MILLISECONDS); Function<String, Integer> getTimeout = k -> getMillis.apply(k).intValue(); setIfPresent(cfg, "use-gzip", cfg::getBoolean, settings::setUseGzip); setIfPresent(cfg, "use-reaper", cfg::getBoolean, settings::setUseReaper); setIfPresent(cfg, "use-tcp-keep-alive", cfg::getBoolean, settings::setUseTcpKeepAlive); setIfPresent(cfg, "use-throttle-retries", cfg::getBoolean, settings::setUseThrottleRetries); setIfPresent(cfg, "max-connections", cfg::getInt, settings::setMaxConnections); setIfPresent(cfg, "max-error-retry", cfg::getInt, settings::setMaxErrorRetry); setIfPresent(cfg, "connection-ttl", getMillis, settings::setConnectionTTL); setIfPresent(cfg, "connection-max-idle", getMillis, settings::setConnectionMaxIdleMillis); setIfPresent(cfg, "connection-timeout", getTimeout, settings::setConnectionTimeout); setIfPresent(cfg, "socket-timeout", getTimeout, settings::setSocketTimeout); setIfPresent(cfg, "client-execution-timeout", getTimeout, settings::setClientExecutionTimeout); setIfPresent(cfg, "user-agent-prefix", cfg::getString, settings::setUserAgentPrefix); setIfPresent(cfg, "user-agent-suffix", cfg::getString, settings::setUserAgentSuffix); setIfPresent(cfg, "proxy-port", cfg::getInt, settings::setProxyPort); setIfPresent(cfg, "proxy-host", cfg::getString, settings::setProxyHost); setIfPresent(cfg, "proxy-domain", cfg::getString, settings::setProxyDomain); setIfPresent(cfg, "proxy-workstation", cfg::getString, settings::setProxyWorkstation); setIfPresent(cfg, "proxy-username", cfg::getString, settings::setProxyUsername); setIfPresent(cfg, "proxy-password", cfg::getString, settings::setProxyPassword); return settings; } }
AwsClientFactory implements AutoCloseable { ClientConfiguration createClientConfig(String name) { final Config cfg = getConfig(name, "client"); final ClientConfiguration settings = new ClientConfiguration(); settings.setProtocol(Protocol.HTTPS); Function<String, Long> getMillis = k -> cfg.getDuration(k, TimeUnit.MILLISECONDS); Function<String, Integer> getTimeout = k -> getMillis.apply(k).intValue(); setIfPresent(cfg, "use-gzip", cfg::getBoolean, settings::setUseGzip); setIfPresent(cfg, "use-reaper", cfg::getBoolean, settings::setUseReaper); setIfPresent(cfg, "use-tcp-keep-alive", cfg::getBoolean, settings::setUseTcpKeepAlive); setIfPresent(cfg, "use-throttle-retries", cfg::getBoolean, settings::setUseThrottleRetries); setIfPresent(cfg, "max-connections", cfg::getInt, settings::setMaxConnections); setIfPresent(cfg, "max-error-retry", cfg::getInt, settings::setMaxErrorRetry); setIfPresent(cfg, "connection-ttl", getMillis, settings::setConnectionTTL); setIfPresent(cfg, "connection-max-idle", getMillis, settings::setConnectionMaxIdleMillis); setIfPresent(cfg, "connection-timeout", getTimeout, settings::setConnectionTimeout); setIfPresent(cfg, "socket-timeout", getTimeout, settings::setSocketTimeout); setIfPresent(cfg, "client-execution-timeout", getTimeout, settings::setClientExecutionTimeout); setIfPresent(cfg, "user-agent-prefix", cfg::getString, settings::setUserAgentPrefix); setIfPresent(cfg, "user-agent-suffix", cfg::getString, settings::setUserAgentSuffix); setIfPresent(cfg, "proxy-port", cfg::getInt, settings::setProxyPort); setIfPresent(cfg, "proxy-host", cfg::getString, settings::setProxyHost); setIfPresent(cfg, "proxy-domain", cfg::getString, settings::setProxyDomain); setIfPresent(cfg, "proxy-workstation", cfg::getString, settings::setProxyWorkstation); setIfPresent(cfg, "proxy-username", cfg::getString, settings::setProxyUsername); setIfPresent(cfg, "proxy-password", cfg::getString, settings::setProxyPassword); return settings; } @Inject  AwsClientFactory(Config config); }
AwsClientFactory implements AutoCloseable { ClientConfiguration createClientConfig(String name) { final Config cfg = getConfig(name, "client"); final ClientConfiguration settings = new ClientConfiguration(); settings.setProtocol(Protocol.HTTPS); Function<String, Long> getMillis = k -> cfg.getDuration(k, TimeUnit.MILLISECONDS); Function<String, Integer> getTimeout = k -> getMillis.apply(k).intValue(); setIfPresent(cfg, "use-gzip", cfg::getBoolean, settings::setUseGzip); setIfPresent(cfg, "use-reaper", cfg::getBoolean, settings::setUseReaper); setIfPresent(cfg, "use-tcp-keep-alive", cfg::getBoolean, settings::setUseTcpKeepAlive); setIfPresent(cfg, "use-throttle-retries", cfg::getBoolean, settings::setUseThrottleRetries); setIfPresent(cfg, "max-connections", cfg::getInt, settings::setMaxConnections); setIfPresent(cfg, "max-error-retry", cfg::getInt, settings::setMaxErrorRetry); setIfPresent(cfg, "connection-ttl", getMillis, settings::setConnectionTTL); setIfPresent(cfg, "connection-max-idle", getMillis, settings::setConnectionMaxIdleMillis); setIfPresent(cfg, "connection-timeout", getTimeout, settings::setConnectionTimeout); setIfPresent(cfg, "socket-timeout", getTimeout, settings::setSocketTimeout); setIfPresent(cfg, "client-execution-timeout", getTimeout, settings::setClientExecutionTimeout); setIfPresent(cfg, "user-agent-prefix", cfg::getString, settings::setUserAgentPrefix); setIfPresent(cfg, "user-agent-suffix", cfg::getString, settings::setUserAgentSuffix); setIfPresent(cfg, "proxy-port", cfg::getInt, settings::setProxyPort); setIfPresent(cfg, "proxy-host", cfg::getString, settings::setProxyHost); setIfPresent(cfg, "proxy-domain", cfg::getString, settings::setProxyDomain); setIfPresent(cfg, "proxy-workstation", cfg::getString, settings::setProxyWorkstation); setIfPresent(cfg, "proxy-username", cfg::getString, settings::setProxyUsername); setIfPresent(cfg, "proxy-password", cfg::getString, settings::setProxyPassword); return settings; } @Inject  AwsClientFactory(Config config); T newInstance(Class<T> cls); T newInstance(String name, Class<T> cls); T newInstance(Class<T> cls, String accountId); @SuppressWarnings("unchecked") T newInstance(String name, Class<T> cls, String accountId); T getInstance(Class<T> cls); T getInstance(String name, Class<T> cls); T getInstance(Class<T> cls, String accountId); @SuppressWarnings("unchecked") T getInstance(String name, Class<T> cls, String accountId); @Override void close(); }
AwsClientFactory implements AutoCloseable { ClientConfiguration createClientConfig(String name) { final Config cfg = getConfig(name, "client"); final ClientConfiguration settings = new ClientConfiguration(); settings.setProtocol(Protocol.HTTPS); Function<String, Long> getMillis = k -> cfg.getDuration(k, TimeUnit.MILLISECONDS); Function<String, Integer> getTimeout = k -> getMillis.apply(k).intValue(); setIfPresent(cfg, "use-gzip", cfg::getBoolean, settings::setUseGzip); setIfPresent(cfg, "use-reaper", cfg::getBoolean, settings::setUseReaper); setIfPresent(cfg, "use-tcp-keep-alive", cfg::getBoolean, settings::setUseTcpKeepAlive); setIfPresent(cfg, "use-throttle-retries", cfg::getBoolean, settings::setUseThrottleRetries); setIfPresent(cfg, "max-connections", cfg::getInt, settings::setMaxConnections); setIfPresent(cfg, "max-error-retry", cfg::getInt, settings::setMaxErrorRetry); setIfPresent(cfg, "connection-ttl", getMillis, settings::setConnectionTTL); setIfPresent(cfg, "connection-max-idle", getMillis, settings::setConnectionMaxIdleMillis); setIfPresent(cfg, "connection-timeout", getTimeout, settings::setConnectionTimeout); setIfPresent(cfg, "socket-timeout", getTimeout, settings::setSocketTimeout); setIfPresent(cfg, "client-execution-timeout", getTimeout, settings::setClientExecutionTimeout); setIfPresent(cfg, "user-agent-prefix", cfg::getString, settings::setUserAgentPrefix); setIfPresent(cfg, "user-agent-suffix", cfg::getString, settings::setUserAgentSuffix); setIfPresent(cfg, "proxy-port", cfg::getInt, settings::setProxyPort); setIfPresent(cfg, "proxy-host", cfg::getString, settings::setProxyHost); setIfPresent(cfg, "proxy-domain", cfg::getString, settings::setProxyDomain); setIfPresent(cfg, "proxy-workstation", cfg::getString, settings::setProxyWorkstation); setIfPresent(cfg, "proxy-username", cfg::getString, settings::setProxyUsername); setIfPresent(cfg, "proxy-password", cfg::getString, settings::setProxyPassword); return settings; } @Inject  AwsClientFactory(Config config); T newInstance(Class<T> cls); T newInstance(String name, Class<T> cls); T newInstance(Class<T> cls, String accountId); @SuppressWarnings("unchecked") T newInstance(String name, Class<T> cls, String accountId); T getInstance(Class<T> cls); T getInstance(String name, Class<T> cls); T getInstance(Class<T> cls, String accountId); @SuppressWarnings("unchecked") T getInstance(String name, Class<T> cls, String accountId); @Override void close();  }