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

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

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

origin: zeebe-io/zeebe

public WorkflowInstanceAssert hasPassed(String... elementIds) {
 final List<String> ids = Arrays.asList(elementIds);
 final List<String> passedElements =
   RecordingExporter.workflowInstanceRecords()
     .withWorkflowInstanceKey(workflowInstanceKey)
     .filter(intent(ELEMENT_PASSED_INTENTS))
     .filter(elementId(ids))
     .map(r -> r.getValue().getElementId())
     .limit(ids.size())
     .collect(Collectors.toList());
 if (passedElements.size() < ids.size()) {
  final List<String> notPassed = new ArrayList<>(ids);
  notPassed.removeAll(passedElements);
  failWithMessage("Expected <%s> to be passed but could not find <%s>", ids, notPassed);
 }
 return this;
}
origin: zeebe-io/zeebe

public WorkflowInstanceAssert hasEntered(String... elementIds) {
 final List<String> ids = Arrays.asList(elementIds);
 final List<String> enteredElements =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED)
     .withWorkflowInstanceKey(workflowInstanceKey)
     .filter(elementId(ids))
     .map(r -> r.getValue().getElementId())
     .limit(ids.size())
     .collect(Collectors.toList());
 if (enteredElements.size() < ids.size()) {
  final List<String> notEntered = new ArrayList<>(ids);
  notEntered.removeAll(enteredElements);
  failWithMessage("Expected <%s> to be entered but could not find <%s>", ids, notEntered);
 }
 return this;
}
origin: zeebe-io/zeebe

public WorkflowInstanceAssert hasCompleted(String... elementIds) {
 final List<String> ids = Arrays.asList(elementIds);
 final List<String> completedElements =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
     .withWorkflowInstanceKey(workflowInstanceKey)
     .filter(elementId(ids))
     .map(r -> r.getValue().getElementId())
     .limit(ids.size())
     .collect(Collectors.toList());
 if (completedElements.size() < ids.size()) {
  final List<String> notCompleted = new ArrayList<>(ids);
  notCompleted.removeAll(completedElements);
  failWithMessage("Expected <%s> to be completed but could not find <%s>", ids, notCompleted);
 }
 return this;
}
origin: io.zeebe/zeebe-test

public WorkflowInstanceAssert hasCompleted(String... elementIds) {
 final List<String> ids = Arrays.asList(elementIds);
 final List<String> completedElements =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
     .withWorkflowInstanceKey(workflowInstanceKey)
     .filter(elementId(ids))
     .map(r -> r.getValue().getElementId())
     .limit(ids.size())
     .collect(Collectors.toList());
 if (completedElements.size() < ids.size()) {
  final List<String> notCompleted = new ArrayList<>(ids);
  notCompleted.removeAll(completedElements);
  failWithMessage("Expected <%s> to be completed but could not find <%s>", ids, notCompleted);
 }
 return this;
}
origin: io.zeebe/zeebe-test

public WorkflowInstanceAssert hasEntered(String... elementIds) {
 final List<String> ids = Arrays.asList(elementIds);
 final List<String> enteredElements =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED)
     .withWorkflowInstanceKey(workflowInstanceKey)
     .filter(elementId(ids))
     .map(r -> r.getValue().getElementId())
     .limit(ids.size())
     .collect(Collectors.toList());
 if (enteredElements.size() < ids.size()) {
  final List<String> notEntered = new ArrayList<>(ids);
  notEntered.removeAll(enteredElements);
  failWithMessage("Expected <%s> to be entered but could not find <%s>", ids, notEntered);
 }
 return this;
}
origin: io.zeebe/zeebe-test

public WorkflowInstanceAssert hasPassed(String... elementIds) {
 final List<String> ids = Arrays.asList(elementIds);
 final List<String> passedElements =
   RecordingExporter.workflowInstanceRecords()
     .withWorkflowInstanceKey(workflowInstanceKey)
     .filter(intent(ELEMENT_PASSED_INTENTS))
     .filter(elementId(ids))
     .map(r -> r.getValue().getElementId())
     .limit(ids.size())
     .collect(Collectors.toList());
 if (passedElements.size() < ids.size()) {
  final List<String> notPassed = new ArrayList<>(ids);
  notPassed.removeAll(passedElements);
  failWithMessage("Expected <%s> to be passed but could not find <%s>", ids, notPassed);
 }
 return this;
}
origin: zeebe-io/zeebe

 /**
  * @return stream with only records for the workflow instance (i.e. root scope of the instance)
  */
 public WorkflowInstanceRecordStream filterRootScope() {
  return filter(r -> r.getKey() == r.getValue().getWorkflowInstanceKey());
 }
}
origin: io.zeebe/zb-test-util

 /**
  * @return stream with only records for the workflow instance (i.e. root scope of the instance)
  */
 public WorkflowInstanceRecordStream filterRootScope() {
  return filter(r -> r.getKey() == r.getValue().getWorkflowInstanceKey());
 }
}
origin: zeebe-io/zeebe

