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()));
}