Search in sources :

Example 1 with GatewayCfg

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

the class SecurityTest method shouldNotStartWithTlsEnabledAndWrongKey.

@Test
void shouldNotStartWithTlsEnabledAndWrongKey() {
    // given
    final GatewayCfg cfg = createGatewayCfg();
    cfg.getSecurity().setPrivateKeyPath(new File("/tmp/i-dont-exist.key"));
    // when
    gateway = buildGateway(cfg);
    // then
    assertThatCode(() -> gateway.start()).isInstanceOf(IllegalArgumentException.class).hasMessage("Expected to find a private key file at the provided location '%s' but none was found.", cfg.getSecurity().getPrivateKeyPath());
}
Also used : GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 2 with GatewayCfg

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

the class StandaloneGatewaySecurityTest method shouldNotStartWithTlsEnabledAndNoCert.

@Test
void shouldNotStartWithTlsEnabledAndNoCert() {
    // given
    final GatewayCfg cfg = createGatewayCfg();
    cfg.getCluster().getSecurity().setCertificateChainPath(null);
    // when
    gateway = buildGateway(cfg);
    // then
    assertThatCode(() -> gateway.run()).isInstanceOf(IllegalArgumentException.class).hasMessage("Expected to have a valid certificate chain path for cluster security, but none " + "configured");
}
Also used : GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) Test(org.junit.jupiter.api.Test)

Example 3 with GatewayCfg

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

the class StandaloneGatewaySecurityTest method shouldStartWithTlsEnabled.

@Test
void shouldStartWithTlsEnabled() throws Exception {
    // given
    final GatewayCfg cfg = createGatewayCfg();
    // when
    gateway = buildGateway(cfg);
    gateway.run();
    // then
    final var clusterAddress = new InetSocketAddress(cfg.getCluster().getHost(), cfg.getCluster().getPort());
    SslAssert.assertThat(clusterAddress).isSecuredBy(certificate);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) Test(org.junit.jupiter.api.Test)

Example 4 with GatewayCfg

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

the class StandaloneGatewaySecurityTest method shouldNotStartWithTlsEnabledAndWrongCert.

@Test
void shouldNotStartWithTlsEnabledAndWrongCert() {
    // given
    final GatewayCfg cfg = createGatewayCfg();
    cfg.getCluster().getSecurity().setCertificateChainPath(new File("/tmp/i-dont-exist.crt"));
    // when
    gateway = buildGateway(cfg);
    // then
    assertThatCode(() -> gateway.run()).isInstanceOf(IllegalArgumentException.class).hasMessage("Expected the configured cluster security certificate chain path " + "'/tmp/i-dont-exist.crt' to point to a readable file, but it does not");
}
Also used : GatewayCfg(io.camunda.zeebe.gateway.impl.configuration.GatewayCfg) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 5 with GatewayCfg

use of io.camunda.zeebe.gateway.impl.configuration.GatewayCfg 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)

Aggregations

GatewayCfg (io.camunda.zeebe.gateway.impl.configuration.GatewayCfg)48 Test (org.junit.jupiter.api.Test)30 File (java.io.File)15 Gateway (io.camunda.zeebe.gateway.Gateway)6 BrokerClientImpl (io.camunda.zeebe.gateway.impl.broker.BrokerClientImpl)6 ClusterCfg (io.camunda.zeebe.gateway.impl.configuration.ClusterCfg)6 NetworkCfg (io.camunda.zeebe.gateway.impl.configuration.NetworkCfg)6 ControlledActorClock (io.camunda.zeebe.util.sched.clock.ControlledActorClock)6 Before (org.junit.Before)6 AtomixCluster (io.atomix.cluster.AtomixCluster)3 AtomixClusterBuilder (io.atomix.cluster.AtomixClusterBuilder)3 ClusterConfig (io.atomix.cluster.ClusterConfig)3 ClusterServices (io.camunda.zeebe.broker.clustering.ClusterServices)3 ZeebeClient (io.camunda.zeebe.client.ZeebeClient)3 BrokerClusterStateImpl (io.camunda.zeebe.gateway.impl.broker.cluster.BrokerClusterStateImpl)3 BrokerTopologyManagerImpl (io.camunda.zeebe.gateway.impl.broker.cluster.BrokerTopologyManagerImpl)3 SecurityCfg (io.camunda.zeebe.gateway.impl.configuration.SecurityCfg)3 ActorScheduler (io.camunda.zeebe.util.sched.ActorScheduler)3 InetSocketAddress (java.net.InetSocketAddress)3 Test (org.junit.Test)3