@Test public void extensionContainsOccurrenceTest() { String id = "1"; String somethingCore = "somethingCore"; String somethingExt = "somethingExt"; Map<String, String> ext1 = new HashMap<>(2); ext1.put(DwcTerm.occurrenceID.qualifiedName(), id); ext1.put(somethingExt, somethingExt); Map<String, String> ext2 = new HashMap<>(2); ext2.put(DwcTerm.occurrenceID.qualifiedName(), id); ext2.put(somethingExt, somethingExt); Map<String, String> ext3 = new HashMap<>(2); ext3.put(DwcTerm.occurrenceID.qualifiedName(), id); ext3.put(somethingExt, somethingExt); ExtendedRecord er = ExtendedRecord.newBuilder() .setId(id) .setCoreTerms(Collections.singletonMap(somethingCore, somethingCore)) .setExtensions( Collections.singletonMap( Occurrence.qualifiedName(), Arrays.asList(ext1, ext2, ext3))) .build(); final List<ExtendedRecord> expected = createCollection( false, false, id + "_" + somethingCore + "_" + somethingExt, id + "_" + somethingCore + "_" + somethingExt, id + "_" + somethingCore + "_" + somethingExt); PCollection<ExtendedRecord> result = p.apply(Create.of(er)).apply(OccurrenceExtensionTransform.create()); PAssert.that(result).containsInAnyOrder(expected); p.run(); }
public static SingleOutput<ExtendedRecord, ExtendedRecord> create() { return ParDo.of(new OccurrenceExtensionTransform()); }
OccurrenceExtensionTransform extends DoFn<ExtendedRecord, ExtendedRecord> { public static SingleOutput<ExtendedRecord, ExtendedRecord> create() { return ParDo.of(new OccurrenceExtensionTransform()); } }
OccurrenceExtensionTransform extends DoFn<ExtendedRecord, ExtendedRecord> { public static SingleOutput<ExtendedRecord, ExtendedRecord> create() { return ParDo.of(new OccurrenceExtensionTransform()); }  }
OccurrenceExtensionTransform extends DoFn<ExtendedRecord, ExtendedRecord> { public static SingleOutput<ExtendedRecord, ExtendedRecord> create() { return ParDo.of(new OccurrenceExtensionTransform()); }  static SingleOutput<ExtendedRecord, ExtendedRecord> create(); void setCounterFn(SerializableConsumer<String> counterFn); @ProcessElement void processElement(@Element ExtendedRecord er, OutputReceiver<ExtendedRecord> out); void convert(ExtendedRecord er, Consumer<ExtendedRecord> resultConsumer); }
OccurrenceExtensionTransform extends DoFn<ExtendedRecord, ExtendedRecord> { public static SingleOutput<ExtendedRecord, ExtendedRecord> create() { return ParDo.of(new OccurrenceExtensionTransform()); }  static SingleOutput<ExtendedRecord, ExtendedRecord> create(); void setCounterFn(SerializableConsumer<String> counterFn); @ProcessElement void processElement(@Element ExtendedRecord er, OutputReceiver<ExtendedRecord> out); void convert(ExtendedRecord er, Consumer<ExtendedRecord> resultConsumer);  }