use of org.wildfly.swarm.spi.api.SocketBindingGroup 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");
}
use of org.wildfly.swarm.spi.api.SocketBindingGroup in project wildfly-swarm by wildfly-swarm.
the class SocketBindingGroupExtension method afterBeanDiscovery.
@SuppressWarnings("unused")
void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager beanManager) throws Exception {
List<SimpleKey> configuredGroups = this.configView.simpleSubkeys(ROOT);
for (SimpleKey groupName : configuredGroups) {
Set<Bean<?>> groups = beanManager.getBeans(SocketBindingGroup.class, AnyLiteral.INSTANCE);
AtomicBoolean producerRequired = new AtomicBoolean(false);
if (groups.stream().noneMatch(e -> e.getQualifiers().stream().anyMatch(anno -> anno instanceof Named && ((Named) anno).value().equals(groupName)))) {
SocketBindingGroup group = new SocketBindingGroup(groupName.name(), null, "0");
applyConfiguration(group);
if (producerRequired.get()) {
CommonBean<SocketBindingGroup> interfaceBean = CommonBeanBuilder.newBuilder(SocketBindingGroup.class).beanClass(SocketBindingGroupExtension.class).scope(ApplicationScoped.class).addQualifier(AnyLiteral.INSTANCE).addQualifier(new NamedLiteral(group.name())).createSupplier(() -> group).addType(SocketBindingGroup.class).addType(Object.class).build();
abd.addBean(interfaceBean);
}
}
}
}
use of org.wildfly.swarm.spi.api.SocketBindingGroup in project wildfly-swarm by wildfly-swarm.
the class UndertowSocketBindingsCustomizerTest method testExplicitHttpPort.
@Test
public void testExplicitHttpPort() {
UndertowSocketBindingsCustomizer customizer = new UndertowSocketBindingsCustomizer();
customizer.fraction = new UndertowFraction();
customizer.fraction.httpPort(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("8675");
SocketBinding https = customizer.group.socketBinding("https");
assertThat(https).isNotNull();
assertThat(https.portExpression()).isEqualTo("8443");
}
Aggregations