use of org.apache.flink.connector.testutils.source.deserialization.TestingDeserializationContext in project flink by apache.
the class PulsarDeserializationSchemaTest method createFromFlinkTypeInformation.
@Test
void createFromFlinkTypeInformation() throws Exception {
PulsarDeserializationSchema<String> schema = flinkTypeInfo(Types.STRING, null);
schema.open(new TestingDeserializationContext(), mock(SourceConfiguration.class));
assertDoesNotThrow(() -> InstantiationUtil.clone(schema));
Message<byte[]> message = getMessage("test-content", s -> {
DataOutputSerializer serializer = new DataOutputSerializer(10);
StringValue.writeString(s, serializer);
return serializer.getSharedBuffer();
});
SingleMessageCollector<String> collector = new SingleMessageCollector<>();
schema.deserialize(message, collector);
assertNotNull(collector.result);
assertEquals(collector.result, "test-content");
}
Aggregations