use of org.apache.beam.sdk.expansion.service.JavaClassLookupTransformProvider.AllowedClass in project beam by apache.
the class JavaClassLookupTransformProviderTest method testEverythingAllowList.
@Test
public void testEverythingAllowList() {
AllowList everything = AllowList.everything();
AllowedClass allowedClass = everything.getAllowedClass("org.apache.beam.sdk.transforms.KvSwap");
assertTrue(allowedClass.isAllowedBuilderMethod("builder"));
assertTrue(allowedClass.isAllowedConstructorMethod("constructor"));
}
use of org.apache.beam.sdk.expansion.service.JavaClassLookupTransformProvider.AllowedClass in project beam by apache.
the class JavaClassLookupTransformProviderTest method testPackageAllowList.
@Test
public void testPackageAllowList() {
AllowList allowList = AllowList.create(ALLOW_LIST_VERSION, Collections.singletonList(AllowedClass.create("good.package.*", Collections.singletonList("goodBuilder"), AllowedClass.WILDCARD)));
assertThrows(RuntimeException.class, () -> allowList.getAllowedClass("bad.package.Transform"));
AllowedClass allowedClass = allowList.getAllowedClass("good.package.Transform");
assertTrue(allowedClass.isAllowedBuilderMethod("goodBuilder"));
assertFalse(allowedClass.isAllowedBuilderMethod("badBuilder"));
assertTrue(allowedClass.isAllowedConstructorMethod("anyConstructor"));
}
Aggregations