Search in sources :

Example 56 with SubscribedEvent

use of io.zeebe.test.broker.protocol.clientapi.SubscribedEvent in project zeebe by zeebe-io.

the class TaskUpdateRetriesTest method shouldRejectUpdateRetriesIfTaskLocked.

@Test
public void shouldRejectUpdateRetriesIfTaskLocked() {
    // given
    client.createTask(TASK_TYPE);
    apiRule.openTaskSubscription(TASK_TYPE).await();
    final SubscribedEvent subscribedEvent = receiveSingleSubscribedEvent();
    final Map<String, Object> event = subscribedEvent.event();
    event.put("retries", NEW_RETRIES);
    // when
    final ExecuteCommandResponse response = client.updateTaskRetries(subscribedEvent.key(), event);
    // then
    assertThat(response.getEvent()).containsEntry("state", "UPDATE_RETRIES_REJECTED");
}
Also used : ExecuteCommandResponse(io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse) SubscribedEvent(io.zeebe.test.broker.protocol.clientapi.SubscribedEvent) Test(org.junit.Test)

Example 57 with SubscribedEvent

use of io.zeebe.test.broker.protocol.clientapi.SubscribedEvent in project zeebe by zeebe-io.

the class TaskUpdateRetriesTest method shouldRejectUpdateRetriesIfTaskCompleted.

@Test
public void shouldRejectUpdateRetriesIfTaskCompleted() {
    // given
    client.createTask(TASK_TYPE);
    apiRule.openTaskSubscription(TASK_TYPE).await();
    final SubscribedEvent subscribedEvent = receiveSingleSubscribedEvent();
    Map<String, Object> event = subscribedEvent.event();
    final ExecuteCommandResponse completeResponse = client.completeTask(subscribedEvent.key(), event);
    event = completeResponse.getEvent();
    event.put("retries", NEW_RETRIES);
    // when
    final ExecuteCommandResponse response = client.updateTaskRetries(subscribedEvent.key(), event);
    // then
    assertThat(response.getEvent()).containsEntry("state", "UPDATE_RETRIES_REJECTED");
}
Also used : ExecuteCommandResponse(io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse) SubscribedEvent(io.zeebe.test.broker.protocol.clientapi.SubscribedEvent) Test(org.junit.Test)

Aggregations

SubscribedEvent (io.zeebe.test.broker.protocol.clientapi.SubscribedEvent)57 Test (org.junit.Test)55 ExecuteCommandResponse (io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse)28 EmbeddedBrokerRule (io.zeebe.broker.test.EmbeddedBrokerRule)13 ClientApiRule (io.zeebe.test.broker.protocol.clientapi.ClientApiRule)13 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)13 Rule (org.junit.Rule)13 RuleChain (org.junit.rules.RuleChain)13 IOException (java.io.IOException)11 EventType (io.zeebe.protocol.clientapi.EventType)10 TestTopicClient (io.zeebe.test.broker.protocol.clientapi.TestTopicClient)10 HashMap (java.util.HashMap)10 Before (org.junit.Before)10 Bpmn (io.zeebe.model.bpmn.Bpmn)9 WorkflowDefinition (io.zeebe.model.bpmn.instance.WorkflowDefinition)9 TestTopicClient.taskEvents (io.zeebe.test.broker.protocol.clientapi.TestTopicClient.taskEvents)8 List (java.util.List)7 Map (java.util.Map)7 ErrorType (io.zeebe.broker.incident.data.ErrorType)6 JSON_MAPPER (io.zeebe.broker.test.MsgPackUtil.JSON_MAPPER)6