Skip to content

Commit 87a4b56

Browse files
committed
fix(deps): update to jackson 3
1 parent 58398eb commit 87a4b56

File tree

67 files changed

+805
-796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+805
-796
lines changed

connectors/citrus-agent-connector/src/main/java/org/citrusframework/agent/connector/yaml/YamlSupport.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
import java.util.Map;
2121

2222
import com.fasterxml.jackson.annotation.JsonInclude;
23-
import com.fasterxml.jackson.core.JsonParser;
24-
import com.fasterxml.jackson.databind.DeserializationFeature;
25-
import com.fasterxml.jackson.databind.MapperFeature;
26-
import com.fasterxml.jackson.databind.ObjectMapper;
27-
import com.fasterxml.jackson.databind.SerializationFeature;
28-
import com.fasterxml.jackson.databind.json.JsonMapper;
23+
import tools.jackson.core.JsonParser;
24+
import tools.jackson.databind.DeserializationFeature;
25+
import tools.jackson.databind.MapperFeature;
26+
import tools.jackson.databind.ObjectMapper;
27+
import tools.jackson.databind.SerializationFeature;
28+
import tools.jackson.databind.json.JsonMapper;
2929
import org.yaml.snakeyaml.DumperOptions;
3030
import org.yaml.snakeyaml.Yaml;
3131
import org.yaml.snakeyaml.introspector.Property;

connectors/citrus-docker/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,20 @@
9696
</dependency>
9797

9898
<dependency>
99-
<groupId>com.fasterxml.jackson.core</groupId>
99+
<groupId>tools.jackson.core</groupId>
100100
<artifactId>jackson-core</artifactId>
101101
</dependency>
102102
<dependency>
103103
<groupId>com.fasterxml.jackson.core</groupId>
104104
<artifactId>jackson-annotations</artifactId>
105105
</dependency>
106106
<dependency>
107-
<groupId>com.fasterxml.jackson.core</groupId>
107+
<groupId>tools.jackson.core</groupId>
108108
<artifactId>jackson-databind</artifactId>
109109
</dependency>
110110

111111
<dependency>
112-
<groupId>com.fasterxml.jackson.jaxrs</groupId>
112+
<groupId>tools.jackson.jaxrs</groupId>
113113
<artifactId>jackson-jaxrs-json-provider</artifactId>
114114
</dependency>
115115

connectors/citrus-docker/src/main/java/org/citrusframework/docker/actions/DockerExecuteAction.java

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,27 @@
1616

1717
package org.citrusframework.docker.actions;
1818

19-
import java.util.Collections;
20-
import java.util.Optional;
21-
22-
import com.fasterxml.jackson.core.JsonProcessingException;
23-
import com.fasterxml.jackson.databind.ObjectMapper;
2419
import org.citrusframework.AbstractTestActionBuilder;
2520
import org.citrusframework.actions.AbstractTestAction;
2621
import org.citrusframework.actions.docker.DockerActionBuilder;
2722
import org.citrusframework.context.TestContext;
2823
import org.citrusframework.docker.client.DockerClient;
29-
import org.citrusframework.docker.command.*;
24+
import org.citrusframework.docker.command.AbstractDockerCommandBuilder;
25+
import org.citrusframework.docker.command.ContainerCreate;
26+
import org.citrusframework.docker.command.ContainerInspect;
27+
import org.citrusframework.docker.command.ContainerRemove;
28+
import org.citrusframework.docker.command.ContainerStart;
29+
import org.citrusframework.docker.command.ContainerStop;
30+
import org.citrusframework.docker.command.ContainerWait;
31+
import org.citrusframework.docker.command.DockerCommand;
32+
import org.citrusframework.docker.command.ImageBuild;
33+
import org.citrusframework.docker.command.ImageInspect;
34+
import org.citrusframework.docker.command.ImagePull;
35+
import org.citrusframework.docker.command.ImageRemove;
36+
import org.citrusframework.docker.command.Info;
37+
import org.citrusframework.docker.command.Ping;
38+
import org.citrusframework.docker.command.StaticDockerCommandBuilder;
39+
import org.citrusframework.docker.command.Version;
3040
import org.citrusframework.exceptions.CitrusRuntimeException;
3141
import org.citrusframework.exceptions.ValidationException;
3242
import org.citrusframework.message.DefaultMessage;
@@ -36,6 +46,10 @@
3646
import org.citrusframework.validation.json.JsonMessageValidationContext;
3747
import org.slf4j.Logger;
3848
import org.slf4j.LoggerFactory;
49+
import tools.jackson.databind.ObjectMapper;
50+
51+
import java.util.Collections;
52+
import java.util.Optional;
3953

