diff --git a/engine/src/main/java/io/camunda/zeebe/process/test/engine/GrpcToLogStreamGateway.java b/engine/src/main/java/io/camunda/zeebe/process/test/engine/GrpcToLogStreamGateway.java index 6411a83e4..613b7d9d1 100644 --- a/engine/src/main/java/io/camunda/zeebe/process/test/engine/GrpcToLogStreamGateway.java +++ b/engine/src/main/java/io/camunda/zeebe/process/test/engine/GrpcToLogStreamGateway.java @@ -170,7 +170,7 @@ public void completeJob( final String variables = request.getVariables(); if (!variables.isEmpty()) { - jobRecord.setVariables(BufferUtil.wrapArray(MsgPackConverter.convertToMsgPack(variables))); + jobRecord.setVariables(convertVariablesToMessagePack(variables)); } writer.writeCommandWithKey(request.getJobKey(), jobRecord, recordMetadata); @@ -329,7 +329,7 @@ public void throwError( final String variables = request.getVariables(); if (!variables.isEmpty()) { - jobRecord.setVariables(BufferUtil.wrapArray(MsgPackConverter.convertToMsgPack(variables))); + jobRecord.setVariables(convertVariablesToMessagePack(variables)); } writer.writeCommandWithKey(request.getJobKey(), jobRecord, recordMetadata); @@ -356,8 +356,7 @@ public void publishMessage( messageRecord.setTimeToLive(request.getTimeToLive()); final String variables = request.getVariables(); if (!variables.isEmpty()) { - messageRecord.setVariables( - BufferUtil.wrapArray(MsgPackConverter.convertToMsgPack(variables))); + messageRecord.setVariables(convertVariablesToMessagePack(variables)); } writer.writeCommandWithoutKey(messageRecord, recordMetadata); @@ -398,8 +397,7 @@ public void setVariables( final String variables = request.getVariables(); if (!variables.isEmpty()) { - variableDocumentRecord.setVariables( - BufferUtil.wrapArray(MsgPackConverter.convertToMsgPack(variables))); + variableDocumentRecord.setVariables(convertVariablesToMessagePack(variables)); } variableDocumentRecord.setScopeKey(request.getElementInstanceKey()); @@ -504,8 +502,7 @@ public void broadcastSignal( final SignalRecord command = new SignalRecord().setSignalName(request.getSignalName()); if (!request.getVariables().isEmpty()) { - command.setVariables( - BufferUtil.wrapArray(MsgPackConverter.convertToMsgPack(request.getVariables()))); + command.setVariables(convertVariablesToMessagePack(request.getVariables())); } writer.writeCommandWithoutKey( @@ -537,9 +534,7 @@ final var record = new ProcessInstanceModificationRecord(); instruction.addVariableInstruction( new ProcessInstanceModificationVariableInstruction() .setElementId(variable.getScopeId()) - .setVariables( - BufferUtil.wrapArray( - MsgPackConverter.convertToMsgPack(variable.getVariables())))); + .setVariables(convertVariablesToMessagePack(variable.getVariables()))); } record.addActivateInstruction(instruction); @@ -576,8 +571,7 @@ private ProcessInstanceCreationRecord createProcessInstanceCreationRecord( final String variables = request.getVariables(); if (!variables.isEmpty()) { - processInstanceCreationRecord.setVariables( - BufferUtil.wrapArray(MsgPackConverter.convertToMsgPack(variables))); + processInstanceCreationRecord.setVariables(convertVariablesToMessagePack(variables)); } return processInstanceCreationRecord; } @@ -594,12 +588,16 @@ private DecisionEvaluationRecord createDecisionEvaluationRecord( final String variables = request.getVariables(); if (!variables.isEmpty()) { - record.setVariables(BufferUtil.wrapArray(MsgPackConverter.convertToMsgPack(variables))); + record.setVariables(convertVariablesToMessagePack(variables)); } return record; } + private static DirectBuffer convertVariablesToMessagePack(final String variables) { + return BufferUtil.wrapArray(MsgPackConverter.convertToMsgPack(variables)); + } + public String getAddress() { return "0.0.0.0:" + port; }