Skip to content

Commit 0391bed

Browse files
committed
Upgrade to json-path-2.8.0
* Fix `IntegrationGraphServerTests` to not use `net.minidev.json.JSONArray` API since it is not available as transitive from `json-path` in the `testCompileClasspath`
1 parent 1a579a6 commit 0391bed

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ext {
7878
jmsApiVersion = '3.1.0'
7979
jpaApiVersion = '3.1.0'
8080
jrubyVersion = '9.4.1.0'
81-
jsonpathVersion = '2.7.0'
81+
jsonpathVersion = '2.8.0'
8282
junit4Version = '4.13.2'
8383
junitJupiterVersion = '5.9.2'
8484
jythonVersion = '2.7.3'

spring-integration-core/src/test/java/org/springframework/integration/graph/IntegrationGraphServerTests.java

+9-13
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import io.micrometer.core.instrument.observation.DefaultMeterObservationHandler;
3030
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
3131
import io.micrometer.observation.ObservationRegistry;
32-
import net.minidev.json.JSONArray;
3332
import org.assertj.core.api.InstanceOfAssertFactories;
3433
import org.junit.jupiter.api.Test;
3534

@@ -128,10 +127,10 @@ void test() throws Exception {
128127
assertThat(nodes).isNotNull();
129128
assertThat(nodes.size()).isEqualTo(35);
130129

131-
JSONArray jsonArray =
130+
List<?> jsonArray =
132131
JsonPathUtils.evaluate(baos.toByteArray(), "$..nodes[?(@.componentType == 'gateway')]");
133132

134-
assertThat(jsonArray.size()).isEqualTo(3);
133+
assertThat(jsonArray).hasSize(3);
135134

136135
Map<String, Object> gateway1 = (Map<String, Object>) jsonArray.get(0);
137136

@@ -159,9 +158,6 @@ void test() throws Exception {
159158
this.testSource.receive();
160159
this.expressionRouterInput.send(MessageBuilder.withPayload("foo").setHeader("foo", "fizChannel").build());
161160

162-
jsonArray = JsonPathUtils.evaluate(baos.toByteArray(), "$..nodes[?(@.name == 'router.router')]");
163-
String routerJson = jsonArray.toJSONString();
164-
165161
this.server.rebuild();
166162
graph = this.server.getGraph();
167163
baos = new ByteArrayOutputStream();
@@ -181,13 +177,13 @@ void test() throws Exception {
181177
assertThat(links.size()).isEqualTo(35);
182178

183179
jsonArray = JsonPathUtils.evaluate(baos.toByteArray(), "$..nodes[?(@.name == 'router.router')]");
184-
routerJson = jsonArray.toJSONString();
180+
String routerJson = jsonArray.toString();
185181
assertThat(routerJson).contains("\"sendTimers\":{\"successes\":{\"count\":4");
186182
jsonArray = JsonPathUtils.evaluate(baos.toByteArray(), "$..nodes[?(@.name == 'toRouter')]");
187-
String toRouterJson = jsonArray.toJSONString();
183+
String toRouterJson = jsonArray.toString();
188184
assertThat(toRouterJson).contains("\"sendTimers\":{\"successes\":{\"count\":4");
189185
jsonArray = JsonPathUtils.evaluate(baos.toByteArray(), "$..nodes[?(@.name == 'testSource')]");
190-
String sourceJson = jsonArray.toJSONString();
186+
String sourceJson = jsonArray.toString();
191187
assertThat(sourceJson).contains("\"receiveCounters\":{\"successes\":1,\"failures\":0");
192188

193189
// stats refresh without rebuild()
@@ -196,29 +192,29 @@ void test() throws Exception {
196192
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
197193
objectMapper.writeValue(baos, graph);
198194
jsonArray = JsonPathUtils.evaluate(baos.toByteArray(), "$..nodes[?(@.name == 'testSource')]");
199-
sourceJson = jsonArray.toJSONString();
195+
sourceJson = jsonArray.toString();
200196
assertThat(sourceJson).contains("\"receiveCounters\":{\"successes\":2,\"failures\":0");
201197

202198
assertThatIllegalStateException().isThrownBy(() -> this.testSource.receive());
203199
baos = new ByteArrayOutputStream();
204200
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
205201
objectMapper.writeValue(baos, graph);
206202
jsonArray = JsonPathUtils.evaluate(baos.toByteArray(), "$..nodes[?(@.name == 'testSource')]");
207-
sourceJson = jsonArray.toJSONString();
203+
sourceJson = jsonArray.toString();
208204
assertThat(sourceJson).contains("\"receiveCounters\":{\"successes\":2,\"failures\":1");
209205

210206
jsonArray =
211207
JsonPathUtils.evaluate(baos.toByteArray(), "$..nodes[?(@.name == 'expressionRouter.router')]");
212208

213209
expressionRouter = (Map<String, Object>) jsonArray.get(0);
214-
JSONArray routes = (JSONArray) expressionRouter.get("routes");
210+
List<?> routes = (List<?>) expressionRouter.get("routes");
215211
assertThat(routes).hasSize(1);
216212
assertThat(routes.get(0)).isEqualTo("fizChannel");
217213

218214
Object routerNodeId = expressionRouter.get("nodeId");
219215

220216
Object fizChannelNodeId =
221-
((JSONArray) JsonPathUtils.evaluate(baos.toByteArray(),
217+
((List<?>) JsonPathUtils.evaluate(baos.toByteArray(),
222218
"$..nodes[?(@.name == 'fizChannel')].nodeId")).get(0);
223219

224220
jsonArray =

0 commit comments

Comments
 (0)