use of com.albedo.java.modules.sys.domain.dto.MenuDto in project albedo by somowhere.
the class MenuDoResourceIntTest method createEntity.
/**
* Create a Menu.
* <p>
* This is a static method, as tests for other entities might also need it, if they
* test an domain which has a required relationship to the Menu domain.
*/
public MenuDto createEntity() {
MenuDto menu = new MenuDto();
menu.setName(DEFAULT_NAME);
menu.setComponent(DEFAULT_COMPONENT);
menu.setIcon(DEFAULT_ICON);
menu.setPermission(DEFAULT_PERMISSION);
menu.setHidden(DEFAULT_HIDDEN);
menu.setCache(DEFAULT_CACHE);
menu.setIframe(DEFAULT_IFRAME);
menu.setSort(DEFAULT_SORT);
menu.setComponent(DEFAULT_COMPONENT);
menu.setPath(DEFAULT_PATH);
menu.setType(DEFAULT_TYPE);
menu.setDescription(DEFAULT_DESCRIPTION);
return menu;
}
use of com.albedo.java.modules.sys.domain.dto.MenuDto in project albedo by somowhere.
the class MenuDoResourceIntTest method updateMenu.
@Test
@Transactional(rollbackFor = Exception.class)
public void updateMenu() throws Exception {
// Initialize the database
menuService.saveOrUpdate(menu);
int databaseSizeBeforeUpdate = menuService.list().size();
// Update the menu
MenuDo updatedMenuDo = menuService.getById(menu.getId());
MenuDto managedMenuVM = new MenuDto();
managedMenuVM.setName(UPDATED_NAME);
managedMenuVM.setPermission(UPDATED_PERMISSION);
managedMenuVM.setIcon(UPDATED_ICON);
managedMenuVM.setSort(UPDATED_SORT);
managedMenuVM.setHidden(UPDATED_HIDDEN);
managedMenuVM.setCache(UPDATED_CACHE);
managedMenuVM.setIframe(UPDATED_IFRAME);
managedMenuVM.setParentId(UPDATED_PARENT_ID);
managedMenuVM.setComponent(UPDATED_COMPONENT);
managedMenuVM.setPath(UPDATED_PATH);
managedMenuVM.setType(UPDATED_TYPE);
managedMenuVM.setDescription(UPDATED_DESCRIPTION);
managedMenuVM.setId(updatedMenuDo.getId());
restMenuMockMvc.perform(post(DEFAULT_API_URL).contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(managedMenuVM))).andExpect(status().isOk()).andExpect(jsonPath("$.code").value(CommonConstants.SUCCESS));
// Validate the Menu in the database
List<MenuDo> menuDoList = menuService.list();
assertThat(menuDoList).hasSize(databaseSizeBeforeUpdate);
MenuDo testMenuDo = menuService.getById(updatedMenuDo.getId());
assertThat(testMenuDo.getName()).isEqualTo(UPDATED_NAME);
assertThat(testMenuDo.getPermission()).isEqualTo(UPDATED_PERMISSION);
assertThat(testMenuDo.getIcon()).isEqualTo(UPDATED_ICON);
assertThat(testMenuDo.getHidden()).isEqualTo(UPDATED_HIDDEN);
assertThat(testMenuDo.getCache()).isEqualTo(UPDATED_CACHE);
assertThat(testMenuDo.getIframe()).isEqualTo(UPDATED_IFRAME);
assertThat(testMenuDo.getSort()).isEqualTo(UPDATED_SORT);
assertThat(testMenuDo.getParentId()).isEqualTo(UPDATED_PARENT_ID);
// assertThat(testMenu.getParentIds()).contains(UPDATED_PARENT_ID);
assertThat(testMenuDo.getComponent()).isEqualTo(UPDATED_COMPONENT);
assertThat(testMenuDo.getPath()).isEqualTo(UPDATED_PATH);
assertThat(testMenuDo.getType()).isEqualTo(UPDATED_TYPE);
assertThat(testMenuDo.isLeaf()).isEqualTo(true);
assertThat(testMenuDo.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
assertThat(testMenuDo.getDelFlag()).isEqualTo(MenuDo.FLAG_NORMAL);
}
use of com.albedo.java.modules.sys.domain.dto.MenuDto in project albedo by somowhere.
the class MenuDoResourceIntTest method createMenuWithExistingCode.
@Test
@Transactional(rollbackFor = Exception.class)
public void createMenuWithExistingCode() throws Exception {
// Initialize the database
menuService.saveOrUpdate(menu);
int databaseSizeBeforeCreate = menuService.list().size();
// Create the Menu
MenuDto managedMenuVM = createEntity();
// Create the Menu
restMenuMockMvc.perform(post(DEFAULT_API_URL).contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(managedMenuVM))).andExpect(status().isOk()).andExpect(jsonPath("$.code").value(ResponseCode.FAIL.getCode())).andExpect(jsonPath("$.message").isNotEmpty());
// Validate the Menu in the database
List<MenuDo> menuDoList = menuService.list();
assertThat(menuDoList).hasSize(databaseSizeBeforeCreate);
}
use of com.albedo.java.modules.sys.domain.dto.MenuDto in project albedo by somowhere.
the class MenuDoResourceIntTest method updateMenuExistingPermission.
@Test
@Transactional(rollbackFor = Exception.class)
public void updateMenuExistingPermission() throws Exception {
menuService.saveOrUpdate(menu);
// Update the menu
MenuDo updatedMenuDo = menuService.getById(menu.getId());
MenuDto managedMenuVM = new MenuDto();
managedMenuVM.setName(DEFAULT_ANOTHER_NAME);
managedMenuVM.setIcon(DEFAULT_ANOTHER_ICON);
managedMenuVM.setParentId(DEFAULT_ANOTHER_PARENT_ID);
managedMenuVM.setPermission(DEFAULT_ANOTHER_PERMISSION);
managedMenuVM.setHidden(DEFAULT_HIDDEN);
managedMenuVM.setCache(DEFAULT_CACHE);
managedMenuVM.setIframe(DEFAULT_IFRAME);
managedMenuVM.setSort(DEFAULT_SORT);
managedMenuVM.setComponent(DEFAULT_COMPONENT);
managedMenuVM.setType(DEFAULT_TYPE);
managedMenuVM.setPath(DEFAULT_PATH);
managedMenuVM.setDescription(DEFAULT_DESCRIPTION);
managedMenuVM.setId(updatedMenuDo.getId());
restMenuMockMvc.perform(post(DEFAULT_API_URL).contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(managedMenuVM))).andExpect(status().isOk()).andExpect(jsonPath("$.code").value(ResponseCode.FAIL.getCode())).andExpect(jsonPath("$.message").isNotEmpty());
// Update the menu
MenuDo updatedMenuAfterDo = menuService.getById(menu.getId());
assertThat(updatedMenuAfterDo.getPermission()).isEqualTo(updatedMenuDo.getPermission());
}
Aggregations