List of usage examples for org.springframework.boot WebApplicationType NONE
WebApplicationType NONE
To view the source code for org.springframework.boot WebApplicationType NONE.
Click Source Link
From source file:org.springframework.cloud.config.server.environment.ConfigurableHttpConnectionFactoryIntegrationTests.java
@Test public void authenticatedHttpsProxy() throws Exception { String repoUrl = "https://myrepo/repo.git"; new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties(gitProperties(repoUrl, null, AUTHENTICATED_HTTPS_PROXY)).run(); HttpClient httpClient = getHttpClientForUrl(repoUrl); this.expectedException.expectCause(allOf(instanceOf(UnknownHostException.class), hasProperty("message", containsString(AUTHENTICATED_HTTPS_PROXY.getHost())))); makeRequest(httpClient, "https://somehost"); }
From source file:org.springframework.cloud.config.server.environment.ConfigurableHttpConnectionFactoryIntegrationTests.java
@Test public void httpsProxy() throws Exception { String repoUrl = "https://myrepo/repo.git"; new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties(gitProperties(repoUrl, null, HTTPS_PROXY)).run(); HttpClient httpClient = getHttpClientForUrl(repoUrl); this.expectedException.expectCause(allOf(instanceOf(UnknownHostException.class), hasProperty("message", containsString(HTTPS_PROXY.getHost())))); makeRequest(httpClient, "https://somehost"); }
From source file:org.springframework.cloud.config.server.environment.ConfigurableHttpConnectionFactoryIntegrationTests.java
@Test public void httpsProxy_placeholderUrl() throws Exception { new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties(//w w w .j a v a2 s . c om gitProperties("https://myrepo/{placeholder1}/{placeholder2}-repo.git", null, HTTPS_PROXY)) .run(); HttpClient httpClient = getHttpClientForUrl( "https://myrepo/someplaceholdervalue/anotherplaceholdervalue-repo.git"); this.expectedException.expectCause(allOf(instanceOf(UnknownHostException.class), hasProperty("message", containsString(HTTPS_PROXY.getHost())))); makeRequest(httpClient, "https://somehost"); }
From source file:org.springframework.cloud.config.server.environment.ConfigurableHttpConnectionFactoryIntegrationTests.java
@Test public void httpsProxy_notCalled() throws Exception { String repoUrl = "https://myrepo/repo.git"; new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties(gitProperties(repoUrl, null, HTTPS_PROXY)).run(); HttpClient httpClient = getHttpClientForUrl(repoUrl); this.expectedException.expectCause( allOf(instanceOf(UnknownHostException.class), hasProperty("message", containsString("somehost")))); makeRequest(httpClient, "http://somehost"); }
From source file:org.springframework.cloud.config.server.environment.ConfigurableHttpConnectionFactoryIntegrationTests.java
@Test public void authenticatedHttpProxy() throws Exception { String repoUrl = "https://myrepo/repo.git"; new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties(gitProperties(repoUrl, AUTHENTICATED_HTTP_PROXY, null)).run(); HttpClient httpClient = getHttpClientForUrl(repoUrl); this.expectedException.expectCause(allOf(instanceOf(UnknownHostException.class), hasProperty("message", containsString(AUTHENTICATED_HTTP_PROXY.getHost())))); makeRequest(httpClient, "http://somehost"); }
From source file:org.springframework.cloud.config.server.environment.ConfigurableHttpConnectionFactoryIntegrationTests.java
@Test public void httpProxy() throws Exception { String repoUrl = "https://myrepo/repo.git"; new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties(gitProperties(repoUrl, HTTP_PROXY, null)).run(); HttpClient httpClient = getHttpClientForUrl(repoUrl); this.expectedException.expectCause(allOf(instanceOf(UnknownHostException.class), hasProperty("message", containsString(HTTP_PROXY.getHost())))); makeRequest(httpClient, "http://somehost"); }
From source file:org.springframework.cloud.config.server.environment.ConfigurableHttpConnectionFactoryIntegrationTests.java
@Test public void httpProxy_placeholderUrl() throws Exception { new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties(gitProperties("https://myrepo/{placeholder}-repo.git", HTTP_PROXY, null)).run(); HttpClient httpClient = getHttpClientForUrl("https://myrepo/someplaceholdervalue-repo.git"); this.expectedException.expectCause(allOf(instanceOf(UnknownHostException.class), hasProperty("message", containsString(HTTP_PROXY.getHost())))); makeRequest(httpClient, "http://somehost"); }
From source file:org.springframework.cloud.config.server.environment.ConfigurableHttpConnectionFactoryIntegrationTests.java
@Test public void httpProxy_notCalled() throws Exception { String repoUrl = "https://myrepo/repo.git"; new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties(gitProperties(repoUrl, HTTP_PROXY, null)).run(); HttpClient httpClient = getHttpClientForUrl(repoUrl); this.expectedException.expectCause( allOf(instanceOf(UnknownHostException.class), hasProperty("message", containsString("somehost")))); makeRequest(httpClient, "https://somehost"); }
From source file:org.springframework.cloud.config.server.environment.ConfigurableHttpConnectionFactoryIntegrationTests.java
@Test public void httpProxy_fromSystemProperty() throws Exception { ProxySelector defaultProxySelector = ProxySelector.getDefault(); try {//from ww w . ja v a2s . co m ProxySelector.setDefault(new ProxySelector() { @Override public List<Proxy> select(URI uri) { InetSocketAddress address = new InetSocketAddress(HTTP_PROXY.getHost(), HTTP_PROXY.getPort()); Proxy proxy = new Proxy(Proxy.Type.HTTP, address); return Collections.singletonList(proxy); } @Override public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { } }); String repoUrl = "https://myrepo/repo.git"; new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties(new String[] { "spring.cloud.config.server.git.uri=" + repoUrl }).run(); HttpClient httpClient = getHttpClientForUrl(repoUrl); this.expectedException.expectCause(allOf(instanceOf(UnknownHostException.class), hasProperty("message", containsString(HTTP_PROXY.getHost())))); makeRequest(httpClient, "http://somehost"); } finally { ProxySelector.setDefault(defaultProxySelector); } }
From source file:org.springframework.cloud.config.server.environment.JGitEnvironmentRepositoryConcurrencyTests.java
@Test public void vanilla() throws Exception { String uri = ConfigServerTestUtils.prepareLocalRepo(); this.context = new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) .properties("spring.cloud.config.server.git.uri:" + uri).run(); final EnvironmentRepository repository = this.context.getBean(EnvironmentRepository.class); ExecutorService threads = Executors.newFixedThreadPool(4); List<Future<Boolean>> tasks = new ArrayList<Future<Boolean>>(); for (int i = 0; i < 30; i++) { tasks.add(threads.submit(new Runnable() { @Override// w ww. j a va 2s . co m public void run() { repository.findOne("bar", "staging", "master"); } }, true)); } for (Future<Boolean> future : tasks) { future.get(); } Environment environment = repository.findOne("bar", "staging", "master"); assertThat(environment.getPropertySources().size()).isEqualTo(2); assertThat(environment.getName()).isEqualTo("bar"); assertThat(environment.getProfiles()).isEqualTo(new String[] { "staging" }); assertThat(environment.getLabel()).isEqualTo("master"); }