Search in sources :

Example 1 with IsBounded

use of org.apache.beam.sdk.values.PCollection.IsBounded in project beam by apache.

the class PCollectionTranslationTest method testEncodeDecodeFields.

@Test
public void testEncodeDecodeFields() throws Exception {
    SdkComponents sdkComponents = SdkComponents.create();
    sdkComponents.registerEnvironment(Environments.createDockerEnvironment("java"));
    RunnerApi.PCollection protoCollection = PCollectionTranslation.toProto(testCollection, sdkComponents);
    RehydratedComponents protoComponents = RehydratedComponents.forComponents(sdkComponents.toComponents());
    Coder<?> decodedCoder = protoComponents.getCoder(protoCollection.getCoderId());
    WindowingStrategy<?, ?> decodedStrategy = protoComponents.getWindowingStrategy(protoCollection.getWindowingStrategyId());
    IsBounded decodedIsBounded = PCollectionTranslation.isBounded(protoCollection);
    assertThat(decodedCoder, equalTo(testCollection.getCoder()));
    assertThat(decodedStrategy, equalTo(testCollection.getWindowingStrategy().withEnvironmentId(sdkComponents.getOnlyEnvironmentId()).fixDefaults()));
    assertThat(decodedIsBounded, equalTo(testCollection.isBounded()));
}
Also used : RunnerApi(org.apache.beam.model.pipeline.v1.RunnerApi) IsBounded(org.apache.beam.sdk.values.PCollection.IsBounded) Test(org.junit.Test)

Aggregations

RunnerApi (org.apache.beam.model.pipeline.v1.RunnerApi)1 IsBounded (org.apache.beam.sdk.values.PCollection.IsBounded)1 Test (org.junit.Test)1