MetaDaoImpl implements MetaDao, Clearable { @Override public SelectionSummary getSelectionSummary(final FindMetaCriteria criteria) { final PageRequest pageRequest = criteria.getPageRequest(); final Collection<Condition> conditions = createCondition(criteria); final Set<Integer> usedValKeys = identifyExtendedAttributesFields(criteria.getExpression(), new HashSet<>()); int offset = JooqUtil.getOffset(pageRequest); int numberOfRows = JooqUtil.getLimit(pageRequest, false); return getSelectionSummary(conditions, offset, numberOfRows, usedValKeys); } @Inject  MetaDaoImpl(final MetaDbConnProvider metaDbConnProvider,
                final MetaFeedDaoImpl feedDao,
                final MetaTypeDaoImpl metaTypeDao,
                final MetaProcessorDaoImpl metaProcessorDao,
                final MetaKeyDaoImpl metaKeyDao,
                final DataRetentionConfig dataRetentionConfig,
                final ExpressionMapperFactory expressionMapperFactory,
                final WordListProvider wordListProvider,
                final CollectionService collectionService,
                final DocRefInfoService docRefInfoService); @Override Long getMaxId(); @Override Meta create(final MetaProperties metaProperties); void create(final List<MetaProperties> metaPropertiesList, final Status status); @Override int updateStatus(final FindMetaCriteria criteria,
                            final Status currentStatus,
                            final Status newStatus,
                            final long statusTime); @Override List<DataRetentionDeleteSummary> getRetentionDeletionSummary(
            final DataRetentionRules rules,
            final FindDataRetentionImpactCriteria criteria); @Override int logicalDelete(final List<DataRetentionRuleAction> ruleActions,
                             final TimePeriod period); @Override int count(final FindMetaCriteria criteria); @Override void search(final ExpressionCriteria criteria, final AbstractField[] fields, final Consumer<Val[]> consumer); @Override ResultPage<Meta> find(final FindMetaCriteria criteria); @Override ResultPage<Meta> findReprocess(final FindMetaCriteria criteria); @Override SelectionSummary getSelectionSummary(final FindMetaCriteria criteria); @Override SelectionSummary getReprocessSelectionSummary(final FindMetaCriteria criteria); @Override int delete(final List<Long> metaIdList); @Override Optional<Long> getLatestIdByEffectiveDate(final FindMetaCriteria criteria); @Override int getLockCount(); @Override void clear(); @Override List<String> getProcessorUuidList(final FindMetaCriteria criteria);  }
@Test void testGetSelectionSummary() { setup(); SelectionSummary selectionSummary = metaDao.getSelectionSummary(new FindMetaCriteria(MetaExpressionUtil.createFeedExpression(TEST1_FEED_NAME))); assertThat(selectionSummary.getItemCount()).isEqualTo(20); selectionSummary = metaDao.getSelectionSummary(new FindMetaCriteria(MetaExpressionUtil.createFeedExpression(TEST2_FEED_NAME))); assertThat(selectionSummary.getItemCount()).isEqualTo(20); selectionSummary = metaDao.getSelectionSummary(new FindMetaCriteria(MetaExpressionUtil.createFeedsExpression(TEST1_FEED_NAME, TEST2_FEED_NAME))); assertThat(selectionSummary.getItemCount()).isEqualTo(40); selectionSummary = metaDao.getSelectionSummary(new FindMetaCriteria(MetaExpressionUtil.createFeedsExpression())); assertThat(selectionSummary.getItemCount()).isEqualTo(0); final ExpressionOperator expression = new ExpressionOperator.Builder(Op.AND) .addTerm(MetaFields.FEED_NAME, Condition.EQUALS, TEST1_FEED_NAME) .addTerm(MetaFields.TYPE_NAME, Condition.EQUALS, RAW_STREAM_TYPE_NAME) .build(); selectionSummary = metaDao.getSelectionSummary(new FindMetaCriteria(expression)); assertThat(selectionSummary.getItemCount()).isEqualTo(10); }