Skip to content

Commit

Permalink
[#noissue] Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Jul 12, 2024
1 parent b3eadc0 commit 3503162
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.navercorp.pinpoint.common.server.util.json.Jackson;
import com.navercorp.pinpoint.common.server.util.json.TypeRef;
import com.navercorp.pinpoint.web.dao.AlarmDao;
import com.navercorp.pinpoint.web.dao.UserGroupDao;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -110,7 +109,7 @@ public void insertAndSelectAndDeleteRule() throws Exception {
"\"notes\" : \"" + NOTES + "\"" +
"}";

MvcResult result = this.mockMvc.perform(post("/alarmRule.pinpoint").contentType(MediaType.APPLICATION_JSON).content(jsonParm))
MvcResult result = this.mockMvc.perform(post("/api/alarmRule").contentType(MediaType.APPLICATION_JSON).content(jsonParm))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andReturn();
Expand All @@ -120,7 +119,7 @@ public void insertAndSelectAndDeleteRule() throws Exception {
Assertions.assertEquals(resultMap.get("result"), "SUCCESS");
Assertions.assertNotNull(resultMap.get("ruleId"));

this.mockMvc.perform(get("/alarmRule.pinpoint?userGroupId=" + USER_GROUP_ID))
this.mockMvc.perform(get("/api/alarmRule?userGroupId=" + USER_GROUP_ID))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$[0]", hasKey("applicationId")))
Expand All @@ -133,7 +132,7 @@ public void insertAndSelectAndDeleteRule() throws Exception {
.andExpect(jsonPath("$[0]", hasKey("notes")))
.andReturn();

this.mockMvc.perform(delete("/alarmRule.pinpoint").contentType(MediaType.APPLICATION_JSON).content("{\"ruleId\" : \"" + resultMap.get("ruleId") + "\"}"))
this.mockMvc.perform(delete("/api/alarmRule").contentType(MediaType.APPLICATION_JSON).content("{\"ruleId\" : \"" + resultMap.get("ruleId") + "\"}"))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
Expand All @@ -154,7 +153,7 @@ public void updateRule() throws Exception {
"\"notes\" : \"" + NOTES + "\"" +
"}";

MvcResult result = this.mockMvc.perform(post("/alarmRule.pinpoint").contentType(MediaType.APPLICATION_JSON).content(jsonParm))
MvcResult result = this.mockMvc.perform(post("/api/alarmRule").contentType(MediaType.APPLICATION_JSON).content(jsonParm))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andReturn();
Expand All @@ -176,14 +175,14 @@ public void updateRule() throws Exception {
"\"notes\" : \"" + NOTES_UPDATED + "\"" +
"}";

this.mockMvc.perform(put("/alarmRule.pinpoint").contentType(MediaType.APPLICATION_JSON).content(updatedJsonParm))
this.mockMvc.perform(put("/api/alarmRule").contentType(MediaType.APPLICATION_JSON).content(updatedJsonParm))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
.andExpect(jsonPath("$.result").value("SUCCESS"))
.andReturn();

this.mockMvc.perform(delete("/alarmRule.pinpoint").contentType(MediaType.APPLICATION_JSON).content("{\"ruleId\" : \"" + resultMap.get("ruleId") + "\"}"))
this.mockMvc.perform(delete("/api/alarmRule").contentType(MediaType.APPLICATION_JSON).content("{\"ruleId\" : \"" + resultMap.get("ruleId") + "\"}"))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
Expand All @@ -193,7 +192,7 @@ public void updateRule() throws Exception {

@Test
public void checkerTest() throws Exception {
MvcResult result = this.mockMvc.perform(get("/alarmRule/checker.pinpoint").contentType(MediaType.APPLICATION_JSON))
MvcResult result = this.mockMvc.perform(get("/api/alarmRule/checker").contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$").isArray())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void after() {

@Test
public void configuration() throws Exception {
MvcResult result = this.mockMvc.perform(get("/configuration.pinpoint").contentType(MediaType.APPLICATION_JSON))
MvcResult result = this.mockMvc.perform(get("/api/configuration").contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("showActiveThread")))
Expand All @@ -86,7 +86,7 @@ public void configuration() throws Exception {
String content = result.getResponse().getContentAsString();
logger.debug(content);

result = this.mockMvc.perform(get("/configuration.pinpoint").contentType(MediaType.APPLICATION_JSON))
result = this.mockMvc.perform(get("/api/configuration").contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("showActiveThread")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ public void insertAndSelectAndDeleteUser() throws Exception {
"\"email\" : \"" + USER_EMAIL + "\"" +
"}";

this.mockMvc.perform(post("/user.pinpoint").contentType(MediaType.APPLICATION_JSON).content(jsonParm))
this.mockMvc.perform(post("/api/user").contentType(MediaType.APPLICATION_JSON).content(jsonParm))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
.andExpect(jsonPath("$.result").value("SUCCESS"))
.andReturn();

this.mockMvc.perform(get("/user.pinpoint").contentType(MediaType.APPLICATION_JSON))
this.mockMvc.perform(get("/api/user").contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$[0]", hasKey("userId")))
Expand All @@ -98,7 +98,7 @@ public void insertAndSelectAndDeleteUser() throws Exception {
.andExpect(jsonPath("$[0]", hasKey("email")))
.andReturn();

this.mockMvc.perform(get("/user.pinpoint?searchKey=" + USER_NAME).contentType(MediaType.APPLICATION_JSON))
this.mockMvc.perform(get("/api/user?searchKey=" + USER_NAME).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$[0]", hasKey("userId")))
Expand All @@ -108,7 +108,7 @@ public void insertAndSelectAndDeleteUser() throws Exception {
.andExpect(jsonPath("$[0]", hasKey("email")))
.andReturn();

this.mockMvc.perform(get("/user.pinpoint?userId=" + USER_ID).contentType(MediaType.APPLICATION_JSON))
this.mockMvc.perform(get("/api/user?userId=" + USER_ID).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$[0]", hasKey("userId")))
Expand All @@ -118,7 +118,7 @@ public void insertAndSelectAndDeleteUser() throws Exception {
.andExpect(jsonPath("$[0]", hasKey("email")))
.andReturn();

this.mockMvc.perform(get("/user.pinpoint?searchKey=" + USER_DEPARTMENT).contentType(MediaType.APPLICATION_JSON))
this.mockMvc.perform(get("/api/user?searchKey=" + USER_DEPARTMENT).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$[0]", hasKey("userId")))
Expand All @@ -128,7 +128,7 @@ public void insertAndSelectAndDeleteUser() throws Exception {
.andExpect(jsonPath("$[0]", hasKey("email")))
.andReturn();

this.mockMvc.perform(delete("/user.pinpoint").contentType(MediaType.APPLICATION_JSON).content("{\"userId\" : \"" + USER_ID + "\"}"))
this.mockMvc.perform(delete("/api/user").contentType(MediaType.APPLICATION_JSON).content("{\"userId\" : \"" + USER_ID + "\"}"))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
Expand All @@ -146,14 +146,14 @@ public void selectUser() throws Exception {
"\"email\" : \"" + USER_EMAIL + "\"" +
"}";

this.mockMvc.perform(post("/user.pinpoint").contentType(MediaType.APPLICATION_JSON).content(jsonParm))
this.mockMvc.perform(post("/api/user").contentType(MediaType.APPLICATION_JSON).content(jsonParm))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
.andExpect(jsonPath("$.result").value("SUCCESS"))
.andReturn();

this.mockMvc.perform(get("/user.pinpoint?userId=" + USER_ID).contentType(MediaType.APPLICATION_JSON))
this.mockMvc.perform(get("/api/user?userId=" + USER_ID).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$[0]", hasKey("userId")))
Expand All @@ -165,7 +165,7 @@ public void selectUser() throws Exception {
.andReturn();


this.mockMvc.perform(delete("/user.pinpoint").contentType(MediaType.APPLICATION_JSON).content("{\"userId\" : \"" + USER_ID + "\"}"))
this.mockMvc.perform(delete("/api/user").contentType(MediaType.APPLICATION_JSON).content("{\"userId\" : \"" + USER_ID + "\"}"))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
Expand All @@ -183,7 +183,7 @@ public void updateUser() throws Exception {
"\"email\" : \"" + USER_EMAIL + "\"" +
"}";

this.mockMvc.perform(post("/user.pinpoint").contentType(MediaType.APPLICATION_JSON).content(jsonParamforUserInfo))
this.mockMvc.perform(post("/api/user").contentType(MediaType.APPLICATION_JSON).content(jsonParamforUserInfo))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
Expand All @@ -198,14 +198,14 @@ public void updateUser() throws Exception {
"\"email\" : \"" + USER_EMAIL_UPDATED + "\"" +
"}";

this.mockMvc.perform(put("/user.pinpoint").contentType(MediaType.APPLICATION_JSON).content(jsonParmForUserInfoUpdated))
this.mockMvc.perform(put("/api/user").contentType(MediaType.APPLICATION_JSON).content(jsonParmForUserInfoUpdated))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
.andExpect(jsonPath("$.result").value("SUCCESS"))
.andReturn();

this.mockMvc.perform(delete("/user.pinpoint").contentType(MediaType.APPLICATION_JSON).content("{\"userId\" : \"" + USER_ID + "\"}"))
this.mockMvc.perform(delete("/api/user").contentType(MediaType.APPLICATION_JSON).content("{\"userId\" : \"" + USER_ID + "\"}"))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$", hasKey("result")))
Expand Down
Loading

0 comments on commit 3503162

Please sign in to comment.