From 5fe8c0f4865784388320c99dfa6c8936bef016e1 Mon Sep 17 00:00:00 2001 From: Remco Westerhoud Date: Fri, 25 Feb 2022 10:35:16 +0100 Subject: [PATCH] refactor: rename value loggers Renamed value loggers from log*Record to log*RecordValue. This makes it more clear that we are logging the value of the record in these functions. --- .../filters/logger/RecordStreamLogger.java | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/filters/src/main/java/io/camunda/zeebe/process/test/filters/logger/RecordStreamLogger.java b/filters/src/main/java/io/camunda/zeebe/process/test/filters/logger/RecordStreamLogger.java index dcb42b26..2119886c 100644 --- a/filters/src/main/java/io/camunda/zeebe/process/test/filters/logger/RecordStreamLogger.java +++ b/filters/src/main/java/io/camunda/zeebe/process/test/filters/logger/RecordStreamLogger.java @@ -39,26 +39,26 @@ public class RecordStreamLogger { public RecordStreamLogger(final RecordStreamSource recordStreamSource) { this.recordStream = RecordStream.of(recordStreamSource); - valueTypeLoggers.put(ValueType.JOB, this::logJobRecord); - valueTypeLoggers.put(ValueType.DEPLOYMENT, this::logDeploymentRecord); - valueTypeLoggers.put(ValueType.PROCESS_INSTANCE, this::logProcessInstanceRecord); - valueTypeLoggers.put(ValueType.INCIDENT, this::logIncidentRecord); - valueTypeLoggers.put(ValueType.MESSAGE, this::logMessageRecord); - valueTypeLoggers.put(ValueType.MESSAGE_SUBSCRIPTION, this::logMessageSubscriptionRecord); + valueTypeLoggers.put(ValueType.JOB, this::logJobRecordValue); + valueTypeLoggers.put(ValueType.DEPLOYMENT, this::logDeploymentRecordValue); + valueTypeLoggers.put(ValueType.PROCESS_INSTANCE, this::logProcessInstanceRecordValue); + valueTypeLoggers.put(ValueType.INCIDENT, this::logIncidentRecordValue); + valueTypeLoggers.put(ValueType.MESSAGE, this::logMessageRecordValue); + valueTypeLoggers.put(ValueType.MESSAGE_SUBSCRIPTION, this::logMessageSubscriptionRecordValue); valueTypeLoggers.put( - ValueType.PROCESS_MESSAGE_SUBSCRIPTION, this::logProcessMessageSubscriptionRecord); - valueTypeLoggers.put(ValueType.JOB_BATCH, this::logJobBatchRecord); - valueTypeLoggers.put(ValueType.TIMER, this::logTimerRecord); + ValueType.PROCESS_MESSAGE_SUBSCRIPTION, this::logProcessMessageSubscriptionRecordValue); + valueTypeLoggers.put(ValueType.JOB_BATCH, this::logJobBatchRecordValue); + valueTypeLoggers.put(ValueType.TIMER, this::logTimerRecordValue); valueTypeLoggers.put( - ValueType.MESSAGE_START_EVENT_SUBSCRIPTION, this::logMessageStartEventSubscriptionRecord); - valueTypeLoggers.put(ValueType.VARIABLE, this::logVariableRecord); - valueTypeLoggers.put(ValueType.VARIABLE_DOCUMENT, this::logVariableDocumentRecord); + ValueType.MESSAGE_START_EVENT_SUBSCRIPTION, this::logMessageStartEventSubscriptionRecordValue); + valueTypeLoggers.put(ValueType.VARIABLE, this::logVariableRecordValue); + valueTypeLoggers.put(ValueType.VARIABLE_DOCUMENT, this::logVariableDocumentRecordValue); valueTypeLoggers.put( - ValueType.PROCESS_INSTANCE_CREATION, this::logProcessInstanceCreationRecord); - valueTypeLoggers.put(ValueType.ERROR, this::logErrorRecord); - valueTypeLoggers.put(ValueType.PROCESS_INSTANCE_RESULT, this::logProcessInstanceResultRecord); - valueTypeLoggers.put(ValueType.PROCESS, this::logProcessRecord); - valueTypeLoggers.put(ValueType.PROCESS_EVENT, this::logProcessEventRecord); + ValueType.PROCESS_INSTANCE_CREATION, this::logProcessInstanceCreationRecordValue); + valueTypeLoggers.put(ValueType.ERROR, this::logErrorRecordValue); + valueTypeLoggers.put(ValueType.PROCESS_INSTANCE_RESULT, this::logProcessInstanceResultRecordValue); + valueTypeLoggers.put(ValueType.PROCESS, this::logProcessRecordValue); + valueTypeLoggers.put(ValueType.PROCESS_EVENT, this::logProcessEventRecordValue); // These records don't have any interesting extra information for the user to log valueTypeLoggers.put(ValueType.DEPLOYMENT_DISTRIBUTION, record -> ""); @@ -94,7 +94,7 @@ private String logGenericRecord(final Record record) { + String.format("%-30s| ", record.getIntent()); } - private String logJobRecord(final Record record) { + private String logJobRecordValue(final Record record) { final JobRecordValue value = (JobRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); // These fields are empty for commands @@ -106,7 +106,7 @@ private String logJobRecord(final Record record) { return joiner.toString(); } - private String logDeploymentRecord(final Record record) { + private String logDeploymentRecordValue(final Record record) { final DeploymentRecordValue value = (DeploymentRecordValue) record.getValue(); final StringBuilder stringBuilder = new StringBuilder(); if (!value.getResources().isEmpty()) { @@ -117,7 +117,7 @@ private String logDeploymentRecord(final Record record) { return stringBuilder.toString(); } - private String logProcessInstanceRecord(final Record record) { + private String logProcessInstanceRecordValue(final Record record) { final ProcessInstanceRecordValue value = (ProcessInstanceRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); joiner.add(String.format("(Element id: %s)", value.getElementId())); @@ -126,7 +126,7 @@ private String logProcessInstanceRecord(final Record record) { return joiner.toString(); } - private String logIncidentRecord(final Record record) { + private String logIncidentRecordValue(final Record record) { final IncidentRecordValue value = (IncidentRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); if (record.getRecordType().equals(RecordType.EVENT)) { @@ -136,7 +136,7 @@ private String logIncidentRecord(final Record record) { return joiner.toString(); } - private String logMessageRecord(final Record record) { + private String logMessageRecordValue(final Record record) { final MessageRecordValue value = (MessageRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); joiner.add(String.format("(Message name: %s)", value.getName())); @@ -145,7 +145,7 @@ private String logMessageRecord(final Record record) { return joiner.toString(); } - private String logMessageSubscriptionRecord(final Record record) { + private String logMessageSubscriptionRecordValue(final Record record) { final MessageSubscriptionRecordValue value = (MessageSubscriptionRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); joiner.add(String.format("(Message name: %s)", value.getMessageName())); @@ -154,7 +154,7 @@ private String logMessageSubscriptionRecord(final Record record) { return joiner.toString(); } - private String logProcessMessageSubscriptionRecord(final Record record) { + private String logProcessMessageSubscriptionRecordValue(final Record record) { final ProcessMessageSubscriptionRecordValue value = (ProcessMessageSubscriptionRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); @@ -170,7 +170,7 @@ private String logProcessMessageSubscriptionRecord(final Record record) { return joiner.toString(); } - private String logJobBatchRecord(final Record record) { + private String logJobBatchRecordValue(final Record record) { final JobBatchRecordValue value = (JobBatchRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); joiner.add(String.format("(Worker: %s)", value.getWorker())); @@ -178,7 +178,7 @@ private String logJobBatchRecord(final Record record) { return joiner.toString(); } - private String logTimerRecord(final Record record) { + private String logTimerRecordValue(final Record record) { final TimerRecordValue value = (TimerRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); joiner.add(String.format("(Element id: %s)", value.getTargetElementId())); @@ -186,7 +186,7 @@ private String logTimerRecord(final Record record) { return joiner.toString(); } - private String logMessageStartEventSubscriptionRecord(final Record record) { + private String logMessageStartEventSubscriptionRecordValue(final Record record) { final MessageStartEventSubscriptionRecordValue value = (MessageStartEventSubscriptionRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); @@ -197,7 +197,7 @@ private String logMessageStartEventSubscriptionRecord(final Record record) { return joiner.toString(); } - private String logVariableRecord(final Record record) { + private String logVariableRecordValue(final Record record) { final VariableRecordValue value = (VariableRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); joiner.add(String.format("(Name: %s)", value.getName())); @@ -205,12 +205,12 @@ private String logVariableRecord(final Record record) { return joiner.toString(); } - private String logVariableDocumentRecord(final Record record) { + private String logVariableDocumentRecordValue(final Record record) { final VariableDocumentRecordValue value = (VariableDocumentRecordValue) record.getValue(); return logVariables(value.getVariables()); } - private String logProcessInstanceCreationRecord(final Record record) { + private String logProcessInstanceCreationRecordValue(final Record record) { final ProcessInstanceCreationRecordValue value = (ProcessInstanceCreationRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); @@ -219,12 +219,12 @@ private String logProcessInstanceCreationRecord(final Record record) { return joiner.toString(); } - private String logErrorRecord(final Record record) { + private String logErrorRecordValue(final Record record) { final ErrorRecordValue value = (ErrorRecordValue) record.getValue(); return String.format("(Exception message: %s)", value.getExceptionMessage()); } - private String logProcessInstanceResultRecord(final Record record) { + private String logProcessInstanceResultRecordValue(final Record record) { final ProcessInstanceResultRecordValue value = (ProcessInstanceResultRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); @@ -233,12 +233,12 @@ private String logProcessInstanceResultRecord(final Record record) { return joiner.toString(); } - private String logProcessRecord(final Record record) { + private String logProcessRecordValue(final Record record) { final ProcessMetadataValue value = (ProcessMetadataValue) record.getValue(); return String.format("(Process: %s)", value.getResourceName()); } - private String logProcessEventRecord(final Record record) { + private String logProcessEventRecordValue(final Record record) { final ProcessEventRecordValue value = (ProcessEventRecordValue) record.getValue(); final StringJoiner joiner = new StringJoiner(", ", "", ""); joiner.add(String.format("(Target element id: %s)", value.getTargetElementId()));