io.github.jhipster.config.JHipsterProperties Java Examples

The following examples show how to use io.github.jhipster.config.JHipsterProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecurityConfiguration.java    From TeamDojo with Apache License 2.0 6 votes vote down vote up
public SecurityConfiguration(AuthenticationManagerBuilder authenticationManagerBuilder, UserDetailsService userDetailsService,
                             JHipsterProperties jHipsterProperties, RememberMeServices rememberMeServices, CorsFilter corsFilter, SecurityProblemSupport problemSupport) {
    this.authenticationManagerBuilder = authenticationManagerBuilder;
    this.userDetailsService = userDetailsService;
    this.jHipsterProperties = jHipsterProperties;
    this.rememberMeServices = rememberMeServices;
    this.corsFilter = corsFilter;
    this.problemSupport = problemSupport;
}
 
Example #2
Source File: WebConfigurer.java    From cubeai with Apache License 2.0 6 votes vote down vote up
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
     * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
     * See the JHipsterProperties class and your application-*.yml configuration files
     * for more information.
     */
    if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
 
Example #3
Source File: WebConfigurer.java    From jhipster-microservices-example with Apache License 2.0 6 votes vote down vote up
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

    /*
     * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
     * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
     * See the JHipsterProperties class and your application-*.yml configuration files
     * for more information.
     */
    if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
 
Example #4
Source File: ProfileInfoResourceIntegrationTest.java    From tutorials with MIT License 6 votes vote down vote up
@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    String mockProfile[] = {"test"};
    JHipsterProperties.Ribbon ribbon = new JHipsterProperties.Ribbon();
    ribbon.setDisplayOnActiveProfiles(mockProfile);
    when(jHipsterProperties.getRibbon()).thenReturn(ribbon);

    String activeProfiles[] = {"test"};
    when(environment.getDefaultProfiles()).thenReturn(activeProfiles);
    when(environment.getActiveProfiles()).thenReturn(activeProfiles);

    ProfileInfoResource profileInfoResource = new ProfileInfoResource(environment, jHipsterProperties);
    this.restProfileMockMvc = MockMvcBuilders
        .standaloneSetup(profileInfoResource)
        .build();
}
 
Example #5
Source File: WebConfigurer.java    From Spring-5.0-Projects with MIT License 6 votes vote down vote up
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(WebServerFactory server) {
    setMimeMappings(server);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(server);

    /*
     * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
     * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
     * See the JHipsterProperties class and your application-*.yml configuration files
     * for more information.
     */
    if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
        server instanceof UndertowServletWebServerFactory) {

        ((UndertowServletWebServerFactory) server)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
 
Example #6
Source File: ProfileInfoResourceIntTest.java    From cubeai with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    String mockProfile[] = { "test" };
    JHipsterProperties.Ribbon ribbon = new JHipsterProperties.Ribbon();
    ribbon.setDisplayOnActiveProfiles(mockProfile);
    when(jHipsterProperties.getRibbon()).thenReturn(ribbon);

    String activeProfiles[] = {"test"};
    when(environment.getDefaultProfiles()).thenReturn(activeProfiles);
    when(environment.getActiveProfiles()).thenReturn(activeProfiles);

    ProfileInfoResource profileInfoResource = new ProfileInfoResource(environment, jHipsterProperties);
    this.restProfileMockMvc = MockMvcBuilders
        .standaloneSetup(profileInfoResource)
        .build();
}
 
Example #7
Source File: WebConfigurer.java    From Full-Stack-Development-with-JHipster with MIT License 6 votes vote down vote up
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(WebServerFactory server) {
    setMimeMappings(server);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(server);

    /*
     * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
     * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
     * See the JHipsterProperties class and your application-*.yml configuration files
     * for more information.
     */
    if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
        server instanceof UndertowServletWebServerFactory) {

        ((UndertowServletWebServerFactory) server)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
 
Example #8
Source File: CacheConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {
    log.debug("Configuring Hazelcast");
    HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("umo");
    if (hazelCastInstance != null) {
        log.debug("Hazelcast already initialized");
        return hazelCastInstance;
    }
    Config config = new Config();
    config.setInstanceName("umo");
    config.getNetworkConfig().setPort(5701);
    config.getNetworkConfig().setPortAutoIncrement(true);

    // In development, remove multicast auto-configuration
    if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
        System.setProperty("hazelcast.local.localAddress", "127.0.0.1");

        config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
    }
    config.getMapConfigs().put("default", initializeDefaultMapConfig());

    // Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html
    config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties));
    return Hazelcast.newHazelcastInstance(config);
}
 
