use of io.camunda.zeebe.engine.processing.streamprocessor.TypedEventImpl in project zeebe by camunda-cloud.
the class BlackListStateTest method createRecord.
private TypedEventImpl createRecord(final long processInstanceKey) {
final ProcessInstanceRecord processInstanceRecord = new ProcessInstanceRecord();
processInstanceRecord.setElementId("startEvent");
processInstanceRecord.setBpmnProcessId(wrapString("process1"));
processInstanceRecord.setProcessInstanceKey(processInstanceKey);
processInstanceRecord.setFlowScopeKey(1001L);
processInstanceRecord.setVersion(1);
processInstanceRecord.setProcessDefinitionKey(2);
processInstanceRecord.setBpmnElementType(BpmnElementType.START_EVENT);
final RecordMetadata metadata = new RecordMetadata();
metadata.intent(ProcessInstanceIntent.ACTIVATE_ELEMENT);
metadata.valueType(ValueType.PROCESS_INSTANCE);
final TypedEventImpl typedEvent = new TypedEventImpl(1);
final LoggedEvent loggedEvent = mock(LoggedEvent.class);
when(loggedEvent.getPosition()).thenReturn(1024L);
typedEvent.wrap(loggedEvent, metadata, processInstanceRecord);
return typedEvent;
}
use of io.camunda.zeebe.engine.processing.streamprocessor.TypedEventImpl in project zeebe by camunda-cloud.
the class BlackListStateTest method shouldNotCallCallbackIfNotProcessInstanceIntent.
@Test
public void shouldNotCallCallbackIfNotProcessInstanceIntent() {
// given
final ProcessInstanceRecord processInstanceRecord = new ProcessInstanceRecord();
processInstanceRecord.setElementId("PI");
processInstanceRecord.setBpmnProcessId(wrapString("process1"));
processInstanceRecord.setProcessInstanceKey(1000L);
processInstanceRecord.setVersion(1);
processInstanceRecord.setProcessDefinitionKey(2);
processInstanceRecord.setBpmnElementType(BpmnElementType.START_EVENT);
final RecordMetadata metadata = new RecordMetadata();
metadata.intent(ProcessInstanceIntent.CANCEL);
metadata.valueType(ValueType.PROCESS_INSTANCE);
final TypedEventImpl typedEvent = new TypedEventImpl(1);
final LoggedEvent loggedEvent = mock(LoggedEvent.class);
when(loggedEvent.getPosition()).thenReturn(1024L);
typedEvent.wrap(loggedEvent, metadata, processInstanceRecord);
final var consumer = mock(Consumer.class);
// when - no blacklisting
blackListState.tryToBlacklist(typedEvent, consumer);
// then
assertThat(blackListState.isOnBlacklist(typedEvent)).isFalse();
verify(consumer, never()).accept(1000L);
}
use of io.camunda.zeebe.engine.processing.streamprocessor.TypedEventImpl in project zeebe by zeebe-io.
the class BlackListStateTest method createRecord.
private TypedEventImpl createRecord(final long processInstanceKey) {
final ProcessInstanceRecord processInstanceRecord = new ProcessInstanceRecord();
processInstanceRecord.setElementId("startEvent");
processInstanceRecord.setBpmnProcessId(wrapString("process1"));
processInstanceRecord.setProcessInstanceKey(processInstanceKey);
processInstanceRecord.setFlowScopeKey(1001L);
processInstanceRecord.setVersion(1);
processInstanceRecord.setProcessDefinitionKey(2);
processInstanceRecord.setBpmnElementType(BpmnElementType.START_EVENT);
final RecordMetadata metadata = new RecordMetadata();
metadata.intent(ProcessInstanceIntent.ACTIVATE_ELEMENT);
metadata.valueType(ValueType.PROCESS_INSTANCE);
final TypedEventImpl typedEvent = new TypedEventImpl(1);
final LoggedEvent loggedEvent = mock(LoggedEvent.class);
when(loggedEvent.getPosition()).thenReturn(1024L);
typedEvent.wrap(loggedEvent, metadata, processInstanceRecord);
return typedEvent;
}
use of io.camunda.zeebe.engine.processing.streamprocessor.TypedEventImpl in project zeebe by zeebe-io.
the class BlackListStateTest method shouldNotCallCallbackIfNotProcessInstanceIntent.
@Test
public void shouldNotCallCallbackIfNotProcessInstanceIntent() {
// given
final ProcessInstanceRecord processInstanceRecord = new ProcessInstanceRecord();
processInstanceRecord.setElementId("PI");
processInstanceRecord.setBpmnProcessId(wrapString("process1"));
processInstanceRecord.setProcessInstanceKey(1000L);
processInstanceRecord.setVersion(1);
processInstanceRecord.setProcessDefinitionKey(2);
processInstanceRecord.setBpmnElementType(BpmnElementType.START_EVENT);
final RecordMetadata metadata = new RecordMetadata();
metadata.intent(ProcessInstanceIntent.CANCEL);
metadata.valueType(ValueType.PROCESS_INSTANCE);
final TypedEventImpl typedEvent = new TypedEventImpl(1);
final LoggedEvent loggedEvent = mock(LoggedEvent.class);
when(loggedEvent.getPosition()).thenReturn(1024L);
typedEvent.wrap(loggedEvent, metadata, processInstanceRecord);
final var consumer = mock(Consumer.class);
// when - no blacklisting
blackListState.tryToBlacklist(typedEvent, consumer);
// then
assertThat(blackListState.isOnBlacklist(typedEvent)).isFalse();
verify(consumer, never()).accept(1000L);
}
use of io.camunda.zeebe.engine.processing.streamprocessor.TypedEventImpl in project zeebe by camunda.
the class BlackListStateTest method shouldNotCallCallbackIfNotProcessInstanceIntent.
@Test
public void shouldNotCallCallbackIfNotProcessInstanceIntent() {
// given
final ProcessInstanceRecord processInstanceRecord = new ProcessInstanceRecord();
processInstanceRecord.setElementId("PI");
processInstanceRecord.setBpmnProcessId(wrapString("process1"));
processInstanceRecord.setProcessInstanceKey(1000L);
processInstanceRecord.setVersion(1);
processInstanceRecord.setProcessDefinitionKey(2);
processInstanceRecord.setBpmnElementType(BpmnElementType.START_EVENT);
final RecordMetadata metadata = new RecordMetadata();
metadata.intent(ProcessInstanceIntent.CANCEL);
metadata.valueType(ValueType.PROCESS_INSTANCE);
final TypedEventImpl typedEvent = new TypedEventImpl(1);
final LoggedEvent loggedEvent = mock(LoggedEvent.class);
when(loggedEvent.getPosition()).thenReturn(1024L);
typedEvent.wrap(loggedEvent, metadata, processInstanceRecord);
final var consumer = mock(Consumer.class);
// when - no blacklisting
blackListState.tryToBlacklist(typedEvent, consumer);
// then
assertThat(blackListState.isOnBlacklist(typedEvent)).isFalse();
verify(consumer, never()).accept(1000L);
}
Aggregations