TypeDescriptor<?> restrictionT = getInitialRestriction.restrictionT(); processElementErrors.checkArgument( processElement.trackerT().getRawType().equals(RestrictionTracker.class), "Has tracker type %s, but the DoFn's tracker type must be of type RestrictionTracker.", formatType(processElement.trackerT()));
@Test public void testHasRestrictionTracker() throws Exception { DoFnSignature.ProcessElementMethod signature = analyzeProcessElementMethod( new AnonymousMethod() { private void method( DoFn<Integer, String>.ProcessContext context, SomeRestrictionTracker tracker) {} }); assertTrue(signature.isSplittable()); assertTrue( signature .extraParameters() .stream() .anyMatch( Predicates.instanceOf(DoFnSignature.Parameter.RestrictionTrackerParameter.class) ::apply)); assertEquals(SomeRestrictionTracker.class, signature.trackerT().getRawType()); }
SomeRestriction, RestrictionTracker<SomeRestriction, ?>, SomeRestrictionCoder>() {}.getClass()); assertEquals(RestrictionTracker.class, signature.processElement().trackerT().getRawType()); assertTrue(signature.processElement().isSplittable()); assertTrue(signature.processElement().hasReturnValue());
assertEquals(RestrictionTracker.class, signature.processElement().trackerT().getRawType()); assertTrue(signature.processElement().isSplittable()); assertTrue(signature.processElement().hasReturnValue());
@Test public void testHasDefaultTracker() throws Exception { class Fn extends DoFn<Integer, String> { @ProcessElement public void process( ProcessContext c, RestrictionTracker<RestrictionWithDefaultTracker, Void> tracker) {} @GetInitialRestriction public RestrictionWithDefaultTracker getInitialRestriction(Integer element) { return null; } } DoFnSignature signature = DoFnSignatures.getSignature(Fn.class); assertEquals(RestrictionTracker.class, signature.processElement().trackerT().getRawType()); }