use of org.apache.beam.sdk.util.ApiSurface in project beam by apache.
the class GcpApiSurfaceTest method testGcpApiSurface.
@Test
public void testGcpApiSurface() throws Exception {
final Package thisPackage = getClass().getPackage();
final ClassLoader thisClassLoader = getClass().getClassLoader();
final ApiSurface apiSurface = ApiSurface.ofPackage(thisPackage, thisClassLoader).pruningPattern(BigqueryMatcher.class.getName()).pruningPattern("org[.]apache[.]beam[.].*Test.*").pruningPattern("org[.]apache[.]beam[.].*IT").pruningPattern("java[.]lang.*").pruningPattern("java[.]util.*");
@SuppressWarnings("unchecked") final Set<Matcher<Class<?>>> allowedClasses = ImmutableSet.of(classesInPackage("com.google.api.client.googleapis"), classesInPackage("com.google.api.client.http"), classesInPackage("com.google.api.client.json"), classesInPackage("com.google.api.client.util"), classesInPackage("com.google.api.services.bigquery.model"), classesInPackage("com.google.auth"), classesInPackage("com.google.bigtable.v2"), classesInPackage("com.google.cloud.bigtable.config"), Matchers.<Class<?>>equalTo(com.google.cloud.bigtable.grpc.BigtableClusterName.class), Matchers.<Class<?>>equalTo(com.google.cloud.bigtable.grpc.BigtableInstanceName.class), Matchers.<Class<?>>equalTo(com.google.cloud.bigtable.grpc.BigtableTableName.class), Matchers.<Class<?>>equalTo(com.google.cloud.ByteArray.class), Matchers.<Class<?>>equalTo(com.google.cloud.Date.class), Matchers.<Class<?>>equalTo(com.google.cloud.Timestamp.class), classesInPackage("com.google.cloud.spanner"), classesInPackage("com.google.datastore.v1"), classesInPackage("com.google.protobuf"), classesInPackage("com.google.type"), classesInPackage("com.fasterxml.jackson.annotation"), classesInPackage("com.fasterxml.jackson.core"), classesInPackage("com.fasterxml.jackson.databind"), classesInPackage("io.grpc"), classesInPackage("java"), classesInPackage("javax"), classesInPackage("org.apache.beam"), classesInPackage("org.apache.commons.logging"), classesInPackage("org.joda.time"));
assertThat(apiSurface, containsOnlyClassesMatching(allowedClasses));
}
use of org.apache.beam.sdk.util.ApiSurface in project beam by apache.
the class DirectRunnerApiSurfaceTest method testDirectRunnerApiSurface.
@Test
public void testDirectRunnerApiSurface() throws Exception {
// The DirectRunner can expose the Core SDK, anything exposed by the Core SDK, and itself
@SuppressWarnings("unchecked") final Set<String> allowed = ImmutableSet.of("org.apache.beam.sdk", "org.apache.beam.runners.direct", "org.joda.time");
final Package thisPackage = getClass().getPackage();
final ClassLoader thisClassLoader = getClass().getClassLoader();
ApiSurface apiSurface = ApiSurface.ofPackage(thisPackage, thisClassLoader).pruningClass(Pipeline.class).pruningClass(PipelineRunner.class).pruningClass(PipelineOptions.class).pruningClass(PipelineOptionsRegistrar.class).pruningClass(PipelineOptions.DirectRunner.class).pruningClass(DisplayData.Builder.class).pruningClass(MetricResults.class).pruningPattern("org[.]apache[.]beam[.].*Test.*").pruningPattern("org[.]apache[.]beam[.].*IT").pruningPattern("java[.]io.*").pruningPattern("java[.]lang.*").pruningPattern("java[.]util.*");
assertThat(apiSurface, containsOnlyPackages(allowed));
}
Aggregations