SystemModule extends Module { void configureHTTP() { property("sys.http.port").ifPresent(port -> http().httpPort(Integer.parseInt(port))); property("sys.https.port").ifPresent(port -> http().httpsPort(Integer.parseInt(port))); property("sys.http.allowCIDR").ifPresent(cidrs -> http().access().allow(new IPv4RangePropertyValueParser(cidrs).parse())); } SystemModule(String propertyFileClasspath);   }
@Test void configureHTTP() { systemModule.configureHTTP(); assertThat(systemModule.context.httpServer.httpPort).isNull(); assertThat(systemModule.context.httpServer.httpsPort).isNull(); }
@Test void configureHTTPPortFromSystemProperty() { System.setProperty("sys.http.port", "8081"); systemModule.context.propertyManager.properties.set("sys.http.port", "8082"); systemModule.configureHTTP(); assertThat(systemModule.context.httpServer.httpPort).isEqualTo(8081); }
@Test void configureHTTPPortFromProperty() { systemModule.context.propertyManager.properties.set("sys.https.port", "8082"); systemModule.configureHTTP(); assertThat(systemModule.context.httpServer.httpPort).isNull(); assertThat(systemModule.context.httpServer.httpsPort).isEqualTo(8082); }