Search in sources :

Example 31 with WorkflowInstanceEvent

use of io.zeebe.client.event.WorkflowInstanceEvent in project zeebe by zeebe-io.

the class DeploymentClusteredTest method shouldCreateInstancesOnRestartedBroker.

@Test
public void shouldCreateInstancesOnRestartedBroker() {
    // given
    final int workCount = PARTITION_COUNT;
    final Topic topic = clusteringRule.createTopic("test", PARTITION_COUNT);
    clusteringRule.stopBroker(ClusteringRule.BROKER_3_CLIENT_ADDRESS);
    client.workflows().deploy("test").addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
    // when
    clusteringRule.restartBroker(ClusteringRule.BROKER_3_CLIENT_ADDRESS);
    // then create wf instance on each partition
    final Integer[] partitionIds = topic.getPartitions().stream().mapToInt(p -> p.getId()).boxed().toArray(Integer[]::new);
    for (int partition : partitionIds) {
        final WorkflowInstanceEvent workflowInstanceEvent = createWorkflowInstanceOnPartition("test", partition, "process");
        assertThat(workflowInstanceEvent.getState()).isEqualTo("WORKFLOW_INSTANCE_CREATED");
    }
}
Also used : WorkflowInstanceEvent(io.zeebe.client.event.WorkflowInstanceEvent) Topic(io.zeebe.client.topic.Topic) Test(org.junit.Test)

Aggregations

WorkflowInstanceEvent (io.zeebe.client.event.WorkflowInstanceEvent)31 Test (org.junit.Test)14 ClientRule (io.zeebe.broker.it.ClientRule)7 EmbeddedBrokerRule (io.zeebe.broker.it.EmbeddedBrokerRule)7 TopicEventRecorder (io.zeebe.broker.it.util.TopicEventRecorder)7 Bpmn (io.zeebe.model.bpmn.Bpmn)7 WorkflowDefinition (io.zeebe.model.bpmn.instance.WorkflowDefinition)7 TestUtil.waitUntil (io.zeebe.test.util.TestUtil.waitUntil)7 Duration (java.time.Duration)7 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)7 RuleChain (org.junit.rules.RuleChain)7 RecordingTaskHandler (io.zeebe.broker.it.util.RecordingTaskHandler)6 WorkflowsClient (io.zeebe.client.WorkflowsClient)6 TaskEvent (io.zeebe.client.event.TaskEvent)6 ExpectedException (org.junit.rules.ExpectedException)6 TopicEventRecorder.wfInstanceEvent (io.zeebe.broker.it.util.TopicEventRecorder.wfInstanceEvent)5 org.junit (org.junit)5 ClientCommandRejectedException (io.zeebe.client.cmd.ClientCommandRejectedException)4 DeploymentEvent (io.zeebe.client.event.DeploymentEvent)4 TasksClient (io.zeebe.client.TasksClient)3