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

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

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

origin: zeebe-io/zeebe

public Record<WorkflowInstanceRecordValue> receiveElementInState(
  final String elementId, final WorkflowInstanceIntent intent) {
 return receiveWorkflowInstances().withIntent(intent).withElementId(elementId).getFirst();
}
origin: io.zeebe/zeebe-protocol-test-util

public Record<WorkflowInstanceRecordValue> receiveElementInState(
  final String elementId, final WorkflowInstanceIntent intent) {
 return receiveWorkflowInstances().withIntent(intent).withElementId(elementId).getFirst();
}
origin: zeebe-io/zeebe

public Record<WorkflowInstanceRecordValue> receiveFirstWorkflowInstanceEvent(
  final long wfInstanceKey, final String elementId, final Intent intent) {
 return receiveWorkflowInstances()
   .withIntent(intent)
   .withWorkflowInstanceKey(wfInstanceKey)
   .withElementId(elementId)
   .getFirst();
}
origin: io.zeebe/zeebe-protocol-test-util

public Record<WorkflowInstanceRecordValue> receiveFirstWorkflowInstanceEvent(
  final long wfInstanceKey, final String elementId, final Intent intent) {
 return receiveWorkflowInstances()
   .withIntent(intent)
   .withWorkflowInstanceKey(wfInstanceKey)
   .withElementId(elementId)
   .getFirst();
}
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 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

 private void assertThatWorkflowInstanceCompletedAfter(
   String elementId, WorkflowInstanceIntent intent) {
  final Record<WorkflowInstanceRecordValue> lastEvent =
    RecordingExporter.workflowInstanceRecords(intent).withElementId(elementId).getFirst();

  final Record<WorkflowInstanceRecordValue> completedEvent =
    RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
      .withElementId(PROCESS_ID)
      .getFirst();

  assertThat(completedEvent.getPosition()).isGreaterThan(lastEvent.getPosition());
 }
}
origin: io.zeebe/zeebe-broker-core

 private void assertThatWorkflowInstanceCompletedAfter(
   String elementId, WorkflowInstanceIntent intent) {
  final Record<WorkflowInstanceRecordValue> lastEvent =
    RecordingExporter.workflowInstanceRecords(intent).withElementId(elementId).getFirst();

  final Record<WorkflowInstanceRecordValue> completedEvent =
    RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
      .withElementId(PROCESS_ID)
      .getFirst();

  assertThat(completedEvent.getPosition()).isGreaterThan(lastEvent.getPosition());
 }
}
origin: zeebe-io/zeebe

@Test
public void shouldCompleteTimerEvent() {
 // given
 testClient.deploy(SINGLE_TIMER_WORKFLOW);
 testClient.createWorkflowInstance(PROCESS_ID);
 // when
 final Record<WorkflowInstanceRecordValue> activatedEvent =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_ACTIVATED)
     .withElementId("timer")
     .getFirst();
 brokerRule.getClock().addTime(Duration.ofSeconds(1));
 // then
 final Record<WorkflowInstanceRecordValue> completedEvent =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_TRIGGERED)
     .withElementId("timer")
     .getFirst();
 assertThat(completedEvent.getKey()).isEqualTo(activatedEvent.getKey());
 assertThat(completedEvent.getValue()).isEqualTo(activatedEvent.getValue());
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldCompleteTimerEvent() {
 // given
 testClient.deploy(SINGLE_TIMER_WORKFLOW);
 testClient.createWorkflowInstance(PROCESS_ID);
 // when
 final Record<WorkflowInstanceRecordValue> activatedEvent =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED)
     .withElementId("timer")
     .getFirst();
 brokerRule.getClock().addTime(Duration.ofSeconds(1));
 // then
 final Record<WorkflowInstanceRecordValue> completedEvent =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
     .withElementId("timer")
     .getFirst();
 assertThat(completedEvent.getKey()).isEqualTo(activatedEvent.getKey());
 assertThat(completedEvent.getValue()).isEqualTo(activatedEvent.getValue());
}
origin: zeebe-io/zeebe