Example #9
Source File: WebConfigurerTest.java    From okta-jhipster-microservices-oauth-example with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    servletContext = spy(new MockServletContext());
    doReturn(mock(FilterRegistration.Dynamic.class))
        .when(servletContext).addFilter(anyString(), any(Filter.class));
    doReturn(mock(ServletRegistration.Dynamic.class))
        .when(servletContext).addServlet(anyString(), any(Servlet.class));

    env = new MockEnvironment();
    props = new JHipsterProperties();

    webConfigurer = new WebConfigurer(env, props);
    metricRegistry = new MetricRegistry();
    webConfigurer.setMetricRegistry(metricRegistry);
}
 
Example #10
Source File: CacheConfiguration.java    From okta-jhipster-microservices-oauth-example with Apache License 2.0 5 votes vote down vote up
private MapConfig initializeDefaultMapConfig(JHipsterProperties jHipsterProperties) {
    MapConfig mapConfig = new MapConfig();

    /*
    Number of backups. If 1 is set as the backup-count for example,
    then all entries of the map will be copied to another JVM for
    fail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
    */
    mapConfig.setBackupCount(jHipsterProperties.getCache().getHazelcast().getBackupCount());

    /*
    Valid values are:
    NONE (no eviction),
    LRU (Least Recently Used),
    LFU (Least Frequently Used).
    NONE is the default.
    */
    mapConfig.setEvictionPolicy(EvictionPolicy.LRU);

    /*
    Maximum size of the map. When max size is reached,
    map is evicted based on the policy defined.
    Any integer between 0 and Integer.MAX_VALUE. 0 means
    Integer.MAX_VALUE. Default is 0.
    */
    mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE));

    return mapConfig;
}
 
Example #11
Source File: ProfileInfoResourceIntTest.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Test
public void getProfileInfoWithoutRibbon() throws Exception {
    JHipsterProperties.Ribbon ribbon = new JHipsterProperties.Ribbon();
    ribbon.setDisplayOnActiveProfiles(null);
    when(jHipsterProperties.getRibbon()).thenReturn(ribbon);

    restProfileMockMvc.perform(get("/api/profile-info"))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
}
 
Example #12
Source File: CacheConfiguration.java    From e-commerce-microservice with Apache License 2.0 5 votes vote down vote up
private ManagementCenterConfig initializeDefaultManagementCenterConfig(JHipsterProperties jHipsterProperties) {
    ManagementCenterConfig managementCenterConfig = new ManagementCenterConfig();
    managementCenterConfig.setEnabled(jHipsterProperties.getCache().getHazelcast().getManagementCenter().isEnabled());
    managementCenterConfig.setUrl(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUrl());
    managementCenterConfig.setUpdateInterval(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUpdateInterval());
    return managementCenterConfig;
}
 
Example #13
Source File: RateLimitingFilter.java    From e-commerce-microservice with Apache License 2.0 5 votes vote down vote up
private Supplier<BucketConfiguration> getConfigSupplier() {
    return () -> {
        JHipsterProperties.Gateway.RateLimiting rateLimitingProperties =
            jHipsterProperties.getGateway().getRateLimiting();

        return Bucket4j.configurationBuilder()
            .addLimit(Bandwidth.simple(rateLimitingProperties.getLimit(),
                Duration.ofSeconds(rateLimitingProperties.getDurationInSeconds())))
            .build();
    };
}
 
Example #14
Source File: WebConfigurerTest.java    From jhipster-microservices-example with Apache License 2.0 5 votes vote down vote up
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
 
