use of org.wildfly.swarm.spi.api.SocketBinding in project wildfly-swarm by wildfly-swarm.
the class NetworkVariableSupplier method valueOf.
protected Object valueOf(SocketBindingGroup group, String name) throws Exception {
String[] parts = name.split("\\.");
String bindingName = null;
String which = "port";
if (parts.length == 3) {
bindingName = parts[1];
} else if (parts.length == 4) {
bindingName = parts[1];
which = parts[2];
}
int offset = Integer.parseInt(group.portOffsetExpression());
for (SocketBinding socketBinding : group.socketBindings()) {
if (socketBinding.name().equals(bindingName)) {
if (which.equals("port")) {
int port = Integer.parseInt(socketBinding.portExpression());
return "" + (port + offset);
} else if (which.equals("multicast-port")) {
int port = Integer.parseInt(socketBinding.multicastPortExpression());
return "" + (port + offset);
} else if (which.equals("multicast-address")) {
String addr = socketBinding.multicastAddress();
return addr;
} else if (which.equals("host")) {
return valueOf("swarm." + socketBinding.iface() + ".host");
}
}
}
return null;
}
use of org.wildfly.swarm.spi.api.SocketBinding in project wildfly-swarm by wildfly-swarm.
the class SocketBindingGroupMarshaller method configureSocketBindings.
private void configureSocketBindings(PathAddress address, SocketBindingGroup group, List<ModelNode> list) {
List<SocketBinding> socketBindings = group.socketBindings();
for (SocketBinding each : socketBindings) {
configureSocketBinding(address, each, list);
}
List<OutboundSocketBinding> outboundSocketBindings = group.outboundSocketBindings();
for (OutboundSocketBinding each : outboundSocketBindings) {
configureSocketBinding(address, each, list);
}
}
use of org.wildfly.swarm.spi.api.SocketBinding 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