@Test
public void shouldTriggerHandlerNodeWhenAttachedToActivity() {
 // given
 testClient.deploy(BOUNDARY_EVENT_WORKFLOW);
 testClient.createWorkflowInstance("process");
 // when
 RecordingExporter.timerRecords(TimerIntent.CREATED).getFirst();
 brokerRule.getClock().addTime(Duration.ofSeconds(10));
 // then
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_TRIGGERING)
       .withElementId("timer")
       .getFirst())
   .isNotNull();
}
origin: io.zeebe/zeebe-broker-core

@Test
public void shouldTriggerHandlerNodeWhenAttachedToActivity() {
 // given
 testClient.deploy(BOUNDARY_EVENT_WORKFLOW);
 testClient.createWorkflowInstance("process");
 // when
 RecordingExporter.timerRecords(TimerIntent.CREATED).getFirst();
 brokerRule.getClock().addTime(Duration.ofSeconds(10));
 // then
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETING)
       .withElementId("timer")
       .getFirst())
   .isNotNull();
}
origin: zeebe-io/zeebe

@Test
public void shouldRecreateATimerForTheSpecifiedAmountOfRepetitions() {
 // given
 testClient.deploy(TWO_REPS_CYCLE_WORKFLOW);
 brokerRule.getClock().pinCurrentTime();
 testClient.createWorkflowInstance(PROCESS_ID);
 // when
 assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).getFirst()).isNotNull();
 brokerRule.getClock().addTime(Duration.ofSeconds(5));
 assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).limit(2)).hasSize(2);
 brokerRule.getClock().addTime(Duration.ofSeconds(5));
 testClient.completeJobOfType("type");
 // then
 assertThat(
     RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED)
       .withElementId(PROCESS_ID)
       .exists())
   .isTrue();
 assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).limit(2).count()).isEqualTo(2);
}
origin: zeebe-io/zeebe

@Test
public void shouldCreateTimerBasedOnBoundaryEvent() {
 // given
 testClient.deploy(BOUNDARY_EVENT_WORKFLOW);
 brokerRule.getClock().pinCurrentTime();
 final long nowMs = brokerRule.getClock().getCurrentTimeInMillis();
 testClient.createWorkflowInstance("process");
 // when
 final Record<TimerRecordValue> timerCreatedRecord =
   RecordingExporter.timerRecords(TimerIntent.CREATED).getFirst();
 final Record<WorkflowInstanceRecordValue> activityRecord =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED)
     .withElementId("task")
     .getFirst();
 // then
 assertThat(timerCreatedRecord.getValue().getDueDate()).isEqualTo(nowMs + 1000);
 assertThat(timerCreatedRecord.getValue().getElementInstanceKey())
   .isEqualTo(activityRecord.getKey());
 assertThat(timerCreatedRecord.getValue().getHandlerFlowNodeId()).isEqualTo("timer");
}
origin: zeebe-io/zeebe

@Test
public void shouldWriteEntireEventOnCancel() {
 // given
 testClient.deploy(WORKFLOW);
 final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID);
 final io.zeebe.exporter.record.Record<WorkflowInstanceRecordValue> activatedEvent =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED)
     .withElementId(PROCESS_ID)
     .getFirst();
 // when
 final ExecuteCommandResponse response = cancelWorkflowInstance(workflowInstanceKey);
 // then
 MsgPackUtil.assertEqualityExcluding(
   response.getRawValue(), activatedEvent.getValue().toJson(), "payload");
 final io.zeebe.exporter.record.Record<WorkflowInstanceRecordValue> cancelingEvent =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_TERMINATING)
     .withElementId(PROCESS_ID)
     .getFirst();
 assertThat(cancelingEvent.getValue()).isEqualTo(activatedEvent.getValue());
}
origin: zeebe-io/zeebe

