You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/04/02 14:08:46 UTC
[incubator-shenyu] branch master updated: [ISSUE #3179] resource add button gives an error (#3181)
This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 5366772 [ISSUE #3179] resource add button gives an error (#3181)
5366772 is described below
commit 53667729e27c588fd3fc4f7b1578347a644e5ba5
Author: nuo-promise <46...@users.noreply.github.com>
AuthorDate: Sat Apr 2 22:08:40 2022 +0800
[ISSUE #3179] resource add button gives an error (#3181)
* #3179 resource add button gives an error
* #3179 modify resourceControllerTest
---
.../java/org/apache/shenyu/admin/controller/ResourceController.java | 2 +-
.../org/apache/shenyu/admin/controller/ResourceControllerTest.java | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ResourceController.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ResourceController.java
index c89fd96..4c06e81 100644
--- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ResourceController.java
+++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ResourceController.java
@@ -151,7 +151,7 @@ public class ResourceController {
public ShenyuAdminResult updateResource(@PathVariable("id") @Valid
@Existed(provider = ResourceMapper.class,
message = "resource not existed") final String id,
- @Valid @RequestBody final ResourceDTO resourceDTO) {
+ @RequestBody final ResourceDTO resourceDTO) {
resourceDTO.setId(id);
return ShenyuAdminResult.success(ShenyuResultMessage.UPDATE_SUCCESS, resourceService.createOrUpdate(resourceDTO));
}
diff --git a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ResourceControllerTest.java b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ResourceControllerTest.java
index 600f549..2566d1b 100644
--- a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ResourceControllerTest.java
+++ b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ResourceControllerTest.java
@@ -48,7 +48,6 @@ import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
/**
@@ -190,8 +189,6 @@ public class ResourceControllerTest {
resourceDTO.setId(mockId);
fill(resourceDTO);
SpringBeanUtils.getInstance().setApplicationContext(mock(ConfigurableApplicationContext.class));
- when(SpringBeanUtils.getInstance().getBean(ResourceMapper.class)).thenReturn(resourceMapper);
- when(resourceMapper.existed(resourceDTO.getId())).thenReturn(true);
given(resourceService.createOrUpdate(resourceDTO)).willReturn(1);
this.mockMvc.perform(MockMvcRequestBuilders.put("/resource/" + mockId)