Skip to content

Commit c09f383

Browse files
committed
Bumping versions
1 parent 2158d6a commit c09f383

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

spring-cloud-gateway-server/src/test/java/org/springframework/cloud/gateway/actuate/GatewayControllerEndpointRedisRefreshTest.java

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
/**
5050
* @author Peter Müller
5151
*/
52-
@SpringBootTest(properties = {"management.endpoint.gateway.enabled=true",
53-
"management.endpoints.web.exposure.include=*", "spring.cloud.gateway.actuator.verbose.enabled=true"},
52+
@SpringBootTest(properties = { "management.endpoint.gateway.enabled=true",
53+
"management.endpoints.web.exposure.include=*", "spring.cloud.gateway.actuator.verbose.enabled=true" },
5454
webEnvironment = RANDOM_PORT)
5555
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
5656
@ActiveProfiles("redis-route-repository")
@@ -94,8 +94,9 @@ public void testCorsConfigurationAfterReload() {
9494
createOrUpdateRouteWithCors(cors);
9595

9696
Awaitility.await().atMost(Duration.ofSeconds(3)).untilAsserted(() -> assertRouteHasCorsConfig(cors));
97-
Awaitility.await().atMost(Duration.ofSeconds(3))
98-
.untilAsserted(() -> assertPreflightAllowOrigin("http://example.org"));
97+
Awaitility.await()
98+
.atMost(Duration.ofSeconds(3))
99+
.untilAsserted(() -> assertPreflightAllowOrigin("http://example.org"));
99100
}
100101

101102
void createOrUpdateRouteWithCors(Map<String, Object> cors) {
@@ -108,41 +109,41 @@ void createOrUpdateRouteWithCors(Map<String, Object> cors) {
108109
testRouteDefinition.setMetadata(Map.of("cors", cors));
109110

110111
testClient.post()
111-
.uri("http://localhost:" + port + "/actuator/gateway/routes/cors-test-route")
112-
.accept(MediaType.APPLICATION_JSON)
113-
.body(BodyInserters.fromValue(testRouteDefinition))
114-
.exchange()
115-
.expectStatus()
116-
.isCreated();
112+
.uri("http://localhost:" + port + "/actuator/gateway/routes/cors-test-route")
113+
.accept(MediaType.APPLICATION_JSON)
114+
.body(BodyInserters.fromValue(testRouteDefinition))
115+
.exchange()
116+
.expectStatus()
117+
.isCreated();
117118

118119
testClient.post()
119-
.uri("http://localhost:" + port + "/actuator/gateway/refresh")
120-
.exchange()
121-
.expectStatus()
122-
.isOk();
120+
.uri("http://localhost:" + port + "/actuator/gateway/refresh")
121+
.exchange()
122+
.expectStatus()
123+
.isOk();
123124
}
124125

125126
void assertRouteHasCorsConfig(Map<String, Object> cors) {
126127
testClient.get()
127-
.uri("http://localhost:" + port + "/actuator/gateway/routes/cors-test-route")
128-
.exchange()
129-
.expectStatus()
130-
.isOk()
131-
.expectBody()
132-
.jsonPath("$.metadata")
133-
.value(map -> assertThat((Map<String, Object>) map).hasSize(1)
134-
.containsEntry("cors", cors));
128+
.uri("http://localhost:" + port + "/actuator/gateway/routes/cors-test-route")
129+
.exchange()
130+
.expectStatus()
131+
.isOk()
132+
.expectBody()
133+
.jsonPath("$.metadata")
134+
.value(map -> assertThat((Map<String, Object>) map).hasSize(1).containsEntry("cors", cors));
135135
}
136136

137137
void assertPreflightAllowOrigin(String origin) {
138138
testClient.options()
139-
.uri("http://localhost:" + port + "/")
140-
.header("Origin", "http://example.org")
141-
.header("Access-Control-Request-Method", "GET")
142-
.exchange()
143-
.expectStatus()
144-
.isOk()
145-
.expectHeader()
146-
.valueEquals("Access-Control-Allow-Origin", origin);
139+
.uri("http://localhost:" + port + "/")
140+
.header("Origin", "http://example.org")
141+
.header("Access-Control-Request-Method", "GET")
142+
.exchange()
143+
.expectStatus()
144+
.isOk()
145+
.expectHeader()
146+
.valueEquals("Access-Control-Allow-Origin", origin);
147147
}
148+
148149
}

0 commit comments

Comments
 (0)