@Test void testFindAllEntireRepositoryDirty() { when(transactionInformation.isEntireRepositoryDirty(emd)).thenReturn(true); Stream<Object> ids = Stream.of("0", "1", "2", "3"); l2CacheRepositoryDecorator.findAll(ids); verify(delegateRepository).findAll(repoIdCaptor.capture()); assertEquals( Stream.of("0", "1", "2", "3").collect(toList()), repoIdCaptor.getValue().collect(toList())); }
@SuppressWarnings("UnstableApiUsage") @Override public Stream<Entity> findAll(Stream<Object> ids) { if (doRetrieveFromCache()) { Iterator<List<Object>> batches = Iterators.partition(ids.iterator(), ID_BATCH_SIZE); Iterable<List<Object>> iterable = () -> batches; return Streams.stream(iterable).flatMap(batch -> findAllCache(batch).stream()); } else { return delegate().findAll(ids); } }
L2CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @SuppressWarnings("UnstableApiUsage") @Override public Stream<Entity> findAll(Stream<Object> ids) { if (doRetrieveFromCache()) { Iterator<List<Object>> batches = Iterators.partition(ids.iterator(), ID_BATCH_SIZE); Iterable<List<Object>> iterable = () -> batches; return Streams.stream(iterable).flatMap(batch -> findAllCache(batch).stream()); } else { return delegate().findAll(ids); } } }
L2CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @SuppressWarnings("UnstableApiUsage") @Override public Stream<Entity> findAll(Stream<Object> ids) { if (doRetrieveFromCache()) { Iterator<List<Object>> batches = Iterators.partition(ids.iterator(), ID_BATCH_SIZE); Iterable<List<Object>> iterable = () -> batches; return Streams.stream(iterable).flatMap(batch -> findAllCache(batch).stream()); } else { return delegate().findAll(ids); } } L2CacheRepositoryDecorator(
      Repository<Entity> delegateRepository,
      L2Cache l2Cache,
      TransactionInformation transactionInformation); }
L2CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @SuppressWarnings("UnstableApiUsage") @Override public Stream<Entity> findAll(Stream<Object> ids) { if (doRetrieveFromCache()) { Iterator<List<Object>> batches = Iterators.partition(ids.iterator(), ID_BATCH_SIZE); Iterable<List<Object>> iterable = () -> batches; return Streams.stream(iterable).flatMap(batch -> findAllCache(batch).stream()); } else { return delegate().findAll(ids); } } L2CacheRepositoryDecorator(
      Repository<Entity> delegateRepository,
      L2Cache l2Cache,
      TransactionInformation transactionInformation); @Override Entity findOneById(Object id); @SuppressWarnings("UnstableApiUsage") @Override Stream<Entity> findAll(Stream<Object> ids); @SuppressWarnings("UnstableApiUsage") @Override Stream<Entity> findAll(Stream<Object> ids, Fetch fetch); @Override Entity findOneById(Object id, Fetch fetch); }
L2CacheRepositoryDecorator extends AbstractRepositoryDecorator<Entity> { @SuppressWarnings("UnstableApiUsage") @Override public Stream<Entity> findAll(Stream<Object> ids) { if (doRetrieveFromCache()) { Iterator<List<Object>> batches = Iterators.partition(ids.iterator(), ID_BATCH_SIZE); Iterable<List<Object>> iterable = () -> batches; return Streams.stream(iterable).flatMap(batch -> findAllCache(batch).stream()); } else { return delegate().findAll(ids); } } L2CacheRepositoryDecorator(
      Repository<Entity> delegateRepository,
      L2Cache l2Cache,
      TransactionInformation transactionInformation); @Override Entity findOneById(Object id); @SuppressWarnings("UnstableApiUsage") @Override Stream<Entity> findAll(Stream<Object> ids); @SuppressWarnings("UnstableApiUsage") @Override Stream<Entity> findAll(Stream<Object> ids, Fetch fetch); @Override Entity findOneById(Object id, Fetch fetch);  }