Search in sources :

Example 1 with Shutdown

use of org.springframework.boot.web.server.Shutdown in project spring-boot by spring-projects.

the class ServletWebServerFactoryCustomizerTests method whenShutdownPropertyIsSetThenShutdownIsCustomized.

@Test
void whenShutdownPropertyIsSetThenShutdownIsCustomized() {
    Map<String, String> map = new HashMap<>();
    map.put("server.shutdown", "graceful");
    bindProperties(map);
    ConfigurableServletWebServerFactory factory = mock(ConfigurableServletWebServerFactory.class);
    this.customizer.customize(factory);
    ArgumentCaptor<Shutdown> shutdownCaptor = ArgumentCaptor.forClass(Shutdown.class);
    then(factory).should().setShutdown(shutdownCaptor.capture());
    assertThat(shutdownCaptor.getValue()).isEqualTo(Shutdown.GRACEFUL);
}
Also used : ConfigurableServletWebServerFactory(org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory) Shutdown(org.springframework.boot.web.server.Shutdown) HashMap(java.util.HashMap) Test(org.junit.jupiter.api.Test)

Example 2 with Shutdown

use of org.springframework.boot.web.server.Shutdown in project spring-boot by spring-projects.

the class ReactiveWebServerFactoryCustomizerTests method whenShutdownPropertyIsSetThenShutdownIsCustomized.

@Test
void whenShutdownPropertyIsSetThenShutdownIsCustomized() {
    this.properties.setShutdown(Shutdown.GRACEFUL);
    ConfigurableReactiveWebServerFactory factory = mock(ConfigurableReactiveWebServerFactory.class);
    this.customizer.customize(factory);
    ArgumentCaptor<Shutdown> shutdownCaptor = ArgumentCaptor.forClass(Shutdown.class);
    then(factory).should().setShutdown(shutdownCaptor.capture());
    assertThat(shutdownCaptor.getValue()).isEqualTo(Shutdown.GRACEFUL);
}
Also used : ConfigurableReactiveWebServerFactory(org.springframework.boot.web.reactive.server.ConfigurableReactiveWebServerFactory) Shutdown(org.springframework.boot.web.server.Shutdown) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 Shutdown (org.springframework.boot.web.server.Shutdown)2 HashMap (java.util.HashMap)1 ConfigurableReactiveWebServerFactory (org.springframework.boot.web.reactive.server.ConfigurableReactiveWebServerFactory)1 ConfigurableServletWebServerFactory (org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory)1