Search in sources :

Example 46 with TaskEvent

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

the class TaskQueueTest method shouldCreateTask.

@Test
public void shouldCreateTask() {
    final TaskEvent taskEvent = clientRule.tasks().create(clientRule.getDefaultTopic(), "foo").addCustomHeader("k1", "a").addCustomHeader("k2", "b").payload("{ \"payload\" : 123 }").execute();
    assertThat(taskEvent).isNotNull();
    final long taskKey = taskEvent.getMetadata().getKey();
    assertThat(taskKey).isGreaterThanOrEqualTo(0);
}
Also used : TaskEvent(io.zeebe.client.event.TaskEvent) Test(org.junit.Test)

Example 47 with TaskEvent

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

the class TaskQueueTest method testCannotCompleteUnlockedTask.

@Test
@Ignore
public void testCannotCompleteUnlockedTask() {
    final TaskEvent task = clientRule.tasks().create(clientRule.getDefaultTopic(), "bar").payload("{}").execute();
    thrown.expect(BrokerErrorException.class);
    thrown.expectMessage("Task does not exist or is not locked");
    clientRule.tasks().complete(task).execute();
}
Also used : TaskEvent(io.zeebe.client.event.TaskEvent) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

TaskEvent (io.zeebe.client.event.TaskEvent)47 Test (org.junit.Test)43 RecordingTaskHandler (io.zeebe.broker.it.util.RecordingTaskHandler)20 ExpectedException (org.junit.rules.ExpectedException)10 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)9 Rule (org.junit.Rule)9 ZeebeClient (io.zeebe.client.ZeebeClient)7 ClientCommandRejectedException (io.zeebe.client.cmd.ClientCommandRejectedException)7 TaskEventImpl (io.zeebe.client.event.impl.TaskEventImpl)7 EventType (io.zeebe.protocol.clientapi.EventType)7 StubBrokerRule (io.zeebe.test.broker.protocol.brokerapi.StubBrokerRule)7 RuleChain (org.junit.rules.RuleChain)7 TopologyBroker (io.zeebe.client.clustering.impl.TopologyBroker)6 ClientRule (io.zeebe.client.util.ClientRule)5 Events (io.zeebe.client.util.Events)5 ExecuteCommandRequest (io.zeebe.test.broker.protocol.brokerapi.ExecuteCommandRequest)5 SocketAddress (io.zeebe.transport.SocketAddress)5 StandardCharsets (java.nio.charset.StandardCharsets)5 Assertions.entry (org.assertj.core.api.Assertions.entry)5 WorkflowInstanceEvent (io.zeebe.client.event.WorkflowInstanceEvent)4