use of org.apache.shenyu.admin.model.vo.MetaDataVO in project incubator-shenyu by apache.
the class MetaDataServiceTest method testListByPage.
/**
* Test case for listByPage.
*/
@Test
public void testListByPage() {
when(metaDataQuery.getPageParameter()).thenReturn(new PageParameter(1, 10, 5));
ArrayList<MetaDataDO> metaDataDOList = getMetaDataDOList();
when(metaDataMapper.selectByQuery(any())).thenReturn(metaDataDOList);
CommonPager<MetaDataVO> pager = metaDataService.listByPage(metaDataQuery);
Assertions.assertEquals(metaDataDOList.size(), pager.getDataList().size(), "The dataList should be contain " + metaDataDOList.size() + " element.");
}
use of org.apache.shenyu.admin.model.vo.MetaDataVO in project incubator-shenyu by apache.
the class MetaDataServiceTest method testFindById.
/**
* Test case for findById.
*/
@Test
public void testFindById() {
when(metaDataMapper.selectById(anyString())).thenReturn(null);
MetaDataVO dataVo = metaDataService.findById(anyString());
Assertions.assertEquals(new MetaDataVO(), dataVo);
final String appName = "appName";
MetaDataDO metaDataDO = MetaDataDO.builder().build();
metaDataDO.setAppName(appName);
when(metaDataMapper.selectById(anyString())).thenReturn(metaDataDO);
dataVo = metaDataService.findById(anyString());
assertEquals(appName, dataVo.getAppName());
}
use of org.apache.shenyu.admin.model.vo.MetaDataVO in project incubator-shenyu by apache.
the class MetaDataControllerTest method testQueryList.
@Test
public void testQueryList() throws Exception {
final PageParameter pageParameter = new PageParameter();
List<MetaDataVO> metaDataVOS = new ArrayList<>();
metaDataVOS.add(metaDataVO);
final CommonPager<MetaDataVO> commonPager = new CommonPager<>();
commonPager.setPage(pageParameter);
commonPager.setDataList(metaDataVOS);
final MetaDataQuery metaDataQuery = new MetaDataQuery("appName", pageParameter);
given(this.metaDataService.listByPage(metaDataQuery)).willReturn(commonPager);
this.mockMvc.perform(MockMvcRequestBuilders.get("/meta-data/queryList").param("appName", "appName").param("currentPage", pageParameter.getCurrentPage() + "").param("pageSize", pageParameter.getPageSize() + "")).andExpect(status().isOk()).andExpect(jsonPath("$.message", is(ShenyuResultMessage.QUERY_SUCCESS))).andExpect(jsonPath("$.data.dataList[0].appName", is(metaDataVO.getAppName()))).andReturn();
}
Aggregations