Skip to content

Commit

Permalink
release(v1.6.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed May 7, 2024
1 parent 434e3a4 commit 25f6b4f
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 29 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<name>Zeebe Exporter Protobuf Schema</name>
<groupId>io.zeebe</groupId>
<artifactId>zeebe-exporter-protobuf</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.6.0</version>
<packaging>jar</packaging>

<url>https://github.com/camunda-community-hub/zeebe-exporter-protobuf</url>
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/io/zeebe/exporter/proto/ProtobufUtil.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
/*
* Copyright © 2019 camunda services GmbH (info@camunda.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.zeebe.exporter.proto;

import com.google.protobuf.Struct;
import com.google.protobuf.Value;

import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
Expand Down
47 changes: 25 additions & 22 deletions src/main/java/io/zeebe/exporter/proto/RecordTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public final class RecordTransformer {
TRANSFORMERS.put(ValueType.FORM, RecordTransformer::toFormRecord);
TRANSFORMERS.put(ValueType.RESOURCE_DELETION, RecordTransformer::toResourceDeletionRecord);
TRANSFORMERS.put(ValueType.USER_TASK, RecordTransformer::toUserTaskRecord);
TRANSFORMERS.put(ValueType.COMPENSATION_SUBSCRIPTION, RecordTransformer::toCompensationSubscriptionRecord);
TRANSFORMERS.put(
ValueType.COMPENSATION_SUBSCRIPTION, RecordTransformer::toCompensationSubscriptionRecord);
TRANSFORMERS.put(ValueType.ESCALATION, RecordTransformer::toEscalationRecord);

VALUE_TYPE_MAPPING.put(ValueType.DEPLOYMENT, RecordMetadata.ValueType.DEPLOYMENT);
Expand Down Expand Up @@ -148,7 +149,8 @@ public final class RecordTransformer {
ValueType.COMMAND_DISTRIBUTION, RecordMetadata.ValueType.COMMAND_DISTRIBUTION);
VALUE_TYPE_MAPPING.put(ValueType.FORM, RecordMetadata.ValueType.FORM);
VALUE_TYPE_MAPPING.put(ValueType.USER_TASK, RecordMetadata.ValueType.USER_TASK);
VALUE_TYPE_MAPPING.put(ValueType.COMPENSATION_SUBSCRIPTION, RecordMetadata.ValueType.COMPENSATION_SUBSCRIPTION);
VALUE_TYPE_MAPPING.put(
ValueType.COMPENSATION_SUBSCRIPTION, RecordMetadata.ValueType.COMPENSATION_SUBSCRIPTION);
}

private RecordTransformer() {}
Expand Down Expand Up @@ -824,35 +826,36 @@ private static Schema.UserTaskRecord toUserTaskRecord(Record<UserTaskRecordValue
.build();
}

private static Schema.CompensationSubscriptionRecord toCompensationSubscriptionRecord(Record<CompensationSubscriptionRecordValue> record) {
private static Schema.CompensationSubscriptionRecord toCompensationSubscriptionRecord(
Record<CompensationSubscriptionRecordValue> record) {
final var value = record.getValue();

return Schema.CompensationSubscriptionRecord.newBuilder()
.setMetadata(toMetadata(record))
.setTenantId(value.getTenantId())
.setProcessInstanceKey(value.getProcessInstanceKey())
.setProcessDefinitionKey(value.getProcessDefinitionKey())
.setCompensableActivityId(value.getCompensableActivityId())
.setThrowEventId(value.getThrowEventId())
.setThrowEventInstanceKey(value.getThrowEventInstanceKey())
.setCompensationHandlerId(value.getCompensationHandlerId())
.setCompensationHandlerInstanceKey(value.getCompensationHandlerInstanceKey())
.setCompensableActivityScopeKey(value.getCompensableActivityScopeKey())
.setCompensableActivityInstanceKey(value.getCompensableActivityInstanceKey())
.setVariables(toStruct(value.getVariables()))
.build();
.setMetadata(toMetadata(record))
.setTenantId(value.getTenantId())
.setProcessInstanceKey(value.getProcessInstanceKey())
.setProcessDefinitionKey(value.getProcessDefinitionKey())
.setCompensableActivityId(value.getCompensableActivityId())
.setThrowEventId(value.getThrowEventId())
.setThrowEventInstanceKey(value.getThrowEventInstanceKey())
.setCompensationHandlerId(value.getCompensationHandlerId())
.setCompensationHandlerInstanceKey(value.getCompensationHandlerInstanceKey())
.setCompensableActivityScopeKey(value.getCompensableActivityScopeKey())
.setCompensableActivityInstanceKey(value.getCompensableActivityInstanceKey())
.setVariables(toStruct(value.getVariables()))
.build();
}

private static Schema.EscalationRecord toEscalationRecord(Record<EscalationRecordValue> record) {
final var value = record.getValue();

return Schema.EscalationRecord.newBuilder()
.setMetadata(toMetadata(record))
.setProcessInstanceKey(value.getProcessInstanceKey())
.setEscalationCode(value.getEscalationCode())
.setThrowElementId(value.getThrowElementId())
.setCatchElementId(value.getCatchElementId())
.build();
.setMetadata(toMetadata(record))
.setProcessInstanceKey(value.getProcessInstanceKey())
.setEscalationCode(value.getEscalationCode())
.setThrowElementId(value.getThrowElementId())
.setCatchElementId(value.getCatchElementId())
.build();
}

private static Struct toStruct(Map<?, ?> map) {
Expand Down
22 changes: 18 additions & 4 deletions src/test/java/io/zeebe/exporter/proto/ProtobufUtilTest.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
/*
* Copyright © 2019 camunda services GmbH (info@camunda.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.zeebe.exporter.proto;

import static org.assertj.core.api.Assertions.assertThat;

import com.google.protobuf.ListValue;
import com.google.protobuf.NullValue;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import org.junit.Test;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;

public class ProtobufUtilTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import static java.util.function.Predicate.not;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.data.MapEntry.entry;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down

0 comments on commit 25f6b4f

Please sign in to comment.