Search in sources :

Example 1 with Shutdown

use of cn.taketoday.framework.web.server.Shutdown in project today-infrastructure by TAKETODAY.

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(cn.taketoday.framework.web.servlet.server.ConfigurableServletWebServerFactory) Shutdown(cn.taketoday.framework.web.server.Shutdown) HashMap(java.util.HashMap) Test(org.junit.jupiter.api.Test)

Example 2 with Shutdown

use of cn.taketoday.framework.web.server.Shutdown in project today-framework by TAKETODAY.

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(cn.taketoday.framework.web.servlet.server.ConfigurableServletWebServerFactory) Shutdown(cn.taketoday.framework.web.server.Shutdown) HashMap(java.util.HashMap) Test(org.junit.jupiter.api.Test)

Aggregations

Shutdown (cn.taketoday.framework.web.server.Shutdown)2 ConfigurableServletWebServerFactory (cn.taketoday.framework.web.servlet.server.ConfigurableServletWebServerFactory)2 HashMap (java.util.HashMap)2 Test (org.junit.jupiter.api.Test)2