@Override
    public Page<ConfigInfoAggr> findConfigInfoAggrByPage(String dataId, String group, String tenant, final int pageNo,
            final int pageSize) {
        String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant;
        ConfigInfoAggrMapper configInfoAggrMapper = mapperManager.findMapper(dataSourceService.getDataSourceType(),
                TableConstant.CONFIG_INFO_AGGR);
        final int startRow = (pageNo - 1) * pageSize;
        final String sqlCountRows = configInfoAggrMapper.select(Collections.singletonList("count(*)"),
                Arrays.asList("data_id", "group_id", "tenant_id"));
        
        MapperContext context = new MapperContext();
        context.putWhereParameter(FieldConstant.DATA_ID, dataId);
        context.putWhereParameter(FieldConstant.GROUP_ID, group);
        context.putWhereParameter(FieldConstant.TENANT_ID, tenantTmp);
        context.setStartRow(startRow);
        context.setPageSize(pageSize);
        MapperResult mapperResult = configInfoAggrMapper.findConfigInfoAggrByPageFetchRows(context);
        String sqlFetchRows = mapperResult.getSql();
        Object[] sqlFetchArgs = mapperResult.getParamList().toArray();
        
        PaginationHelper<ConfigInfoAggr> helper = createPaginationHelper();
        return helper.fetchPageLimit(sqlCountRows, new Object[] {dataId, group, tenantTmp}, sqlFetchRows, sqlFetchArgs,
                pageNo, pageSize, CONFIG_INFO_AGGR_ROW_MAPPER);
    }
@Test
    void testFindConfigInfoAggrByPage() {
        String dataId = "dataId111";
        String group = "group";
        String tenant = "tenant";
        
        //mock query count.
        Mockito.when(databaseOperate.queryOne(anyString(), eq(new Object[] {dataId, group, tenant}), eq(Integer.class))).thenReturn(101);
        //mock query page list
        List<ConfigInfoAggr> configInfoAggrs = new ArrayList<>();
        configInfoAggrs.add(new ConfigInfoAggr());
        configInfoAggrs.add(new ConfigInfoAggr());
        configInfoAggrs.add(new ConfigInfoAggr());
        
        Mockito.when(databaseOperate.queryMany(anyString(), eq(new Object[] {dataId, group, tenant}), eq(CONFIG_INFO_AGGR_ROW_MAPPER)))
                .thenReturn(configInfoAggrs);
        int pageNo = 1;
        int pageSize = 120;
        Page<ConfigInfoAggr> configInfoAggrByPage = embededConfigInfoAggrPersistService.findConfigInfoAggrByPage(dataId, group, tenant,
                pageNo, pageSize);
        assertEquals(101, configInfoAggrByPage.getTotalCount());
        assertEquals(configInfoAggrs, configInfoAggrByPage.getPageItems());
        
    }