Interface DataStreamSourceExternalContext<T>
-
- Type Parameters:
T
- Type of elements after deserialization by source
- All Superinterfaces:
AutoCloseable
,ExternalContext
,ResultTypeQueryable<T>
@Experimental public interface DataStreamSourceExternalContext<T> extends ExternalContext, ResultTypeQueryable<T>
External context for DataStream sources.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Source<T,?,?>
createSource(TestingSourceSettings sourceSettings)
Create an instance ofSource
satisfying given options.ExternalSystemSplitDataWriter<T>
createSourceSplitDataWriter(TestingSourceSettings sourceSettings)
Create a new split in the external system and return a data writer corresponding to the new split.List<T>
generateTestData(TestingSourceSettings sourceSettings, int splitIndex, long seed)
Generate test data.-
Methods inherited from interface java.lang.AutoCloseable
close
-
Methods inherited from interface org.apache.flink.connector.testframe.external.ExternalContext
getConnectorJarPaths
-
Methods inherited from interface org.apache.flink.api.java.typeutils.ResultTypeQueryable
getProducedType
-
-
-
-
Method Detail
-
createSource
Source<T,?,?> createSource(TestingSourceSettings sourceSettings) throws UnsupportedOperationException
Create an instance ofSource
satisfying given options.- Parameters:
sourceSettings
- settings of the source- Throws:
UnsupportedOperationException
- if the provided option is not supported.
-
createSourceSplitDataWriter
ExternalSystemSplitDataWriter<T> createSourceSplitDataWriter(TestingSourceSettings sourceSettings)
Create a new split in the external system and return a data writer corresponding to the new split.- Parameters:
sourceSettings
- options of the source
-
generateTestData
List<T> generateTestData(TestingSourceSettings sourceSettings, int splitIndex, long seed)
Generate test data.These test data will be written to external system using
ExternalSystemSplitDataWriter
, consume back by source in testing Flink job, and make comparison withObject.equals(Object)
for validating correctness.Note: Make sure that the
Object.equals(Object)
returns false when the records in different splits.- Parameters:
sourceSettings
- options of the sourcesplitIndex
- index of the split.seed
- Seed for generating random test data set.- Returns:
- List of generated test data.
-
-