@Test public void test() { PAssert .that(buildBasePipeline(pipeline).apply(RecordBranchMapper.of(null, "b1", "other"))) .satisfies(values -> { final List<Record> items = StreamSupport.stream(values.spliterator(), false).collect(toList()); assertEquals(2, items.size()); items.forEach(item -> { final Collection<Record> other = Collection.class.cast(item.get(Object.class, "other")); assertNotNull(other); assertNotNull(other.iterator().next().getString("foo")); assertNull(item.get(Object.class, "b1")); assertNotNull(item.get(Object.class, "b2")); }); return null; }); assertEquals(PipelineResult.State.DONE, pipeline.run().waitUntilFinish()); }
public static PTransform<PCollection<Record>, PCollection<Record>> of(final String plugin, final String fromBranch, final String toBranch) { final RecordBuilderFactory lookup = ServiceLookup.lookup(ComponentManager.instance(), plugin, RecordBuilderFactory.class); return new RecordParDoTransformCoderProvider<>(SchemaRegistryCoder.of(), new RecordBranchMapper(lookup, fromBranch, toBranch)); }
RecordBranchMapper extends DoFn<Record, Record> { public static PTransform<PCollection<Record>, PCollection<Record>> of(final String plugin, final String fromBranch, final String toBranch) { final RecordBuilderFactory lookup = ServiceLookup.lookup(ComponentManager.instance(), plugin, RecordBuilderFactory.class); return new RecordParDoTransformCoderProvider<>(SchemaRegistryCoder.of(), new RecordBranchMapper(lookup, fromBranch, toBranch)); } }
RecordBranchMapper extends DoFn<Record, Record> { public static PTransform<PCollection<Record>, PCollection<Record>> of(final String plugin, final String fromBranch, final String toBranch) { final RecordBuilderFactory lookup = ServiceLookup.lookup(ComponentManager.instance(), plugin, RecordBuilderFactory.class); return new RecordParDoTransformCoderProvider<>(SchemaRegistryCoder.of(), new RecordBranchMapper(lookup, fromBranch, toBranch)); } RecordBranchMapper(final RecordBuilderFactory factory, final String sourceBranch,
            final String targetBranch); protected  RecordBranchMapper(); }
RecordBranchMapper extends DoFn<Record, Record> { public static PTransform<PCollection<Record>, PCollection<Record>> of(final String plugin, final String fromBranch, final String toBranch) { final RecordBuilderFactory lookup = ServiceLookup.lookup(ComponentManager.instance(), plugin, RecordBuilderFactory.class); return new RecordParDoTransformCoderProvider<>(SchemaRegistryCoder.of(), new RecordBranchMapper(lookup, fromBranch, toBranch)); } RecordBranchMapper(final RecordBuilderFactory factory, final String sourceBranch,
            final String targetBranch); protected  RecordBranchMapper(); @ProcessElement void onElement(final ProcessContext context); static PTransform<PCollection<Record>, PCollection<Record>> of(final String plugin, final String fromBranch,
            final String toBranch); }
RecordBranchMapper extends DoFn<Record, Record> { public static PTransform<PCollection<Record>, PCollection<Record>> of(final String plugin, final String fromBranch, final String toBranch) { final RecordBuilderFactory lookup = ServiceLookup.lookup(ComponentManager.instance(), plugin, RecordBuilderFactory.class); return new RecordParDoTransformCoderProvider<>(SchemaRegistryCoder.of(), new RecordBranchMapper(lookup, fromBranch, toBranch)); } RecordBranchMapper(final RecordBuilderFactory factory, final String sourceBranch,
            final String targetBranch); protected  RecordBranchMapper(); @ProcessElement void onElement(final ProcessContext context); static PTransform<PCollection<Record>, PCollection<Record>> of(final String plugin, final String fromBranch,
            final String toBranch);  }