|
1 |
| -package it.vige.rubia.resttest.forummodule.adminpanel.test; |
| 1 | +package it.vige.rubia.resttest.forummodule.test; |
2 | 2 |
|
3 | 3 | import static org.jboss.logging.Logger.getLogger;
|
4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
23 | 23 | import it.vige.rubia.dto.ForumInstanceBean;
|
24 | 24 | import it.vige.rubia.resttest.RestCaller;
|
25 | 25 |
|
26 |
| -public class AdminPanelForumTest extends RestCaller { |
| 26 | +public class ForumTest extends RestCaller { |
27 | 27 |
|
28 | 28 | private final static String url = "http://localhost:8080/rubia-forums-rest/services/forums/";
|
29 | 29 | private final static String authorization = "Basic cm9vdDpndG4=";
|
30 | 30 |
|
31 |
| - private static Logger log = getLogger(AdminPanelForumTest.class); |
| 31 | + private static Logger log = getLogger(ForumTest.class); |
32 | 32 |
|
33 | 33 | @BeforeAll
|
34 | 34 | public static void setUp() {
|
@@ -109,6 +109,46 @@ public static void setUp() {
|
109 | 109 |
|
110 | 110 | @Test
|
111 | 111 | public void verifyMoveForum() {
|
| 112 | + Response response = get(url + "findForums/1", authorization); |
| 113 | + List<ForumBean> forumBeans = response.readEntity(new GenericType<List<ForumBean>>() { |
| 114 | + }); |
| 115 | + assertEquals(4, forumBeans.size(), "Forums size"); |
| 116 | + |
| 117 | + response = get(url + "findForumById/" + forumBeans.get(1).getId(), authorization); |
| 118 | + ForumBean forumBean = response.readEntity(ForumBean.class); |
| 119 | + assertEquals(10, forumBean.getOrder(), "Forum is up"); |
| 120 | + |
| 121 | + response = get(url + "findForumById/" + forumBeans.get(3).getId(), authorization); |
| 122 | + ForumBean forumBean2 = response.readEntity(ForumBean.class); |
| 123 | + assertEquals(20, forumBean2.getOrder(), "Forum is down"); |
| 124 | + |
| 125 | + forumBean.setOrder(20); |
| 126 | + response = post(url + "updateForum", authorization, forumBean); |
| 127 | + response = get(url + "findForumById/" + forumBeans.get(1).getId(), authorization); |
| 128 | + forumBean = response.readEntity(ForumBean.class); |
| 129 | + |
| 130 | + forumBean2.setOrder(10); |
| 131 | + response = post(url + "updateForum", authorization, forumBean2); |
| 132 | + response = get(url + "findForumById/" + forumBeans.get(3).getId(), authorization); |
| 133 | + forumBean2 = response.readEntity(ForumBean.class); |
| 134 | + |
| 135 | + assertEquals(20, forumBean.getOrder(), "Forum is down"); |
| 136 | + assertEquals(10, forumBean2.getOrder(), "Forum is up"); |
| 137 | + |
| 138 | + forumBean.setOrder(10); |
| 139 | + response = post(url + "updateForum", authorization, forumBean); |
| 140 | + response = get(url + "findForumById/" + forumBeans.get(1).getId(), authorization); |
| 141 | + forumBean = response.readEntity(ForumBean.class); |
| 142 | + |
| 143 | + forumBean2.setOrder(20); |
| 144 | + response = post(url + "updateForum", authorization, forumBean2); |
| 145 | + response = get(url + "findForumById/" + forumBeans.get(3).getId(), authorization); |
| 146 | + forumBean2 = response.readEntity(ForumBean.class); |
| 147 | + |
| 148 | + assertEquals(10, forumBean.getOrder(), "Forum is up"); |
| 149 | + assertEquals(20, forumBean2.getOrder(), "Forum is down"); |
| 150 | + |
| 151 | + response.close(); |
112 | 152 | }
|
113 | 153 |
|
114 | 154 | @Test
|
|
0 commit comments