diff --git a/connector-runtime/spring-boot-starter-camunda-connectors/src/main/java/io/camunda/connector/runtime/OutboundConnectorsAutoConfiguration.java b/connector-runtime/spring-boot-starter-camunda-connectors/src/main/java/io/camunda/connector/runtime/OutboundConnectorsAutoConfiguration.java index 5ddb3c1c0c..d8e4b59a66 100644 --- a/connector-runtime/spring-boot-starter-camunda-connectors/src/main/java/io/camunda/connector/runtime/OutboundConnectorsAutoConfiguration.java +++ b/connector-runtime/spring-boot-starter-camunda-connectors/src/main/java/io/camunda/connector/runtime/OutboundConnectorsAutoConfiguration.java @@ -163,7 +163,6 @@ public ConsoleSecretApiClient consoleSecretApiClient(CamundaClientProperties cli @Bean @ConditionalOnMissingBean public ObjectMapper objectMapper(DocumentFactory documentFactory) { - ConnectorsObjectMapperSupplier.getCopy(documentFactory, DocumentModuleSettings.create()); - return ConnectorsObjectMapperSupplier.getCopy(); + return ConnectorsObjectMapperSupplier.getCopy(documentFactory, DocumentModuleSettings.create()); } } diff --git a/connector-sdk/test/src/main/java/io/camunda/connector/test/inbound/InboundConnectorContextBuilder.java b/connector-sdk/test/src/main/java/io/camunda/connector/test/inbound/InboundConnectorContextBuilder.java index fb6f866114..bed14edf99 100644 --- a/connector-sdk/test/src/main/java/io/camunda/connector/test/inbound/InboundConnectorContextBuilder.java +++ b/connector-sdk/test/src/main/java/io/camunda/connector/test/inbound/InboundConnectorContextBuilder.java @@ -24,6 +24,7 @@ import io.camunda.connector.api.json.ConnectorsObjectMapperSupplier; import io.camunda.connector.api.secret.SecretProvider; import io.camunda.connector.api.validation.ValidationProvider; +import io.camunda.connector.document.annotation.jackson.JacksonModuleDocument; import io.camunda.connector.runtime.core.AbstractConnectorContext; import io.camunda.connector.runtime.core.inbound.InboundConnectorElement; import io.camunda.connector.runtime.core.inbound.InboundConnectorReportingContext; @@ -50,13 +51,16 @@ public class InboundConnectorContextBuilder { protected Map properties; protected InboundConnectorDefinition definition; protected ValidationProvider validationProvider; - - protected ObjectMapper objectMapper = ConnectorsObjectMapperSupplier.getCopy(); - protected CorrelationResult result; - protected DocumentFactory documentFactory = new DocumentFactoryImpl(InMemoryDocumentStore.INSTANCE); + protected ObjectMapper objectMapper = + ConnectorsObjectMapperSupplier.getCopy() + .registerModule( + new JacksonModuleDocument( + this.documentFactory, + null, + JacksonModuleDocument.DocumentModuleSettings.create())); public static InboundConnectorContextBuilder create() { return new InboundConnectorContextBuilder(); @@ -167,6 +171,13 @@ public InboundConnectorContextBuilder validation(ValidationProvider validationPr return this; } + public InboundConnectorContextBuilder documentFactory(DocumentFactory documentFactory) { + this.objectMapper = + ConnectorsObjectMapperSupplier.getCopy( + documentFactory, JacksonModuleDocument.DocumentModuleSettings.create()); + return this; + } + /** * Sets a custom {@link ObjectMapper} that is used to serialize and deserialize the properties. If * not provided, default mapper will be used.