Search in sources :

Example 1 with NetworkCfg

use of io.camunda.zeebe.gateway.impl.configuration.NetworkCfg in project zeebe by camunda.

the class NetworkCfgTest method shouldNotFailOnLongHostName.

@Test
public void shouldNotFailOnLongHostName() {
    // given
    final var port = 1000;
    final var hostName = RandomString.make(139);
    final var networkCfg = new NetworkCfg();
    networkCfg.setPort(port);
    // when
    networkCfg.setHost(hostName);
    final var socketAddress = networkCfg.toSocketAddress();
    // then
    assertThat(socketAddress).isEqualTo(new InetSocketAddress(hostName, port));
}
Also used : NetworkCfg(io.camunda.zeebe.gateway.impl.configuration.NetworkCfg) InetSocketAddress(java.net.InetSocketAddress) Test(org.junit.Test)

Example 2 with NetworkCfg

use of io.camunda.zeebe.gateway.impl.configuration.NetworkCfg in project zeebe by camunda.

the class UnavailableBrokersTest method setUp.

@BeforeAll
static void setUp() throws IOException {
    final NetworkCfg networkCfg = new NetworkCfg().setPort(SocketUtil.getNextAddress().getPort());
    final GatewayCfg config = new GatewayCfg().setNetwork(networkCfg);
    config.init(InetAddress.getLocalHost().getHostName());
    cluster = AtomixCluster.builder().build();
    cluster.start();
    actorScheduler = ActorScheduler.newActorScheduler().build();
    actorScheduler.start();
    gateway = new Gateway(new GatewayCfg().setNetwork(networkCfg), cluster.getMessagingService(), cluster.getMembershipService(), cluster.getEventService(), actorScheduler);
    gateway.start();
    final String gatewayAddress = NetUtil.toSocketAddressString(networkCfg.toSocketAddress());
    client = ZeebeClient.newClientBuilder().gatewayAddress(gatewayAddress).usePlaintext().build();
}
Also used : NetworkCfg(io.camunda.zeebe.gateway.impl.configuration.NetworkCfg) Gateway(io.camunda.zeebe.gateway.Gateway) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with NetworkCfg

use of io.camunda.zeebe.gateway.impl.configuration.NetworkCfg in project zeebe by zeebe-io.

the class UnavailableBrokersTest method setUp.

@BeforeAll
static void setUp() throws IOException {
    final NetworkCfg networkCfg = new NetworkCfg().setPort(SocketUtil.getNextAddress().getPort());
    final GatewayCfg config = new GatewayCfg().setNetwork(networkCfg);
    config.init(InetAddress.getLocalHost().getHostName());
    cluster = AtomixCluster.builder().build();
    cluster.start();
    actorScheduler = ActorScheduler.newActorScheduler().build();
    actorScheduler.start();
    gateway = new Gateway(new GatewayCfg().setNetwork(networkCfg), cluster.getMessagingService(), cluster.getMembershipService(), cluster.getEventService(), actorScheduler);
    gateway.start().join();
    final String gatewayAddress = NetUtil.toSocketAddressString(networkCfg.toSocketAddress());
    client = ZeebeClient.newClientBuilder().gatewayAddress(gatewayAddress).usePlaintext().build();
}
Also used : NetworkCfg(io.camunda.zeebe.gateway.impl.configuration.NetworkCfg) Gateway(io.camunda.zeebe.gateway.Gateway) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with NetworkCfg

use of io.camunda.zeebe.gateway.impl.configuration.NetworkCfg in project zeebe by camunda-cloud.

the class StandaloneGatewaySecurityTest method createGatewayCfg.

private GatewayCfg createGatewayCfg() {
    final var gatewayAddress = SocketUtil.getNextAddress();
    final var clusterAddress = SocketUtil.getNextAddress();
    return new GatewayCfg().setNetwork(new NetworkCfg().setHost(gatewayAddress.getHostName()).setPort(gatewayAddress.getPort())).setCluster(new ClusterCfg().setHost(clusterAddress.getHostName()).setPort(clusterAddress.getPort()).setSecurity(new SecurityCfg().setEnabled(true).setCertificateChainPath(certificate.certificate()).setPrivateKeyPath(certificate.privateKey())));
}
Also used : NetworkCfg(io.camunda.zeebe.gateway.impl.configuration.NetworkCfg) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) ClusterCfg(io.camunda.zeebe.gateway.impl.configuration.ClusterCfg) SecurityCfg(io.camunda.zeebe.gateway.impl.configuration.SecurityCfg)

Example 5 with NetworkCfg

use of io.camunda.zeebe.gateway.impl.configuration.NetworkCfg in project zeebe by zeebe-io.

the class StandaloneGatewaySecurityTest method createGatewayCfg.

private GatewayCfg createGatewayCfg() {
    final var gatewayAddress = SocketUtil.getNextAddress();
    final var clusterAddress = SocketUtil.getNextAddress();
    return new GatewayCfg().setNetwork(new NetworkCfg().setHost(gatewayAddress.getHostName()).setPort(gatewayAddress.getPort())).setCluster(new ClusterCfg().setHost(clusterAddress.getHostName()).setPort(clusterAddress.getPort()).setSecurity(new SecurityCfg().setEnabled(true).setCertificateChainPath(certificate.certificate()).setPrivateKeyPath(certificate.privateKey())));
}
Also used : NetworkCfg(io.camunda.zeebe.gateway.impl.configuration.NetworkCfg) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) ClusterCfg(io.camunda.zeebe.gateway.impl.configuration.ClusterCfg) SecurityCfg(io.camunda.zeebe.gateway.impl.configuration.SecurityCfg)

Aggregations

NetworkCfg (io.camunda.zeebe.gateway.impl.configuration.NetworkCfg)9 GatewayCfg (io.camunda.zeebe.gateway.impl.configuration.GatewayCfg)6 Gateway (io.camunda.zeebe.gateway.Gateway)3 ClusterCfg (io.camunda.zeebe.gateway.impl.configuration.ClusterCfg)3 SecurityCfg (io.camunda.zeebe.gateway.impl.configuration.SecurityCfg)3 InetSocketAddress (java.net.InetSocketAddress)3 BeforeAll (org.junit.jupiter.api.BeforeAll)3 Test (org.junit.jupiter.api.Test)2 Test (org.junit.Test)1