@Test
public void test() {
 // given
 testClient.deploy(scenario.modelInstance());
 // when
 scenario.executeInstance();
 // then
 final List<Record<WorkflowInstanceRecordValue>> records =
   RecordingExporter.workflowInstanceRecords()
     .withBpmnProcessId(scenario.processId())
     .limitToWorkflowInstanceCompleted()
     .withElementId(scenario.elementId())
     .asList();
 assertThat(records)
   .extracting(r -> r.getValue().getBpmnElementType())
   .isNotEmpty()
   .containsOnly(scenario.elementType());
}
origin: zeebe-io/zeebe

@Test
public void shouldOccurEndEvent() {
 // given
 testClient.deploy(Bpmn.createExecutableProcess(PROCESS_ID).startEvent().endEvent("foo").done());
 // when
 final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID);
 // then
 assertThat(
     RecordingExporter.workflowInstanceRecords()
       .limitToWorkflowInstanceCompleted()
       .withElementId("foo"))
   .extracting(r -> r.getMetadata().getIntent())
   .containsExactly(
     WorkflowInstanceIntent.EVENT_ACTIVATING, WorkflowInstanceIntent.EVENT_ACTIVATED);
 assertWorkflowInstanceRecord(
   workflowInstanceKey,
   "foo",
   testClient.receiveFirstWorkflowInstanceEvent(WorkflowInstanceIntent.EVENT_ACTIVATED));
}
origin: io.zeebe/zeebe-broker-core

@Test
public void test() {
 // given
 testClient.deploy(scenario.modelInstance());
 // when
 scenario.executeInstance();
 // then
 final List<Record<WorkflowInstanceRecordValue>> records =
   RecordingExporter.workflowInstanceRecords()
     .withBpmnProcessId(scenario.processId())
     .limitToWorkflowInstanceCompleted()
     .withElementId(scenario.elementId())
     .asList();
 assertThat(records)
   .extracting(r -> r.getValue().getBpmnElementType())
   .isNotEmpty()
   .containsOnly(scenario.elementType());
}
origin: zeebe-io/zeebe

@Test
public void shouldCreateIncidentIfCorrelationKeyNotFound() {
 // when
 final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID);
 final Record<WorkflowInstanceRecordValue> failureEvent =
   RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_ACTIVATED)
     .withElementId("catch")
     .getFirst();
 // then
 final Record<IncidentRecordValue> incidentRecord =
   RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst();
 Assertions.assertThat(incidentRecord.getValue())
   .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name())
   .hasErrorMessage("Failed to extract the correlation-key by '$.orderId': no value found")
   .hasBpmnProcessId(PROCESS_ID)
   .hasWorkflowInstanceKey(workflowInstanceKey)
   .hasElementId("catch")
   .hasElementInstanceKey(failureEvent.getKey())
   .hasJobKey(-1L);
}
origin: zeebe-io/zeebe

@Test
public void shouldCreateIncidentIfMessageCorrelationKeyNotFound() {
 // when
 final long workflowInstanceKey =
   testClient.createWorkflowInstance(PROCESS_ID, MsgPackUtil.asMsgPack("key-1", "k1"));
 final Record<WorkflowInstanceRecordValue> failureEvent =
   RecordingExporter.workflowInstanceRecords(failureEventIntent)
     .withElementId(elementId)
     .getFirst();
 // then
 final Record<IncidentRecordValue> incidentRecord =
   RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst();
 Assertions.assertThat(incidentRecord.getValue())
   .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name())
   .hasErrorMessage("Failed to extract the correlation-key by '$.key-2': no value found")
   .hasBpmnProcessId(PROCESS_ID)
   .hasWorkflowInstanceKey(workflowInstanceKey)
   .hasElementId(failureEvent.getValue().getElementId())
   .hasElementInstanceKey(failureEvent.getKey())
   .hasJobKey(-1L);
}
io.zeebe.test.util.recordWorkflowInstanceRecordStreamwithElementId

Popular methods of WorkflowInstanceRecordStream

  • filter
  • limit
  • 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
  • onRequestPermissionsResult (Fragment)
  • requestLocationUpdates (LocationManager)
  • getSystemService (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Collectors (java.util.stream)
  • Runner (org.openjdk.jmh.runner)
  • Top 12 Jupyter Notebook extensions
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