use of org.springframework.boot.autoconfigure.web.ServerProperties in project spring-boot by spring-projects.
the class EndpointWebMvcAutoConfigurationTests method overrideServerProperties.
@Test
public void overrideServerProperties() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext, "server.displayName:foo");
this.applicationContext.register(RootConfig.class, EndpointConfig.class, PropertyPlaceholderAutoConfiguration.class, JacksonAutoConfiguration.class, ServletWebServerFactoryAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class, AuditAutoConfiguration.class);
this.applicationContext.refresh();
assertContent("/controller", ports.get().server, "controlleroutput");
ServerProperties serverProperties = this.applicationContext.getBean(ServerProperties.class);
assertThat(serverProperties.getDisplayName()).isEqualTo("foo");
}
use of org.springframework.boot.autoconfigure.web.ServerProperties in project coffeenet-starter by coffeenet.
the class CoffeeNetDiscoveryInstancePropertiesTest method setServerPort.
@Test
public void setServerPort() {
int port = 9999;
ServerProperties serverProperties = new ServerProperties();
serverProperties.setPort(port);
CoffeeNetDiscoveryInstanceProperties sut = new CoffeeNetDiscoveryInstanceProperties(new InetUtils(new InetUtilsProperties()), serverProperties, new CoffeeNetConfigurationProperties());
assertThat(sut.getNonSecurePort(), is(port));
}
use of org.springframework.boot.autoconfigure.web.ServerProperties in project coffeenet-starter by coffeenet.
the class CoffeeNetDiscoveryInstancePropertiesTest method defaultValues.
@Test
public void defaultValues() {
InetUtils inetUtils = new InetUtils(new InetUtilsProperties());
ServerProperties serverProperties = new ServerProperties();
CoffeeNetConfigurationProperties coffeeNetConfigurationProperties = new CoffeeNetConfigurationProperties();
CoffeeNetDiscoveryInstanceProperties sut = new CoffeeNetDiscoveryInstanceProperties(inetUtils, serverProperties, coffeeNetConfigurationProperties);
assertThat(sut.getNonSecurePort(), is(8080));
assertThat(sut.getHostname(), is("localhost"));
}
use of org.springframework.boot.autoconfigure.web.ServerProperties in project spring-cloud-sleuth by spring-cloud.
the class DefaultEndpointLocatorConfigurationTest method hostFromServerPropertiesIp.
@Test
public void hostFromServerPropertiesIp() throws UnknownHostException {
ServerProperties properties = new ServerProperties();
properties.setAddress(InetAddress.getByAddress(ADDRESS1234));
DefaultEndpointLocator locator = new DefaultEndpointLocator(null, properties, environment, new ZipkinProperties(), localAddress(new byte[] { 4, 4, 4, 4 }));
assertThat(locator.local().ipv4()).isEqualTo("1.2.3.4");
}
use of org.springframework.boot.autoconfigure.web.ServerProperties in project spring-cloud-sleuth by spring-cloud.
the class DefaultEndpointLocatorConfigurationTest method appNameFromProperties.
@Test
public void appNameFromProperties() throws UnknownHostException {
ServerProperties properties = new ServerProperties();
ZipkinProperties zipkinProperties = new ZipkinProperties();
zipkinProperties.getService().setName("foo");
DefaultEndpointLocator locator = new DefaultEndpointLocator(null, properties, environment, zipkinProperties, localAddress(ADDRESS1234));
assertThat(locator.local().serviceName()).isEqualTo("foo");
}
Aggregations