use of org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.AnonymousMethod in project beam by apache.
the class DoFnSignaturesSplittableDoFnTest method testSplittableProcessElementMustNotHaveOtherParams.
@Test
public void testSplittableProcessElementMustNotHaveOtherParams() throws Exception {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Illegal parameter");
thrown.expectMessage("BoundedWindow");
DoFnSignature.ProcessElementMethod signature = analyzeProcessElementMethod(new AnonymousMethod() {
private void method(DoFn<Integer, String>.ProcessContext<Integer, String> context, SomeRestrictionTracker tracker, BoundedWindow window) {
}
});
}
use of org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.AnonymousMethod in project beam by apache.
the class DoFnSignaturesProcessElementTest method testBadGenericWildCards.
@Test
public void testBadGenericWildCards() throws Exception {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("DoFn<Integer, ? super Integer>.ProcessContext");
thrown.expectMessage("must have type");
thrown.expectMessage("DoFn<Integer, String>.ProcessContext");
analyzeProcessElementMethod(new AnonymousMethod() {
private void method(DoFn<Integer, ? super Integer>.ProcessContext c) {
}
});
}
use of org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.AnonymousMethod in project beam by apache.
the class DoFnSignaturesSplittableDoFnTest method testHasRestrictionTracker.
@Test
// used via reflection
@SuppressWarnings("unused")
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());
}
use of org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.AnonymousMethod in project beam by apache.
the class DoFnSignaturesSplittableDoFnTest method testReturnsProcessContinuation.
@Test
// used via reflection
@SuppressWarnings("unused")
public void testReturnsProcessContinuation() throws Exception {
DoFnSignature.ProcessElementMethod signature = analyzeProcessElementMethod(new AnonymousMethod() {
private DoFn.ProcessContinuation method(DoFn<Integer, String>.ProcessContext context) {
return null;
}
});
assertTrue(signature.hasReturnValue());
}
use of org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.AnonymousMethod in project beam by apache.
the class DoFnSignaturesProcessElementTest method testBadExtraProcessContextType.
@Test
public void testBadExtraProcessContextType() throws Exception {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Integer is not a valid context parameter.");
analyzeProcessElementMethod(new AnonymousMethod() {
private void method(DoFn<Integer, String>.ProcessContext c, Integer n) {
}
});
}
Aggregations