private static ListMultimap<IndexType, EsQueueDto> groupItemsByType(Collection<EsQueueDto> items) { return items.stream().collect(MoreCollectors.index(i -> IndexType.parse(i.getDocType()))); }
private static ListMultimap<IndexType, EsQueueDto> groupItemsByType(Collection<EsQueueDto> items) { return items.stream().collect(MoreCollectors.index(i -> IndexType.parse(i.getDocType()))); }
public OneToOneResilientIndexingListener(DbClient dbClient, DbSession dbSession, Collection<EsQueueDto> items) { this.dbClient = dbClient; this.dbSession = dbSession; this.itemsById = items.stream() .collect(MoreCollectors.index(i -> new DocId(IndexType.parse(i.getDocType()), i.getDocId()), Function.identity())); }
@Test public void format_and_parse() { IndexType type1 = new IndexType("foo", "bar"); assertThat(type1.format()).isEqualTo("foo/bar"); IndexType type2 = IndexType.parse(type1.format()); assertThat(type2.equals(type1)).isTrue(); }
@Test public void parse_throws_IAE_if_invalid_format() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Unsupported IndexType value: foo"); IndexType.parse("foo"); }
private static DocId toDocId(EsQueueDto dto) { return new DocId(IndexType.parse(dto.getDocType()), dto.getDocId()); }
private static ListMultimap<IndexType, EsQueueDto> groupItemsByType(Collection<EsQueueDto> items) { return items.stream().collect(MoreCollectors.index(i -> IndexType.parse(i.getDocType()))); }
private static ListMultimap<IndexType, EsQueueDto> groupItemsByType(Collection<EsQueueDto> items) { return items.stream().collect(MoreCollectors.index(i -> IndexType.parse(i.getDocType()))); }
public OneToOneResilientIndexingListener(DbClient dbClient, DbSession dbSession, Collection<EsQueueDto> items) { this.dbClient = dbClient; this.dbSession = dbSession; this.itemsById = items.stream() .collect(MoreCollectors.index(i -> new DocId(IndexType.parse(i.getDocType()), i.getDocId()), Function.identity())); }