Search in sources :

Example 6 with UndertowFraction

use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.

the class UndertowSocketBindingsCustomizerTest method testDefaultPorts.

@Test
public void testDefaultPorts() {
    UndertowSocketBindingsCustomizer customizer = new UndertowSocketBindingsCustomizer();
    customizer.fraction = new UndertowFraction();
    customizer.group = new SocketBindingGroup("standard-sockets", "public", "0");
    customizer.customize();
    assertThat(customizer.group.socketBindings()).hasSize(2);
    SocketBinding http = customizer.group.socketBinding("http");
    assertThat(http).isNotNull();
    assertThat(http.portExpression()).isEqualTo("8080");
    SocketBinding https = customizer.group.socketBinding("https");
    assertThat(https).isNotNull();
    assertThat(https.portExpression()).isEqualTo("8443");
}
Also used : SocketBinding(org.wildfly.swarm.spi.api.SocketBinding) UndertowFraction(org.wildfly.swarm.undertow.UndertowFraction) SocketBindingGroup(org.wildfly.swarm.spi.api.SocketBindingGroup) Test(org.junit.Test)

Example 7 with UndertowFraction

use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.

the class UndertowSocketBindingsCustomizerTest method testExplicitHttpsPort.

@Test
public void testExplicitHttpsPort() {
    UndertowSocketBindingsCustomizer customizer = new UndertowSocketBindingsCustomizer();
    customizer.fraction = new UndertowFraction();
    customizer.fraction.httpsPort(8675);
    customizer.group = new SocketBindingGroup("standard-sockets", "public", "0");
    customizer.customize();
    assertThat(customizer.group.socketBindings()).hasSize(2);
    SocketBinding http = customizer.group.socketBinding("http");
    assertThat(http).isNotNull();
    assertThat(http.portExpression()).isEqualTo("8080");
    SocketBinding https = customizer.group.socketBinding("https");
    assertThat(https).isNotNull();
    assertThat(https.portExpression()).isEqualTo("8675");
}
Also used : SocketBinding(org.wildfly.swarm.spi.api.SocketBinding) UndertowFraction(org.wildfly.swarm.undertow.UndertowFraction) SocketBindingGroup(org.wildfly.swarm.spi.api.SocketBindingGroup) Test(org.junit.Test)

Example 8 with UndertowFraction

use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.

the class InUndertowInstaller method customize.

public void customize() {
    if (!undertowFractionInstance.isUnsatisfied()) {
        UndertowFraction undertow = undertowFractionInstance.get();
        if (undertow.subresources().filterConfiguration() == null) {
            undertow.filterConfiguration();
        }
        undertow.subresources().filterConfiguration().customFilter("wfs-mp-metrics", customFilter -> {
            customFilter.module("org.wildfly.swarm.microprofile.metrics:runtime");
            customFilter.className("org.wildfly.swarm.microprofile.metrics.runtime.MetricsHttpHandler");
        });
        undertow.subresources().server("default-server").subresources().host("default-host").filterRef("wfs-mp-metrics", f -> {
            f.priority(101);
        });
    } else {
        throw new RuntimeException("The monitor fraction requires the undertow fraction!");
    }
}
Also used : UndertowFraction(org.wildfly.swarm.undertow.UndertowFraction)

Example 9 with UndertowFraction

use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.

the class UndertowFilterCustomizer method customize.

@Override
public void customize() {
    if (!undertowFractionInstance.isUnsatisfied()) {
        UndertowFraction undertow = undertowFractionInstance.get();
        if (undertow.subresources().filterConfiguration() == null) {
            undertow.filterConfiguration();
        }
        undertow.subresources().filterConfiguration().customFilter("wfs-monitor", customFilter -> {
            customFilter.module("org.wildfly.swarm.monitor:runtime");
            customFilter.className("org.wildfly.swarm.monitor.runtime.SecureHttpContexts");
        });
        undertow.subresources().server("default-server").subresources().host("default-host").filterRef("wfs-monitor", f -> {
            f.priority(100);
        });
    } else {
        throw new RuntimeException("The monitor fraction requires the undertow fraction!");
    }
}
Also used : UndertowFraction(org.wildfly.swarm.undertow.UndertowFraction)

Example 10 with UndertowFraction

use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.

the class CertInfoProducerTest method testDefaults.

@Test
public void testDefaults() {
    CertInfoProducer producer = new CertInfoProducer();
    producer.undertow = new UndertowFraction();
    CertInfo certInfo = producer.produceCertInfo();
    assertThat(certInfo).isNotNull();
    assertThat(certInfo.generateSelfSignedCertificateHost()).isNull();
}
Also used : CertInfo(org.wildfly.swarm.undertow.descriptors.CertInfo) UndertowFraction(org.wildfly.swarm.undertow.UndertowFraction) Test(org.junit.Test)

Aggregations

UndertowFraction (org.wildfly.swarm.undertow.UndertowFraction)13 Test (org.junit.Test)9 CertInfo (org.wildfly.swarm.undertow.descriptors.CertInfo)4 Server (org.wildfly.swarm.config.undertow.Server)3 SocketBinding (org.wildfly.swarm.spi.api.SocketBinding)3 SocketBindingGroup (org.wildfly.swarm.spi.api.SocketBindingGroup)3 Category (org.junit.experimental.categories.Category)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 ManagementCoreService (org.wildfly.swarm.config.ManagementCoreService)1 SecurityRealm (org.wildfly.swarm.config.management.SecurityRealm)1 HttpsListener (org.wildfly.swarm.config.undertow.server.HttpsListener)1