4054
/**
4155
* Executes docker command with given docker client implementation. Possible command result is stored within command object.
@@ -108,14 +122,10 @@ private void validateCommandResult(DockerCommand command, TestContext context) {
108122
throw new ValidationException("Missing Docker command result");
109123
}
110124

111-
try {
112-
String commandResultJson = jsonMapper.writeValueAsString(command.getCommandResult());
113-
JsonMessageValidationContext validationContext = new JsonMessageValidationContext();
114-
getMessageValidator(context).validateMessage(new DefaultMessage(commandResultJson), new DefaultMessage(expectedCommandResult), context, Collections.singletonList(validationContext));
115-
logger.debug("Docker command result validation successful - all values OK!");
116-
} catch (JsonProcessingException e) {
117-
throw new CitrusRuntimeException(e);
118-
}
125+
String commandResultJson = jsonMapper.writeValueAsString(command.getCommandResult());
126+
JsonMessageValidationContext validationContext = new JsonMessageValidationContext();
127+
getMessageValidator(context).validateMessage(new DefaultMessage(commandResultJson), new DefaultMessage(expectedCommandResult), context, Collections.singletonList(validationContext));
128+
logger.debug("Docker command result validation successful - all values OK!");
119129
}
120130

121131
if (command.getResultCallback() != null) {

connectors/citrus-docker/src/main/java/org/citrusframework/docker/command/AbstractDockerCommandBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.citrusframework.exceptions.CitrusRuntimeException;
2525
import org.citrusframework.validation.MessageValidator;
2626
import org.citrusframework.validation.context.ValidationContext;
27-
import com.fasterxml.jackson.databind.ObjectMapper;
27+
import tools.jackson.databind.ObjectMapper;
2828

2929
public abstract class AbstractDockerCommandBuilder<R, T extends AbstractDockerCommand<R>, S extends AbstractDockerCommandBuilder<R, T, S>>
3030
implements TestActionBuilder<DockerExecuteAction>, DockerActionBuilderBase<R, DockerExecuteAction, S> {

connectors/citrus-docker/src/main/java/org/citrusframework/docker/config/xml/DockerExecuteActionParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.citrusframework.docker.command.DockerCommand;
2525
import org.citrusframework.validation.MessageValidator;
2626
import org.citrusframework.validation.context.ValidationContext;
27-
import com.fasterxml.jackson.databind.ObjectMapper;
27+
import tools.jackson.databind.ObjectMapper;
2828
import org.springframework.beans.factory.BeanCreationException;
2929
import org.springframework.beans.factory.annotation.Autowired;
3030
import org.springframework.beans.factory.annotation.Qualifier;

connectors/citrus-knative/src/main/java/org/citrusframework/knative/ce/CloudEventSupport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import java.util.Map;
2121
import java.util.Optional;
2222

23-
import com.fasterxml.jackson.core.JsonProcessingException;
24-
import com.fasterxml.jackson.databind.JsonNode;
25-
import com.fasterxml.jackson.databind.ObjectMapper;
23+
import tools.jackson.core.JsonProcessingException;
24+
import tools.jackson.databind.JsonNode;
25+
import tools.jackson.databind.ObjectMapper;
2626
import org.citrusframework.exceptions.CitrusRuntimeException;
2727
import org.citrusframework.message.MessageType;
2828
import org.springframework.http.HttpMethod;

connectors/citrus-kubernetes/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,23 @@
9696
</dependency>
9797

9898
<dependency>
99-
<groupId>com.fasterxml.jackson.core</groupId>
99+
<groupId>tools.jackson.core</groupId>
100100
<artifactId>jackson-core</artifactId>
101101
</dependency>
102102
<dependency>
103103
<groupId>com.fasterxml.jackson.core</groupId>
104104
<artifactId>jackson-annotations</artifactId>
105105
</dependency>
106106
<dependency>
107-
<groupId>com.fasterxml.jackson.core</groupId>
107+
<groupId>tools.jackson.core</groupId>
108108
<artifactId>jackson-databind</artifactId>
109109
</dependency>
110110
<dependency>
111-
<groupId>com.fasterxml.jackson.module</groupId>
111+
<groupId>tools.jackson.module</groupId>
112112
<artifactId>jackson-module-jaxb-annotations</artifactId>
113113
</dependency>
114114
<dependency>
115-
<groupId>com.fasterxml.jackson.jaxrs</groupId>
115+
<groupId>tools.jackson.jaxrs</groupId>
116116
<artifactId>jackson-jaxrs-json-provider</artifactId>
117117
</dependency>
118118

connectors/citrus-kubernetes/src/main/java/org/citrusframework/kubernetes/KubernetesSupport.java

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,7 @@
1616

1717
package org.citrusframework.kubernetes;
1818

19-
import java.io.ByteArrayInputStream;
20-
import java.nio.charset.StandardCharsets;
21-
import java.util.Collection;
22-
import java.util.Map;
23-
import java.util.Optional;
24-
2519
import com.fasterxml.jackson.annotation.JsonInclude;
26-
import com.fasterxml.jackson.core.JsonParser;
27-
import com.fasterxml.jackson.databind.DeserializationFeature;
28-
import com.fasterxml.jackson.databind.MapperFeature;
29-
import com.fasterxml.jackson.databind.ObjectMapper;
30-
import com.fasterxml.jackson.databind.SerializationFeature;
31-
import com.fasterxml.jackson.databind.json.JsonMapper;
3220
import io.fabric8.kubernetes.api.model.ContainerStatus;
3321
import io.fabric8.kubernetes.api.model.GenericKubernetesResource;
3422
import io.fabric8.kubernetes.api.model.GenericKubernetesResourceList;
@@ -47,21 +35,32 @@
4735
import org.yaml.snakeyaml.nodes.NodeTuple;
4836
import org.yaml.snakeyaml.nodes.Tag;
4937
import org.yaml.snakeyaml.representer.Representer;
38+
import tools.jackson.databind.ObjectMapper;
39+
import tools.jackson.databind.json.JsonMapper;
5040

51-
public final class KubernetesSupport {
41+
import java.io.ByteArrayInputStream;
42+
import java.nio.charset.StandardCharsets;
43+
import java.util.Collection;
44+
import java.util.Map;
45+
import java.util.Optional;
5246

53-
private static final ObjectMapper OBJECT_MAPPER;
47+
import static tools.jackson.core.StreamReadFeature.AUTO_CLOSE_SOURCE;
48+
import static tools.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
49+
import static tools.jackson.databind.cfg.EnumFeature.READ_ENUMS_USING_TO_STRING;
50+
import static tools.jackson.databind.cfg.EnumFeature.WRITE_ENUMS_USING_TO_STRING;
5451

55-
static {
56-
OBJECT_MAPPER = JsonMapper.builder()
57-
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
58-
.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING)
59-
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
60-
.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE)
61-
.enable(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES)
62-
.build()
63-
.setDefaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_EMPTY, JsonInclude.Include.NON_EMPTY));
64-
}
52+
public final class KubernetesSupport {
53+
54+
private static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
55+
.disable(FAIL_ON_UNKNOWN_PROPERTIES)
56+
.enable(READ_ENUMS_USING_TO_STRING)
57+
.enable(WRITE_ENUMS_USING_TO_STRING)
58+
.disable(AUTO_CLOSE_SOURCE)
59+
// .enable(MBLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES)
60+
.changeDefaultPropertyInclusion((handler) ->
61+
handler.withValueInclusion(JsonInclude.Include.NON_EMPTY)
62+
)
63+
.build();
6564

6665
private KubernetesSupport() {
6766
// prevent instantiation of utility class
@@ -70,6 +69,7 @@ private KubernetesSupport() {
7069
/**
7170
* Dump given domain model object as YAML.
7271
* Uses Json conversion to generic map as intermediate step. This makes sure to properly write Json additional properties.
72+
*
7373
* @param model
7474
* @return
7575
*/
@@ -80,6 +80,7 @@ public static String dumpYaml(Object model) {
8080
/**
8181
* Retrieve current Kubernetes client if set in Citrus context as bean reference.
8282
* Otherwise, create new default instance.
83+
*
8384
* @param citrus holding the potential bean reference to the client instance.
8485
* @return
8586
*/
@@ -94,6 +95,7 @@ public static KubernetesClient getKubernetesClient(Citrus citrus) {
9495
/**
9596
* Retrieve current Kubernetes client if set in test context as bean reference.
9697
* Otherwise, create new default instance.
98+
*
9799
* @param context holding the potential client bean reference.
98100
* @return
99101
*/
@@ -108,6 +110,7 @@ public static KubernetesClient getKubernetesClient(TestContext context) {
108110
/**
109111
* Retrieve current namespace set as test variable.
110112
* In case no suitable test variable is available use namespace loaded from Kubernetes settings via environment settings.
113+
*
111114
* @param context potentially holding the namespace variable.
112115
* @return
113116
*/
@@ -133,7 +136,7 @@ public static Yaml yaml() {
133136
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) {
134137
// if value of property is null, ignore it.
135138
if (propertyValue == null || (propertyValue instanceof Collection && ((Collection<?>) propertyValue).isEmpty()) ||
136-
(propertyValue instanceof Map && ((Map<?, ?>) propertyValue).isEmpty())) {
139+
(propertyValue instanceof Map && ((Map<?, ?>) propertyValue).isEmpty())) {
137140
return null;
138141
} else {
139142
return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
@@ -171,7 +174,7 @@ public static GenericKubernetesResourceList getResources(KubernetesClient k8sCli
171174
}
172175

173176
public static <T> void createResource(KubernetesClient k8sClient, String namespace,
174-
ResourceDefinitionContext context, T resource) {
177+
ResourceDefinitionContext context, T resource) {
175178
createResource(k8sClient, namespace, context, yaml().dumpAsMap(resource));
176179
}
177180

@@ -199,6 +202,7 @@ public static ResourceDefinitionContext crdContext(String resourceType, String g
199202
/**
200203
* Checks pod status with expected phase. If expected status is "Running" all
201204
* containers in the pod must be in ready state, too.
205+
*
202206
* @param pod
203207
* @param status
204208
* @return
@@ -217,6 +221,7 @@ public static boolean verifyPodStatus(Pod pod, String status) {
217221
* Try to get the cluster IP address of given service.
218222
* Resolves service by its name in given namespace and retrieves the cluster IP setting from the service spec.
219223
* Returns empty Optional in case of errors or no cluster IP setting.
224+
*
220225
* @param citrus
221226
* @param serviceName
222227
* @param namespace
@@ -237,6 +242,7 @@ public static Optional<String> getServiceClusterIp(Citrus citrus, String service
237242

238243
/**
239244
* Create K8s conform name using lowercase RFC 1123 rules.
245+
*
240246
* @param name
241247
* @return
242248
*/

connectors/citrus-kubernetes/src/main/java/org/citrusframework/kubernetes/actions/KubernetesExecuteAction.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.Map;
2222
import java.util.Optional;
2323

24-
import com.fasterxml.jackson.core.JsonProcessingException;
2524
import io.fabric8.kubernetes.api.model.Endpoints;
2625
import io.fabric8.kubernetes.api.model.HasMetadata;
2726
import io.fabric8.kubernetes.api.model.Namespace;
@@ -134,23 +133,19 @@ private void validateCommandResult(KubernetesCommand<?, ?> command, TestContext
134133
throw new ValidationException("Missing Kubernetes command result");
135134
}
136135

137-
try {
138-
String commandResultJson = kubernetesClient.getEndpointConfiguration()
139-
.getObjectMapper().writeValueAsString(result);
140-
if (StringUtils.hasText(commandResult)) {
141-
getMessageValidator(context).validateMessage(new DefaultMessage(commandResultJson), new DefaultMessage(commandResult), context, Collections.singletonList(new JsonMessageValidationContext()));
142-
logger.debug("Kubernetes command result validation successful - all values OK!");
143-
}
136+
String commandResultJson = kubernetesClient.getEndpointConfiguration()
137+
.getObjectMapper().writeValueAsString(result);
138+
if (StringUtils.hasText(commandResult)) {
139+
getMessageValidator(context).validateMessage(new DefaultMessage(commandResultJson), new DefaultMessage(commandResult), context, Collections.singletonList(new JsonMessageValidationContext()));
140+
logger.debug("Kubernetes command result validation successful - all values OK!");
141+
}
144142

145-
if (!commandResultExpressions.isEmpty()) {
146-
JsonPathMessageValidationContext validationContext = new JsonPathMessageValidationContext.Builder()
147-
.expressions(commandResultExpressions)
148-
.build();
149-
getPathValidator(context).validateMessage(new DefaultMessage(commandResultJson), new DefaultMessage(commandResult), context, Collections.singletonList(validationContext));
150-
logger.debug("Kubernetes command result path validation successful - all values OK!");
151-
}
152-
} catch (JsonProcessingException e) {
153-
throw new CitrusRuntimeException(e);
143+
if (!commandResultExpressions.isEmpty()) {
144+
JsonPathMessageValidationContext validationContext = new JsonPathMessageValidationContext.Builder()
145+
.expressions(commandResultExpressions)
146+
.build();
147+
getPathValidator(context).validateMessage(new DefaultMessage(commandResultJson), new DefaultMessage(commandResult), context, Collections.singletonList(validationContext));
148+
logger.debug("Kubernetes command result path validation successful - all values OK!");
154149
}
155150
}
156151

connectors/citrus-kubernetes/src/main/java/org/citrusframework/kubernetes/client/KubernetesClientBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.citrusframework.kubernetes.client;
1818

19-
import com.fasterxml.jackson.databind.ObjectMapper;
19+
import tools.jackson.databind.ObjectMapper;
2020
import io.fabric8.kubernetes.client.ConfigBuilder;
2121
import org.citrusframework.endpoint.AbstractEndpointBuilder;
2222
import org.citrusframework.kubernetes.message.KubernetesMessageConverter;

0 commit comments

Comments
 (0)