Example #15
Source File: WebConfigurerTest.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    servletContext = spy(new MockServletContext());
    doReturn(new MockFilterRegistration())
        .when(servletContext).addFilter(anyString(), any(Filter.class));
    doReturn(new MockServletRegistration())
        .when(servletContext).addServlet(anyString(), any(Servlet.class));

    env = new MockEnvironment();
    props = new JHipsterProperties();

    webConfigurer = new WebConfigurer(env, props, null);
    metricRegistry = new MetricRegistry();
    webConfigurer.setMetricRegistry(metricRegistry);
}
 
Example #16
Source File: MailService.java    From Spring-5.0-Projects with MIT License 5 votes vote down vote up
public MailService(JHipsterProperties jHipsterProperties, JavaMailSender javaMailSender,
        MessageSource messageSource, SpringTemplateEngine templateEngine) {

    this.jHipsterProperties = jHipsterProperties;
    this.javaMailSender = javaMailSender;
    this.messageSource = messageSource;
    this.templateEngine = templateEngine;
}
 
Example #17
Source File: WebConfigurerTest.java    From okta-jhipster-microservices-oauth-example with Apache License 2.0 5 votes vote down vote up
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
 
Example #18
Source File: WebConfigurerTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
 
Example #19
Source File: LoggingConfiguration.java    From Full-Stack-Development-with-JHipster with MIT License 5 votes vote down vote up
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
     JHipsterProperties jHipsterProperties) {
    this.appName = appName;
    this.serverPort = serverPort;
    this.jHipsterProperties = jHipsterProperties;
    if (jHipsterProperties.getLogging().getLogstash().isEnabled()) {
        addLogstashAppender(context);
        addContextListener(context);
    }
    if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        setMetricsMarkerLogbackFilter(context);
    }
}
 
Example #20
Source File: WebConfigurerTest.java    From tutorials with MIT License 5 votes vote down vote up
@Before
public void setup() {
    servletContext = spy(new MockServletContext());
    doReturn(mock(FilterRegistration.Dynamic.class))
        .when(servletContext).addFilter(anyString(), any(Filter.class));
    doReturn(mock(ServletRegistration.Dynamic.class))
        .when(servletContext).addServlet(anyString(), any(Servlet.class));

    env = new MockEnvironment();
    props = new JHipsterProperties();

    webConfigurer = new WebConfigurer(env, props);
    metricRegistry = new MetricRegistry();
    webConfigurer.setMetricRegistry(metricRegistry);
}
 
Example #21
Source File: WebConfigurerTest.java    From e-commerce-microservice with Apache License 2.0 5 votes vote down vote up
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
 
Example #22
Source File: AuditEventService.java    From jhipster-online with Apache License 2.0 5 votes vote down vote up
public AuditEventService(
    PersistenceAuditEventRepository persistenceAuditEventRepository,
    AuditEventConverter auditEventConverter, JHipsterProperties jhipsterProperties) {

    this.persistenceAuditEventRepository = persistenceAuditEventRepository;
    this.auditEventConverter = auditEventConverter;
    this.jHipsterProperties = jhipsterProperties;
}
 
Example #23
Source File: CacheConfiguration.java    From tutorials with MIT License 5 votes vote down vote up
public CacheConfiguration(JHipsterProperties jHipsterProperties) {
    JHipsterProperties.Cache.Ehcache ehcache =
        jHipsterProperties.getCache().getEhcache();

    jcacheConfiguration = Eh107Configuration.fromEhcacheCacheConfiguration(
        CacheConfigurationBuilder.newCacheConfigurationBuilder(Object.class, Object.class,
            ResourcePoolsBuilder.heap(ehcache.getMaxEntries()))
            .withExpiry(Expirations.timeToLiveExpiration(Duration.of(ehcache.getTimeToLiveSeconds(), TimeUnit.SECONDS)))
            .build());
}
 
