@Test void testForEachBatched() { VcfRepository vcfRepository = new VcfRepository(testData, "testData", vcfAttrs, entityTypeFactory, attrMetaFactory); vcfRepository.forEachBatched(batchConsumer, 5); verify(batchConsumer, times(2)).accept(entityListCaptor.capture()); List<List<Entity>> allValues = entityListCaptor.getAllValues(); List<List<Integer>> positions = allValues.stream() .map( batch -> batch.stream().map(entity -> entity.getInt(POS)).collect(Collectors.toList())) .collect(Collectors.toList()); assertEquals( of(of(565286, 2243618, 3171929, 3172062, 3172273), of(6097450, 7569187)), positions); Set<String> chroms = allValues.stream() .flatMap(batch -> batch.stream().map(entity -> entity.getString(CHROM))) .collect(Collectors.toSet()); assertEquals(singleton("1"), chroms); }
@Override public void forEachBatched(Consumer<List<Entity>> consumer, int batchSize) { withReader( reader -> stream(partition(transform(reader.iterator(), vcfToEntity::toEntity), batchSize)) .forEach(consumer)); }
VcfRepository extends AbstractRepository { @Override public void forEachBatched(Consumer<List<Entity>> consumer, int batchSize) { withReader( reader -> stream(partition(transform(reader.iterator(), vcfToEntity::toEntity), batchSize)) .forEach(consumer)); } }
VcfRepository extends AbstractRepository { @Override public void forEachBatched(Consumer<List<Entity>> consumer, int batchSize) { withReader( reader -> stream(partition(transform(reader.iterator(), vcfToEntity::toEntity), batchSize)) .forEach(consumer)); } VcfRepository(
      File file,
      String entityTypeId,
      VcfAttributes vcfAttributes,
      EntityTypeFactory entityTypeFactory,
      AttributeFactory attrMetaFactory); }
VcfRepository extends AbstractRepository { @Override public void forEachBatched(Consumer<List<Entity>> consumer, int batchSize) { withReader( reader -> stream(partition(transform(reader.iterator(), vcfToEntity::toEntity), batchSize)) .forEach(consumer)); } VcfRepository(
      File file,
      String entityTypeId,
      VcfAttributes vcfAttributes,
      EntityTypeFactory entityTypeFactory,
      AttributeFactory attrMetaFactory); @Override Iterator<Entity> iterator(); EntityType getEntityType(); @Override Set<RepositoryCapability> getCapabilities(); @Override long count(); @Override void forEachBatched(Consumer<List<Entity>> consumer, int batchSize); }
VcfRepository extends AbstractRepository { @Override public void forEachBatched(Consumer<List<Entity>> consumer, int batchSize) { withReader( reader -> stream(partition(transform(reader.iterator(), vcfToEntity::toEntity), batchSize)) .forEach(consumer)); } VcfRepository(
      File file,
      String entityTypeId,
      VcfAttributes vcfAttributes,
      EntityTypeFactory entityTypeFactory,
      AttributeFactory attrMetaFactory); @Override Iterator<Entity> iterator(); EntityType getEntityType(); @Override Set<RepositoryCapability> getCapabilities(); @Override long count(); @Override void forEachBatched(Consumer<List<Entity>> consumer, int batchSize); static final String DEFAULT_ATTRIBUTE_DESCRIPTION; static final String NAME; static final String ORIGINAL_NAME; static final int BATCH_SIZE; }