Skip to content

Commit b8e9d57

Browse files
acogoluegnesmergify[bot]
authored andcommitted
Bump dependencies in Spring Boot HTTP backend example
(cherry picked from commit a1f88fa)
1 parent aec822f commit b8e9d57

File tree

2 files changed

+61
-51
lines changed

2 files changed

+61
-51
lines changed

deps/rabbitmq_auth_backend_http/examples/rabbitmq_auth_backend_spring_boot/pom.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@
2929
<parent>
3030
<groupId>org.springframework.boot</groupId>
3131
<artifactId>spring-boot-starter-parent</artifactId>
32-
<version>2.4.1</version>
32+
<version>2.7.3</version>
3333
</parent>
3434

3535
<properties>
3636
<maven.compiler.source>1.8</maven.compiler.source>
3737
<maven.compiler.target>1.8</maven.compiler.target>
38+
<junit.jupiter.version>5.9.3</junit.jupiter.version>
3839
</properties>
3940

4041
<groupId>com.rabbitmq.examples</groupId>
@@ -54,11 +55,12 @@
5455
</dependency>
5556

5657
<dependency>
57-
<groupId>junit</groupId>
58-
<artifactId>junit</artifactId>
59-
<version>4.13.1</version>
58+
<groupId>org.junit.jupiter</groupId>
59+
<artifactId>junit-jupiter-params</artifactId>
60+
<version>${junit.jupiter.version}</version>
6061
<scope>test</scope>
6162
</dependency>
63+
6264
</dependencies>
6365

6466
<build>
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,74 @@
11
/**
2-
* This Source Code Form is subject to the terms of the Mozilla Public
3-
* License, v. 2.0. If a copy of the MPL was not distributed with this
4-
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
2+
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
3+
* the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
54
*
6-
* Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved.
5+
* <p>Copyright (c) 2017-2023 VMware, Inc. or its affiliates. All rights reserved.
76
*/
8-
97
package com.rabbitmq.examples;
108

11-
import org.junit.Test;
12-
import org.junit.runner.RunWith;
9+
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
10+
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
11+
12+
import org.junit.jupiter.api.Test;
1313
import org.springframework.beans.factory.annotation.Autowired;
1414
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
15-
import org.springframework.test.context.junit4.SpringRunner;
1615
import org.springframework.test.web.servlet.MockMvc;
1716

18-
import static org.assertj.core.api.Assertions.*;
19-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
20-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
21-
22-
@RunWith(SpringRunner.class)
2317
@WebMvcTest(AuthBackendHttpController.class)
2418
public class AuthBackendHttpControllerTest {
2519

26-
@Autowired
27-
private MockMvc mvc;
28-
29-
@Test public void authenticationAuthorisation() throws Exception {
30-
this.mvc.perform(get("/auth/user").param("username", "guest").param("password", "guest"))
31-
.andExpect(status().isOk()).andExpect(content().string("allow administrator management"));
20+
@Autowired private MockMvc mvc;
3221

33-
this.mvc.perform(get("/auth/user").param("username", "guest").param("password", "wrong"))
34-
.andExpect(status().isOk()).andExpect(content().string("deny"));
22+
@Test
23+
public void authenticationAuthorisation() throws Exception {
24+
this.mvc
25+
.perform(get("/auth/user").param("username", "guest").param("password", "guest"))
26+
.andExpect(status().isOk())
27+
.andExpect(content().string("allow administrator management"));
3528

36-
this.mvc.perform(get("/auth/vhost").param("username", "guest").param("vhost", "/"))
37-
.andExpect(status().isOk()).andExpect(content().string("allow"));
29+
this.mvc
30+
.perform(get("/auth/user").param("username", "guest").param("password", "wrong"))
31+
.andExpect(status().isOk())
32+
.andExpect(content().string("deny"));
3833

39-
this.mvc.perform(get("/auth/resource")
40-
.param("username", "guest")
41-
.param("vhost", "/")
42-
.param("resource", "exchange")
43-
.param("name", "amq.topic")
44-
.param("permission", "write"))
45-
.andExpect(status().isOk()).andExpect(content().string("allow"));
34+
this.mvc
35+
.perform(get("/auth/vhost").param("username", "guest").param("vhost", "/"))
36+
.andExpect(status().isOk())
37+
.andExpect(content().string("allow"));
4638

47-
this.mvc.perform(get("/auth/topic")
48-
.param("username", "guest")
49-
.param("vhost", "/")
50-
.param("resource", "exchange")
51-
.param("name", "amq.topic")
52-
.param("permission", "write")
53-
.param("routing_key","a.b"))
54-
.andExpect(status().isOk()).andExpect(content().string("allow"));
39+
this.mvc
40+
.perform(
41+
get("/auth/resource")
42+
.param("username", "guest")
43+
.param("vhost", "/")
44+
.param("resource", "exchange")
45+
.param("name", "amq.topic")
46+
.param("permission", "write"))
47+
.andExpect(status().isOk())
48+
.andExpect(content().string("allow"));
5549

56-
this.mvc.perform(get("/auth/topic")
57-
.param("username", "guest")
58-
.param("vhost", "/")
59-
.param("resource", "exchange")
60-
.param("name", "amq.topic")
61-
.param("permission", "write")
62-
.param("routing_key","b.b"))
63-
.andExpect(status().isOk()).andExpect(content().string("deny"));
64-
}
50+
this.mvc
51+
.perform(
52+
get("/auth/topic")
53+
.param("username", "guest")
54+
.param("vhost", "/")
55+
.param("resource", "exchange")
56+
.param("name", "amq.topic")
57+
.param("permission", "write")
58+
.param("routing_key", "a.b"))
59+
.andExpect(status().isOk())
60+
.andExpect(content().string("allow"));
6561

62+
this.mvc
63+
.perform(
64+
get("/auth/topic")
65+
.param("username", "guest")
66+
.param("vhost", "/")
67+
.param("resource", "exchange")
68+
.param("name", "amq.topic")
69+
.param("permission", "write")
70+
.param("routing_key", "b.b"))
71+
.andExpect(status().isOk())
72+
.andExpect(content().string("deny"));
73+
}
6674
}

0 commit comments

Comments
 (0)