use of io.camunda.zeebe.protocol.record.value.VariableDocumentRecordValue in project zeebe by camunda.
the class UpdateVariableDocumentProcessorTest method shouldRejectOnMsgpackReadError.
@Test
public void shouldRejectOnMsgpackReadError() {
// given
final MutableDirectBuffer badDocument = new UnsafeBuffer(asMsgPack("{\"a\": 1}"));
// overwrite string header type
badDocument.putByte(1, (byte) 0);
final long processInstanceKey = startProcessWithVariables(Map.of());
// when
final Record<VariableDocumentRecordValue> result = ENGINE.variables().ofScope(processInstanceKey).withDocument(badDocument).expectRejection().update();
// then
assertThat(result).hasRecordType(RecordType.COMMAND_REJECTION).hasRejectionType(RejectionType.INVALID_ARGUMENT);
}
use of io.camunda.zeebe.protocol.record.value.VariableDocumentRecordValue in project zeebe by camunda.
the class SetVariablesTest method shouldSetVariables.
@Test
public void shouldSetVariables() {
// given
final long processInstanceKey = CLIENT_RULE.createProcessInstance(processDefinitionKey);
// when
final SetVariablesResponse response = CLIENT_RULE.getClient().newSetVariablesCommand(processInstanceKey).variables(Map.of("foo", "bar")).send().join();
// then
ZeebeAssertHelper.assertVariableDocumentUpdated((variableDocument) -> assertThat(variableDocument.getVariables()).containsOnly(entry("foo", "bar")));
final Record<VariableDocumentRecordValue> record = RecordingExporter.variableDocumentRecords(VariableDocumentIntent.UPDATED).getFirst();
assertThat(response.getKey()).isEqualTo(record.getKey());
}
use of io.camunda.zeebe.protocol.record.value.VariableDocumentRecordValue in project zeebe by camunda-cloud.
the class SetVariablesTest method shouldSetVariables.
@Test
public void shouldSetVariables() {
// given
final long processInstanceKey = CLIENT_RULE.createProcessInstance(processDefinitionKey);
// when
final SetVariablesResponse response = CLIENT_RULE.getClient().newSetVariablesCommand(processInstanceKey).variables(Map.of("foo", "bar")).send().join();
// then
ZeebeAssertHelper.assertVariableDocumentUpdated((variableDocument) -> assertThat(variableDocument.getVariables()).containsOnly(entry("foo", "bar")));
final Record<VariableDocumentRecordValue> record = RecordingExporter.variableDocumentRecords(VariableDocumentIntent.UPDATED).getFirst();
assertThat(response.getKey()).isEqualTo(record.getKey());
}
use of io.camunda.zeebe.protocol.record.value.VariableDocumentRecordValue in project zeebe by zeebe-io.
the class SetVariablesTest method shouldSetVariables.
@Test
public void shouldSetVariables() {
// given
final long processInstanceKey = CLIENT_RULE.createProcessInstance(processDefinitionKey);
// when
final SetVariablesResponse response = CLIENT_RULE.getClient().newSetVariablesCommand(processInstanceKey).variables(Map.of("foo", "bar")).send().join();
// then
ZeebeAssertHelper.assertVariableDocumentUpdated((variableDocument) -> assertThat(variableDocument.getVariables()).containsOnly(entry("foo", "bar")));
final Record<VariableDocumentRecordValue> record = RecordingExporter.variableDocumentRecords(VariableDocumentIntent.UPDATED).getFirst();
assertThat(response.getKey()).isEqualTo(record.getKey());
}
use of io.camunda.zeebe.protocol.record.value.VariableDocumentRecordValue in project zeebe by zeebe-io.
the class UpdateVariableDocumentProcessorTest method shouldRejectOnMsgpackReadError.
@Test
public void shouldRejectOnMsgpackReadError() {
// given
final MutableDirectBuffer badDocument = new UnsafeBuffer(asMsgPack("{\"a\": 1}"));
// overwrite string header type
badDocument.putByte(1, (byte) 0);
final long processInstanceKey = startProcessWithVariables(Map.of());
// when
final Record<VariableDocumentRecordValue> result = ENGINE.variables().ofScope(processInstanceKey).withDocument(badDocument).expectRejection().update();
// then
assertThat(result).hasRecordType(RecordType.COMMAND_REJECTION).hasRejectionType(RejectionType.INVALID_ARGUMENT);
}
Aggregations