Search in sources :

Example 16 with SingleShardFanOutKinesisV2

use of org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SingleShardFanOutKinesisV2 in project flink by apache.

the class FanOutRecordPublisherTest method testToSdkV2StartingPositionAtTimeStamp.

@Test
public void testToSdkV2StartingPositionAtTimeStamp() throws Exception {
    SingleShardFanOutKinesisV2 kinesis = emptyShard();
    Date now = new Date();
    RecordPublisher publisher = createRecordPublisher(kinesis, StartingPosition.fromTimestamp(now));
    publisher.run(new TestConsumer());
    assertEquals(now.toInstant(), kinesis.getStartingPositionForSubscription(0).timestamp());
    assertEquals(AT_TIMESTAMP, kinesis.getStartingPositionForSubscription(0).type());
}
Also used : RecordPublisher(org.apache.flink.streaming.connectors.kinesis.internals.publisher.RecordPublisher) SingleShardFanOutKinesisV2(org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SingleShardFanOutKinesisV2) Date(java.util.Date) TestConsumer(org.apache.flink.streaming.connectors.kinesis.testutils.TestUtils.TestConsumer) Test(org.junit.Test)

Example 17 with SingleShardFanOutKinesisV2

use of org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SingleShardFanOutKinesisV2 in project flink by apache.

the class FanOutRecordPublisherTest method testToSdkV2StartingPositionLatest.

@Test
public void testToSdkV2StartingPositionLatest() throws Exception {
    SingleShardFanOutKinesisV2 kinesis = emptyShard();
    RecordPublisher publisher = createRecordPublisher(kinesis, latest());
    publisher.run(new TestConsumer());
    assertNull(kinesis.getStartingPositionForSubscription(0).sequenceNumber());
    assertEquals(LATEST, kinesis.getStartingPositionForSubscription(0).type());
}
Also used : RecordPublisher(org.apache.flink.streaming.connectors.kinesis.internals.publisher.RecordPublisher) SingleShardFanOutKinesisV2(org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SingleShardFanOutKinesisV2) TestConsumer(org.apache.flink.streaming.connectors.kinesis.testutils.TestUtils.TestConsumer) Test(org.junit.Test)

Aggregations

SingleShardFanOutKinesisV2 (org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SingleShardFanOutKinesisV2)17 Test (org.junit.Test)17 AbstractSingleShardFanOutKinesisV2 (org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.AbstractSingleShardFanOutKinesisV2)9 RecordPublisher (org.apache.flink.streaming.connectors.kinesis.internals.publisher.RecordPublisher)8 TestConsumer (org.apache.flink.streaming.connectors.kinesis.testutils.TestUtils.TestConsumer)7 ShardConsumerTestUtils.fakeSequenceNumber (org.apache.flink.streaming.connectors.kinesis.internals.ShardConsumerTestUtils.fakeSequenceNumber)4 SequenceNumber (org.apache.flink.streaming.connectors.kinesis.model.SequenceNumber)4 UserRecord (com.amazonaws.services.kinesis.clientlibrary.types.UserRecord)2 Instant (java.time.Instant)2 StartingPosition (software.amazon.awssdk.services.kinesis.model.StartingPosition)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Properties (java.util.Properties)1 ShardConsumerMetricsReporter (org.apache.flink.streaming.connectors.kinesis.metrics.ShardConsumerMetricsReporter)1 TestUtils.efoProperties (org.apache.flink.streaming.connectors.kinesis.testutils.TestUtils.efoProperties)1