Example #24
Source File: CacheConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Bean
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {
    log.debug("Configuring Hazelcast");
    HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("umm");
    if (hazelCastInstance != null) {
        log.debug("Hazelcast already initialized");
        return hazelCastInstance;
    }
    Config config = new Config();
    config.setInstanceName("umm");
    config.getNetworkConfig().setPort(5701);
    config.getNetworkConfig().setPortAutoIncrement(true);

    // In development, remove multicast auto-configuration
    if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
        System.setProperty("hazelcast.local.localAddress", "127.0.0.1");

        config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
        config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
    }
    config.getMapConfigs().put("default", initializeDefaultMapConfig());

    // Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html
    config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties));
    config.getMapConfigs().put("com.wyy.domain.*", initializeDomainMapConfig(jHipsterProperties));
    return Hazelcast.newHazelcastInstance(config);
}
 
Example #25
Source File: RateLimitingFilter.java    From tutorials with MIT License 5 votes vote down vote up
private Supplier<BucketConfiguration> getConfigSupplier() {
    return () -> {
        JHipsterProperties.Gateway.RateLimiting rateLimitingProperties =
            jHipsterProperties.getGateway().getRateLimiting();

        return Bucket4j.configurationBuilder()
            .addLimit(Bandwidth.simple(rateLimitingProperties.getLimit(),
                Duration.ofSeconds(rateLimitingProperties.getDurationInSeconds())))
            .build();
    };
}
 
Example #26
Source File: LoggingConfiguration.java    From jhipster-microservices-example with Apache License 2.0 5 votes vote down vote up
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
    @Value("${eureka.instance.instanceId}") String instanceId, JHipsterProperties jHipsterProperties) {
    this.appName = appName;
    this.serverPort = serverPort;
    this.instanceId = instanceId;
    this.jHipsterProperties = jHipsterProperties;
    if (jHipsterProperties.getLogging().getLogstash().isEnabled()) {
        addLogstashAppender(context);

        // Add context listener
        LogbackLoggerContextListener loggerContextListener = new LogbackLoggerContextListener();
        loggerContextListener.setContext(context);
        context.addListener(loggerContextListener);
    }
}
 
Example #27
Source File: CacheConfiguration.java    From cubeai with Apache License 2.0 5 votes vote down vote up
private ManagementCenterConfig initializeDefaultManagementCenterConfig(JHipsterProperties jHipsterProperties) {
    ManagementCenterConfig managementCenterConfig = new ManagementCenterConfig();
    managementCenterConfig.setEnabled(jHipsterProperties.getCache().getHazelcast().getManagementCenter().isEnabled());
    managementCenterConfig.setUrl(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUrl());
    managementCenterConfig.setUpdateInterval(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUpdateInterval());
    return managementCenterConfig;
}
 
Example #28
Source File: LoggingConfiguration.java    From e-commerce-microservice with Apache License 2.0 5 votes vote down vote up
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
     @Value("${info.project.version:}") String version, JHipsterProperties jHipsterProperties) {
    this.appName = appName;
    this.serverPort = serverPort;
    this.version = version;
    this.jHipsterProperties = jHipsterProperties;
    if (jHipsterProperties.getLogging().getLogstash().isEnabled()) {
        addLogstashAppender(context);
        addContextListener(context);
    }
    if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        setMetricsMarkerLogbackFilter(context);
    }
}
 
Example #29
Source File: CacheConfiguration.java    From java-microservices-examples with Apache License 2.0 5 votes vote down vote up
private ManagementCenterConfig initializeDefaultManagementCenterConfig(JHipsterProperties jHipsterProperties) {
    ManagementCenterConfig managementCenterConfig = new ManagementCenterConfig();
    managementCenterConfig.setEnabled(jHipsterProperties.getCache().getHazelcast().getManagementCenter().isEnabled());
    managementCenterConfig.setUrl(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUrl());
    managementCenterConfig.setUpdateInterval(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUpdateInterval());
    return managementCenterConfig;
}
 
Example #30
Source File: WebConfigurerTest.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@Test
public void testUndertowHttp2Enabled() {
    props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
    UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
    webConfigurer.customize(container);
    Builder builder = Undertow.builder();
    container.getBuilderCustomizers().forEach(c -> c.customize(builder));
    OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
    assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}