org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration Java Examples

The following examples show how to use org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GatewayAutoConfigurationTests.java    From spring-cloud-gateway with Apache License 2.0 6 votes vote down vote up
@Test
public void nettyHttpClientDefaults() {
	new ReactiveWebApplicationContextRunner()
			.withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class,
					MetricsAutoConfiguration.class,
					SimpleMetricsExportAutoConfiguration.class,
					GatewayAutoConfiguration.class))
			.withPropertyValues("debug=true").run(context -> {
				assertThat(context).hasSingleBean(HttpClient.class);
				assertThat(context).hasBean("gatewayHttpClient");
				HttpClient httpClient = context.getBean(HttpClient.class);
				/*
				 * FIXME: 2.1.0 HttpClientOptions options = httpClient.options();
				 *
				 * PoolResources poolResources = options.getPoolResources();
				 * assertThat(poolResources).isNotNull(); //TODO: howto test
				 * PoolResources
				 *
				 * ClientProxyOptions proxyOptions = options.getProxyOptions();
				 * assertThat(proxyOptions).isNull();
				 *
				 * SslContext sslContext = options.sslContext();
				 * assertThat(sslContext).isNull();
				 */
			});
}
 
Example #2
Source File: GatewayAutoConfigurationTests.java    From spring-cloud-gateway with Apache License 2.0 4 votes vote down vote up
@Test
public void nettyHttpClientConfigured() {
	new ReactiveWebApplicationContextRunner()
			.withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class,
					MetricsAutoConfiguration.class,
					SimpleMetricsExportAutoConfiguration.class,
					GatewayAutoConfiguration.class, HttpClientCustomizedConfig.class))
			.withPropertyValues(
					"spring.cloud.gateway.httpclient.ssl.use-insecure-trust-manager=true",
					"spring.cloud.gateway.httpclient.connect-timeout=10",
					"spring.cloud.gateway.httpclient.response-timeout=10s",
					"spring.cloud.gateway.httpclient.pool.type=fixed",
					// greather than integer max value
					"spring.cloud.gateway.httpclient.max-initial-line-length=2147483647",
					"spring.cloud.gateway.httpclient.proxy.host=myhost",
					"spring.cloud.gateway.httpclient.websocket.max-frame-payload-length=1024")
			.run(context -> {
				assertThat(context).hasSingleBean(HttpClient.class);
				HttpClient httpClient = context.getBean(HttpClient.class);
				HttpClientProperties properties = context
						.getBean(HttpClientProperties.class);
				assertThat(properties.getMaxInitialLineLength().toBytes())
						.isLessThanOrEqualTo(Integer.MAX_VALUE);
				/*
				 * FIXME: 2.1.0 HttpClientOptions options = httpClient.options();
				 *
				 * PoolResources poolResources = options.getPoolResources();
				 * assertThat(poolResources).isNotNull(); //TODO: howto test
				 * PoolResources
				 *
				 * ClientProxyOptions proxyOptions = options.getProxyOptions();
				 * assertThat(proxyOptions).isNotNull();
				 * assertThat(proxyOptions.getAddress().get().getHostName()).isEqualTo
				 * ("myhost");
				 *
				 * SslContext sslContext = options.sslContext();
				 * assertThat(sslContext).isNotNull();
				 */
				// TODO: howto test SslContext
				assertThat(context)
						.hasSingleBean(ReactorNettyRequestUpgradeStrategy.class);
				ReactorNettyRequestUpgradeStrategy upgradeStrategy = context
						.getBean(ReactorNettyRequestUpgradeStrategy.class);
				assertThat(upgradeStrategy.getMaxFramePayloadLength())
						.isEqualTo(1024);
				assertThat(upgradeStrategy.getHandlePing()).isTrue();
				assertThat(context).hasSingleBean(ReactorNettyWebSocketClient.class);
				ReactorNettyWebSocketClient webSocketClient = context
						.getBean(ReactorNettyWebSocketClient.class);
				assertThat(webSocketClient.getMaxFramePayloadLength())
						.isEqualTo(1024);
				HttpClientCustomizedConfig config = context
						.getBean(HttpClientCustomizedConfig.class);
				assertThat(config.called.get()).isTrue();
			});
}