@Test void countQueryUnsupported() { indexedRepositoryDecorator.count(unsupportedQuery); verify(searchService).count(repositoryEntityType, unsupportedQuery); verify(delegateRepository, never()).count(unsupportedQuery); }
@Override public long count(Query<Entity> q) { if (querySupported(q)) { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), DECORATED_REPOSITORY); return delegate().count(q); } else { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), INDEX_REPOSITORY); return tryTwice(() -> searchService.count(getEntityType(), q)); } }
IndexedRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public long count(Query<Entity> q) { if (querySupported(q)) { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), DECORATED_REPOSITORY); return delegate().count(q); } else { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), INDEX_REPOSITORY); return tryTwice(() -> searchService.count(getEntityType(), q)); } } }
IndexedRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public long count(Query<Entity> q) { if (querySupported(q)) { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), DECORATED_REPOSITORY); return delegate().count(q); } else { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), INDEX_REPOSITORY); return tryTwice(() -> searchService.count(getEntityType(), q)); } } IndexedRepositoryDecorator(
      Repository<Entity> delegateRepository,
      SearchService searchService,
      IndexJobScheduler indexJobScheduler); }
IndexedRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public long count(Query<Entity> q) { if (querySupported(q)) { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), DECORATED_REPOSITORY); return delegate().count(q); } else { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), INDEX_REPOSITORY); return tryTwice(() -> searchService.count(getEntityType(), q)); } } IndexedRepositoryDecorator(
      Repository<Entity> delegateRepository,
      SearchService searchService,
      IndexJobScheduler indexJobScheduler); @Override Entity findOne(Query<Entity> q); @Override Stream<Entity> findAll(Query<Entity> q); @Override Set<RepositoryCapability> getCapabilities(); @Override Set<Operator> getQueryOperators(); @Override long count(Query<Entity> q); @Override AggregateResult aggregate(AggregateQuery aggregateQuery); }
IndexedRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public long count(Query<Entity> q) { if (querySupported(q)) { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), DECORATED_REPOSITORY); return delegate().count(q); } else { LOG.debug( "public long count({}) entityTypeId: [{}] repository: [{}]", q, getEntityType().getId(), INDEX_REPOSITORY); return tryTwice(() -> searchService.count(getEntityType(), q)); } } IndexedRepositoryDecorator(
      Repository<Entity> delegateRepository,
      SearchService searchService,
      IndexJobScheduler indexJobScheduler); @Override Entity findOne(Query<Entity> q); @Override Stream<Entity> findAll(Query<Entity> q); @Override Set<RepositoryCapability> getCapabilities(); @Override Set<Operator> getQueryOperators(); @Override long count(Query<Entity> q); @Override AggregateResult aggregate(AggregateQuery aggregateQuery);  }