public HttpConfiguration httpBuilder() throws Exception { HttpConfiguration springSecurityFilterChain = new HttpConfiguration(authenticationManager()); springSecurityFilterChain.setSharedObject( UserDetailsService.class, authenticationRegistry.userDetailsService()); applyDefaults(springSecurityFilterChain); configure(springSecurityFilterChain); return springSecurityFilterChain; }
public EndpointIdentity getEndpointIdentity() { if (getNetworkConfiguration().getTransportType().equals(TransportType.HTTP)) { return EndpointIdentityFactory.createUrlEndpointIdentity(mHttpConfiguration.getUrlEndpoint()); } else { return EndpointIdentityFactory.createServiceIdentity("DeviceMetricsService"); } }
@Test(priority = 7) public void getRetryDelayTest() { Assert.assertEquals(httpConf.getRetryDelay(), 1000); }
@Test(priority = 6) public void getReadTimeoutTest() { Assert.assertEquals(httpConf.getReadTimeout(), 0); }
public EndpointIdentity getStaticCredentialEndpointIdentity() { return EndpointIdentityFactory.createUrlEndpointIdentity( mHttpConfiguration.getStaticCredentialUrlEndpoint()); }
@Test(priority = 17) public void setAndGetProxyPortTest() { httpConf.setProxyPort(8080); Assert.assertEquals(httpConf.getProxyPort(), 8080); }
@Test(priority = 15) public void setAndGetMaxRetryTest() { httpConf.setMaxRetry(2); Assert.assertEquals(httpConf.getMaxRetry(), 2); }
@Test(priority = 12) public void setAndGetEndPointUrlTest() { httpConf.setEndPointUrl("https://svcs.sandbox.paypal.com/Invoice/CreateInvoice"); Assert.assertEquals( httpConf.getEndPointUrl(), "https://svcs.sandbox.paypal.com/Invoice/CreateInvoice"); }
@Test(priority = 0) public void getConnectionTimeoutTest() { Assert.assertEquals(httpConf.getConnectionTimeout(), 0); }
@Test(priority = 22) public void setAndGetProxyPassword() { httpConf.setProxyPassword("proxyPassword"); Assert.assertEquals(httpConf.getProxyPassword(), "proxyPassword"); }
@Test(priority = 21) public void setAndGetProxyUserName() { httpConf.setProxyUserName("proxyUser"); Assert.assertEquals(httpConf.getProxyUserName(), "proxyUser"); }
@Test(priority = 20) public void setAndGetRetryDelayTest() { httpConf.setRetryDelay(30); Assert.assertEquals(httpConf.getRetryDelay(), 30); }
@Test(priority = 19) public void setAndGetReadTimeoutTest() { httpConf.setReadTimeout(10); Assert.assertEquals(httpConf.getReadTimeout(), 10); }
@Test(priority = 18) public void setAndIsProxySetTest() { httpConf.setProxySet(true); Assert.assertEquals(httpConf.isProxySet(), true); }
@Test public void should_use_default_value_for_configuration() throws IOException { Configuration configuration = read(fixture("use_default_value_for_configuration.yml"), Configuration.class); HttpConfiguration http = configuration.getHttp(); assertThat(http.getPort(), is(DEFAULT_PORT)); assertThat(http.getHost().isPresent(), is(false)); assertThat(http.getMinThread(), is(DEFAULT_MIN_THREAD)); assertThat(http.getMaxThread(), is(DEFAULT_MAX_THREAD)); assertThat(http.getAcceptorThreads(), is(DEFAULT_ACCEPTOR_THREADS)); assertThat(http.getSelectorThreads(), is(DEFAULT_SELECTOR_THREADS)); assertThat(http.getAcceptQueueSize(), is(DEFAULT_ACCEPT_QUEUE_SIZE)); assertThat(http.getMaxIdleTime(), is(DEFAULT_MAX_IDLE_TIME)); assertThat(http.getIdleTimeout(), is(DEFAULT_IDLE_TIMEOUT)); assertThat(http.getSoLingerTime().isPresent(), is(false)); assertThat(http.getSsl(), is(Optional.<SslConfiguration>absent())); LoggingConfiguration logging = configuration.getLogging(); assertThat(logging.getLevel(), is(LogLevel.INFO)); assertThat(logging.getLoggers().isEmpty(), is(true)); assertThat(logging.getConsole().isPresent(), is(false)); assertThat(logging.getFile().isPresent(), is(false)); }
@Test(priority = 9) public void isProxySetTest() { Assert.assertEquals(httpConf.isProxySet(), false); }
@Test(priority = 11) public void setAndGetConnectionTimeoutTest() { httpConf.setConnectionTimeout(5000); Assert.assertEquals(httpConf.getConnectionTimeout(), 5000); }
@Test(priority = 1) public void getEndPointUrlTest() { Assert.assertEquals(httpConf.getEndPointUrl(), null); }
@Test(priority = 14) public void setAndGetMaxHttpConnectionTest() { httpConf.setMaxHttpConnection(3); Assert.assertEquals(httpConf.getMaxHttpConnection(), 3); }
@Test(priority = 2) public void getMaxHttpConnectionTest() { Assert.assertEquals(httpConf.getMaxHttpConnection(), 10); }
@Test(priority = 16) public void setAndGetProxyHostTest() { httpConf.setProxyHost(null); Assert.assertEquals(httpConf.getProxyHost(), null); }
@Test(priority = 3) public void getMaxRetryTest() { Assert.assertEquals(httpConf.getMaxRetry(), 2); }
@Test(priority = 4) public void getProxyHostTest() { Assert.assertEquals(httpConf.getProxyHost(), null); }
@Test(priority = 5) public void getProxyPortTest() { Assert.assertEquals(httpConf.getProxyPort(), -1); }
public String getUrl() { return http != null ? http.getUrl() : url; }
protected void applyDefaults(HttpConfiguration http) throws Exception { http.applyDefaultConfigurators(); authorizeUrls(http.authorizeUrls()); }