Commit ef9dfda300b07acb6b577c3447aa291ea48717db
Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/1.6.2-postgresql
Showing
1 changed file
with
393 additions
and
393 deletions
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceTest.java
| 1 | -//package cn.iocoder.yudao.module.system.service.permission; | |
| 2 | -// | |
| 3 | -//import cn.hutool.core.bean.BeanUtil; | |
| 4 | -//import cn.hutool.core.lang.Assert; | |
| 5 | -//import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 6 | -//import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | |
| 7 | -//import cn.iocoder.yudao.framework.common.util.spring.SpringAopUtils; | |
| 8 | -//import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuCreateReqVO; | |
| 9 | -//import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuListReqVO; | |
| 10 | -//import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuUpdateReqVO; | |
| 11 | -//import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; | |
| 12 | -//import cn.iocoder.yudao.module.system.dal.mysql.permission.MenuMapper; | |
| 13 | -//import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum; | |
| 14 | -//import cn.iocoder.yudao.module.system.mq.producer.permission.MenuProducer; | |
| 15 | -//import cn.iocoder.yudao.module.system.service.tenant.TenantService; | |
| 16 | -//import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 17 | -//import com.google.common.collect.Multimap; | |
| 18 | -//import org.junit.jupiter.api.Test; | |
| 19 | -//import org.springframework.boot.test.mock.mockito.MockBean; | |
| 20 | -//import org.springframework.context.annotation.Import; | |
| 21 | -// | |
| 22 | -//import javax.annotation.Resource; | |
| 23 | -//import java.util.*; | |
| 24 | -// | |
| 25 | -//import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet; | |
| 26 | -//import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 27 | -//import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | |
| 28 | -//import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | |
| 29 | -//import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | |
| 30 | -//import static org.junit.jupiter.api.Assertions.*; | |
| 31 | -//import static org.mockito.ArgumentMatchers.argThat; | |
| 32 | -//import static org.mockito.Mockito.doNothing; | |
| 33 | -//import static org.mockito.Mockito.verify; | |
| 34 | -// | |
| 35 | -//// TODO @芋艿:单测的代码质量可以提升下 | |
| 36 | -//@Import(MenuServiceImpl.class) | |
| 37 | -//public class MenuServiceTest extends BaseDbUnitTest { | |
| 38 | -// | |
| 39 | -// @Resource | |
| 40 | -// private MenuServiceImpl menuService; | |
| 41 | -// | |
| 42 | -// @Resource | |
| 43 | -// private MenuMapper menuMapper; | |
| 44 | -// | |
| 45 | -// @MockBean | |
| 46 | -// private PermissionService permissionService; | |
| 47 | -// @MockBean | |
| 48 | -// private MenuProducer menuProducer; | |
| 49 | -// @MockBean | |
| 50 | -// private TenantService tenantService; | |
| 51 | -// | |
| 52 | -// @Test | |
| 53 | -// public void testInitLocalCache_success() throws Exception { | |
| 54 | -// MenuDO menuDO1 = createMenuDO(MenuTypeEnum.MENU, "xxxx", 0L); | |
| 55 | -// menuMapper.insert(menuDO1); | |
| 56 | -// MenuDO menuDO2 = createMenuDO(MenuTypeEnum.MENU, "xxxx", 0L); | |
| 57 | -// menuMapper.insert(menuDO2); | |
| 58 | -// | |
| 59 | -// // 调用 | |
| 60 | -// menuService.initLocalCache(); | |
| 61 | -// | |
| 62 | -// // 获取代理对象 | |
| 63 | -// MenuServiceImpl target = (MenuServiceImpl) SpringAopUtils.getTarget(menuService); | |
| 64 | -// | |
| 65 | -// Map<Long, MenuDO> menuCache = | |
| 66 | -// (Map<Long, MenuDO>) BeanUtil.getFieldValue(target, "menuCache"); | |
| 67 | -// Assert.isTrue(menuCache.size() == 2); | |
| 68 | -// assertPojoEquals(menuDO1, menuCache.get(menuDO1.getId())); | |
| 69 | -// assertPojoEquals(menuDO2, menuCache.get(menuDO2.getId())); | |
| 70 | -// | |
| 71 | -// Multimap<String, MenuDO> permissionMenuCache = | |
| 72 | -// (Multimap<String, MenuDO>) BeanUtil.getFieldValue(target, "permissionMenuCache"); | |
| 73 | -// Assert.isTrue(permissionMenuCache.size() == 2); | |
| 74 | -// assertPojoEquals(menuDO1, permissionMenuCache.get(menuDO1.getPermission())); | |
| 75 | -// assertPojoEquals(menuDO2, permissionMenuCache.get(menuDO2.getPermission())); | |
| 76 | -// | |
| 77 | -// Date maxUpdateTime = (Date) BeanUtil.getFieldValue(target, "maxUpdateTime"); | |
| 78 | -// assertEquals(ObjectUtils.max(menuDO1.getUpdateTime(), menuDO2.getUpdateTime()), maxUpdateTime); | |
| 79 | -// } | |
| 80 | -// | |
| 81 | -// @Test | |
| 82 | -// public void testCreateMenu_success() { | |
| 83 | -// //构造父目录 | |
| 84 | -// MenuDO menuDO = createMenuDO(MenuTypeEnum.MENU, "parent", 0L); | |
| 85 | -// menuMapper.insert(menuDO); | |
| 86 | -// Long parentId = menuDO.getId(); | |
| 87 | -// | |
| 88 | -// //调用 | |
| 89 | -// MenuCreateReqVO vo = randomPojo(MenuCreateReqVO.class, o -> { | |
| 90 | -// o.setParentId(parentId); | |
| 91 | -// o.setName("testSonName"); | |
| 92 | -// o.setType(MenuTypeEnum.MENU.getType()); | |
| 93 | -// o.setStatus(randomCommonStatus()); | |
| 94 | -// }); | |
| 95 | -// Long menuId = menuService.createMenu(vo); | |
| 96 | -// | |
| 97 | -// //断言 | |
| 98 | -// assertNotNull(menuId); | |
| 99 | -// // 校验记录的属性是否正确 | |
| 100 | -// MenuDO ret = menuMapper.selectById(menuId); | |
| 101 | -// assertPojoEquals(vo, ret); | |
| 102 | -// // 校验调用 | |
| 103 | -// verify(menuProducer).sendMenuRefreshMessage(); | |
| 104 | -// } | |
| 105 | -// | |
| 106 | -// @Test | |
| 107 | -// public void testUpdateMenu_success() { | |
| 108 | -// //构造父子目录 | |
| 109 | -// MenuDO sonMenuDO = initParentAndSonMenuDO(); | |
| 110 | -// Long sonId = sonMenuDO.getId(); | |
| 111 | -// Long parentId = sonMenuDO.getParentId(); | |
| 112 | -// | |
| 113 | -// //调用 | |
| 114 | -// MenuUpdateReqVO vo = randomPojo(MenuUpdateReqVO.class, o -> { | |
| 115 | -// o.setId(sonId); | |
| 116 | -// o.setParentId(parentId); | |
| 117 | -// o.setType(MenuTypeEnum.MENU.getType()); | |
| 118 | -// o.setStatus(randomCommonStatus()); | |
| 119 | -// o.setName("pppppp"); //修改名字 | |
| 120 | -// }); | |
| 121 | -// menuService.updateMenu(vo); | |
| 122 | -// | |
| 123 | -// //断言 | |
| 124 | -// // 校验记录的属性是否正确 | |
| 125 | -// MenuDO ret = menuMapper.selectById(sonId); | |
| 126 | -// assertPojoEquals(vo, ret); | |
| 127 | -// // 校验调用 | |
| 128 | -// verify(menuProducer).sendMenuRefreshMessage(); | |
| 129 | -// } | |
| 130 | -// | |
| 131 | -// @Test | |
| 132 | -// public void testUpdateMenu_sonIdNotExist() { | |
| 133 | -// Long sonId = 99999L; | |
| 134 | -// Long parentId = 10000L; | |
| 135 | -// | |
| 136 | -// //调用 | |
| 137 | -// MenuUpdateReqVO vo = randomPojo(MenuUpdateReqVO.class, o -> { | |
| 138 | -// o.setId(sonId); | |
| 139 | -// o.setParentId(parentId); | |
| 140 | -// o.setType(MenuTypeEnum.MENU.getType()); | |
| 141 | -// o.setStatus(randomCommonStatus()); | |
| 142 | -// }); | |
| 143 | -// //断言 | |
| 144 | -// assertServiceException(() -> menuService.updateMenu(vo), MENU_NOT_EXISTS); | |
| 145 | -// } | |
| 146 | -// | |
| 147 | -// @Test | |
| 148 | -// public void testDeleteMenu_success() { | |
| 149 | -// MenuDO sonMenuDO = initParentAndSonMenuDO(); | |
| 150 | -// Long sonId = sonMenuDO.getId(); | |
| 151 | -// | |
| 152 | -// // 调用 | |
| 153 | -// menuService.deleteMenu(sonId); | |
| 154 | -// | |
| 155 | -// // 断言 | |
| 156 | -// MenuDO menuDO = menuMapper.selectById(sonId); | |
| 157 | -// assertNull(menuDO); | |
| 158 | -// verify(permissionService).processMenuDeleted(sonId); | |
| 159 | -// verify(menuProducer).sendMenuRefreshMessage(); | |
| 160 | -// } | |
| 161 | -// | |
| 162 | -// @Test | |
| 163 | -// public void testDeleteMenu_menuNotExist() { | |
| 164 | -// Long sonId = 99999L; | |
| 165 | -// | |
| 166 | -// assertServiceException(() -> menuService.deleteMenu(sonId), MENU_NOT_EXISTS); | |
| 167 | -// } | |
| 168 | -// | |
| 169 | -// @Test | |
| 170 | -// public void testDeleteMenu_existChildren() { | |
| 171 | -// MenuDO sonMenu = initParentAndSonMenuDO(); | |
| 172 | -// Long parentId = sonMenu.getParentId(); | |
| 173 | -// | |
| 174 | -// assertServiceException(() -> menuService.deleteMenu(parentId), MENU_EXISTS_CHILDREN); | |
| 175 | -// } | |
| 176 | -// | |
| 177 | -// @Test | |
| 178 | -// public void testGetMenus() { | |
| 179 | -// // mock 数据 | |
| 180 | -// MenuDO menu100 = randomPojo(MenuDO.class, o -> o.setId(100L).setStatus(CommonStatusEnum.ENABLE.getStatus())); | |
| 181 | -// menuMapper.insert(menu100); | |
| 182 | -// MenuDO menu101 = randomPojo(MenuDO.class, o -> o.setId(101L).setStatus(CommonStatusEnum.DISABLE.getStatus())); | |
| 183 | -// menuMapper.insert(menu101); | |
| 184 | -// // 准备参数 | |
| 185 | -// MenuListReqVO reqVO = new MenuListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 186 | -// | |
| 187 | -// // 调用 | |
| 188 | -// List<MenuDO> result = menuService.getMenus(reqVO); | |
| 189 | -// // 断言 | |
| 190 | -// assertEquals(1, result.size()); | |
| 191 | -// assertPojoEquals(menu100, result.get(0)); | |
| 192 | -// } | |
| 193 | -// | |
| 194 | -// @Test | |
| 195 | -// public void testTenantMenus() { | |
| 196 | -// // mock 数据 | |
| 197 | -// MenuDO menu100 = randomPojo(MenuDO.class, o -> o.setId(100L).setStatus(CommonStatusEnum.ENABLE.getStatus())); | |
| 198 | -// menuMapper.insert(menu100); | |
| 199 | -// MenuDO menu101 = randomPojo(MenuDO.class, o -> o.setId(101L).setStatus(CommonStatusEnum.DISABLE.getStatus())); | |
| 200 | -// menuMapper.insert(menu101); | |
| 201 | -// MenuDO menu102 = randomPojo(MenuDO.class, o -> o.setId(102L).setStatus(CommonStatusEnum.ENABLE.getStatus())); | |
| 202 | -// menuMapper.insert(menu102); | |
| 203 | -// // mock 过滤菜单 | |
| 204 | -// // mock 账户额度充足 | |
| 205 | -// Set<Long> menuIds = asSet(100L, 101L); | |
| 206 | -// doNothing().when(tenantService).handleTenantMenu(argThat(handler -> { | |
| 207 | -// handler.handle(menuIds); | |
| 208 | -// return true; | |
| 209 | -// })); | |
| 210 | -// // 准备参数 | |
| 211 | -// MenuListReqVO reqVO = new MenuListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 212 | -// | |
| 213 | -// // 调用 | |
| 214 | -// List<MenuDO> result = menuService.getTenantMenus(reqVO); | |
| 215 | -// // 断言 | |
| 216 | -// assertEquals(1, result.size()); | |
| 217 | -// assertPojoEquals(menu100, result.get(0)); | |
| 218 | -// } | |
| 219 | -// | |
| 220 | -// @Test | |
| 221 | -// public void testGetMenusReqVo_success() { | |
| 222 | -// Map<Long, MenuDO> idMenuMap = new HashMap<>(); | |
| 223 | -// // 用于验证可以模糊搜索名称包含"name",状态为1的menu | |
| 224 | -// MenuDO menu = createMenuDO(MenuTypeEnum.MENU, "name2", 0L, 1); | |
| 225 | -// menuMapper.insert(menu); | |
| 226 | -// idMenuMap.put(menu.getId(), menu); | |
| 227 | -// | |
| 228 | -// menu = createMenuDO(MenuTypeEnum.MENU, "11name111", 0L, 1); | |
| 229 | -// menuMapper.insert(menu); | |
| 230 | -// idMenuMap.put(menu.getId(), menu); | |
| 231 | -// | |
| 232 | -// menu = createMenuDO(MenuTypeEnum.MENU, "name", 0L, 1); | |
| 233 | -// menuMapper.insert(menu); | |
| 234 | -// idMenuMap.put(menu.getId(), menu); | |
| 235 | -// | |
| 236 | -// // 以下是不符合搜索条件的的menu | |
| 237 | -// menu = createMenuDO(MenuTypeEnum.MENU, "xxxxxx", 0L, 1); | |
| 238 | -// menuMapper.insert(menu); | |
| 239 | -// menu = createMenuDO(MenuTypeEnum.MENU, "name", 0L, 2); | |
| 240 | -// menuMapper.insert(menu); | |
| 241 | -// | |
| 242 | -// // 调用 | |
| 243 | -// MenuListReqVO reqVO = new MenuListReqVO(); | |
| 244 | -// reqVO.setStatus(1); | |
| 245 | -// reqVO.setName("name"); | |
| 246 | -// List<MenuDO> menuDOS = menuService.getMenus(reqVO); | |
| 247 | -// | |
| 248 | -// // 断言 | |
| 249 | -// assertEquals(menuDOS.size(), idMenuMap.size()); | |
| 250 | -// menuDOS.forEach(m -> assertPojoEquals(idMenuMap.get(m.getId()), m)); | |
| 251 | -// } | |
| 252 | -// | |
| 253 | -// @Test | |
| 254 | -// public void testListMenusFromCache_success() throws Exception { | |
| 255 | -// Map<Long, MenuDO> mockCacheMap = new HashMap<>(); | |
| 256 | -// // 获取代理对象 | |
| 257 | -// MenuServiceImpl target = (MenuServiceImpl) SpringAopUtils.getTarget(menuService); | |
| 258 | -// BeanUtil.setFieldValue(target, "menuCache", mockCacheMap); | |
| 259 | -// | |
| 260 | -// Map<Long, MenuDO> idMenuMap = new HashMap<>(); | |
| 261 | -// // 用于验证搜索类型为MENU,状态为1的menu | |
| 262 | -// MenuDO menuDO = createMenuDO(1L, MenuTypeEnum.MENU, "name", 0L, 1); | |
| 263 | -// mockCacheMap.put(menuDO.getId(), menuDO); | |
| 264 | -// idMenuMap.put(menuDO.getId(), menuDO); | |
| 265 | -// | |
| 266 | -// menuDO = createMenuDO(2L, MenuTypeEnum.MENU, "name", 0L, 1); | |
| 267 | -// mockCacheMap.put(menuDO.getId(), menuDO); | |
| 268 | -// idMenuMap.put(menuDO.getId(), menuDO); | |
| 269 | -// | |
| 270 | -// // 以下是不符合搜索条件的menu | |
| 271 | -// menuDO = createMenuDO(3L, MenuTypeEnum.BUTTON, "name", 0L, 1); | |
| 272 | -// mockCacheMap.put(menuDO.getId(), menuDO); | |
| 273 | -// menuDO = createMenuDO(4L, MenuTypeEnum.MENU, "name", 0L, 2); | |
| 274 | -// mockCacheMap.put(menuDO.getId(), menuDO); | |
| 275 | -// | |
| 276 | -// List<MenuDO> menuDOS = menuService.getMenuListFromCache(Collections.singletonList(MenuTypeEnum.MENU.getType()), | |
| 277 | -// Collections.singletonList(CommonStatusEnum.DISABLE.getStatus())); | |
| 278 | -// assertEquals(menuDOS.size(), idMenuMap.size()); | |
| 279 | -// menuDOS.forEach(m -> assertPojoEquals(idMenuMap.get(m.getId()), m)); | |
| 280 | -// } | |
| 281 | -// | |
| 282 | -// @Test | |
| 283 | -// public void testListMenusFromCache2_success() throws Exception { | |
| 284 | -// Map<Long, MenuDO> mockCacheMap = new HashMap<>(); | |
| 285 | -// // 获取代理对象 | |
| 286 | -// MenuServiceImpl target = (MenuServiceImpl) SpringAopUtils.getTarget(menuService); | |
| 287 | -// BeanUtil.setFieldValue(target, "menuCache", mockCacheMap); | |
| 288 | -// | |
| 289 | -// Map<Long, MenuDO> idMenuMap = new HashMap<>(); | |
| 290 | -// // 验证搜索id为1, 类型为MENU, 状态为1 的menu | |
| 291 | -// MenuDO menuDO = createMenuDO(1L, MenuTypeEnum.MENU, "name", 0L, 1); | |
| 292 | -// mockCacheMap.put(menuDO.getId(), menuDO); | |
| 293 | -// idMenuMap.put(menuDO.getId(), menuDO); | |
| 294 | -// | |
| 295 | -// // 以下是不符合搜索条件的menu | |
| 296 | -// menuDO = createMenuDO(2L, MenuTypeEnum.MENU, "name", 0L, 1); | |
| 297 | -// mockCacheMap.put(menuDO.getId(), menuDO); | |
| 298 | -// menuDO = createMenuDO(3L, MenuTypeEnum.BUTTON, "name", 0L, 1); | |
| 299 | -// mockCacheMap.put(menuDO.getId(), menuDO); | |
| 300 | -// menuDO = createMenuDO(4L, MenuTypeEnum.MENU, "name", 0L, 2); | |
| 301 | -// mockCacheMap.put(menuDO.getId(), menuDO); | |
| 302 | -// | |
| 303 | -// List<MenuDO> menuDOS = menuService.getMenuListFromCache(Collections.singletonList(1L), | |
| 304 | -// Collections.singletonList(MenuTypeEnum.MENU.getType()), Collections.singletonList(1)); | |
| 305 | -// assertEquals(menuDOS.size(), idMenuMap.size()); | |
| 306 | -// menuDOS.forEach(menu -> assertPojoEquals(idMenuMap.get(menu.getId()), menu)); | |
| 307 | -// } | |
| 308 | -// | |
| 309 | -// @Test | |
| 310 | -// public void testCheckParentResource_success() { | |
| 311 | -// MenuDO menuDO = createMenuDO(MenuTypeEnum.MENU, "parent", 0L); | |
| 312 | -// menuMapper.insert(menuDO); | |
| 313 | -// Long parentId = menuDO.getId(); | |
| 314 | -// | |
| 315 | -// menuService.checkParentResource(parentId, null); | |
| 316 | -// } | |
| 317 | -// | |
| 318 | -// @Test | |
| 319 | -// public void testCheckParentResource_canNotSetSelfToBeParent() { | |
| 320 | -// assertServiceException(() -> menuService.checkParentResource(1L, 1L), MENU_PARENT_ERROR); | |
| 321 | -// } | |
| 322 | -// | |
| 323 | -// @Test | |
| 324 | -// public void testCheckParentResource_parentNotExist() { | |
| 325 | -// assertServiceException(() -> menuService.checkParentResource(randomLongId(), null), MENU_PARENT_NOT_EXISTS); | |
| 326 | -// } | |
| 327 | -// | |
| 328 | -// @Test | |
| 329 | -// public void testCheckParentResource_parentTypeError() { | |
| 330 | -// MenuDO menuDO = createMenuDO(MenuTypeEnum.BUTTON, "parent", 0L); | |
| 331 | -// menuMapper.insert(menuDO); | |
| 332 | -// Long parentId = menuDO.getId(); | |
| 333 | -// | |
| 334 | -// assertServiceException(() -> menuService.checkParentResource(parentId, null), MENU_PARENT_NOT_DIR_OR_MENU); | |
| 335 | -// } | |
| 336 | -// | |
| 337 | -// @Test | |
| 338 | -// public void testCheckResource_success() { | |
| 339 | -// MenuDO sonMenu = initParentAndSonMenuDO(); | |
| 340 | -// Long parentId = sonMenu.getParentId(); | |
| 341 | -// | |
| 342 | -// Long otherSonMenuId = randomLongId(); | |
| 343 | -// String otherSonMenuName = randomString(); | |
| 344 | -// | |
| 345 | -// menuService.checkResource(parentId, otherSonMenuName, otherSonMenuId); | |
| 346 | -// } | |
| 347 | -// | |
| 348 | -// @Test | |
| 349 | -// public void testCheckResource_sonMenuNameDuplicate(){ | |
| 350 | -// MenuDO sonMenu=initParentAndSonMenuDO(); | |
| 351 | -// Long parentId=sonMenu.getParentId(); | |
| 352 | -// | |
| 353 | -// Long otherSonMenuId=randomLongId(); | |
| 354 | -// String otherSonMenuName=sonMenu.getName(); //相同名称 | |
| 355 | -// | |
| 356 | -// assertServiceException(() -> menuService.checkResource(parentId, otherSonMenuName, otherSonMenuId), MENU_NAME_DUPLICATE); | |
| 357 | -// } | |
| 358 | -// | |
| 359 | -// /** | |
| 360 | -// * 构造父子目录,返回子目录 | |
| 361 | -// * | |
| 362 | -// * @return | |
| 363 | -// */ | |
| 364 | -// private MenuDO initParentAndSonMenuDO() { | |
| 365 | -// //构造父子目录 | |
| 366 | -// MenuDO menuDO = createMenuDO(MenuTypeEnum.MENU, "parent", 0L); | |
| 367 | -// menuMapper.insert(menuDO); | |
| 368 | -// Long parentId = menuDO.getId(); | |
| 369 | -// | |
| 370 | -// MenuDO sonMenuDO = createMenuDO(MenuTypeEnum.MENU, "testSonName", parentId); | |
| 371 | -// menuMapper.insert(sonMenuDO); | |
| 372 | -// return sonMenuDO; | |
| 373 | -// } | |
| 374 | -// | |
| 375 | -// private MenuDO createMenuDO(MenuTypeEnum typeEnum, String menuName, Long parentId) { | |
| 376 | -// return createMenuDO(typeEnum, menuName, parentId, randomCommonStatus()); | |
| 377 | -// } | |
| 378 | -// | |
| 379 | -// private MenuDO createMenuDO(MenuTypeEnum typeEnum, String menuName, Long parentId, Integer status) { | |
| 380 | -// return createMenuDO(null, typeEnum, menuName, parentId, status); | |
| 381 | -// } | |
| 382 | -// | |
| 383 | -// private MenuDO createMenuDO(Long id, MenuTypeEnum typeEnum, String menuName, Long parentId, Integer status) { | |
| 384 | -// return randomPojo(MenuDO.class, o -> { | |
| 385 | -// o.setId(id); | |
| 386 | -// o.setParentId(parentId); | |
| 387 | -// o.setType(typeEnum.getType()); | |
| 388 | -// o.setStatus(status); | |
| 389 | -// o.setName(menuName); | |
| 390 | -// }); | |
| 391 | -// } | |
| 392 | -// | |
| 393 | -//} | |
| 1 | +package cn.iocoder.yudao.module.system.service.permission; | |
| 2 | + | |
| 3 | +import cn.hutool.core.bean.BeanUtil; | |
| 4 | +import cn.hutool.core.lang.Assert; | |
| 5 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.spring.SpringAopUtils; | |
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuCreateReqVO; | |
| 9 | +import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuListReqVO; | |
| 10 | +import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuUpdateReqVO; | |
| 11 | +import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; | |
| 12 | +import cn.iocoder.yudao.module.system.dal.mysql.permission.MenuMapper; | |
| 13 | +import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum; | |
| 14 | +import cn.iocoder.yudao.module.system.mq.producer.permission.MenuProducer; | |
| 15 | +import cn.iocoder.yudao.module.system.service.tenant.TenantService; | |
| 16 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 17 | +import com.google.common.collect.Multimap; | |
| 18 | +import org.junit.jupiter.api.Test; | |
| 19 | +import org.springframework.boot.test.mock.mockito.MockBean; | |
| 20 | +import org.springframework.context.annotation.Import; | |
| 21 | + | |
| 22 | +import javax.annotation.Resource; | |
| 23 | +import java.util.*; | |
| 24 | + | |
| 25 | +import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet; | |
| 26 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 27 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | |
| 28 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | |
| 29 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | |
| 30 | +import static org.junit.jupiter.api.Assertions.*; | |
| 31 | +import static org.mockito.ArgumentMatchers.argThat; | |
| 32 | +import static org.mockito.Mockito.doNothing; | |
| 33 | +import static org.mockito.Mockito.verify; | |
| 34 | + | |
| 35 | +// TODO @芋艿:单测的代码质量可以提升下 | |
| 36 | +@Import(MenuServiceImpl.class) | |
| 37 | +public class MenuServiceTest extends BaseDbUnitTest { | |
| 38 | + | |
| 39 | + @Resource | |
| 40 | + private MenuServiceImpl menuService; | |
| 41 | + | |
| 42 | + @Resource | |
| 43 | + private MenuMapper menuMapper; | |
| 44 | + | |
| 45 | + @MockBean | |
| 46 | + private PermissionService permissionService; | |
| 47 | + @MockBean | |
| 48 | + private MenuProducer menuProducer; | |
| 49 | + @MockBean | |
| 50 | + private TenantService tenantService; | |
| 51 | + | |
| 52 | + @Test | |
| 53 | + public void testInitLocalCache_success() throws Exception { | |
| 54 | + MenuDO menuDO1 = createMenuDO(MenuTypeEnum.MENU, "xxxx", 0L); | |
| 55 | + menuMapper.insert(menuDO1); | |
| 56 | + MenuDO menuDO2 = createMenuDO(MenuTypeEnum.MENU, "xxxx", 0L); | |
| 57 | + menuMapper.insert(menuDO2); | |
| 58 | + | |
| 59 | + // 调用 | |
| 60 | + menuService.initLocalCache(); | |
| 61 | + | |
| 62 | + // 获取代理对象 | |
| 63 | + MenuServiceImpl target = (MenuServiceImpl) SpringAopUtils.getTarget(menuService); | |
| 64 | + | |
| 65 | + Map<Long, MenuDO> menuCache = | |
| 66 | + (Map<Long, MenuDO>) BeanUtil.getFieldValue(target, "menuCache"); | |
| 67 | + Assert.isTrue(menuCache.size() == 2); | |
| 68 | + assertPojoEquals(menuDO1, menuCache.get(menuDO1.getId())); | |
| 69 | + assertPojoEquals(menuDO2, menuCache.get(menuDO2.getId())); | |
| 70 | + | |
| 71 | + Multimap<String, MenuDO> permissionMenuCache = | |
| 72 | + (Multimap<String, MenuDO>) BeanUtil.getFieldValue(target, "permissionMenuCache"); | |
| 73 | + Assert.isTrue(permissionMenuCache.size() == 2); | |
| 74 | + assertPojoEquals(menuDO1, permissionMenuCache.get(menuDO1.getPermission())); | |
| 75 | + assertPojoEquals(menuDO2, permissionMenuCache.get(menuDO2.getPermission())); | |
| 76 | + | |
| 77 | + Date maxUpdateTime = (Date) BeanUtil.getFieldValue(target, "maxUpdateTime"); | |
| 78 | + assertEquals(ObjectUtils.max(menuDO1.getUpdateTime(), menuDO2.getUpdateTime()), maxUpdateTime); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Test | |
| 82 | + public void testCreateMenu_success() { | |
| 83 | + //构造父目录 | |
| 84 | + MenuDO menuDO = createMenuDO(MenuTypeEnum.MENU, "parent", 0L); | |
| 85 | + menuMapper.insert(menuDO); | |
| 86 | + Long parentId = menuDO.getId(); | |
| 87 | + | |
| 88 | + //调用 | |
| 89 | + MenuCreateReqVO vo = randomPojo(MenuCreateReqVO.class, o -> { | |
| 90 | + o.setParentId(parentId); | |
| 91 | + o.setName("testSonName"); | |
| 92 | + o.setType(MenuTypeEnum.MENU.getType()); | |
| 93 | + o.setStatus(randomCommonStatus()); | |
| 94 | + }); | |
| 95 | + Long menuId = menuService.createMenu(vo); | |
| 96 | + | |
| 97 | + //断言 | |
| 98 | + assertNotNull(menuId); | |
| 99 | + // 校验记录的属性是否正确 | |
| 100 | + MenuDO ret = menuMapper.selectById(menuId); | |
| 101 | + assertPojoEquals(vo, ret); | |
| 102 | + // 校验调用 | |
| 103 | + verify(menuProducer).sendMenuRefreshMessage(); | |
| 104 | + } | |
| 105 | + | |
| 106 | + @Test | |
| 107 | + public void testUpdateMenu_success() { | |
| 108 | + //构造父子目录 | |
| 109 | + MenuDO sonMenuDO = initParentAndSonMenuDO(); | |
| 110 | + Long sonId = sonMenuDO.getId(); | |
| 111 | + Long parentId = sonMenuDO.getParentId(); | |
| 112 | + | |
| 113 | + //调用 | |
| 114 | + MenuUpdateReqVO vo = randomPojo(MenuUpdateReqVO.class, o -> { | |
| 115 | + o.setId(sonId); | |
| 116 | + o.setParentId(parentId); | |
| 117 | + o.setType(MenuTypeEnum.MENU.getType()); | |
| 118 | + o.setStatus(randomCommonStatus()); | |
| 119 | + o.setName("pppppp"); //修改名字 | |
| 120 | + }); | |
| 121 | + menuService.updateMenu(vo); | |
| 122 | + | |
| 123 | + //断言 | |
| 124 | + // 校验记录的属性是否正确 | |
| 125 | + MenuDO ret = menuMapper.selectById(sonId); | |
| 126 | + assertPojoEquals(vo, ret); | |
| 127 | + // 校验调用 | |
| 128 | + verify(menuProducer).sendMenuRefreshMessage(); | |
| 129 | + } | |
| 130 | + | |
| 131 | + @Test | |
| 132 | + public void testUpdateMenu_sonIdNotExist() { | |
| 133 | + Long sonId = 99999L; | |
| 134 | + Long parentId = 10000L; | |
| 135 | + | |
| 136 | + //调用 | |
| 137 | + MenuUpdateReqVO vo = randomPojo(MenuUpdateReqVO.class, o -> { | |
| 138 | + o.setId(sonId); | |
| 139 | + o.setParentId(parentId); | |
| 140 | + o.setType(MenuTypeEnum.MENU.getType()); | |
| 141 | + o.setStatus(randomCommonStatus()); | |
| 142 | + }); | |
| 143 | + //断言 | |
| 144 | + assertServiceException(() -> menuService.updateMenu(vo), MENU_NOT_EXISTS); | |
| 145 | + } | |
| 146 | + | |
| 147 | + @Test | |
| 148 | + public void testDeleteMenu_success() { | |
| 149 | + MenuDO sonMenuDO = initParentAndSonMenuDO(); | |
| 150 | + Long sonId = sonMenuDO.getId(); | |
| 151 | + | |
| 152 | + // 调用 | |
| 153 | + menuService.deleteMenu(sonId); | |
| 154 | + | |
| 155 | + // 断言 | |
| 156 | + MenuDO menuDO = menuMapper.selectById(sonId); | |
| 157 | + assertNull(menuDO); | |
| 158 | + verify(permissionService).processMenuDeleted(sonId); | |
| 159 | + verify(menuProducer).sendMenuRefreshMessage(); | |
| 160 | + } | |
| 161 | + | |
| 162 | + @Test | |
| 163 | + public void testDeleteMenu_menuNotExist() { | |
| 164 | + Long sonId = 99999L; | |
| 165 | + | |
| 166 | + assertServiceException(() -> menuService.deleteMenu(sonId), MENU_NOT_EXISTS); | |
| 167 | + } | |
| 168 | + | |
| 169 | + @Test | |
| 170 | + public void testDeleteMenu_existChildren() { | |
| 171 | + MenuDO sonMenu = initParentAndSonMenuDO(); | |
| 172 | + Long parentId = sonMenu.getParentId(); | |
| 173 | + | |
| 174 | + assertServiceException(() -> menuService.deleteMenu(parentId), MENU_EXISTS_CHILDREN); | |
| 175 | + } | |
| 176 | + | |
| 177 | + @Test | |
| 178 | + public void testGetMenus() { | |
| 179 | + // mock 数据 | |
| 180 | + MenuDO menu100 = randomPojo(MenuDO.class, o -> o.setId(100L).setStatus(CommonStatusEnum.ENABLE.getStatus())); | |
| 181 | + menuMapper.insert(menu100); | |
| 182 | + MenuDO menu101 = randomPojo(MenuDO.class, o -> o.setId(101L).setStatus(CommonStatusEnum.DISABLE.getStatus())); | |
| 183 | + menuMapper.insert(menu101); | |
| 184 | + // 准备参数 | |
| 185 | + MenuListReqVO reqVO = new MenuListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 186 | + | |
| 187 | + // 调用 | |
| 188 | + List<MenuDO> result = menuService.getMenus(reqVO); | |
| 189 | + // 断言 | |
| 190 | + assertEquals(1, result.size()); | |
| 191 | + assertPojoEquals(menu100, result.get(0)); | |
| 192 | + } | |
| 193 | + | |
| 194 | + @Test | |
| 195 | + public void testTenantMenus() { | |
| 196 | + // mock 数据 | |
| 197 | + MenuDO menu100 = randomPojo(MenuDO.class, o -> o.setId(100L).setStatus(CommonStatusEnum.ENABLE.getStatus())); | |
| 198 | + menuMapper.insert(menu100); | |
| 199 | + MenuDO menu101 = randomPojo(MenuDO.class, o -> o.setId(101L).setStatus(CommonStatusEnum.DISABLE.getStatus())); | |
| 200 | + menuMapper.insert(menu101); | |
| 201 | + MenuDO menu102 = randomPojo(MenuDO.class, o -> o.setId(102L).setStatus(CommonStatusEnum.ENABLE.getStatus())); | |
| 202 | + menuMapper.insert(menu102); | |
| 203 | + // mock 过滤菜单 | |
| 204 | + // mock 账户额度充足 | |
| 205 | + Set<Long> menuIds = asSet(100L, 101L); | |
| 206 | + doNothing().when(tenantService).handleTenantMenu(argThat(handler -> { | |
| 207 | + handler.handle(menuIds); | |
| 208 | + return true; | |
| 209 | + })); | |
| 210 | + // 准备参数 | |
| 211 | + MenuListReqVO reqVO = new MenuListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 212 | + | |
| 213 | + // 调用 | |
| 214 | + List<MenuDO> result = menuService.getTenantMenus(reqVO); | |
| 215 | + // 断言 | |
| 216 | + assertEquals(1, result.size()); | |
| 217 | + assertPojoEquals(menu100, result.get(0)); | |
| 218 | + } | |
| 219 | + | |
| 220 | + @Test | |
| 221 | + public void testGetMenusReqVo_success() { | |
| 222 | + Map<Long, MenuDO> idMenuMap = new HashMap<>(); | |
| 223 | + // 用于验证可以模糊搜索名称包含"name",状态为1的menu | |
| 224 | + MenuDO menu = createMenuDO(MenuTypeEnum.MENU, "name2", 0L, 1); | |
| 225 | + menuMapper.insert(menu); | |
| 226 | + idMenuMap.put(menu.getId(), menu); | |
| 227 | + | |
| 228 | + menu = createMenuDO(MenuTypeEnum.MENU, "11name111", 0L, 1); | |
| 229 | + menuMapper.insert(menu); | |
| 230 | + idMenuMap.put(menu.getId(), menu); | |
| 231 | + | |
| 232 | + menu = createMenuDO(MenuTypeEnum.MENU, "name", 0L, 1); | |
| 233 | + menuMapper.insert(menu); | |
| 234 | + idMenuMap.put(menu.getId(), menu); | |
| 235 | + | |
| 236 | + // 以下是不符合搜索条件的的menu | |
| 237 | + menu = createMenuDO(MenuTypeEnum.MENU, "xxxxxx", 0L, 1); | |
| 238 | + menuMapper.insert(menu); | |
| 239 | + menu = createMenuDO(MenuTypeEnum.MENU, "name", 0L, 2); | |
| 240 | + menuMapper.insert(menu); | |
| 241 | + | |
| 242 | + // 调用 | |
| 243 | + MenuListReqVO reqVO = new MenuListReqVO(); | |
| 244 | + reqVO.setStatus(1); | |
| 245 | + reqVO.setName("name"); | |
| 246 | + List<MenuDO> menuDOS = menuService.getMenus(reqVO); | |
| 247 | + | |
| 248 | + // 断言 | |
| 249 | + assertEquals(menuDOS.size(), idMenuMap.size()); | |
| 250 | + menuDOS.forEach(m -> assertPojoEquals(idMenuMap.get(m.getId()), m)); | |
| 251 | + } | |
| 252 | + | |
| 253 | + @Test | |
| 254 | + public void testListMenusFromCache_success() throws Exception { | |
| 255 | + Map<Long, MenuDO> mockCacheMap = new HashMap<>(); | |
| 256 | + // 获取代理对象 | |
| 257 | + MenuServiceImpl target = (MenuServiceImpl) SpringAopUtils.getTarget(menuService); | |
| 258 | + BeanUtil.setFieldValue(target, "menuCache", mockCacheMap); | |
| 259 | + | |
| 260 | + Map<Long, MenuDO> idMenuMap = new HashMap<>(); | |
| 261 | + // 用于验证搜索类型为MENU,状态为1的menu | |
| 262 | + MenuDO menuDO = createMenuDO(1L, MenuTypeEnum.MENU, "name", 0L, 1); | |
| 263 | + mockCacheMap.put(menuDO.getId(), menuDO); | |
| 264 | + idMenuMap.put(menuDO.getId(), menuDO); | |
| 265 | + | |
| 266 | + menuDO = createMenuDO(2L, MenuTypeEnum.MENU, "name", 0L, 1); | |
| 267 | + mockCacheMap.put(menuDO.getId(), menuDO); | |
| 268 | + idMenuMap.put(menuDO.getId(), menuDO); | |
| 269 | + | |
| 270 | + // 以下是不符合搜索条件的menu | |
| 271 | + menuDO = createMenuDO(3L, MenuTypeEnum.BUTTON, "name", 0L, 1); | |
| 272 | + mockCacheMap.put(menuDO.getId(), menuDO); | |
| 273 | + menuDO = createMenuDO(4L, MenuTypeEnum.MENU, "name", 0L, 2); | |
| 274 | + mockCacheMap.put(menuDO.getId(), menuDO); | |
| 275 | + | |
| 276 | + List<MenuDO> menuDOS = menuService.getMenuListFromCache(Collections.singletonList(MenuTypeEnum.MENU.getType()), | |
| 277 | + Collections.singletonList(CommonStatusEnum.DISABLE.getStatus())); | |
| 278 | + assertEquals(menuDOS.size(), idMenuMap.size()); | |
| 279 | + menuDOS.forEach(m -> assertPojoEquals(idMenuMap.get(m.getId()), m)); | |
| 280 | + } | |
| 281 | + | |
| 282 | + @Test | |
| 283 | + public void testListMenusFromCache2_success() throws Exception { | |
| 284 | + Map<Long, MenuDO> mockCacheMap = new HashMap<>(); | |
| 285 | + // 获取代理对象 | |
| 286 | + MenuServiceImpl target = (MenuServiceImpl) SpringAopUtils.getTarget(menuService); | |
| 287 | + BeanUtil.setFieldValue(target, "menuCache", mockCacheMap); | |
| 288 | + | |
| 289 | + Map<Long, MenuDO> idMenuMap = new HashMap<>(); | |
| 290 | + // 验证搜索id为1, 类型为MENU, 状态为1 的menu | |
| 291 | + MenuDO menuDO = createMenuDO(1L, MenuTypeEnum.MENU, "name", 0L, 1); | |
| 292 | + mockCacheMap.put(menuDO.getId(), menuDO); | |
| 293 | + idMenuMap.put(menuDO.getId(), menuDO); | |
| 294 | + | |
| 295 | + // 以下是不符合搜索条件的menu | |
| 296 | + menuDO = createMenuDO(2L, MenuTypeEnum.MENU, "name", 0L, 1); | |
| 297 | + mockCacheMap.put(menuDO.getId(), menuDO); | |
| 298 | + menuDO = createMenuDO(3L, MenuTypeEnum.BUTTON, "name", 0L, 1); | |
| 299 | + mockCacheMap.put(menuDO.getId(), menuDO); | |
| 300 | + menuDO = createMenuDO(4L, MenuTypeEnum.MENU, "name", 0L, 2); | |
| 301 | + mockCacheMap.put(menuDO.getId(), menuDO); | |
| 302 | + | |
| 303 | + List<MenuDO> menuDOS = menuService.getMenuListFromCache(Collections.singletonList(1L), | |
| 304 | + Collections.singletonList(MenuTypeEnum.MENU.getType()), Collections.singletonList(1)); | |
| 305 | + assertEquals(menuDOS.size(), idMenuMap.size()); | |
| 306 | + menuDOS.forEach(menu -> assertPojoEquals(idMenuMap.get(menu.getId()), menu)); | |
| 307 | + } | |
| 308 | + | |
| 309 | + @Test | |
| 310 | + public void testCheckParentResource_success() { | |
| 311 | + MenuDO menuDO = createMenuDO(MenuTypeEnum.MENU, "parent", 0L); | |
| 312 | + menuMapper.insert(menuDO); | |
| 313 | + Long parentId = menuDO.getId(); | |
| 314 | + | |
| 315 | + menuService.checkParentResource(parentId, null); | |
| 316 | + } | |
| 317 | + | |
| 318 | + @Test | |
| 319 | + public void testCheckParentResource_canNotSetSelfToBeParent() { | |
| 320 | + assertServiceException(() -> menuService.checkParentResource(1L, 1L), MENU_PARENT_ERROR); | |
| 321 | + } | |
| 322 | + | |
| 323 | + @Test | |
| 324 | + public void testCheckParentResource_parentNotExist() { | |
| 325 | + assertServiceException(() -> menuService.checkParentResource(randomLongId(), null), MENU_PARENT_NOT_EXISTS); | |
| 326 | + } | |
| 327 | + | |
| 328 | + @Test | |
| 329 | + public void testCheckParentResource_parentTypeError() { | |
| 330 | + MenuDO menuDO = createMenuDO(MenuTypeEnum.BUTTON, "parent", 0L); | |
| 331 | + menuMapper.insert(menuDO); | |
| 332 | + Long parentId = menuDO.getId(); | |
| 333 | + | |
| 334 | + assertServiceException(() -> menuService.checkParentResource(parentId, null), MENU_PARENT_NOT_DIR_OR_MENU); | |
| 335 | + } | |
| 336 | + | |
| 337 | + @Test | |
| 338 | + public void testCheckResource_success() { | |
| 339 | + MenuDO sonMenu = initParentAndSonMenuDO(); | |
| 340 | + Long parentId = sonMenu.getParentId(); | |
| 341 | + | |
| 342 | + Long otherSonMenuId = randomLongId(); | |
| 343 | + String otherSonMenuName = randomString(); | |
| 344 | + | |
| 345 | + menuService.checkResource(parentId, otherSonMenuName, otherSonMenuId); | |
| 346 | + } | |
| 347 | + | |
| 348 | + @Test | |
| 349 | + public void testCheckResource_sonMenuNameDuplicate(){ | |
| 350 | + MenuDO sonMenu=initParentAndSonMenuDO(); | |
| 351 | + Long parentId=sonMenu.getParentId(); | |
| 352 | + | |
| 353 | + Long otherSonMenuId=randomLongId(); | |
| 354 | + String otherSonMenuName=sonMenu.getName(); //相同名称 | |
| 355 | + | |
| 356 | + assertServiceException(() -> menuService.checkResource(parentId, otherSonMenuName, otherSonMenuId), MENU_NAME_DUPLICATE); | |
| 357 | + } | |
| 358 | + | |
| 359 | + /** | |
| 360 | + * 构造父子目录,返回子目录 | |
| 361 | + * | |
| 362 | + * @return | |
| 363 | + */ | |
| 364 | + private MenuDO initParentAndSonMenuDO() { | |
| 365 | + //构造父子目录 | |
| 366 | + MenuDO menuDO = createMenuDO(MenuTypeEnum.MENU, "parent", 0L); | |
| 367 | + menuMapper.insert(menuDO); | |
| 368 | + Long parentId = menuDO.getId(); | |
| 369 | + | |
| 370 | + MenuDO sonMenuDO = createMenuDO(MenuTypeEnum.MENU, "testSonName", parentId); | |
| 371 | + menuMapper.insert(sonMenuDO); | |
| 372 | + return sonMenuDO; | |
| 373 | + } | |
| 374 | + | |
| 375 | + private MenuDO createMenuDO(MenuTypeEnum typeEnum, String menuName, Long parentId) { | |
| 376 | + return createMenuDO(typeEnum, menuName, parentId, randomCommonStatus()); | |
| 377 | + } | |
| 378 | + | |
| 379 | + private MenuDO createMenuDO(MenuTypeEnum typeEnum, String menuName, Long parentId, Integer status) { | |
| 380 | + return createMenuDO(null, typeEnum, menuName, parentId, status); | |
| 381 | + } | |
| 382 | + | |
| 383 | + private MenuDO createMenuDO(Long id, MenuTypeEnum typeEnum, String menuName, Long parentId, Integer status) { | |
| 384 | + return randomPojo(MenuDO.class, o -> { | |
| 385 | + o.setId(id); | |
| 386 | + o.setParentId(parentId); | |
| 387 | + o.setType(typeEnum.getType()); | |
| 388 | + o.setStatus(status); | |
| 389 | + o.setName(menuName); | |
| 390 | + }); | |
| 391 | + } | |
| 392 | + | |
| 393 | +} | ... | ... |