Search in sources :

Example 1 with DeploymentEvent

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

the class BrokerRestartTest method shouldDeployNewWorkflowVersionAfterRestart.

@Test
// FIXME: https://github.com/zeebe-io/zeebe/issues/567
@Category(io.zeebe.UnstableTest.class)
public void shouldDeployNewWorkflowVersionAfterRestart() {
    // given
    clientRule.workflows().deploy(clientRule.getDefaultTopic()).addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
    // when
    restartBroker();
    final DeploymentEvent deploymentResult = clientRule.workflows().deploy(clientRule.getDefaultTopic()).addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
    // then
    assertThat(deploymentResult.getDeployedWorkflows().get(0).getVersion()).isEqualTo(2);
    final WorkflowInstanceEvent workflowInstanceV1 = clientRule.workflows().create(clientRule.getDefaultTopic()).bpmnProcessId("process").version(1).execute();
    final WorkflowInstanceEvent workflowInstanceV2 = clientRule.workflows().create(clientRule.getDefaultTopic()).bpmnProcessId("process").latestVersion().execute();
    // then
    assertThat(workflowInstanceV1.getVersion()).isEqualTo(1);
    assertThat(workflowInstanceV2.getVersion()).isEqualTo(2);
}
Also used : WorkflowInstanceEvent(io.zeebe.client.event.WorkflowInstanceEvent) DeploymentEvent(io.zeebe.client.event.DeploymentEvent) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 2 with DeploymentEvent

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

the class BrokerRecoveryTest method shouldDeployNewWorkflowVersionAfterRestart.

@Test
public void shouldDeployNewWorkflowVersionAfterRestart() {
    // given
    clientRule.workflows().deploy(clientRule.getDefaultTopic()).addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
    // when
    restartBroker();
    final DeploymentEvent deploymentResult = clientRule.workflows().deploy(clientRule.getDefaultTopic()).addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
    // then
    assertThat(deploymentResult.getDeployedWorkflows().get(0).getVersion()).isEqualTo(2);
    final WorkflowInstanceEvent workflowInstanceV1 = clientRule.workflows().create(clientRule.getDefaultTopic()).bpmnProcessId("process").version(1).execute();
    final WorkflowInstanceEvent workflowInstanceV2 = clientRule.workflows().create(clientRule.getDefaultTopic()).bpmnProcessId("process").latestVersion().execute();
    // then
    assertThat(workflowInstanceV1.getVersion()).isEqualTo(1);
    assertThat(workflowInstanceV2.getVersion()).isEqualTo(2);
}
Also used : WorkflowInstanceEvent(io.zeebe.client.event.WorkflowInstanceEvent) DeploymentEvent(io.zeebe.client.event.DeploymentEvent) Test(org.junit.Test)

Example 3 with DeploymentEvent

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

the class DeploymentClusteredTest method shouldDeployInCluster.

@Test
public void shouldDeployInCluster() {
    // given
    clusteringRule.createTopic("test", PARTITION_COUNT);
    // when
    final DeploymentEvent deploymentEvent = client.workflows().deploy("test").addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
    // then
    assertThat(deploymentEvent.getDeployedWorkflows().size()).isEqualTo(1);
    assertThat(deploymentEvent.getErrorMessage()).isEmpty();
}
Also used : DeploymentEvent(io.zeebe.client.event.DeploymentEvent) Test(org.junit.Test)

Example 4 with DeploymentEvent

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

the class DeploymentClusteredTest method shouldDeployOnDifferentTopics.

@Test
public void shouldDeployOnDifferentTopics() {
    // given
    clusteringRule.createTopic("test-1", PARTITION_COUNT);
    clusteringRule.createTopic("test-2", PARTITION_COUNT);
    // when
    final DeploymentEvent deploymentEventOnTest1 = client.workflows().deploy("test-2").addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
    final DeploymentEvent deploymentEventOnTest2 = client.workflows().deploy("test-2").addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
    // then
    assertThat(deploymentEventOnTest1.getDeployedWorkflows().size()).isEqualTo(1);
    assertThat(deploymentEventOnTest1.getErrorMessage()).isEmpty();
    assertThat(deploymentEventOnTest2.getDeployedWorkflows().size()).isEqualTo(1);
    assertThat(deploymentEventOnTest2.getErrorMessage()).isEmpty();
}
Also used : DeploymentEvent(io.zeebe.client.event.DeploymentEvent) Test(org.junit.Test)

Example 5 with DeploymentEvent

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

the class DeploymentClusteredTest method shouldDeployMultipleResources.

@Test
public void shouldDeployMultipleResources() {
    // given
    clusteringRule.createTopic("test", PARTITION_COUNT);
    // when
    final DeploymentEvent deploymentEvent = client.workflows().deploy("test").addWorkflowModel(WORKFLOW, "workflow.bpmn").addWorkflowModel(WORKFLOW_WITH_TASK, "workflowWithTask.bpmn").addWorkflowModel(WORKFLOW_WITH_OTHER_TASK, "workflowWithOtherTask.bpmn").execute();
    // then
    assertThat(deploymentEvent.getDeployedWorkflows().size()).isEqualTo(3);
    assertThat(deploymentEvent.getErrorMessage()).isEmpty();
}
Also used : DeploymentEvent(io.zeebe.client.event.DeploymentEvent) Test(org.junit.Test)

Aggregations

DeploymentEvent (io.zeebe.client.event.DeploymentEvent)11 Test (org.junit.Test)8 ZeebeClient (io.zeebe.client.ZeebeClient)2 ClientCommandRejectedException (io.zeebe.client.cmd.ClientCommandRejectedException)2 WorkflowInstanceEvent (io.zeebe.client.event.WorkflowInstanceEvent)2 ExecuteCommandRequest (io.zeebe.test.broker.protocol.brokerapi.ExecuteCommandRequest)2 ClientProperties (io.zeebe.client.ClientProperties)1 ZeebeClientImpl (io.zeebe.client.impl.ZeebeClientImpl)1 ClientRule (io.zeebe.client.util.ClientRule)1 Bpmn (io.zeebe.model.bpmn.Bpmn)1 WorkflowDefinition (io.zeebe.model.bpmn.instance.WorkflowDefinition)1 Protocol (io.zeebe.protocol.Protocol)1 DEPLOYMENT_EVENT (io.zeebe.protocol.clientapi.EventType.DEPLOYMENT_EVENT)1 StubBrokerRule (io.zeebe.test.broker.protocol.brokerapi.StubBrokerRule)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 java.util (java.util)1 Properties (java.util.Properties)1 Collectors (java.util.stream.Collectors)1