congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
WorkflowInstanceRecordStream.collect
Code IndexAdd Tabnine to your IDE (free)

How to use
collect
method
in
io.zeebe.test.util.record.WorkflowInstanceRecordStream

Best Java code snippets using io.zeebe.test.util.record.WorkflowInstanceRecordStream.collect (Showing top 20 results out of 315)

origin: zeebe-io/zeebe

public List<Record<WorkflowInstanceRecordValue>> receiveElementInstancesInState(
  Intent intent, int expectedNumber) {
 return receiveWorkflowInstances()
   .withIntent(intent)
   .limit(expectedNumber)
   .collect(Collectors.toList());
}
origin: io.zeebe/zeebe-protocol-test-util

public List<Record<WorkflowInstanceRecordValue>> receiveElementInstancesInState(
  Intent intent, int expectedNumber) {
 return receiveWorkflowInstances()
   .withIntent(intent)
   .limit(expectedNumber)
   .collect(Collectors.toList());
}
origin: io.zeebe/zeebe-protocol-test-util

public List<Record<WorkflowInstanceRecordValue>> receiveElementInstancesInState(
  Intent intent, BpmnElementType elementType, int expectedNumber) {
 return receiveWorkflowInstances()
   .withIntent(intent)
   .withElementType(elementType)
   .limit(expectedNumber)
   .collect(Collectors.toList());
}
origin: zeebe-io/zeebe

