Search in sources :

Example 6 with WorkflowInstanceEventImpl

use of io.zeebe.client.workflow.impl.WorkflowInstanceEventImpl in project zeebe by zeebe-io.

the class CancelWorkflowInstanceTest method shouldRejectCancelWorkflowInstance.

@Test
public void shouldRejectCancelWorkflowInstance() {
    // given
    final WorkflowInstanceEventImpl event = Events.exampleWorfklowInstance();
    event.setKey(2L);
    brokerRule.onWorkflowRequestRespondWith(2L).put("state", "CANCEL_WORKFLOW_INSTANCE_REJECTED").done().register();
    thrown.expect(ClientCommandRejectedException.class);
    thrown.expectMessage("Command for event with key 2 was rejected by broker (CANCEL_WORKFLOW_INSTANCE_REJECTED)");
    // when
    clientRule.workflows().cancel(event).execute();
}
Also used : WorkflowInstanceEventImpl(io.zeebe.client.workflow.impl.WorkflowInstanceEventImpl) Test(org.junit.Test)

Aggregations

WorkflowInstanceEventImpl (io.zeebe.client.workflow.impl.WorkflowInstanceEventImpl)6 Test (org.junit.Test)4 ExecuteCommandRequest (io.zeebe.test.broker.protocol.brokerapi.ExecuteCommandRequest)3 MsgPackConverter (io.zeebe.client.impl.data.MsgPackConverter)2 WorkflowsClient (io.zeebe.client.WorkflowsClient)1 ClientCommandRejectedException (io.zeebe.client.cmd.ClientCommandRejectedException)1 TopicEventType (io.zeebe.client.event.TopicEventType)1 ClientRule (io.zeebe.client.util.ClientRule)1 Events (io.zeebe.client.util.Events)1 EventType (io.zeebe.protocol.clientapi.EventType)1 StubBrokerRule (io.zeebe.test.broker.protocol.brokerapi.StubBrokerRule)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Before (org.junit.Before)1 Rule (org.junit.Rule)1 ExpectedException (org.junit.rules.ExpectedException)1 RuleChain (org.junit.rules.RuleChain)1