Search in sources :

Example 6 with ZeebeContainer

use of io.zeebe.containers.ZeebeContainer in project zeebe by zeebe-io.

the class ContainerState method start.

public void start(final boolean enableDebug, final boolean withRemoteDebugging) {
    final String contactPoint;
    broker = new ZeebeContainer(brokerImage).withEnv("ZEEBE_LOG_LEVEL", "DEBUG").withEnv("ZEEBE_BROKER_NETWORK_MAXMESSAGESIZE", "128KB").withEnv("ZEEBE_BROKER_DATA_LOGSEGMENTSIZE", "64MB").withEnv("ZEEBE_BROKER_DATA_SNAPSHOTPERIOD", "1m").withEnv("ZEEBE_BROKER_DATA_LOGINDEXDENSITY", "1").withZeebeData(volume).withNetwork(network);
    this.withRemoteDebugging = withRemoteDebugging;
    if (withRemoteDebugging) {
        RemoteDebugger.configureContainer(broker);
        LOG.info("================================================");
        LOG.info("About to start broker....");
        LOG.info("The broker will wait for a debugger to connect to it at port " + RemoteDebugger.DEFAULT_REMOTE_DEBUGGER_PORT + ". It will wait for " + RemoteDebugger.DEFAULT_START_TIMEOUT.toString());
        LOG.info("================================================");
    }
    if (enableDebug) {
        broker = broker.withEnv("ZEEBE_DEBUG", "true");
    }
    Failsafe.with(CONTAINER_START_RETRY_POLICY).run(() -> broker.self().start());
    if (gatewayImage == null) {
        contactPoint = broker.getExternalGatewayAddress();
    } else {
        gateway = new ZeebeGatewayContainer(gatewayImage).withEnv("ZEEBE_GATEWAY_CLUSTER_CONTACTPOINT", broker.getInternalClusterAddress()).withEnv("ZEEBE_LOG_LEVEL", "DEBUG").withNetwork(network);
        Failsafe.with(CONTAINER_START_RETRY_POLICY).run(() -> gateway.self().start());
        contactPoint = gateway.getExternalGatewayAddress();
    }
    client = ZeebeClient.newClientBuilder().gatewayAddress(contactPoint).usePlaintext().build();
    partitionsActuatorClient = new PartitionsActuatorClient(broker.getExternalMonitoringAddress());
}
Also used : PartitionsActuatorClient(io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient) ZeebeGatewayContainer(io.zeebe.containers.ZeebeGatewayContainer) ZeebeContainer(io.zeebe.containers.ZeebeContainer)

Example 7 with ZeebeContainer

use of io.zeebe.containers.ZeebeContainer in project zeebe by camunda-cloud.

the class BrokerMonitoringEndpointTest method setUpClass.

@BeforeClass
public static void setUpClass() {
    sutBroker = new ZeebeContainer(ZeebeTestContainerDefaults.defaultTestImage());
    sutBroker.start();
    final Integer monitoringPort = sutBroker.getMappedPort(ZeebePort.MONITORING.getPort());
    final String containerIPAddress = sutBroker.getExternalHost();
    brokerServerSpec = new RequestSpecBuilder().setContentType(ContentType.TEXT).setBaseUri("http://" + containerIPAddress).setPort(monitoringPort).addFilter(new ResponseLoggingFilter()).addFilter(new RequestLoggingFilter()).build();
}
Also used : RequestLoggingFilter(io.restassured.filter.log.RequestLoggingFilter) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RequestSpecBuilder(io.restassured.builder.RequestSpecBuilder) ResponseLoggingFilter(io.restassured.filter.log.ResponseLoggingFilter) ZeebeContainer(io.zeebe.containers.ZeebeContainer) BeforeClass(org.junit.BeforeClass)

Example 8 with ZeebeContainer

use of io.zeebe.containers.ZeebeContainer in project zeebe by camunda.

the class BrokerMonitoringEndpointTest method setUpClass.