@Test
public void shouldActivateTasksOnParallelBranches() {
 // given
 testClient.deploy(FORK_PROCESS);
 // when
 testClient.createWorkflowInstance(PROCESS_ID);
 // then
 final List<Record<WorkflowInstanceRecordValue>> taskEvents =
   testClient
     .receiveWorkflowInstances()
     .withIntent(WorkflowInstanceIntent.ELEMENT_ACTIVATED)
     .filter(e -> isServiceTaskInProcess(e.getValue().getElementId(), FORK_PROCESS))
     .limit(2)
     .collect(Collectors.toList());
 assertThat(taskEvents).hasSize(2);
 assertThat(taskEvents)
   .extracting(e -> e.getValue().getElementId())
   .containsExactlyInAnyOrder("task1", "task2");
 assertThat(taskEvents.get(0).getKey()).isNotEqualTo(taskEvents.get(1).getKey());
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldActivateTasksOnParallelBranches() {
 // given
 testClient.deploy(FORK_PROCESS);
 // when
 testClient.createWorkflowInstance(PROCESS_ID);
 // then
 final List<Record<WorkflowInstanceRecordValue>> taskEvents =
   testClient
     .receiveWorkflowInstances()
     .withIntent(WorkflowInstanceIntent.ELEMENT_ACTIVATED)
     .filter(e -> isServiceTaskInProcess(e.getValue().getElementId(), FORK_PROCESS))
     .limit(2)
     .collect(Collectors.toList());
 assertThat(taskEvents).hasSize(2);
 assertThat(taskEvents)
   .extracting(e -> e.getValue().getElementId())
   .containsExactlyInAnyOrder("task1", "task2");
 assertThat(taskEvents.get(0).getKey()).isNotEqualTo(taskEvents.get(1).getKey());
}
origin: zeebe-io/zeebe

@Test
public void testIntermediateMessageEventLifeCycle() {
 // given
 testClient.deploy(SINGLE_MESSAGE_WORKFLOW);
 testClient.publishMessage("message", "order-123");
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(events)
   .filteredOn(r -> r.getValue().getElementId().equals("receive-message"))
   .extracting(Record::getMetadata)
   .extracting(RecordMetadata::getIntent)
   .containsExactly(
     WorkflowInstanceIntent.EVENT_ACTIVATING,
     WorkflowInstanceIntent.EVENT_ACTIVATED,
     WorkflowInstanceIntent.EVENT_OCCURRED,
     WorkflowInstanceIntent.EVENT_TRIGGERING,
     WorkflowInstanceIntent.EVENT_TRIGGERED);
}
origin: zeebe-io/zeebe

@Test
public void testReceiveTaskLifeCycle() {
 // given
 testClient.deploy(RECEIVE_TASK_WORKFLOW);
 testClient.publishMessage("message", "order-123");
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(events)
   .filteredOn(r -> r.getValue().getElementId().equals("receive-message"))
   .extracting(Record::getMetadata)
   .extracting(RecordMetadata::getIntent)
   .containsExactly(
     WorkflowInstanceIntent.ELEMENT_READY,
     WorkflowInstanceIntent.ELEMENT_ACTIVATED,
     WorkflowInstanceIntent.EVENT_OCCURRED,
     WorkflowInstanceIntent.ELEMENT_COMPLETING,
     WorkflowInstanceIntent.ELEMENT_COMPLETED);
}
origin: io.zeebe/zeebe-broker-core

@Test
public void testIntermediateMessageEventLifeCycle() {
 // given
 testClient.deploy(SINGLE_MESSAGE_WORKFLOW);
 testClient.publishMessage("message", "order-123");
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(events)
   .filteredOn(r -> r.getValue().getElementId().equals("receive-message"))
   .extracting(Record::getMetadata)
   .extracting(RecordMetadata::getIntent)
   .containsExactly(
     WorkflowInstanceIntent.ELEMENT_ACTIVATING,
     WorkflowInstanceIntent.ELEMENT_ACTIVATED,
     WorkflowInstanceIntent.EVENT_OCCURRED,
     WorkflowInstanceIntent.ELEMENT_COMPLETING,
     WorkflowInstanceIntent.ELEMENT_COMPLETED);
}
origin: io.zeebe/zeebe-broker-core

@Test
public void testReceiveTaskLifeCycle() {
 // given
 testClient.deploy(RECEIVE_TASK_WORKFLOW);
 testClient.publishMessage("message", "order-123");
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(events)
   .filteredOn(r -> r.getValue().getElementId().equals("receive-message"))
   .extracting(Record::getMetadata)
   .extracting(RecordMetadata::getIntent)
   .containsExactly(
     WorkflowInstanceIntent.ELEMENT_ACTIVATING,
     WorkflowInstanceIntent.ELEMENT_ACTIVATED,
     WorkflowInstanceIntent.EVENT_OCCURRED,
     WorkflowInstanceIntent.ELEMENT_COMPLETING,
     WorkflowInstanceIntent.ELEMENT_COMPLETED);
}
origin: zeebe-io/zeebe

@Test
public void shouldPropagatePayloadOnSplit() {
 // given
 testClient.deploy(FORK_PROCESS);
 final byte[] payload = BufferUtil.bufferAsArray(MsgPackUtil.asMsgPack("key", "val"));
 // when
 testClient.createWorkflowInstance(PROCESS_ID, payload);
 // then
 final List<Record<WorkflowInstanceRecordValue>> taskEvents =
   testClient
     .receiveWorkflowInstances()
     .withIntent(WorkflowInstanceIntent.ELEMENT_ACTIVATED)
     .filter(e -> isServiceTaskInProcess(e.getValue().getElementId(), FORK_PROCESS))
     .limit(2)
     .collect(Collectors.toList());
 assertThat(taskEvents)
   .extracting(e -> MsgPackUtil.asMsgPackReturnArray(e.getValue().getPayload()))
   .allSatisfy(p -> p.equals(payload));
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldPropagatePayloadOnSplit() {
 // given
 testClient.deploy(FORK_PROCESS);
 final byte[] payload = BufferUtil.bufferAsArray(MsgPackUtil.asMsgPack("key", "val"));
 // when
 testClient.createWorkflowInstance(PROCESS_ID, payload);
 // then
 final List<Record<WorkflowInstanceRecordValue>> taskEvents =
   testClient
     .receiveWorkflowInstances()
     .withIntent(WorkflowInstanceIntent.ELEMENT_ACTIVATED)
     .filter(e -> isServiceTaskInProcess(e.getValue().getElementId(), FORK_PROCESS))
     .limit(2)
     .collect(Collectors.toList());
 assertThat(taskEvents)
   .extracting(e -> MsgPackUtil.asMsgPackReturnArray(e.getValue().getPayload()))
   .allSatisfy(p -> p.equals(payload));
}
origin: zeebe-io/zeebe

 @Test
 public void shouldEndScopeIfGatewayHasNoOutgoingFlows() {
  final BpmnModelInstance workflowDefinition =
    Bpmn.createExecutableProcess("workflow").startEvent().exclusiveGateway("xor").done();

  testClient.deploy(workflowDefinition);

  // when
  testClient.createWorkflowInstance("workflow", MsgPackUtil.asMsgPack("foo", 10));

  // then
  final List<Record<WorkflowInstanceRecordValue>> completedEvents =
    RecordingExporter.workflowInstanceRecords()
      .onlyEvents()
      .skipUntil(r -> r.getValue().getElementId().equals("xor"))
      .limitToWorkflowInstanceCompleted()
      .collect(Collectors.toList());

  assertThat(completedEvents)
    .extracting(r -> r.getMetadata().getIntent())
    .containsExactly(
      WorkflowInstanceIntent.GATEWAY_ACTIVATED,
      WorkflowInstanceIntent.ELEMENT_COMPLETING,
      WorkflowInstanceIntent.ELEMENT_COMPLETED);
 }
}
origin: zeebe-io/zeebe

@Test
public void shouldCreateMultipleWorkflowInstancesForDifferentBpmnProcessIds() {
 // given
 testClient.deploy(Bpmn.createExecutableProcess("foo").startEvent().endEvent().done());
 testClient.deploy(Bpmn.createExecutableProcess("bar").startEvent().endEvent().done());
 // when
 final long workflowInstanceKeyFoo = testClient.createWorkflowInstance("foo");
 final long workflowInstanceKeyBar = testClient.createWorkflowInstance("bar");
 // then
 final List<Record<WorkflowInstanceRecordValue>> workflowInstanceEvents =
   testClient
     .receiveWorkflowInstances()
     .filterRootScope()
     .withIntent(WorkflowInstanceIntent.ELEMENT_READY)
     .limit(2)
     .collect(Collectors.toList());
 assertWorkflowInstanceRecord(
   "foo", 1, workflowInstanceKeyFoo, "foo", workflowInstanceEvents.get(0));
 assertWorkflowInstanceRecord(
   "bar", 1, workflowInstanceKeyBar, "bar", workflowInstanceEvents.get(1));
}
origin: zeebe-io/zeebe

@Test
public void shouldCorrelateMessageToAllSubscriptions() {
 // given
 testClient.deploy(SINGLE_MESSAGE_WORKFLOW);
 final long workflowInstanceKey1 =
   testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 final long workflowInstanceKey2 =
   testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 // when
 testClient.publishMessage("message", "order-123");
 // then
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .withIntent(WorkflowInstanceIntent.EVENT_TRIGGERED)
     .withElementId("receive-message")
     .limit(2)
     .collect(Collectors.toList());
 assertThat(events)
   .extracting(r -> r.getValue().getWorkflowInstanceKey())
   .contains(workflowInstanceKey1, workflowInstanceKey2);
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldCreateMultipleWorkflowInstancesForDifferentBpmnProcessIds() {
 // given
 testClient.deploy(Bpmn.createExecutableProcess("foo").startEvent().endEvent().done());
 testClient.deploy(Bpmn.createExecutableProcess("bar").startEvent().endEvent().done());
 // when
 final long workflowInstanceKeyFoo = testClient.createWorkflowInstance("foo");
 final long workflowInstanceKeyBar = testClient.createWorkflowInstance("bar");
 // then
 final List<Record<WorkflowInstanceRecordValue>> workflowInstanceEvents =
   testClient
     .receiveWorkflowInstances()
     .filterRootScope()
     .withIntent(WorkflowInstanceIntent.ELEMENT_ACTIVATING)
     .limit(2)
     .collect(Collectors.toList());
 assertWorkflowInstanceRecord(
   "foo", 1, workflowInstanceKeyFoo, "foo", workflowInstanceEvents.get(0));
 assertWorkflowInstanceRecord(
   "bar", 1, workflowInstanceKeyBar, "bar", workflowInstanceEvents.get(1));
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldCorrelateMessageToAllSubscriptions() {
 // given
 testClient.deploy(SINGLE_MESSAGE_WORKFLOW);
 final long workflowInstanceKey1 =
   testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 final long workflowInstanceKey2 =
   testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 // when
 testClient.publishMessage("message", "order-123");
 // then
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .withIntent(WorkflowInstanceIntent.ELEMENT_COMPLETED)
     .withElementId("receive-message")
     .limit(2)
     .collect(Collectors.toList());
 assertThat(events)
   .extracting(r -> r.getValue().getWorkflowInstanceKey())
   .contains(workflowInstanceKey1, workflowInstanceKey2);
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldMergeParallelBranches() {
 // given
 testClient.deploy(FORK_JOIN_PROCESS);
 // when
 testClient.createWorkflowInstance(PROCESS_ID);
 // then
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(events)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSubsequence(
     tuple("flow1", WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN),
     tuple("join", WorkflowInstanceIntent.ELEMENT_ACTIVATING))
   .containsSubsequence(
     tuple("flow2", WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN),
     tuple("join", WorkflowInstanceIntent.ELEMENT_ACTIVATING))
   .containsOnlyOnce(tuple("join", WorkflowInstanceIntent.ELEMENT_ACTIVATING));
}
origin: zeebe-io/zeebe

@Test
public void shouldSplitIfDefaultFlowIsDeclaredFirst() {
 final BpmnModelInstance workflowDefinition =
   Bpmn.createExecutableProcess("workflow")
     .startEvent()
     .exclusiveGateway()
     .defaultFlow()
     .endEvent("a")
     .moveToLastExclusiveGateway()
     .condition("$.foo < 5")
     .endEvent("b")
     .done();
 testClient.deploy(workflowDefinition);
 // when
 testClient.createWorkflowInstance("workflow", MsgPackUtil.asMsgPack("foo", 10));
 // then
 final List<Record<WorkflowInstanceRecordValue>> completedEvents =
   RecordingExporter.workflowInstanceRecords()
     .limitToWorkflowInstanceCompleted()
     .withIntent(WorkflowInstanceIntent.EVENT_ACTIVATED)
     .collect(Collectors.toList());
 assertThat(completedEvents).extracting(r -> r.getValue().getElementId()).containsExactly("a");
}
origin: zeebe-io/zeebe

@Test
public void testBoundaryMessageEventLifecycle() {
 // given
 testClient.deploy(BOUNDARY_EVENTS_WORKFLOW);
 testClient.publishMessage("msg1", "order-123");
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(events)
   .extracting(r -> tuple(r.getValue().getElementId(), r.getMetadata().getIntent()))
   .containsSequence(
     tuple("task", WorkflowInstanceIntent.ELEMENT_READY),
     tuple("task", WorkflowInstanceIntent.ELEMENT_ACTIVATED),
     tuple("msg1", WorkflowInstanceIntent.EVENT_OCCURRED),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATED),
     tuple("msg1", WorkflowInstanceIntent.EVENT_TRIGGERING),
     tuple("msg1", WorkflowInstanceIntent.EVENT_TRIGGERED));
}
origin: zeebe-io/zeebe

@Test
public void shouldMergeParallelBranches() {
 // given
 testClient.deploy(FORK_JOIN_PROCESS);
 // when
 final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID);
 // then
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .limit(
       r ->
         r.getKey() == workflowInstanceKey
           && WorkflowInstanceIntent.ELEMENT_COMPLETED == r.getMetadata().getIntent())
     .collect(Collectors.toList());
 assertThat(events)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSubsequence(
     tuple("flow1", WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN),
     tuple("join", WorkflowInstanceIntent.GATEWAY_ACTIVATED))
   .containsSubsequence(
     tuple("flow2", WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN),
     tuple("join", WorkflowInstanceIntent.GATEWAY_ACTIVATED))
   .containsOnlyOnce(tuple("join", WorkflowInstanceIntent.GATEWAY_ACTIVATED));
}
io.zeebe.test.util.recordWorkflowInstanceRecordStreamcollect

Popular methods of WorkflowInstanceRecordStream

  • filter
  • limit
  • withElementId
  • withIntent
  • withWorkflowInstanceKey
  • exists
  • getFirst
  • map
  • withElementType
  • <init>
  • asList
  • count
  • asList,
  • count,
  • filterRootScope,
  • findFirst,
  • forEach,
  • limitToWorkflowInstanceCompleted,
  • onlyCommandRejections,
  • onlyCommands,
  • onlyEvents

Popular in Java

  • Reactive rest calls using spring rest template
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • notifyDataSetChanged (ArrayAdapter)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now