/**
 * Blocks and wait until the workflow identified by the key has been completed.
 *
 * @param workflowInstanceKey ID of the workflow
 */
public void awaitWorkflowCompletion(long workflowInstanceKey) {
 TestUtil.waitUntil(
   () ->
     workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
       .filter(r -> r.getKey() == workflowInstanceKey)
       .exists());
}
origin: io.zeebe/zeebe-test

/**
 * Blocks and wait until the workflow identified by the key has been completed.
 *
 * @param workflowInstanceKey ID of the workflow
 */
public void awaitWorkflowCompletion(long workflowInstanceKey) {
 TestUtil.waitUntil(
   () ->
     workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
       .filter(r -> r.getKey() == workflowInstanceKey)
       .exists());
}
origin: zeebe-io/zeebe

public WorkflowInstanceAssert hasPayload(String key, Object expectedValue) {
 final Optional<Record<WorkflowInstanceRecordValue>> record =
   RecordingExporter.workflowInstanceRecords()
     .withWorkflowInstanceKey(workflowInstanceKey)
     .withKey(workflowInstanceKey)
     .filter(intent(INSTANCE_ENDED_INTENTS))
     .findFirst();
 if (record.isPresent()) {
  hasPayload(record.get(), key, expectedValue);
 } else {
  failWithMessage("Expected workflow instance to contain payload but instance is not ended");
 }
 return this;
}
origin: zeebe-io/zeebe

public WorkflowInstanceAssert hasElementPayload(
  String elementId, String key, Object expectedValue) {
 final Optional<Record<WorkflowInstanceRecordValue>> record =
   RecordingExporter.workflowInstanceRecords()
     .withWorkflowInstanceKey(workflowInstanceKey)
     .withElementId(elementId)
     .filter(r -> ELEMENT_PASSED_INTENTS.contains(r.getMetadata().getIntent()))
     .findFirst();
 if (record.isPresent()) {
  hasPayload(record.get(), key, expectedValue);
 } else {
  failWithMessage("Expected <%s> to contain payload but element was not passed", elementId);
 }
 return this;
}
origin: io.zeebe/zeebe-test

public WorkflowInstanceAssert hasPayload(String key, Object expectedValue) {
 final Optional<Record<WorkflowInstanceRecordValue>> record =
   RecordingExporter.workflowInstanceRecords()
     .withWorkflowInstanceKey(workflowInstanceKey)
     .withKey(workflowInstanceKey)
     .filter(intent(INSTANCE_ENDED_INTENTS))
     .findFirst();
 if (record.isPresent()) {
  hasPayload(record.get(), key, expectedValue);
 } else {
  failWithMessage("Expected workflow instance to contain payload but instance is not ended");
 }
 return this;
}
origin: io.zeebe/zeebe-test

public WorkflowInstanceAssert hasElementPayload(
  String elementId, String key, Object expectedValue) {
 final Optional<Record<WorkflowInstanceRecordValue>> record =
   RecordingExporter.workflowInstanceRecords()
     .withWorkflowInstanceKey(workflowInstanceKey)
     .withElementId(elementId)
     .filter(r -> ELEMENT_PASSED_INTENTS.contains(r.getMetadata().getIntent()))
     .findFirst();
 if (record.isPresent()) {
  hasPayload(record.get(), key, expectedValue);
 } else {
  failWithMessage("Expected <%s> to contain payload but element was not passed", elementId);
 }
 return this;
}
origin: zeebe-io/zeebe

public WorkflowInstanceAssert isEnded() {
 final boolean isEnded =
   exists(
     RecordingExporter.workflowInstanceRecords()
       .withWorkflowInstanceKey(workflowInstanceKey)
       .withKey(workflowInstanceKey)
       .filter(intent(INSTANCE_ENDED_INTENTS)));
 if (!isEnded) {
  failWithMessage("Expected workflow instance to be <ended> but was <active>");
 }
 return this;
}
origin: io.zeebe/zeebe-test

public WorkflowInstanceAssert isEnded() {
 final boolean isEnded =
   exists(
     RecordingExporter.workflowInstanceRecords()
       .withWorkflowInstanceKey(workflowInstanceKey)
       .withKey(workflowInstanceKey)
       .filter(intent(INSTANCE_ENDED_INTENTS)));
 if (!isEnded) {
  failWithMessage("Expected workflow instance to be <ended> but was <active>");
 }
 return this;
}
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 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 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 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));
}
io.zeebe.test.util.recordWorkflowInstanceRecordStreamfilter

Popular methods of WorkflowInstanceRecordStream

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

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • getExternalFilesDir (Context)
  • getApplicationContext (Context)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top Vim 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