@Test void testFindAllRepositoryDirty() { when(transactionInformation.isRepositoryCompletelyClean(entityType)).thenReturn(false); Query<Entity> query = new QueryImpl<>().eq(COUNTRY, "NL"); query.pageSize(10); query.sort(new Sort()); query.fetch(new Fetch()); List<Entity> expectedEntities = newArrayList(entity1, entity2); when(delegateRepository.findAll(query)).thenReturn(expectedEntities.stream()); List<Entity> actualEntities = l3CacheRepositoryDecorator.findAll(query).collect(toList()); assertEquals(expectedEntities, actualEntities); verifyNoMoreInteractions(l3Cache); }
@Override public Stream<Entity> findAll(Query<Entity> query) { if (transactionInformation.isRepositoryCompletelyClean(getEntityType())) { if (cacheable && query.getPageSize() > 0 && query.getPageSize() <= MAX_PAGE_SIZE) { List<Object> ids = l3Cache.get(delegate(), query); return delegate().findAll(ids.stream(), query.getFetch()); } } else { LOG.debug("Repository is dirty: {}", getName()); } return delegate().findAll(query); }
L3CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Stream<Entity> findAll(Query<Entity> query) { if (transactionInformation.isRepositoryCompletelyClean(getEntityType())) { if (cacheable && query.getPageSize() > 0 && query.getPageSize() <= MAX_PAGE_SIZE) { List<Object> ids = l3Cache.get(delegate(), query); return delegate().findAll(ids.stream(), query.getFetch()); } } else { LOG.debug("Repository is dirty: {}", getName()); } return delegate().findAll(query); } }
L3CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Stream<Entity> findAll(Query<Entity> query) { if (transactionInformation.isRepositoryCompletelyClean(getEntityType())) { if (cacheable && query.getPageSize() > 0 && query.getPageSize() <= MAX_PAGE_SIZE) { List<Object> ids = l3Cache.get(delegate(), query); return delegate().findAll(ids.stream(), query.getFetch()); } } else { LOG.debug("Repository is dirty: {}", getName()); } return delegate().findAll(query); } L3CacheRepositoryDecorator(
      Repository<Entity> delegateRepository,
      L3Cache l3Cache,
      TransactionInformation transactionInformation); }
L3CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Stream<Entity> findAll(Query<Entity> query) { if (transactionInformation.isRepositoryCompletelyClean(getEntityType())) { if (cacheable && query.getPageSize() > 0 && query.getPageSize() <= MAX_PAGE_SIZE) { List<Object> ids = l3Cache.get(delegate(), query); return delegate().findAll(ids.stream(), query.getFetch()); } } else { LOG.debug("Repository is dirty: {}", getName()); } return delegate().findAll(query); } L3CacheRepositoryDecorator(
      Repository<Entity> delegateRepository,
      L3Cache l3Cache,
      TransactionInformation transactionInformation); @Override Stream<Entity> findAll(Query<Entity> query); @Override Entity findOne(Query<Entity> query); }
L3CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @Override public Stream<Entity> findAll(Query<Entity> query) { if (transactionInformation.isRepositoryCompletelyClean(getEntityType())) { if (cacheable && query.getPageSize() > 0 && query.getPageSize() <= MAX_PAGE_SIZE) { List<Object> ids = l3Cache.get(delegate(), query); return delegate().findAll(ids.stream(), query.getFetch()); } } else { LOG.debug("Repository is dirty: {}", getName()); } return delegate().findAll(query); } L3CacheRepositoryDecorator(
      Repository<Entity> delegateRepository,
      L3Cache l3Cache,
      TransactionInformation transactionInformation); @Override Stream<Entity> findAll(Query<Entity> query); @Override Entity findOne(Query<Entity> query);  }