use of io.camunda.zeebe.protocol.record.ValueType in project zeebe by zeebe-io.
the class IntentTypeIdResolver method typeFromId.
@Override
public JavaType typeFromId(final DatabindContext context, final String id) {
final ValueType valueType = ValueType.valueOf(id);
final TypeFactory typeFactory = context.getTypeFactory();
return typeFactory.constructType(mapValueTypeToIntentClass(valueType));
}
use of io.camunda.zeebe.protocol.record.ValueType in project zeebe by camunda.
the class QueryApiIT method shouldRespondWithBpmnProcessIdWhenProcessInstanceFound.
@Test
public void shouldRespondWithBpmnProcessIdWhenProcessInstanceFound() {
// given
final var client = command.partitionClient(1);
client.deploy(Bpmn.createExecutableProcess("OneProcessToRuleThemAll").startEvent().serviceTask("task", b -> b.zeebeJobType("type")).endEvent().done());
final long key = client.createProcessInstance(r -> r.setBpmnProcessId("OneProcessToRuleThemAll")).getProcessInstanceKey();
assertThat(RecordingExporter.processInstanceRecords().withIntent(ProcessInstanceIntent.ELEMENT_ACTIVATING).withProcessInstanceKey(key).filterRootScope().limit(1).exists()).as("wait until the element instance actually exists in the state").isTrue();
// when
final DirectBuffer response = clientTransport.sendRequest(() -> serverAddress, new Request().partitionId(1).key(key).valueType(ValueType.PROCESS_INSTANCE), Duration.ofSeconds(10)).join();
final var result = new ExecuteQueryResponse();
result.wrap(response, 0, response.capacity());
assertThat(result).extracting(ExecuteQueryResponse::getBpmnProcessId).isEqualTo("OneProcessToRuleThemAll");
}
use of io.camunda.zeebe.protocol.record.ValueType in project zeebe by camunda.
the class TypedEventSerializationTest method createRecordTuple.
private static Tuple<TypedRecord, CopiedRecord> createRecordTuple() {
final RecordMetadata recordMetadata = new RecordMetadata();
final DeploymentIntent intent = DeploymentIntent.CREATE;
final int protocolVersion = 1;
final ValueType valueType = ValueType.DEPLOYMENT;
final RecordType recordType = RecordType.COMMAND;
final String rejectionReason = "fails";
final RejectionType rejectionType = RejectionType.INVALID_ARGUMENT;
final int requestId = 23;
final int requestStreamId = 1;
recordMetadata.intent(intent).protocolVersion(protocolVersion).valueType(valueType).recordType(recordType).rejectionReason(rejectionReason).rejectionType(rejectionType).requestId(requestId).requestStreamId(requestStreamId);
final String resourceName = "resource";
final DirectBuffer resource = wrapString("contents");
final String bpmnProcessId = "testProcess";
final long processDefinitionKey = 123;
final int processVersion = 12;
final DeploymentRecord record = new DeploymentRecord();
record.resources().add().setResourceName(wrapString(resourceName)).setResource(resource);
record.processesMetadata().add().setBpmnProcessId(wrapString(bpmnProcessId)).setKey(processDefinitionKey).setResourceName(wrapString(resourceName)).setVersion(processVersion).setChecksum(wrapString("checksum"));
final long key = 1234;
final long position = 4321;
final long sourcePosition = 231;
final long timestamp = 2191L;
final LoggedEvent loggedEvent = mock(LoggedEvent.class);
when(loggedEvent.getPosition()).thenReturn(position);
when(loggedEvent.getKey()).thenReturn(key);
when(loggedEvent.getSourceEventPosition()).thenReturn(sourcePosition);
when(loggedEvent.getTimestamp()).thenReturn(timestamp);
final TypedEventImpl typedEvent = new TypedEventImpl(0);
typedEvent.wrap(loggedEvent, recordMetadata, record);
final CopiedRecord copiedRecord = new CopiedRecord<>(record, recordMetadata, key, 0, position, sourcePosition, timestamp);
return new Tuple<>(typedEvent, copiedRecord);
}
use of io.camunda.zeebe.protocol.record.ValueType in project zeebe by camunda-cloud.
the class ValueTypeIdResolver method typeFromId.
@Override
public JavaType typeFromId(final DatabindContext context, final String id) {
final ValueType valueType = ValueType.valueOf(id);
final TypeFactory typeFactory = context.getTypeFactory();
return typeFactory.constructType(mapValueTypeToRecordValue(valueType));
}
use of io.camunda.zeebe.protocol.record.ValueType in project zeebe by camunda-cloud.
the class IntentTypeIdResolver method typeFromId.
@Override
public JavaType typeFromId(final DatabindContext context, final String id) {
final ValueType valueType = ValueType.valueOf(id);
final TypeFactory typeFactory = context.getTypeFactory();
return typeFactory.constructType(mapValueTypeToIntentClass(valueType));
}
Aggregations