use of org.apache.flink.streaming.connectors.kinesis.table.RowDataKinesisDeserializationSchema.Metadata in project flink by apache.
the class KinesisDynamicTableFactoryTest method testGoodTableSourceWithMetadataFields.
@Test
public void testGoodTableSourceWithMetadataFields() {
ResolvedSchema sourceSchema = defaultSourceSchema();
Map<String, String> sourceOptions = defaultTableOptions().build();
Metadata[] requestedMetadata = new Metadata[] { ShardId, Timestamp };
List<String> metadataKeys = Arrays.asList(ShardId.getFieldName(), Timestamp.getFieldName());
DataType producedDataType = getProducedType(sourceSchema, requestedMetadata);
// Construct actual DynamicTableSource using FactoryUtil
KinesisDynamicSource actualSource = (KinesisDynamicSource) createTableSource(sourceSchema, sourceOptions);
actualSource.applyReadableMetadata(metadataKeys, producedDataType);
// Construct expected DynamicTableSink using factory under test
KinesisDynamicSource expectedSource = new KinesisDynamicSource(sourceSchema.toPhysicalRowDataType(), STREAM_NAME, defaultConsumerProperties(), new TestFormatFactory.DecodingFormatMock(",", true), producedDataType, Arrays.asList(requestedMetadata));
// verify that the constructed DynamicTableSource is as expected
assertEquals(expectedSource, actualSource);
// verify that the copy of the constructed DynamicTableSink is as expected
assertEquals(expectedSource, actualSource.copy());
}
Aggregations