Skip to content

Commit f0ef4d1

Browse files
committed
Jackson3 update
1 parent b0da473 commit f0ef4d1

3 files changed

Lines changed: 15 additions & 20 deletions

File tree

integrations/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
<artifactId>gitlab-branch-source</artifactId>
8383
<scope>test</scope>
8484
</dependency>
85+
<dependency>
86+
<groupId>io.jenkins.plugins</groupId>
87+
<artifactId>jackson3-api</artifactId>
88+
<scope>test</scope>
89+
</dependency>
8590
<dependency>
8691
<groupId>io.jenkins.plugins</groupId>
8792
<artifactId>joda-time-api</artifactId>
@@ -194,11 +199,6 @@
194199
<artifactId>gitlab-plugin</artifactId>
195200
<scope>test</scope>
196201
</dependency>
197-
<dependency>
198-
<groupId>org.jenkins-ci.plugins</groupId>
199-
<artifactId>jackson2-api</artifactId>
200-
<scope>test</scope>
201-
</dependency>
202202
<dependency>
203203
<groupId>org.jenkins-ci.plugins</groupId>
204204
<artifactId>jdk-tool</artifactId>

test-harness/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@
6262
<version>${project.version}</version>
6363
</dependency>
6464
<dependency>
65-
<groupId>org.jenkins-ci.main</groupId>
66-
<artifactId>jenkins-test-harness</artifactId>
65+
<groupId>io.jenkins.plugins</groupId>
66+
<artifactId>jackson3-api</artifactId>
6767
</dependency>
6868
<dependency>
69-
<groupId>org.jenkins-ci.plugins</groupId>
70-
<artifactId>jackson2-api</artifactId>
69+
<groupId>org.jenkins-ci.main</groupId>
70+
<artifactId>jenkins-test-harness</artifactId>
7171
</dependency>
7272
<dependency>
7373
<groupId>com.google.code.findbugs</groupId>

test-harness/src/main/java/io/jenkins/plugins/casc/misc/Util.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
import static org.junit.Assert.assertFalse;
88
import static org.junit.Assert.assertTrue;
99

10-
import com.fasterxml.jackson.core.JsonProcessingException;
11-
import com.fasterxml.jackson.databind.ObjectMapper;
12-
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
1310
import hudson.ExtensionList;
1411
import io.jenkins.plugins.casc.ConfigurationAsCode;
1512
import io.jenkins.plugins.casc.ConfigurationContext;
@@ -40,6 +37,8 @@
4037
import org.jvnet.hudson.test.LogRecorder;
4138
import org.jvnet.hudson.test.LoggerRule;
4239
import org.yaml.snakeyaml.nodes.Node;
40+
import tools.jackson.databind.ObjectMapper;
41+
import tools.jackson.dataformat.yaml.YAMLMapper;
4342

4443
public class Util {
4544

@@ -252,15 +251,11 @@ public static void assertLogContains(LogRecorder logging, String expectedText) {
252251
* @return the json conversion of the yaml string.
253252
*/
254253
public static String convertToJson(String yamlString) {
255-
try {
256-
ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
257-
Object obj = yamlReader.readValue(yamlString, Object.class);
254+
ObjectMapper yamlReader = new YAMLMapper();
255+
Object obj = yamlReader.readValue(yamlString, Object.class);
258256

259-
ObjectMapper jsonWriter = new ObjectMapper();
260-
return jsonWriter.writeValueAsString(obj);
261-
} catch (JsonProcessingException e) {
262-
throw new UncheckedIOException(e);
263-
}
257+
ObjectMapper jsonWriter = new ObjectMapper();
258+
return jsonWriter.writeValueAsString(obj);
264259
}
265260

266261
/**

0 commit comments

Comments
 (0)