Skip to content

Commit 9bc6af7

Browse files
committed
Jackson3 update
1 parent d6d11a8 commit 9bc6af7

4 files changed

Lines changed: 24 additions & 24 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>

pom.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@
3939
<properties>
4040
<changelist>999999-SNAPSHOT</changelist>
4141
<gitHubRepo>jenkinsci/configuration-as-code-plugin</gitHubRepo>
42-
<jenkins.baseline>2.528</jenkins.baseline>
43-
<!-- TODO change back to baseline once next bom version is out -->
44-
<jenkins.version>2.541.1</jenkins.version>
42+
<jenkins.baseline>2.541</jenkins.baseline>
43+
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
4544
<tagNameFormat>configuration-as-code-@{project.version}</tagNameFormat>
46-
<plugin-bom.version>6077.v303e2d08985d</plugin-bom.version>
45+
<plugin-bom.version>6098.v29a_dff8a_0c19</plugin-bom.version>
4746
<spotless.check.skip>false</spotless.check.skip>
4847
</properties>
4948

test-harness/pom.xml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
<type>pom</type>
2626
<scope>import</scope>
2727
</dependency>
28+
<!-- TODO Remove when on bom -->
29+
<dependency>
30+
<groupId>io.jenkins.plugins</groupId>
31+
<artifactId>jackson3-api</artifactId>
32+
<version>3.1.0-64.v37e742c35905</version>
33+
</dependency>
2834
</dependencies>
2935
</dependencyManagement>
3036

@@ -62,12 +68,12 @@
6268
<version>${project.version}</version>
6369
</dependency>
6470
<dependency>
65-
<groupId>org.jenkins-ci.main</groupId>
66-
<artifactId>jenkins-test-harness</artifactId>
71+
<groupId>io.jenkins.plugins</groupId>
72+
<artifactId>jackson3-api</artifactId>
6773
</dependency>
6874
<dependency>
69-
<groupId>org.jenkins-ci.plugins</groupId>
70-
<artifactId>jackson2-api</artifactId>
75+
<groupId>org.jenkins-ci.main</groupId>
76+
<artifactId>jenkins-test-harness</artifactId>
7177
</dependency>
7278
</dependencies>
7379

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)