Search in sources :

Example 16 with ServerProperties

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");
}
Also used : ServerProperties(org.springframework.boot.autoconfigure.web.ServerProperties) Test(org.junit.Test)

Example 17 with ServerProperties

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));
}
Also used : InetUtilsProperties(org.springframework.cloud.commons.util.InetUtilsProperties) ServerProperties(org.springframework.boot.autoconfigure.web.ServerProperties) CoffeeNetConfigurationProperties(coffee.synyx.autoconfigure.CoffeeNetConfigurationProperties) InetUtils(org.springframework.cloud.commons.util.InetUtils) Test(org.junit.Test)

Example 18 with ServerProperties

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"));
}
Also used : InetUtilsProperties(org.springframework.cloud.commons.util.InetUtilsProperties) ServerProperties(org.springframework.boot.autoconfigure.web.ServerProperties) CoffeeNetConfigurationProperties(coffee.synyx.autoconfigure.CoffeeNetConfigurationProperties) InetUtils(org.springframework.cloud.commons.util.InetUtils) Test(org.junit.Test)

Example 19 with ServerProperties

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");
}
Also used : ServerProperties(org.springframework.boot.autoconfigure.web.ServerProperties) Test(org.junit.Test)

Example 20 with ServerProperties

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");
}
Also used : ServerProperties(org.springframework.boot.autoconfigure.web.ServerProperties) Test(org.junit.Test)

Aggregations

ServerProperties (org.springframework.boot.autoconfigure.web.ServerProperties)27 Test (org.junit.Test)13 MockEnvironment (org.springframework.mock.env.MockEnvironment)9 CoffeeNetConfigurationProperties (coffee.synyx.autoconfigure.CoffeeNetConfigurationProperties)6 InetUtils (org.springframework.cloud.commons.util.InetUtils)6 InetUtilsProperties (org.springframework.cloud.commons.util.InetUtilsProperties)6 BeforeEach (org.junit.jupiter.api.BeforeEach)5 PropertyMapper (org.springframework.boot.context.properties.PropertyMapper)3 DataSize (org.springframework.util.unit.DataSize)3 Test (org.junit.jupiter.api.Test)2 UndertowServletWebServerFactory (org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 Duration (java.time.Duration)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Lifecycle (org.apache.catalina.Lifecycle)1 AccessLogValve (org.apache.catalina.valves.AccessLogValve)1 ErrorReportValve (org.apache.catalina.valves.ErrorReportValve)1 RemoteIpValve (org.apache.catalina.valves.RemoteIpValve)1 AbstractProtocol (org.apache.coyote.AbstractProtocol)1