Search in sources :

Example 26 with ServerProperties

use of org.springframework.boot.autoconfigure.web.ServerProperties in project spring-boot by spring-projects.

the class SessionAutoConfigurationHazelcastTests method validateDefaultConfig.

private void validateDefaultConfig(AssertableWebApplicationContext context) {
    HazelcastIndexedSessionRepository repository = validateSessionRepository(context, HazelcastIndexedSessionRepository.class);
    assertThat(repository).hasFieldOrPropertyWithValue("defaultMaxInactiveInterval", (int) new ServerProperties().getServlet().getSession().getTimeout().getSeconds());
    HazelcastInstance hazelcastInstance = context.getBean(HazelcastInstance.class);
    then(hazelcastInstance).should().getMap("spring:session:sessions");
}
Also used : HazelcastIndexedSessionRepository(org.springframework.session.hazelcast.HazelcastIndexedSessionRepository) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ServerProperties(org.springframework.boot.autoconfigure.web.ServerProperties)

Example 27 with ServerProperties

use of org.springframework.boot.autoconfigure.web.ServerProperties in project spring-boot by spring-projects.

the class SessionAutoConfigurationJdbcTests method validateDefaultConfig.

private void validateDefaultConfig(AssertableWebApplicationContext context) {
    JdbcIndexedSessionRepository repository = validateSessionRepository(context, JdbcIndexedSessionRepository.class);
    assertThat(repository).hasFieldOrPropertyWithValue("defaultMaxInactiveInterval", (int) new ServerProperties().getServlet().getSession().getTimeout().getSeconds());
    assertThat(repository).hasFieldOrPropertyWithValue("tableName", "SPRING_SESSION");
    assertThat(context.getBean(JdbcSessionProperties.class).getInitializeSchema()).isEqualTo(DatabaseInitializationMode.EMBEDDED);
    assertThat(context.getBean(JdbcOperations.class).queryForList("select * from SPRING_SESSION")).isEmpty();
    SpringBootJdbcHttpSessionConfiguration configuration = context.getBean(SpringBootJdbcHttpSessionConfiguration.class);
    assertThat(configuration).hasFieldOrPropertyWithValue("cleanupCron", "0 * * * * *");
}
Also used : ServerProperties(org.springframework.boot.autoconfigure.web.ServerProperties) JdbcIndexedSessionRepository(org.springframework.session.jdbc.JdbcIndexedSessionRepository) JdbcOperations(org.springframework.jdbc.core.JdbcOperations) SpringBootJdbcHttpSessionConfiguration(org.springframework.boot.autoconfigure.session.JdbcSessionConfiguration.SpringBootJdbcHttpSessionConfiguration)

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