Tabnine Logo
WorkflowInstanceRecordStream.limit
Code IndexAdd Tabnine to your IDE (free)

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

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

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: 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, BpmnElementType elementType, int expectedNumber) {
 return receiveWorkflowInstances()
   .withIntent(intent)
   .withElementType(elementType)
   .limit(expectedNumber)
   .collect(Collectors.toList());
}
origin: io.zeebe/zb-test-util

public WorkflowInstanceRecordStream limitToWorkflowInstanceCompleted() {
 return limit(
   r ->
     r.getMetadata().getIntent() == WorkflowInstanceIntent.ELEMENT_COMPLETED
       && r.getKey() == r.getValue().getWorkflowInstanceKey());
}
origin: zeebe-io/zeebe

public WorkflowInstanceRecordStream limitToWorkflowInstanceCompleted() {
 return limit(
   r ->
     r.getMetadata().getIntent() == WorkflowInstanceIntent.ELEMENT_COMPLETED
       && r.getKey() == r.getValue().getWorkflowInstanceKey());
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldCreateMultipleWorkflowInstancesWithRepeatingTimer() {
 // when
 testClient.deployWithResponse(THREE_SEC_MODEL);
 // then
 assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).exists()).isTrue();
 brokerRule.getClock().addTime(Duration.ofSeconds(3));
 assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).exists()).isTrue();
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATING)
       .withElementId("process_3")
       .exists())
   .isTrue();
 assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).limit(2).count()).isEqualTo(2);
 brokerRule.getClock().addTime(Duration.ofSeconds(3));
 assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).limit(2).count()).isEqualTo(2);
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATING)
       .withElementId("process_3")
       .limit(2)
       .count())
   .isEqualTo(2);
}
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 shouldTakeAllOutgoingSequenceFlowsIfTriggered() {
 // given
 testClient.deploy(MULTIPLE_SEQUENCE_FLOWS);
 testClient.createWorkflowInstance(PROCESS_ID);
 // when
 testClient.receiveTimerRecord("timer", TimerIntent.CREATED);
 brokerRule.getClock().addTime(Duration.ofMinutes(1));
 awaitProcessCompleted();
 // then
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_ACTIVATED)
       .limit(2))
   .extracting(Record::getValue)
   .extracting(WorkflowInstanceRecordValue::getElementId)
   .contains("end1", "end2");
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldTakeAllOutgoingSequenceFlowsIfTriggered() {
 // given
 testClient.deploy(MULTIPLE_SEQUENCE_FLOWS);
 testClient.createWorkflowInstance(PROCESS_ID);
 // when
 testClient.receiveTimerRecord("timer", TimerIntent.CREATED);
 brokerRule.getClock().addTime(Duration.ofMinutes(1));
 awaitProcessCompleted();
 // then
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
       .withElementType(BpmnElementType.END_EVENT)
       .limit(2))
   .extracting(Record::getValue)
   .extracting(WorkflowInstanceRecordValue::getElementId)
   .contains("end1", "end2");
}
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 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 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 shouldCorrelateOnlyOneMessagePerCatchElement() {
 // given
 testClient.deploy(TWO_MESSAGES_WORKFLOW);
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "123"));
 assertThat(
     RecordingExporter.workflowInstanceSubscriptionRecords(
         WorkflowInstanceSubscriptionIntent.OPENED)
       .exists())
   .isTrue();
 // when
 testClient.publishMessage("ping", "123", asMsgPack("nr", 1));
 testClient.publishMessage("ping", "123", asMsgPack("nr", 2));
 // then
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
       .filter(r -> r.getValue().getElementId().startsWith("message"))
       .limit(2)
       .asList())
   .extracting(
     r -> tuple(r.getValue().getElementId(), r.getValue().getPayloadAsMap().get("nr")))
   .contains(tuple("message1", 1), tuple("message2", 2));
}
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: zeebe-io/zeebe

@Test
public void shouldCorrelateMessageOnlyOnceIfPublishedBefore() {
 // given
 testClient.deploy(TWO_MESSAGES_WORKFLOW);
 testClient.publishMessage("ping", "123", asMsgPack("nr", 1));
 testClient.publishMessage("ping", "123", asMsgPack("nr", 2));
 // when
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "123"));
 // then
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_TRIGGERED)
       .filter(r -> r.getValue().getElementId().startsWith("message"))
       .limit(2)
       .asList())
   .extracting(
     r -> tuple(r.getValue().getElementId(), r.getValue().getPayloadAsMap().get("nr")))
   .contains(tuple("message1", 1), tuple("message2", 2));
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldCorrelateMessageOnlyOnceIfPublishedBefore() {
 // given
 testClient.deploy(TWO_MESSAGES_WORKFLOW);
 testClient.publishMessage("ping", "123", asMsgPack("nr", 1));
 testClient.publishMessage("ping", "123", asMsgPack("nr", 2));
 // when
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "123"));
 // then
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
       .filter(r -> r.getValue().getElementId().startsWith("message"))
       .limit(2)
       .asList())
   .extracting(
     r -> tuple(r.getValue().getElementId(), r.getValue().getPayloadAsMap().get("nr")))
   .contains(tuple("message1", 1), tuple("message2", 2));
}
origin: zeebe-io/zeebe

@Test
public void shouldCompleteScopeOnParallelGateway() {
 // given
 final BpmnModelInstance process =
   Bpmn.createExecutableProcess(PROCESS_ID)
     .startEvent("start")
     .sequenceFlowId("flow1")
     .parallelGateway("fork")
     .done();
 testClient.deploy(process);
 // when
 testClient.createWorkflowInstance(PROCESS_ID);
 // then
 final Record<WorkflowInstanceRecordValue> completedEvent =
   testClient.receiveElementInState(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETED);
 final List<Record<WorkflowInstanceRecordValue>> workflowInstanceEvents =
   testClient
     .receiveWorkflowInstances()
     .limit(r -> r.getPosition() == completedEvent.getPosition())
     .collect(Collectors.toList());
 assertThat(workflowInstanceEvents)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSequence(
     tuple("fork", WorkflowInstanceIntent.GATEWAY_ACTIVATED),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETING));
}
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.recordWorkflowInstanceRecordStreamlimit

Popular methods of WorkflowInstanceRecordStream

  • filter
  • withElementId
  • withIntent
  • withWorkflowInstanceKey
  • collect
  • 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
  • getSupportFragmentManager (FragmentActivity)
  • addToBackStack (FragmentTransaction)
  • getSharedPreferences (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Permission (java.security)
    Legacy security code; do not use.
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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