@BeforeClass
public static void setUpClass() {
    sutBroker = new ZeebeContainer(ZeebeTestContainerDefaults.defaultTestImage());
    sutBroker.start();
    final Integer monitoringPort = sutBroker.getMappedPort(ZeebePort.MONITORING.getPort());
    final String containerIPAddress = sutBroker.getExternalHost();
    brokerServerSpec = new RequestSpecBuilder().setContentType(ContentType.TEXT).setBaseUri("http://" + containerIPAddress).setPort(monitoringPort).addFilter(new ResponseLoggingFilter()).addFilter(new RequestLoggingFilter()).build();
}
Also used : RequestLoggingFilter(io.restassured.filter.log.RequestLoggingFilter) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RequestSpecBuilder(io.restassured.builder.RequestSpecBuilder) ResponseLoggingFilter(io.restassured.filter.log.ResponseLoggingFilter) ZeebeContainer(io.zeebe.containers.ZeebeContainer) BeforeClass(org.junit.BeforeClass)

Example 9 with ZeebeContainer

use of io.zeebe.containers.ZeebeContainer in project zeebe-test-container by camunda-community-hub.

the class ZeebeClusterBuilder method createBrokers.

private void createBrokers() {
    for (int i = 0; i < brokersCount; i++) {
        final ZeebeBrokerNode<?> broker;
        if (useEmbeddedGateway) {
            final ZeebeContainer container = new ZeebeContainer(brokerImageName);
            configureGateway(container);
            broker = container;
            gateways.put(String.valueOf(i), container);
        } else {
            broker = new ZeebeBrokerContainer(brokerImageName);
        }
        configureBroker(broker, i);
        brokers.put(i, broker);
    }
    // since initial contact points has to container all known brokers, we can only configure it
    // AFTER the base broker configuration
    configureBrokerInitialContactPoints();
}
Also used : ZeebeBrokerContainer(io.zeebe.containers.ZeebeBrokerContainer) ZeebeContainer(io.zeebe.containers.ZeebeContainer)

Example 10 with ZeebeContainer

use of io.zeebe.containers.ZeebeContainer in project zeebe-test-container by camunda-community-hub.

the class RestartWithExtractedDataExampleTest method shouldRestartWithGeneratedData.

/**
 * The test here will start a process based on the definition deployed in the previous test.
 *
 * <p>The data here is copied to avoid further modifying it. We could also use a {@link
 * io.zeebe.containers.ZeebeHostData} if that was not a constraint.
 */
@Test
@Order(2)
@Timeout(value = 5, unit = TimeUnit.MINUTES)
void shouldRestartWithGeneratedData() {
    // given
    final Path dataPath = Paths.get(tempDir.resolve(DATA_DIR).toString(), ZeebeDefaults.getInstance().getDefaultDataPath());
    // when
    try (final ZeebeContainer container = new ZeebeContainer().withCopyFileToContainer(MountableFile.forHostPath(dataPath), ZeebeDefaults.getInstance().getDefaultDataPath())) {
        // when
        container.start();
        final ProcessInstanceResult result = createProcessInstance(container);
        // then
        assertThat(result).isNotNull();
    }
}
Also used : Path(java.nio.file.Path) ProcessInstanceResult(io.camunda.zeebe.client.api.response.ProcessInstanceResult) ZeebeContainer(io.zeebe.containers.ZeebeContainer) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test) Timeout(org.junit.jupiter.api.Timeout)

Aggregations

ZeebeContainer (io.zeebe.containers.ZeebeContainer)13 Test (org.junit.jupiter.api.Test)5 Timeout (org.junit.jupiter.api.Timeout)5 ZeebeClient (io.camunda.zeebe.client.ZeebeClient)3 PartitionsActuatorClient (io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient)3 RequestSpecBuilder (io.restassured.builder.RequestSpecBuilder)3 RequestLoggingFilter (io.restassured.filter.log.RequestLoggingFilter)3 ResponseLoggingFilter (io.restassured.filter.log.ResponseLoggingFilter)3 ZeebeGatewayContainer (io.zeebe.containers.ZeebeGatewayContainer)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 BeforeClass (org.junit.BeforeClass)3 ActivatedJob (io.camunda.zeebe.client.api.response.ActivatedJob)2 JobHandler (io.camunda.zeebe.client.api.worker.JobHandler)2 JobWorker (io.camunda.zeebe.client.api.worker.JobWorker)2 Bpmn (io.camunda.zeebe.model.bpmn.Bpmn)2 BpmnModelInstance (io.camunda.zeebe.model.bpmn.BpmnModelInstance)2 ZeebeClock (io.zeebe.containers.clock.ZeebeClock)2 Path (java.nio.file.Path)2 Duration (java.time.Duration)2 Instant (java.time.Instant)2